Skip to content

Commit 3c64743

Browse files
separate calculate_fgem function
1 parent a1706b3 commit 3c64743

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/geophires_x/SurfacePlantFgemORC.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ def Calculate(self, model: Model) -> None:
6666

6767
model.logger.info("Init " + self.__class__.__name__ + ": " + __name__)
6868

69-
def degC(p: HasQuantity) -> float:
70-
return p.quantity().to('degC').magnitude
71-
72-
# fgem_TenteringPP = np.zeros(len(model.reserv.timevector.value))
73-
7469
# calculate power plant entering temperature
7570
self.TenteringPP.value = SurfacePlant.power_plant_entering_temperature(self, self.enduse_option.value,
7671
model.reserv.timevector.value,
@@ -144,26 +139,36 @@ def degC(p: HasQuantity) -> float:
144139
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
145140
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)
146141

142+
self._calculate_fgem(model)
143+
self._calculate_derived_outputs(model)
144+
model.logger.info(f"complete {self.__class__.__name__}: {__name__}")
145+
146+
def _calculate_fgem(self, model: Model):
147147

148-
nameplate_capacity_MW = 10 # FIXME WIP
148+
def degC(p: HasQuantity) -> float:
149+
return p.quantity().to('degC').magnitude
150+
151+
# fgem_TenteringPP = np.zeros(len(model.reserv.timevector.value))
152+
153+
# nameplate_capacity_MW = 10 # FIXME WIP
149154
# self._fgem_geophires_orc_power_plant: GEOPHIRESORCPowerPlant = GEOPHIRESORCPowerPlant(
150155
# nameplate_capacity_MW,
151156
# model.reserv.Tresoutput.value
152157
# ) # FIXME TEMP WIP
153158

159+
fgem_timestep = timedelta(days=365 * (1 / model.economics.timestepsperyear.value))
154160
fgem_orc_power_plant = ORCPowerPlant(
155-
#degC(model.reserv.Tresoutput)[0],
161+
# degC(model.reserv.Tresoutput)[0],
156162
degC(model.wellbores.ProducedTemperature)[0],
157163
degC(self.ambient_temperature),
158164
model.wellbores.prodwellflowrate.value,
159165
num_prd=model.wellbores.nprod.value,
160166
# TODO capacity factor
161-
cf =self.utilization_factor.value,
167+
cf=self.utilization_factor.value,
162168

163-
timestep=timedelta(days=365*(1 / model.economics.timestepsperyear.value))
169+
timestep=fgem_timestep
164170
)
165171

166-
167172
fgem_Tinj = np.zeros(len(model.reserv.timevector.value))
168173
fgem_ElectricityProduced = np.zeros(len(model.reserv.timevector.value))
169174
for t in range(len(model.reserv.timevector.value)):
@@ -176,5 +181,7 @@ def degC(p: HasQuantity) -> float:
176181
fgem_Tinj[t] = fgem_orc_power_plant.T_inj
177182
fgem_ElectricityProduced[t] = fgem_orc_power_plant.power_output_MWe
178183

179-
self._calculate_derived_outputs(model)
180-
model.logger.info(f"complete {self.__class__.__name__}: {__name__}")
184+
185+
fgem_calculated = True
186+
187+

tests/fgem_tests/test_fgem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ def _get_result(self, _params, file_path=None) -> GeophiresXResult:
3030
return GeophiresXClient().get_geophires_result(
3131
GeophiresInputParameters(
3232
from_file_path=file_path,
33-
params={'Power Plant Type': 10, **_params},
33+
params={'Power Plant Type': 10, 'Time steps per year': 12, **_params},
3434
)
3535
)

0 commit comments

Comments
 (0)