Skip to content

Commit 41d26a8

Browse files
Break out Economics.calculate_total_capital_costs (no functional change)
1 parent 212eec8 commit 41d26a8

File tree

1 file changed

+56
-54
lines changed

1 file changed

+56
-54
lines changed

src/geophires_x/Economics.py

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,60 +2412,7 @@ def Calculate(self, model: Model) -> None:
24122412
self.Cstim.value = self.calculate_stimulation_costs(model).to(self.Cstim.CurrentUnits).magnitude
24132413
self.calculate_field_gathering_costs(model)
24142414
self.calculate_plant_costs(model)
2415-
2416-
if not self.totalcapcost.Valid:
2417-
# exploration costs (same as in Geophires v1.2) (M$)
2418-
if self.ccexplfixed.Valid:
2419-
self.Cexpl.value = self.ccexplfixed.value
2420-
else:
2421-
self.Cexpl.value = self._contingency_factor * self.ccexpladjfactor.value * self._indirect_cost_factor * (
2422-
1. + self.cost_one_production_well.value * 0.6)
2423-
2424-
# Surface Piping Length Costs (M$) #assumed $750k/km
2425-
self.Cpiping.value = 750 / 1000 * model.surfaceplant.piping_length.value
2426-
2427-
# district heating network costs
2428-
if model.surfaceplant.plant_type.value == PlantType.DISTRICT_HEATING: # district heat
2429-
if self.dhtotaldistrictnetworkcost.Provided:
2430-
self.dhdistrictcost.value = self.dhtotaldistrictnetworkcost.value
2431-
elif self.dhpipinglength.Provided:
2432-
self.dhdistrictcost.value = self.dhpipinglength.value * self.dhpipingcostrate.value / 1000 # M$
2433-
elif self.dhroadlength.Provided: # check if road length is provided to calculate cost
2434-
self.dhdistrictcost.value = self.dhroadlength.value * 0.75 * self.dhpipingcostrate.value / 1000 # M$ (assuming 75% of road length is used for district network piping)
2435-
else: # calculate district network cost based on population density
2436-
if self.dhlandarea.Provided == False:
2437-
model.logger.warning("District heating network cost calculated based on default district area")
2438-
if self.dhpopulation.Provided:
2439-
self.populationdensity.value = self.dhpopulation.value / self.dhlandarea.value
2440-
elif model.surfaceplant.dh_number_of_housing_units.Provided:
2441-
self.populationdensity.value = model.surfaceplant.dh_number_of_housing_units.value * 2.6 / self.dhlandarea.value # estimate population based on 2.6 number of people per household
2442-
else:
2443-
model.logger.warning(
2444-
"District heating network cost calculated based on default number of people in district")
2445-
self.populationdensity.value = self.dhpopulation.value / self.dhlandarea.value
2446-
2447-
if self.populationdensity.value > 1000:
2448-
self.dhpipinglength.value = 7.5 * self.dhlandarea.value # using constant 7.5km of pipe per km^2 when population density is >1500
2449-
else:
2450-
self.dhpipinglength.value = max(
2451-
self.populationdensity.value / 1000 * 7.5 * self.dhlandarea.value,
2452-
self.dhlandarea.value) # scale the piping length based on population density, but with a minimum of 1 km of piping per km^2 of area
2453-
self.dhdistrictcost.value = self.dhpipingcostrate.value * self.dhpipinglength.value / 1000
2454-
2455-
else:
2456-
self.dhdistrictcost.value = 0
2457-
2458-
self.CCap.value = self.Cexpl.value + self.Cwell.value + self.Cstim.value + self.Cgath.value + self.Cplant.value + self.Cpiping.value + self.dhdistrictcost.value
2459-
else:
2460-
self.CCap.value = self.totalcapcost.value
2461-
2462-
# update the capital costs, assuming the entire ITC is used to reduce the capital costs
2463-
if self.RITC.Provided:
2464-
self.RITCValue.value = self.RITC.value * self.CCap.value
2465-
self.CCap.value = self.CCap.value - self.RITCValue.value
2466-
2467-
# Add in the FlatLicenseEtc, OtherIncentives, & TotalGrant
2468-
self.CCap.value = self.CCap.value + self.FlatLicenseEtc.value - self.OtherIncentives.value - self.TotalGrant.value
2415+
self.calculate_total_capital_costs(model)
24692416

24702417
# O&M costs
24712418
# calculate first O&M costs independent of whether oamtotalfixed is provided or not
@@ -3087,7 +3034,60 @@ def calculate_plant_costs(self, model: Model) -> None:
30873034
if not self.CAPEX_heat_electricity_plant_ratio.Provided:
30883035
self.CAPEX_heat_electricity_plant_ratio.value = self.CAPEX_cost_electricity_plant/self.Cplant.value
30893036

3037+
def calculate_total_capital_costs(self, model):
3038+
if not self.totalcapcost.Valid:
3039+
# exploration costs (same as in Geophires v1.2) (M$)
3040+
if self.ccexplfixed.Valid:
3041+
self.Cexpl.value = self.ccexplfixed.value
3042+
else:
3043+
self.Cexpl.value = self._contingency_factor * self.ccexpladjfactor.value * self._indirect_cost_factor * (
3044+
1. + self.cost_one_production_well.value * 0.6)
3045+
3046+
# Surface Piping Length Costs (M$) #assumed $750k/km
3047+
self.Cpiping.value = 750 / 1000 * model.surfaceplant.piping_length.value
3048+
3049+
# district heating network costs
3050+
if model.surfaceplant.plant_type.value == PlantType.DISTRICT_HEATING: # district heat
3051+
if self.dhtotaldistrictnetworkcost.Provided:
3052+
self.dhdistrictcost.value = self.dhtotaldistrictnetworkcost.value
3053+
elif self.dhpipinglength.Provided:
3054+
self.dhdistrictcost.value = self.dhpipinglength.value * self.dhpipingcostrate.value / 1000 # M$
3055+
elif self.dhroadlength.Provided: # check if road length is provided to calculate cost
3056+
self.dhdistrictcost.value = self.dhroadlength.value * 0.75 * self.dhpipingcostrate.value / 1000 # M$ (assuming 75% of road length is used for district network piping)
3057+
else: # calculate district network cost based on population density
3058+
if self.dhlandarea.Provided == False:
3059+
model.logger.warning("District heating network cost calculated based on default district area")
3060+
if self.dhpopulation.Provided:
3061+
self.populationdensity.value = self.dhpopulation.value / self.dhlandarea.value
3062+
elif model.surfaceplant.dh_number_of_housing_units.Provided:
3063+
self.populationdensity.value = model.surfaceplant.dh_number_of_housing_units.value * 2.6 / self.dhlandarea.value # estimate population based on 2.6 number of people per household
3064+
else:
3065+
model.logger.warning(
3066+
"District heating network cost calculated based on default number of people in district")
3067+
self.populationdensity.value = self.dhpopulation.value / self.dhlandarea.value
3068+
3069+
if self.populationdensity.value > 1000:
3070+
self.dhpipinglength.value = 7.5 * self.dhlandarea.value # using constant 7.5km of pipe per km^2 when population density is >1500
3071+
else:
3072+
self.dhpipinglength.value = max(
3073+
self.populationdensity.value / 1000 * 7.5 * self.dhlandarea.value,
3074+
self.dhlandarea.value) # scale the piping length based on population density, but with a minimum of 1 km of piping per km^2 of area
3075+
self.dhdistrictcost.value = self.dhpipingcostrate.value * self.dhpipinglength.value / 1000
30903076

3077+
else:
3078+
self.dhdistrictcost.value = 0
3079+
3080+
self.CCap.value = self.Cexpl.value + self.Cwell.value + self.Cstim.value + self.Cgath.value + self.Cplant.value + self.Cpiping.value + self.dhdistrictcost.value
3081+
else:
3082+
self.CCap.value = self.totalcapcost.value
3083+
3084+
# update the capital costs, assuming the entire ITC is used to reduce the capital costs
3085+
if self.RITC.Provided:
3086+
self.RITCValue.value = self.RITC.value * self.CCap.value
3087+
self.CCap.value = self.CCap.value - self.RITCValue.value
3088+
3089+
# Add in the FlatLicenseEtc, OtherIncentives, & TotalGrant
3090+
self.CCap.value = self.CCap.value + self.FlatLicenseEtc.value - self.OtherIncentives.value - self.TotalGrant.value
30913091

30923092
def calculate_cashflow(self, model: Model) -> None:
30933093
"""
@@ -3212,3 +3212,5 @@ def _calculate_derived_outputs(self, model: Model) -> None:
32123212

32133213
def __str__(self):
32143214
return "Economics"
3215+
3216+

0 commit comments

Comments
 (0)