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
Exemplo n.º 2
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
Exemplo n.º 3
0
    def ParseXMLNode(self, mineDataNode):
        """
      Generate Mine Data Manager data from xml tree node. 
      """

        # Location
        if (HasChild(mineDataNode, "Location")):
            locNode = GetChild(mineDataNode, "Location")
            self.mineLatLong[0] = GetAttributeValue(locNode, "lat")
            self.mineLatLong[1] = GetAttributeValue(locNode, "long")

        # Orebody
        if (HasChild(mineDataNode, "Orebody")):
            orebodyNode = GetChild(mineDataNode, "Orebody")
            self.theOreBody.ParseXMLNode(orebodyNode)

        theFunctionManager = FunctionManager()
        if ((self.theOreBody.cover < 0.0)
                and (theFunctionManager.HasFunction("DepthOfCover"))):
            self.theOreBody.cover = theFunctionManager.GetFunction(
                "DepthOfCover").f(self.mineLatLong)
            print "Cover set to: ", self.theOreBody.cover

        # Infrastructure
        if (HasChild(mineDataNode, "Infrastructure")):
            infrastructureNode = GetChild(mineDataNode, "Infrastructure")
            self.theInfrastructureManager.ParseXMLNode(infrastructureNode)

        # Economics
        if (HasChild(mineDataNode, "Economics")):
            economicsNode = GetChild(mineDataNode, "Economics")
            self.theEconomicDataManager.ParseXMLNode(economicsNode)
    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")
    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
Exemplo n.º 6
0
 def ParseXMLNode(self, functionObjectNode, problemManager):
     """
    Generate named function from xml tree node. 
    """
     UserDefinedFunction.ParseXMLNode(self, functionObjectNode,
                                      problemManager)
     self.coeff = GetAttributeValue(functionObjectNode, "coeff")
     self.power = GetAttributeValue(functionObjectNode, "power")
Exemplo n.º 7
0
 def ParseXMLNode(self, functionObjectNode, problemManager):
     """
    Generate a powerlaw function from xml tree node. 
    """
     UserDefinedFunction.ParseXMLNode(self, functionObjectNode,
                                      problemManager)
     self.coeff = GetAttributeValue(functionObjectNode, "coeff")
     self.unperturbed_coeff = np.copy(self.coeff)
     self.power = GetAttributeValue(functionObjectNode, "power")
     self.stdErrorScale = GetAttributeValueOrDefault(
         functionObjectNode, "stdErrorScale", self.stdErrorScale)
Exemplo n.º 8
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
Exemplo n.º 9
0
    def ParseXMLNode(self, infrastructureNode):
        """
      Generate infrastructure data from xml tree node. 
      """
        #self.powerSupply = GetAttributeStringOrDefault(infrastructureNode,"powerSupply", self.powerSupply)
        self.calculateDiesel = GetAttributeValueOrDefault(
            infrastructureNode, "calculateDiesel", self.calculateDiesel)
        self.calculateGas = GetAttributeValueOrDefault(infrastructureNode,
                                                       "calculateGas",
                                                       self.calculateGas)
        self.calculateRenewable = GetAttributeValueOrDefault(
            infrastructureNode, "calculateRenewable", self.calculateRenewable)

        if (self.calculateRenewable):
            self.renewableLCOE = GetAttributeValue(infrastructureNode,
                                                   "renewableLCOE")

        self.doTransportClosureCostEstimate = GetAttributeValueOrDefault(
            infrastructureNode, "calculateTransportClosureCosts",
            self.doTransportClosureCostEstimate)

        self.roadClosureDays = GetAttributeValueOrDefault(
            infrastructureNode, "roadClosureDays", self.roadClosureDays)
        self.railClosureDays = GetAttributeValueOrDefault(
            infrastructureNode, "railClosureDays", self.railClosureDays)

        return infrastructureNode
Exemplo n.º 10
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
Exemplo n.º 11
0
    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  
      """

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

        return miningSystemNode
    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
Exemplo n.º 13
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")
Exemplo n.º 14
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
Exemplo n.º 15
0
    def ParseXMLNode(self, hydrogenDataNode):
      """
      Generate Hydrogen Data Manager data from xml tree node. 
      """
      
      # Location
      if(HasChild(hydrogenDataNode,"Location")):
        locNode = GetChild(hydrogenDataNode,"Location")
        self.plantLatLong[0] = GetAttributeValue(locNode,"lat")
        self.plantLatLong[1] = GetAttributeValue(locNode,"long")
      
      
      # Hydrogen plant
      if(HasChild(hydrogenDataNode,"HydrogenPlant")):
        hydrogenPlantNode = GetChild(hydrogenDataNode,"HydrogenPlant")
        self.theHydrogenPlant.ParseXMLNode(hydrogenPlantNode)  
        
      
      # Power plant
      if(HasChild(hydrogenDataNode,"PowerPlant")):
        powerPlantNode = GetChild(hydrogenDataNode,"PowerPlant")
        self.thePowerPlant.ParseXMLNode(powerPlantNode)  
 
       # Energy storage
      if(HasChild(hydrogenDataNode,"EnergyStorage")):
        energyStorageNode = GetChild(hydrogenDataNode,"EnergyStorage")
        self.theEnergyStorage = HydrogenEnergyStorageManager()
        self.theEnergyStorage.ParseXMLNode(energyStorageNode)
        
      # Infrastructure
      if(HasChild(hydrogenDataNode,"Infrastructure")):
        infrastructureNode = GetChild(hydrogenDataNode,"Infrastructure")
        self.theInfrastructureManager.ParseXMLNode(infrastructureNode)      
      
        
      # Economics
      if(HasChild(hydrogenDataNode,"Economics")):
        economicsNode = GetChild(hydrogenDataNode,"Economics")
        self.theEconomicDataManager.ParseXMLNode(economicsNode)
    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")
Exemplo n.º 17
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')
Exemplo n.º 18
0
 def ParseXMLNode(self, mineDataNode):
   """
   Generate Mine Data Manager data from xml tree node. 
   """
   
   # Location
   if(HasChild(mineDataNode,"Location")):
     locNode = GetChild(mineDataNode,"Location")
     self.mineLatLong[0] = GetAttributeValue(locNode,"lat")
     self.mineLatLong[1] = GetAttributeValue(locNode,"long")
   
   # Orebody
   if(HasChild(mineDataNode,"Orebody")):
     orebodyNode = GetChild(mineDataNode,"Orebody")
     orebodyName = GetAttributeStringOrDefault(orebodyNode,"name","unnamed")
     self.theOrebodies[orebodyName] = OreBodyDataManager(orebodyName)
     self.theOrebodies[orebodyName].ParseXMLNode(orebodyNode)
     self.theOrebodies["Active"] = self.theOrebodies[orebodyName]
     self.theOreBody = self.theOrebodies[orebodyName]
     self.theMines[orebodyName] = MiningSystemDataManager(orebodyName)
     self.theMiningSystem = self.theMines[orebodyName]
     
   # Orebody Set
   if(HasChild(mineDataNode,"OrebodyList")):
     orebodyList = GetChild(mineDataNode,"OrebodyList")
     setActive = True
     for orebodyNode in GetChildren(orebodyList):
     
       if(GetXMLTag(orebodyNode) != "note"):
         
         orebodyName = GetAttributeString(orebodyNode,"name")
         self.theOrebodies[orebodyName] = OreBodyDataManager(orebodyName)
         self.theOrebodies[orebodyName].latLong = np.array(self.mineLatLong)  # set global lat long as orebody lat long as default
         self.theOrebodies[orebodyName].ParseXMLNode(orebodyNode)
       
         self.theMines[orebodyName] = MiningSystemDataManager(orebodyName)
       
         if(setActive):
           self.theOrebodies["Active"] = self.theOrebodies[orebodyName]
           self.theOreBody = self.theOrebodies[orebodyName]
           self.theMiningSystem = self.theMines[orebodyName]
           setActive = False
         
       
   
   theFunctionManager = FunctionManager()
   if( (self.theOreBody.cover < 0.0 ) and (theFunctionManager.HasFunction("DepthOfCover") ) ):
     self.theOreBody.cover = theFunctionManager.GetFunction("DepthOfCover").f( self.mineLatLong[::-1]  )
     print("Cover set to: ", self.theOreBody.cover )
     
     
   
   if(HasChild(mineDataNode,"Mining")):
     miningNode = GetChild(mineDataNode,"Mining")
     # pass XML settings to all orebodies
     self.theMines["Active"].ParseXMLNode(miningNode)
     for orebodyName in self.theOrebodies:
       self.theMines[orebodyName].ParseXMLNode(miningNode)
     
   # Infrastructure
   if(HasChild(mineDataNode,"Infrastructure")):
     infrastructureNode = GetChild(mineDataNode,"Infrastructure")
     self.theInfrastructureManager.ParseXMLNode(infrastructureNode)      
 
   # Rehabilitation
   if(HasChild(mineDataNode,"Rehabilitation")):
     rehabNode = GetChild(mineDataNode,"Rehabilitation")
     self.theRehabilitationManager = RehabilitationDataManager()
     self.theRehabilitationManager.ParseXMLNode(rehabNode)    
     
   # Economics
   if(HasChild(mineDataNode,"Economics")):
     economicsNode = GetChild(mineDataNode,"Economics")
     self.theEconomicDataManager.ParseXMLNode(economicsNode)
Exemplo n.º 19
0
 def ParseXMLNode(self, funcNode, problemManager):
     """
    Populate ConstantFunction object with data from xml tree node. 
    """
     UserDefinedFunction.ParseXMLNode(self, funcNode, problemManager)
     self.fval = GetAttributeValue(funcNode, "f")