def ParseXMLNode(self, regionalDataNode):
      """
      Generate regional calculation data from xml tree node. 
      """
      
      self.type = GetAttributeString(regionalDataNode,"type")
          
      self.coverDepthMapFile = GetAttributeFileString(regionalDataNode,"coverDepth")
      self.waterDistanceMapFile = GetAttributeFileString(regionalDataNode,"waterDistance") 
      self.powerDistanceMapFile = GetAttributeFileString(regionalDataNode,"powerDistance")
      self.railDistanceMapFile = GetAttributeFileString(regionalDataNode,"railDistance")
      self.roadDistanceMapFile = GetAttributeFileString(regionalDataNode,"roadDistance")
      self.railDistanceToPortMapFile = GetAttributeFileString(regionalDataNode,"railTransportationDistance")
      self.roadDistanceToPortMapFile = GetAttributeFileString(regionalDataNode,"roadTransportationDistance")
      
      self.gasDistanceMapFile = GetAttributeFileStringOrDefault(regionalDataNode,"gasDistance",self.gasDistanceMapFile)  # optional

      self.stateIdsMapFile = GetAttributeFileString(regionalDataNode,"states")
      
      if(HasAttribute(regionalDataNode,"dataBoundingBox")):
        self.dataBoundingBox = GetAttributeVector(regionalDataNode,"dataBoundingBox")
      if(HasAttribute(regionalDataNode,"outputBoundingBox")):
        self.outputBoundingBox = GetAttributeVector(regionalDataNode,"outputBoundingBox")
      if(HasAttribute(regionalDataNode,"coverOffset")):
        self.coverOffset = GetAttributeValue(regionalDataNode,"coverOffset")
  
      if(HasAttribute(regionalDataNode,"stride")):
        self.stride = GetAttributeValue(regionalDataNode,"stride")
        
      if(HasAttribute(regionalDataNode,"estimateEmployment")):
        self.doEmploymentCalculation = GetAttributeValue(regionalDataNode,"estimateEmployment")
Esempio n. 2
0
    def ParseXMLNode(self, orebodyDataNode):
        """
      Generate Ore body data from xml tree node. 
      """
        self.type = GetAttributeString(orebodyDataNode, "type")
        self.dip = GetAttributeValue(orebodyDataNode, "dip")

        self.cover = GetAttributeValue(orebodyDataNode, "cover")

        if (HasAttribute(orebodyDataNode, "length")):
            self.length = GetAttributeValue(orebodyDataNode, "length")
            self.width = GetAttributeValue(orebodyDataNode, "width")
            self.height = GetAttributeValue(orebodyDataNode, "height")
            if (self.width > self.length):
                temp = self.width
                self.width = self.length
                self.length = temp
        elif (HasAttribute(orebodyDataNode, "mass")):
            self.orebodyMass = GetAttributeValue(orebodyDataNode, "mass")
            self.CalculateDepositVolume()
            self.CalculateDepositDimensionsFromVolume()
        else:
            BluecapError("Failed to find orebody mass or dimensions in input.")

        for child in GetChildren(orebodyDataNode):
            type = GetXMLTag(child)
            name = GetAttributeString(child, "name")
            grade = GetAttributeValue(child, "grade")

            self.metalGrades[name] = grade
Esempio n. 3
0
    def ParseXMLNode(self, hydrogenPlantNode):
        """
      Generate hydrogen plant data from xml tree node.
       - Note this may not be needed in many cases as the mining system is derived from the orebody shape  
      """

        if (HasAttribute(hydrogenPlantNode, "energyEfficiency")):
            self.energyEfficiency = GetAttributeValue(hydrogenPlantNode,
                                                      "energyEfficiency")

        self.hydrogenProductionCapacity = GetAttributeValue(
            hydrogenPlantNode, "capacity")

        if (HasAttribute(hydrogenPlantNode, "waterH2Ratio")):
            self.waterPerKgH2 = GetAttributeValue(hydrogenPlantNode,
                                                  "waterH2Ratio")

        if (HasAttribute(hydrogenPlantNode, "CO2H2Ratio")):
            self.co2PerKgH2 = GetAttributeValue(hydrogenPlantNode,
                                                "CO2H2Ratio")

        if (HasAttribute(hydrogenPlantNode, "type")):
            self.type = GetAttributeString(hydrogenPlantNode, "type")

        return hydrogenPlantNode
 def ParseXMLNode(self,actionNode,problemManager):
    """
    Generate named action from xml tree node. 
    """
    if(HasAttribute(actionNode,"type")):
      self.type = GetAttributeString(actionNode,"type")
    if(HasAttribute(actionNode,"samples")):
      self.samples = GetAttributeString(actionNode,"samples")
Esempio n. 5
0
 def ParseXMLNode(self, storageNode):
   """
   Generate energy storage data from xml tree node.
   """
 
   if(HasAttribute(storageNode,"roundTripEfficiency")):  
     self.roundTripEfficiency = GetAttributeValue(storageNode,"roundTripEfficiency")
   
   self.netOutputCapacity = GetAttributeValue(storageNode,"netOutputCapacity")
   
   if(HasAttribute(storageNode,"type")):  
     self.type = GetAttributeString(storageNode,"type")
     
   return storageNode
    def ParseSecondarySystemXMLNode(self, processingSystemNode,
                                    primaryProcessingSystem):
        """
      Generate processing system data from xml tree node. 
      """
        node = GetChild(processingSystemNode, "SecondarySystem")
        self.processingMethod = GetAttributeStringOrDefault(node, "method", "")

        if (HasAttribute(node, "metals")):
            self.concentrateMetals = GetAttributeVectorString(node, "metals")

        if (self.processingMethod):
            self.concentrateMetals.append(self.processingMethod)

        self.concentrateMetals = set(self.concentrateMetals)

        self.concentratePrimaryMetal = self.processingMethod

        self.refiningTake = GetAttributeValue(node, "refiningTake")
        self.processingLoss = GetAttributeValue(node, "processingLoss")

        # For tertiary+ system
        if (HasChild(node, "SecondarySystem")):
            # Secondary systems are a recursive instance of the ProcessingSystemDataManager
            self.secondaryProcessingSystem = ProcessingSystemDataManager()
            self.secondaryProcessingSystem.ParseSecondarySystemXMLNode(
                node, self)

        return processingSystemNode
 def ParseXMLNode(self,actionNode,problemManager):
    """Generate comparitive sensitivity action from xml tree node."""
    if(HasAttribute(actionNode,"type")):
      self.type = GetAttributeString(actionNode,"type")
      
    self.parameters = GetAttributeVectorString(actionNode,"parameters")
    self.minValues = GetAttributeVector(actionNode,"minima")
    self.maxValues = GetAttributeVector(actionNode,"maxima")
 def ParseXMLNode(self,actionNode,problemManager):
    """
    Generate named action from xml tree node. 
    """
    if(HasAttribute(actionNode,"type")):
      self.type = GetAttributeString(actionNode,"type")
      
    self.parameter = GetAttributeString(actionNode,"parameter")
    self.minValue = GetAttributeString(actionNode,"min")
    self.maxValue = GetAttributeString(actionNode,"max")
Esempio n. 9
0
 def ParseXMLNode(self, economicDataNode):
   """
   Generate Economic Data Manager data from xml tree node. 
   """
   
   self.discountRate = GetAttributeValue(economicDataNode,"discountRate")
   
   for child in GetChildren(economicDataNode,"Commodity"):
   	name = GetAttributeString(child,"name")
   	price = GetAttributeValue(child,"price")
   	self.metalPrices[name] = price
   	
   if(HasAttribute(economicDataNode,"GandAFraction")):
     self.GandAFraction = GetAttributeValue(economicDataNode,"GandAFraction")
     
   if(HasAttribute(economicDataNode,"state")):
     self.state = GetAttributeString(economicDataNode,"state")
     
   if(HasAttribute(economicDataNode,"inflation")):
     self.inflation = GetAttributeValue(economicDataNode,"inflation")
    def ParseXMLNode(self, processingSystemNode):
        """
      Generate processing system data from xml tree node. 
      """

        # NB processing method, take etc for primary product is set in "Determine Processing system"
        if (HasAttribute(processingSystemNode, "refiningTake")
                or HasAttribute(processingSystemNode, "processingLoss")):
            self.overwrite = True
            self.userRefiningTake = GetAttributeValue(processingSystemNode,
                                                      "refiningTake")
            self.userProcessingLoss = GetAttributeValue(
                processingSystemNode, "processingLoss")
        if (HasChild(processingSystemNode, "SecondarySystem")):
            # Secondary systems are a recursive instance of the ProcessingSystemDataManager
            self.secondaryProcessingSystem = ProcessingSystemDataManager()
            self.secondaryProcessingSystem.ParseSecondarySystemXMLNode(
                processingSystemNode, self)

        return processingSystemNode
    def ParseXMLNode(self, miningSystemNode):
        """
      Generate mining system data from xml tree node.
       - Note this may not be needed in many cases as the mining system is derived from the orebody shape  
      """

        theUnitManager = UnitManager()

        if (HasAttribute(miningSystemNode, "alpha")):
            self.alpha = GetAttributeValue(miningSystemNode, "alpha")

        if (HasAttribute(miningSystemNode, "orebody")):
            self.orebodyName = GetAttributeString(miningSystemNode, "orebody")

        # for K2SO4 (brine mining) only - bit ugly - might be able to use orebody instead
        if (HasAttribute(miningSystemNode, "method")):
            self.miningMethod = GetAttributeString(miningSystemNode, "method")

        # for proving well costs
        if (HasAttribute(miningSystemNode, "boreholeSpacing")):
            spacing = theUnitManager.ConvertToBaseUnits(
                GetAttributeString(miningSystemNode, "boreholeSpacing"))
            self.boreholeDensity = 1.0 / (spacing**2)

        if (HasAttribute(miningSystemNode, "drillingCost")):
            self.drillingCostPerMeter = theUnitManager.ConvertToBaseUnits(
                GetAttributeString(miningSystemNode, "drillingCost"))

        if (HasAttribute(miningSystemNode, "includeProvingCosts")):
            self.doProvingCostCalculation = GetAttributeValue(
                miningSystemNode, "includeProvingCosts")

        return miningSystemNode
Esempio n. 12
0
 def ParseXMLNode(self, actionNode, problemManager):
     """
    Generate named action from xml tree node. 
    """
     if (HasAttribute(actionNode, "filename")):
         self.saveFullPath = GetAttributeValueOrDefault(
             actionNode, "save_full_path", self.saveFullPath)
         if (self.saveFullPath):
             self.filename = GetAttributeFileString(actionNode, "filename")
         else:
             self.filename = GetAttributeString(actionNode, "filename")
     self.recordSha = GetAttributeValueOrDefault(actionNode, "record_sha",
                                                 self.recordSha)
    def ParseXMLNode(self, economicDataNode):
        """
      Generate Economic Data Manager data from xml tree node. 
      """

        EconomicDataManager.ParseXMLNode(self, economicDataNode)

        self.discountRate = GetAttributeValue(economicDataNode, "discountRate")

        for child in GetChildren(economicDataNode, "Commodity"):
            name = GetAttributeString(child, "name")
            price = GetAttributeValue(child, "price")
            self.commodityPrices[name] = price
            self.referenceCommodityPrices[name] = price
            self.commodityPriceSigmas[name] = 0.0
            if (HasAttribute(economicDataNode, "sigma")):
                self.commodityPriceSigmas[name] = GetAttributeValue(
                    child, "sigma")

        if (HasAttribute(economicDataNode, "GandAFraction")):
            self.GandAFraction = GetAttributeValue(economicDataNode,
                                                   "GandAFraction")

        if (HasAttribute(economicDataNode, "state")):
            self.state = GetAttributeString(economicDataNode, "state")

        if (HasAttribute(economicDataNode, "inflation")):
            self.inflation = GetAttributeValue(economicDataNode, "inflation")

        if (HasAttribute(economicDataNode, "calculateGasCosts")):
            self.calculateGasCosts = GetAttributeValue(economicDataNode,
                                                       "calculateGasCosts")

        if (HasAttribute(economicDataNode, "calculateBlackCoalCosts")):
            self.calculateBlackCoalCosts = GetAttributeValue(
                economicDataNode, "calculateBlackCoalCosts")

        if (HasAttribute(economicDataNode, "calculateBrownCoalCosts")):
            ## NB: This model uses CSIRO brown coal cost estimate (good) but employs black coal sensitivity to coal price per GJ due to lack of data.
            self.calculateBrownCoalCosts = GetAttributeValue(
                economicDataNode, "calculateBrownCoalCosts")
Esempio n. 14
0
    def ParseXMLNode(self, functionObjectNode, problemManager):
        """
       Generate named function from xml tree node. 
       """
        UserDefinedFunction.ParseXMLNode(self, functionObjectNode,
                                         problemManager)
        self.xfile = GetAttributeFileString(functionObjectNode, "xticks")
        self.yfile = GetAttributeFileString(functionObjectNode, "yticks")
        self.valueFile = GetAttributeFileString(functionObjectNode, "values")
        if (self.xfile[-4:] == ".npy"):
            self.xs = np.load(self.xfile)
        else:
            print("loading:", self.xfile)
            self.xs = np.loadtxt(self.xfile)

        if (self.yfile[-4:] == ".npy"):
            self.ys = np.load(self.yfile)
        else:
            self.ys = np.loadtxt(self.yfile)

        if (self.valueFile[-4:] == ".npy"):
            self.values = np.load(self.valueFile)
        else:
            self.values = np.loadtxt(self.valueFile)

        if (HasAttribute(functionObjectNode, "transpose")):
            self.transpose = GetAttributeValue(functionObjectNode, "transpose")

        if (self.transpose):
            self.values = self.values.T

        self.values[np.isnan(self.values)] = 2e3
        self.interpFunc = interpolate.interp2d(self.xs,
                                               self.ys,
                                               self.values,
                                               kind='linear')
Esempio n. 15
0
    def ParseXMLNode(self, powerPlantNode):
        """
      Generate power plant data from xml tree node.
       - Note this may not be needed in many cases as the mining system is derived from the orebody shape  
      """

        if (HasAttribute(powerPlantNode, "capacityFactor")):
            self.capacityFactor = GetAttributeValue(powerPlantNode,
                                                    "capacityFactor")

        if (HasAttribute(powerPlantNode, "waterPerMWh")):
            self.waterPerMWh = GetAttributeValue(powerPlantNode, "waterPerMWh")

        if (HasAttribute(powerPlantNode, "operatingLife")):
            self.operatingLife = GetAttributeValue(powerPlantNode,
                                                   "operatingLife")
            if (self.operatingLife > 100):
                # assumed life is given in years not integer
                theUnitManager = UnitManager()
                self.operatingLife *= theUnitManager.ConvertTo("year")
            self.operatingLife = int(np.round(self.operatingLife))

        if (HasAttribute(powerPlantNode, "type")):
            self.type = GetAttributeString(powerPlantNode, "type")

        if (HasAttribute(powerPlantNode, "fraction")):
            self.powerFraction = GetAttributeValue(powerPlantNode, "fraction")

        if (HasChild(powerPlantNode,
                     "SecondarySystem")):  # and tertiary systems
            secondaryNode = GetChild(powerPlantNode, "SecondarySystem")
            self.secondaryPowerSource = PowerPlantManager()
            self.secondaryPowerSource.ParseXMLNode(secondaryNode)

            if (HasAttribute(powerPlantNode, "useHybridPlantWithCurtailment")):
                self.useHybridPlantWithCurtailment = GetAttributeValue(
                    powerPlantNode, "useHybridPlantWithCurtailment")
                self.secondaryPowerSource.useHybridPlantWithCurtailment = self.useHybridPlantWithCurtailment

        return powerPlantNode
Esempio n. 16
0
 def ParseXMLNode(self, actionNode, problemManager):
     """
    Generate named action from xml tree node. 
    """
     if (HasAttribute(actionNode, "msg")):
         self.exitMessage = GetAttributeString(actionNode, "msg")
Esempio n. 17
0
 def ParseXMLNode(self,actionNode,problemManager):
    """
    Generate named action from xml tree node. 
    """
    if(HasAttribute(actionNode,"name")):
      self.orebodyName = GetAttributeString(actionNode,"name")