11
11
from geophires_x .TDPReservoir import TDPReservoir
12
12
from geophires_x .WellBores import WellBores
13
13
from geophires_x .SurfacePlant import SurfacePlant
14
+ from geophires_x .SBTEconomics import SBTEconomics
15
+ from geophires_x .SBTWellbores import SBTWellbores
16
+ from geophires_x .SBTReservoir import SBTReservoir
14
17
from geophires_x .SurfacePlantIndustrialHeat import SurfacePlantIndustrialHeat
15
18
from geophires_x .SurfacePlantSubcriticalORC import SurfacePlantSubcriticalOrc
16
19
from geophires_x .SurfacePlantSupercriticalORC import SurfacePlantSupercriticalOrc
@@ -72,68 +75,107 @@ def __init__(self, enable_geophires_logging_config=True, input_file=None):
72
75
if input_file is None and len (sys .argv ) > 1 :
73
76
input_file = sys .argv [1 ]
74
77
78
+ # Key step - read the entire provided input file
75
79
read_input_file (self .InputParameters , logger = self .logger , input_file_name = input_file )
76
80
81
+ # initiate the outputs object
82
+ output_file = 'HDR.out'
83
+ if len (sys .argv ) > 2 :
84
+ output_file = sys .argv [2 ]
85
+ self .outputs = Outputs (self , output_file = output_file )
86
+
87
+ # Initiate the elements of the Model object
88
+ # this is where you can change what class get initiated - the superclass, or one of the subclasses
89
+ self .logger .info ("Initiate the elements of the Model" )
90
+
91
+ # Assume that SDAC and add-ons are not used
77
92
self .sdacgtoutputs = None
78
93
self .sdacgteconomics = None
79
94
self .addoutputs = None
80
95
self .addeconomics = None
81
96
82
- # Initiate the elements of the Model
83
- # this is where you can change what class get initiated - the superclass, or one of the subclasses
84
- self .logger .info ("Initiate the elements of the Model" )
85
- # we need to decide which reservoir to instantiate based on the user input (InputParameters),
86
- # which we just read above for the first time
87
- # Default is Thermal drawdown percentage model (GETEM)
88
- self .reserv : TDPReservoir = TDPReservoir (self )
89
- if 'Reservoir Model' in self .InputParameters :
90
- if self .InputParameters ['Reservoir Model' ].sValue == '0' :
91
- self .reserv : CylindricalReservoir = CylindricalReservoir (self ) # Simple Cylindrical Reservoir
92
- elif self .InputParameters ['Reservoir Model' ].sValue == '1' :
93
- self .reserv : MPFReservoir = MPFReservoir (self ) # Multiple parallel fractures model (LANL)
94
- elif self .InputParameters ['Reservoir Model' ].sValue == '2' :
95
- self .reserv : LHSReservoir = LHSReservoir (self ) # Multiple parallel fractures model (LANL)
96
- elif self .InputParameters ['Reservoir Model' ].sValue == '3' :
97
- self .reserv : SFReservoir = SFReservoir (self ) # Drawdown parameter model (Tester)
98
- elif self .InputParameters ['Reservoir Model' ].sValue == '5' :
99
- self .reserv : UPPReservoir = UPPReservoir (self ) # Generic user-provided temperature profile
100
- elif self .InputParameters ['Reservoir Model' ].sValue == '6' :
101
- self .reserv : TOUGH2Reservoir = TOUGH2Reservoir (self ) # Tough2 is called
102
- elif self .InputParameters ['Reservoir Model' ].sValue == '7' :
103
- self .reserv : SUTRAReservoir = SUTRAReservoir (self ) # SUTRA output is created
104
-
105
97
# initialize the default objects
98
+ self .reserv : TDPReservoir = TDPReservoir (self )
106
99
self .wellbores : WellBores = WellBores (self )
107
- self .surfaceplant : SurfacePlant = SurfacePlant (self )
100
+ self .surfaceplant = SurfacePlantIndustrialHeat (self ) # default is Industrial Heat
108
101
self .economics : Economics = Economics (self )
109
102
110
- output_file = 'HDR.out'
111
- if len ( sys . argv ) > 2 :
112
- output_file = sys . argv [ 2 ]
113
-
114
- self . outputs = Outputs ( self , output_file = output_file )
103
+ # Now we need to handle the creation of all the special case objects based on the user settings
104
+ # We have to access the user setting from the overall master table because the read_parameters functions
105
+ # have not been called on the specific objects yet, so the instantiated objects only contain default values
106
+ # not user set values. The user set value can only come from the master dictionary "InputParameters"
107
+ # based on the user input, which we just read above for the first time
115
108
109
+ # First, we need to decide which reservoir to instantiate
110
+ # For reservoirs, the default is Thermal drawdown percentage model (GETEM); see above where it is initialized.
111
+ # The user can change this in the input file, so check the values and initiate the appropriate reservoir object
116
112
if 'Reservoir Model' in self .InputParameters :
117
- if self .InputParameters ['Reservoir Model' ].sValue == '7' :
118
- # if we use SUTRA output for simulating reservoir thermal energy storage, we use a special wellbore object that can handle SUTRA data
113
+ if self .InputParameters ['Reservoir Model' ].sValue in ['0' , 'Simple cylindrical' ]:
114
+ self .reserv : CylindricalReservoir = CylindricalReservoir (self )
115
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['1' , 'Multiple Parallel Fractures' ]:
116
+ self .reserv : MPFReservoir = MPFReservoir (self )
117
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['2' , '1-D Linear Heat Sweep' ]:
118
+ self .reserv : LHSReservoir = LHSReservoir (self )
119
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['3' , 'Single Fracture m/A Thermal Drawdown' ]:
120
+ self .reserv : SFReservoir = SFReservoir (self )
121
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['5' , 'User-Provided Temperature Profile' ]:
122
+ self .reserv : UPPReservoir = UPPReservoir (self )
123
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['6' , 'TOUGH2 Simulator' ]:
124
+ self .reserv : TOUGH2Reservoir = TOUGH2Reservoir (self )
125
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['7' , 'SUTRA' ]:
126
+ # if we use SUTRA output for simulating reservoir thermal energy storage,
127
+ # we use a special wellbore object that handles SUTRA data, and special Economics and Outputs objects
128
+ self .logger .info ('Setup the SUTRA elements of the Model and instantiate new attributes as needed' )
129
+ self .reserv : SUTRAReservoir = SUTRAReservoir (self )
119
130
self .wellbores : WellBores = SUTRAWellBores (self )
120
131
self .surfaceplant : SurfacePlantSUTRA = SurfacePlantSUTRA (self )
121
132
self .economics : SUTRAEconomics = SUTRAEconomics (self )
122
133
self .outputs : SUTRAOutputs = SUTRAOutputs (self , output_file = output_file )
134
+ elif self .InputParameters ['Reservoir Model' ].sValue in ['8' , 'SBT' ]:
135
+ self .logger .info ('Setup the SBT elements of the Model and instantiate new attributes as needed' )
136
+ self .reserv : SBTReservoir = SBTReservoir (self )
137
+ self .wellbores : SBTWellBores = SBTWellbores (self )
138
+ self .economics : SBTEconomics = SBTEconomics (self )
123
139
140
+ # Now handle the special cases for all AGS cases (CLGS, SBT, or CLGS)
124
141
if 'Is AGS' in self .InputParameters :
125
142
if self .InputParameters ['Is AGS' ].sValue in ['True' , 'true' , 'TRUE' , 'T' , '1' ]:
126
- self .logger .info ("Setup the AGS elements of the Model and instantiate new attributes as needed" )
127
- # If we are doing AGS, we need to replace the various objects we with versions of the objects
128
- # that have AGS functionality.
129
- # that means importing them, initializing them, then reading their parameters
130
- # use the simple cylindrical reservoir for all AGS systems.
131
- self .reserv : CylindricalReservoir = CylindricalReservoir (self )
132
- self .wellbores : WellBores = AGSWellBores (self )
133
- self .surfaceplant : SurfacePlantAGS = SurfacePlantAGS (self )
134
- self .economics : AGSEconomics = AGSEconomics (self )
135
- self .outputs : AGSOutputs = AGSOutputs (self , output_file = output_file )
143
+ self .logger .info ('Setup the AGS elements of the Model and instantiate new attributes as needed' )
136
144
self .wellbores .IsAGS .value = True
145
+ if not isinstance (self .reserv , SBTReservoir ):
146
+ if self .InputParameters ['Economic Model' ].sValue not in ['4' , 'Simple (CLGS)' ]:
147
+ # must be doing wangju approach, # so go back to using default objects
148
+ self .surfaceplant = SurfacePlant (self )
149
+ self .economics = Economics (self )
150
+ # Must be doing CLGS, so we need to instantiate the right objects
151
+ self .reserv : CylindricalReservoir = CylindricalReservoir (self )
152
+ self .wellbores : WellBores = AGSWellBores (self )
153
+ self .surfaceplant : SurfacePlantAGS = SurfacePlantAGS (self )
154
+ self .economics : AGSEconomics = AGSEconomics (self )
155
+ self .outputs : AGSOutputs = AGSOutputs (self , output_file = output_file )
156
+
157
+ # initialize the right Power Plant Type
158
+ if 'Power Plant Type' in self .InputParameters :
159
+ # electricity
160
+ if self .InputParameters ['Power Plant Type' ].sValue in ['1' , 'Subcritical ORC' ]:
161
+ self .surfaceplant = SurfacePlantSubcriticalOrc (self )
162
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['2' , 'Supercritical ORC' ]:
163
+ self .surfaceplant = SurfacePlantSupercriticalOrc (self )
164
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['3' , 'Single-Flash' ]:
165
+ self .surfaceplant = SurfacePlantSingleFlash (self )
166
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['4' , 'Double-Flash' ]:
167
+ self .surfaceplant = SurfacePlantDoubleFlash (self )
168
+ # Heat applications
169
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['5' , 'Absorption Chiller' ]:
170
+ self .surfaceplant = SurfacePlantAbsorptionChiller (self )
171
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['6' , 'Heat Pump' ]:
172
+ self .surfaceplant = SurfacePlantHeatPump (self )
173
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['7' , 'District Heating' ]:
174
+ self .surfaceplant = SurfacePlantDistrictHeating (self )
175
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['8' , 'Reservoir Thermal Energy Storage' ]:
176
+ self .surfaceplant = SurfacePlantSUTRA (self )
177
+ elif self .InputParameters ['Power Plant Type' ].sValue in ['9' , 'Industrial' ]:
178
+ self .surfaceplant = SurfacePlantIndustrialHeat (self )
137
179
138
180
# if we find out we have an add-ons, we need to instantiate it, then read for the parameters
139
181
if 'AddOn Nickname 1' in self .InputParameters :
@@ -150,6 +192,7 @@ def __init__(self, enable_geophires_logging_config=True, input_file=None):
150
192
151
193
self .logger .info (f'Complete { __class__ } : { __name__ } ' )
152
194
195
+
153
196
def __str__ (self ):
154
197
return "Model"
155
198
0 commit comments