@@ -19,7 +19,7 @@ def __init__(self, model: Model):
1919 :return: None
2020 """
2121
22- model .logger .info (" Init " + str (__class__ ) + ": " + inspect .currentframe ().f_code .co_name )
22+ model .logger .info (f' Init { str (__class__ )} : { inspect .currentframe ().f_code .co_name } ' )
2323 super ().__init__ (model ) # Initialize all the parameters in the superclass
2424
2525 # Set up all the Parameters that will be predefined by this class using the different types of parameter classes.
@@ -65,7 +65,7 @@ def __init__(self, model: Model):
6565 CurrentUnits = EnergyFrequencyUnit .KWhPERYEAR
6666 )
6767
68- model .logger .info (" Complete " + str (__class__ ) + ": " + inspect .currentframe ().f_code .co_name )
68+ model .logger .info (f' Complete { str (__class__ )} : { inspect .currentframe ().f_code .co_name } ' )
6969
7070 def __str__ (self ):
7171 return "SurfacePlantHeatPump"
@@ -78,12 +78,12 @@ def read_parameters(self, model:Model) -> None:
7878 :param model: The container class of the application, giving access to everything else, including the logger
7979 :return: None
8080 """
81- model .logger .info (" Init " + str (__class__ ) + ": " + inspect .currentframe ().f_code .co_name )
81+ model .logger .info (f' Init { str (__class__ )} : { inspect .currentframe ().f_code .co_name } ' )
8282 super ().read_parameters (model ) # Read in all the parameters from the superclass
8383
8484 # Since there are no parameters unique to this class, we don't need to read any in here.
8585
86- model .logger .info (" complete " + str (__class__ ) + ": " + inspect .currentframe ().f_code .co_name )
86+ model .logger .info (f' complete { str (__class__ )} : { inspect .currentframe ().f_code .co_name } ' )
8787
8888 def Calculate (self , model : Model ) -> None :
8989 """
@@ -93,7 +93,7 @@ def Calculate(self, model: Model) -> None:
9393 :type model: :class:`~geophires_x.Model.Model`
9494 :return: Nothing, but it does make calculations and set values in the model
9595 """
96- model .logger .info (" Init " + str (__class__ ) + ": " + inspect .currentframe ().f_code .co_name )
96+ model .logger .info (f' Init { str (__class__ )} : { inspect .currentframe ().f_code .co_name } ' )
9797
9898 # This is where all the calculations are made using all the values that have been set.
9999 # If you subclass this class, you can choose to run these calculations before (or after) your calculations,
@@ -115,24 +115,26 @@ def Calculate(self, model: Model) -> None:
115115 self .HeatkWhExtracted .value = np .zeros (self .plant_lifetime .value )
116116 self .PumpingkWh .value = np .zeros (self .plant_lifetime .value )
117117
118+ def _integrate_slice (series , _i ):
119+ return SurfacePlant .integrate_time_series_slice (
120+ series , _i , model .economics .timestepsperyear .value , self .utilization_factor .value
121+ )
122+
118123 for i in range (0 , self .plant_lifetime .value ):
119- # FIXME TODO WIP adjust dx for slice size
120- self .HeatkWhExtracted .value [i ] = np .trapz (self .HeatExtracted .value [(0 + i * model .economics .timestepsperyear .value ):((i + 1 ) * model .economics .timestepsperyear .value ) + 1 ],dx = 1. / model .economics .timestepsperyear .value * 365. * 24. ) * 1000. * self .utilization_factor .value
121- self .PumpingkWh .value [i ] = np .trapz (model .wellbores .PumpingPower .value [(0 + i * model .economics .timestepsperyear .value ):((i + 1 ) * model .economics .timestepsperyear .value ) + 1 ],dx = 1. / model .economics .timestepsperyear .value * 365. * 24. ) * 1000. * self .utilization_factor .value
124+ self .HeatkWhExtracted .value [i ] = _integrate_slice (self .HeatExtracted .value , i )
125+ self .PumpingkWh .value [i ] = _integrate_slice (model .wellbores .PumpingPower .value , i )
122126
123127 self .HeatkWhProduced .value = np .zeros (self .plant_lifetime .value )
124128 for i in range (0 , self .plant_lifetime .value ):
125- # FIXME TODO WIP adjust dx for slice size
126- self .HeatkWhProduced .value [i ] = np .trapz (self .HeatProduced .value [(0 + i * model .economics .timestepsperyear .value ):((i + 1 )* model .economics .timestepsperyear .value )+ 1 ],dx = 1. / model .economics .timestepsperyear .value * 365. * 24. )* 1000. * self .utilization_factor .value
129+ self .HeatkWhProduced .value [i ] = _integrate_slice (self .HeatProduced .value , i )
127130
128131 self .heat_pump_electricity_kwh_used .value = np .zeros (self .plant_lifetime .value )
129132 for i in range (0 , self .plant_lifetime .value ):
130- # FIXME TODO WIP adjust dx for slice size
131- self .heat_pump_electricity_kwh_used .value [i ] = np .trapz (self .heat_pump_electricity_used .value [(0 + i * model .economics .timestepsperyear .value ):((i + 1 ) * model .economics .timestepsperyear .value ) + 1 ], dx = 1. / model .economics .timestepsperyear .value * 365. * 24. ) * 1000. * self .utilization_factor .value
133+ self .heat_pump_electricity_kwh_used .value [i ] = _integrate_slice (self .heat_pump_electricity_used .value , i )
132134
133135 # calculate reservoir heat content
134136 self .RemainingReservoirHeatContent .value = SurfacePlant .remaining_reservoir_heat_content (
135137 self , model .reserv .InitialReservoirHeatContent .value , self .HeatkWhExtracted .value )
136138
137139 self ._calculate_derived_outputs (model )
138- model .logger .info (f" complete { str (__class__ )} : { inspect .currentframe ().f_code .co_name } " )
140+ model .logger .info (f' complete { str (__class__ )} : { inspect .currentframe ().f_code .co_name } ' )
0 commit comments