Skip to content

Commit

Permalink
fixes bugs and adds example13.txt as new unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
kfbeckers committed Nov 20, 2023
1 parent 9720b15 commit a18cd17
Show file tree
Hide file tree
Showing 7 changed files with 317 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/geophires_x/Economics.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def CalculateLCOELCOH(self, model: Model) -> tuple:
elif model.surfaceplant.enduseoption.value in [EndUseOptions.COGENERATION_TOPPING_EXTRA_ELECTRICTY,
EndUseOptions.COGENERATION_BOTTOMING_EXTRA_ELECTRICTY,
EndUseOptions.COGENERATION_PARALLEL_EXTRA_ELECTRICTY]: # electricity sales is additional income revenue stream
annualelectricityincome = model.surfaceplant.NetkWhProduced.value * self.elecprice.value / 1E6 # M$/year
annualelectricityincome = model.surfaceplant.NetkWhProduced.value * model.surfaceplant.elecprice.value / 1E6 # M$/year
LCOH = ((1 + self.inflrateconstruction.value) * self.CCap.value + np.sum(
(self.Coam.value - annualelectricityincome) * discountvector)) / np.sum(
model.surfaceplant.HeatkWhProduced.value * discountvector) * 1E8 # cents/kWh
Expand Down Expand Up @@ -2080,7 +2080,7 @@ def Calculate(self, model: Model) -> None:
model.surfaceplant.HeatProduced.value / model.surfaceplant.enduseefficiencyfactor.value) * 1000.
elif model.surfaceplant.enduseoption.value in [EndUseOptions.COGENERATION_BOTTOMING_EXTRA_HEAT,
EndUseOptions.COGENERATION_BOTTOMING_EXTRA_ELECTRICTY]: # enduseoption = 4: cogen bottoming cycle
self.Cplant = self.Cplant.value + 1.12 * 1.15 * self.ccplantadjfactor.value * 250E-6 * np.max(
self.Cplant.value = self.Cplant.value + 1.12 * 1.15 * self.ccplantadjfactor.value * 250E-6 * np.max(
model.surfaceplant.HeatProduced.value / model.surfaceplant.enduseefficiencyfactor.value) * 1000.
elif model.surfaceplant.enduseoption.value in [EndUseOptions.COGENERATION_PARALLEL_EXTRA_ELECTRICTY,
EndUseOptions.COGENERATION_PARALLEL_EXTRA_HEAT]: # cogen parallel cycle
Expand Down
4 changes: 2 additions & 2 deletions src/geophires_x/OptionList.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class EndUseOptions(str, Enum):
HEAT = "Direct-Use Heat" # 2
COGENERATION_TOPPING_EXTRA_HEAT = "Cogeneration Topping Cycle, Heat sales considered as extra income" # 31
COGENERATION_TOPPING_EXTRA_ELECTRICTY = "Cogeneration Topping Cycle, Electricity sales considered as extra income" # 32
COGENERATION_BOTTOMING_EXTRA_ELECTRICTY = "Cogeneration Bottoming Cycle, Electricity sales considered as extra income" # 41
COGENERATION_BOTTOMING_EXTRA_HEAT = "Cogeneration Bottoming Cycle, Heat sales considered as extra income" # 42
COGENERATION_BOTTOMING_EXTRA_HEAT = "Cogeneration Bottoming Cycle, Heat sales considered as extra income" # 41
COGENERATION_BOTTOMING_EXTRA_ELECTRICTY = "Cogeneration Bottoming Cycle, Electricity sales considered as extra income" # 42
COGENERATION_PARALLEL_EXTRA_HEAT = "Cogeneration Parallel Cycle, Heat sales considered as extra income" # 51
COGENERATION_PARALLEL_EXTRA_ELECTRICTY = "Cogeneration Parallel Cycle, Electricity sales considered as extra income" # 52
ABSORPTION_CHILLER = "Absorption Chiller" # 6
Expand Down
6 changes: 3 additions & 3 deletions src/geophires_x/SurfacePlant.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def Calculate(self, model: Model) -> None:

else:
if self.enduseoption.value in [EndUseOptions.COGENERATION_BOTTOMING_EXTRA_ELECTRICTY, EndUseOptions.COGENERATION_BOTTOMING_EXTRA_HEAT]:
self.TenteringPP.value = self.Tchpbottom.value
self.TenteringPP.value = self.Tchpbottom.value*np.ones(len(model.reserv.timevector.value))
else:
self.TenteringPP.value = model.wellbores.ProducedTemperature.value
# Availability water (copied from GEOPHIRES v1.0 Fortran Code)
Expand Down Expand Up @@ -886,8 +886,8 @@ def Calculate(self, model: Model) -> None:
self.ElectricityProduced.value = self.Availability.value*etau*model.wellbores.nprod.value*model.wellbores.prodwellflowrate.value
self.HeatExtracted.value = model.wellbores.nprod.value*model.wellbores.prodwellflowrate.value*model.reserv.cpwater.value *\
(model.wellbores.ProducedTemperature.value - model.wellbores.Tinj.value)/1E6 # Heat extracted from geofluid [MWth]
self.valueHeatProduced.value = self.enduseefficiencyfactor.value*model.wellbores.nprod.value *\
model.wellbores.prodwellflowrate*model.reserv.cpwater.value *\
self.HeatProduced.value = self.enduseefficiencyfactor.value*model.wellbores.nprod.value *\
model.wellbores.prodwellflowrate.value*model.reserv.cpwater.value *\
(model.wellbores.ProducedTemperature.value - self.Tchpbottom.value)/1E6 # Useful heat for direct-use application [MWth]
HeatExtractedTowardsElectricity = model.wellbores.nprod.value*model.wellbores.prodwellflowrate.value *\
model.reserv.cpwater.value*(self.Tchpbottom.value - model.wellbores.Tinj.value)/1E6
Expand Down
3 changes: 3 additions & 0 deletions src/geophires_x/WellBores.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,9 @@ def Calculate(self, model: Model) -> None:
ProducedTemperatureRepeatead = np.tile(self.ProducedTemperature.value[0:indexfirstmaxdrawdown],
self.redrill.value + 1)
self.ProducedTemperature.value = ProducedTemperatureRepeatead[0:len(self.ProducedTemperature.value)]
TResOutputRepeated = np.tile(model.reserv.Tresoutput.value[0:indexfirstmaxdrawdown],
self.redrill.value + 1)
model.reserv.Tresoutput.value = TResOutputRepeated[0:len(self.ProducedTemperature.value)]

# calculate pressure drops and pumping power
self.DPProdWell.value, f3, vprod, self.rhowaterprod = WellPressureDrop(
Expand Down
Loading

0 comments on commit a18cd17

Please sign in to comment.