@@ -19,7 +19,7 @@ def __init__(self, model: Model):
19
19
:return: None
20
20
"""
21
21
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 } ' )
23
23
super ().__init__ (model ) # Initialize all the parameters in the superclass
24
24
25
25
# 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):
65
65
CurrentUnits = EnergyFrequencyUnit .KWhPERYEAR
66
66
)
67
67
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 } ' )
69
69
70
70
def __str__ (self ):
71
71
return "SurfacePlantHeatPump"
@@ -78,12 +78,12 @@ def read_parameters(self, model:Model) -> None:
78
78
:param model: The container class of the application, giving access to everything else, including the logger
79
79
:return: None
80
80
"""
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 } ' )
82
82
super ().read_parameters (model ) # Read in all the parameters from the superclass
83
83
84
84
# Since there are no parameters unique to this class, we don't need to read any in here.
85
85
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 } ' )
87
87
88
88
def Calculate (self , model : Model ) -> None :
89
89
"""
@@ -93,7 +93,7 @@ def Calculate(self, model: Model) -> None:
93
93
:type model: :class:`~geophires_x.Model.Model`
94
94
:return: Nothing, but it does make calculations and set values in the model
95
95
"""
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 } ' )
97
97
98
98
# This is where all the calculations are made using all the values that have been set.
99
99
# 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:
115
115
self .HeatkWhExtracted .value = np .zeros (self .plant_lifetime .value )
116
116
self .PumpingkWh .value = np .zeros (self .plant_lifetime .value )
117
117
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
+
118
123
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 )
122
126
123
127
self .HeatkWhProduced .value = np .zeros (self .plant_lifetime .value )
124
128
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 )
127
130
128
131
self .heat_pump_electricity_kwh_used .value = np .zeros (self .plant_lifetime .value )
129
132
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 )
132
134
133
135
# calculate reservoir heat content
134
136
self .RemainingReservoirHeatContent .value = SurfacePlant .remaining_reservoir_heat_content (
135
137
self , model .reserv .InitialReservoirHeatContent .value , self .HeatkWhExtracted .value )
136
138
137
139
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