@@ -138,6 +138,37 @@ def test_hip_ra_monte_carlo(self):
138
138
self .assertLess (json_result ['Producible Electricity' ]['median' ], 1000 )
139
139
self .assertGreater (json_result ['Producible Electricity' ]['median' ], 20 )
140
140
141
+ def test_hip_ra_x_monte_carlo (self ):
142
+ client = GeophiresMonteCarloClient ()
143
+
144
+ result : MonteCarloResult = client .get_monte_carlo_result (
145
+ MonteCarloRequest (
146
+ SimulationProgram .HIP_RA_X ,
147
+ self ._get_arg_file_path ('HIP-RA-X_example1.txt' ),
148
+ self ._get_arg_file_path ('MC_HIP-RA-X_Settings_file.txt' ),
149
+ self ._get_arg_file_path ('MC_HIP-RA-X_Result.txt' ),
150
+ )
151
+ )
152
+ self .assertIsNotNone (result )
153
+ self .assertIsNotNone (result .output_file_path )
154
+
155
+ with open (result .output_file_path ) as f :
156
+ result_content = '\n ' .join (f .readlines ())
157
+ self .assertIn ('Electricity' , result_content )
158
+
159
+ with open (result .json_output_file_path ) as f :
160
+ json_result = json .loads (f .read ())
161
+ self .assertIn ('Producible Electricity (reservoir)' , json_result )
162
+
163
+ # Note: it is possible, though unlikely, for the test to incorrectly fail (i.e. a false negative)
164
+ # if the random values generated happen to give valid results that are outside this range.
165
+ # If you experience intermittent test failures from the below lines (that are unrelated to HIP-RA code
166
+ # changes), then it probably means the expected range or settings file need to be adjusted to 'guarantee'
167
+ # the results can be confidently asserted. (Such as in
168
+ # https://github.com/NREL/GEOPHIRES-X/pull/178/commits/ec4db42fca5a90715ceb5143e18315d5f3d782b7)
169
+ self .assertLess (json_result ['Producible Electricity (reservoir)' ]['median' ], 1000 )
170
+ self .assertGreater (json_result ['Producible Electricity (reservoir)' ]['median' ], 20 )
171
+
141
172
def _get_arg_file_path (self , arg_file ):
142
173
test_dir : Path = Path (os .path .abspath (__file__ )).parent
143
174
return Path (test_dir , arg_file ).absolute ()
0 commit comments