Skip to content

Commit

Permalink
AGS/CLGS profile parsing workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
softwareengineerprogrammer committed Oct 10, 2023
1 parent 7817397 commit a085325
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/geophires_x_client/geophires_x_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,29 @@ def power_generation_profile(self):
return self.result['POWER GENERATION PROFILE']

def _get_power_generation_profile(self):
s1 = '* HEATING, COOLING AND/OR ELECTRICITY PRODUCTION PROFILE *'
s2 = '***************************************************************' # header of next profile
profile_lines = ''.join(self._lines).split(s1)[1].split(s2)[0].split('\n') # [5:]
profile_lines = None
try:
s1 = '* HEATING, COOLING AND/OR ELECTRICITY PRODUCTION PROFILE *'
s2 = '***************************************************************' # header of next profile
profile_lines = ''.join(self._lines).split(s1)[1].split(s2)[0].split('\n') # [5:]
except IndexError:
s1 = '* POWER GENERATION PROFILE *'
s2 = '***************************************************************' # header of next profile
profile_lines = ''.join(self._lines).split(s1)[1].split(s2)[0].split('\n') # [5:]
return self._get_data_from_profile_lines(profile_lines)

@property
def heat_electricity_extraction_generation_profile(self):
return self.result['HEAT AND/OR ELECTRICITY EXTRACTION AND GENERATION PROFILE']

def _get_heat_electricity_extraction_generation_profile(self):
s1 = '* ANNUAL HEATING, COOLING AND/OR ELECTRICITY PRODUCTION PROFILE *'
profile_lines = ''.join(self._lines).split(s1)[1].split('\n')
profile_lines = None
try:
s1 = '* ANNUAL HEATING, COOLING AND/OR ELECTRICITY PRODUCTION PROFILE *'
profile_lines = ''.join(self._lines).split(s1)[1].split('\n')
except IndexError:
s1 = '* HEAT AND/OR ELECTRICITY EXTRACTION AND GENERATION PROFILE *'
profile_lines = ''.join(self._lines).split(s1)[1].split('\n')
return self._get_data_from_profile_lines(profile_lines)

def _get_data_from_profile_lines(self, profile_lines):
Expand Down
133 changes: 133 additions & 0 deletions tests/geophires-result_example-5.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
*****************
***CASE REPORT***
*****************

Simulation Metadata
----------------------
GEOPHIRES Version: 3.0
GEOPHIRES Build Date: 2022-06-30
Simulation Date: 2023-09-28
Simulation Time: 17:14
Calculation Time: 7.460 sec


***AGS/CLGS STYLE OUTPUT***

### Configuration ###
End-Use: Electricity
Fluid: sCO2
Design: utube
Flow rate: 40.0 kg/sec
Lateral Length: 9000 meter
Vertical Depth: 3000 meter
Geothermal Gradient: 0.0600 degC/m
Wellbore Diameter: 8.5000 in
Injection Temperature: 60.0 degC
Thermal Conductivity: 3.00 watt/m/kelvin
### Reservoir Simulation Results ###
Average Production Temperature: 96.1 degC
Average Production Pressure: 234.2 bar
Average Heat Production: 3060.6 kW
First Year Heat Production: 33399.7 kWh
Average Net Electricity Production: 201.2 kW
First Year Electricity Production: 2410.5 kWh
### Cost Results ###
Total CAPEX: 15.9 MUSD
Drilling Cost: 15.0 MUSD
Surface Plant Cost: 0.9 MUSD
OPEX: 13.2 KUSD/yr
LCOE: 601.4 USD/MWh

******************************
* POWER GENERATION PROFILE *
******************************
YEAR THERMAL GEOFLUID PUMP NET FIRST LAW
DRAWDOWN TEMPERATURE POWER POWER EFFICIENCY
(degC) (MW) (MW) (%)
1 1.0000 108.39 0.0000 0.2930 9.5729
2 0.9536 108.39 0.0000 0.2930 9.5729
3 0.9332 105.79 0.0000 0.2729 8.9163
4 0.9222 104.35 0.0000 0.2620 8.5597
5 0.9148 103.36 0.0000 0.2550 8.3317
6 0.9093 102.62 0.0000 0.2497 8.1597
7 0.9048 102.04 0.0000 0.2453 8.0153
8 0.9012 101.56 0.0000 0.2416 7.8931
9 0.8981 101.15 0.0000 0.2384 7.7891
10 0.8954 100.80 0.0000 0.2356 7.6992
11 0.8930 100.49 0.0000 0.2332 7.6199
12 0.8909 100.21 0.0000 0.2310 7.5489
13 0.8890 99.96 0.0000 0.2291 7.4863
14 0.8872 99.74 0.0000 0.2276 7.4355
15 0.8856 99.53 0.0000 0.2261 7.3889
16 0.8842 99.34 0.0000 0.2248 7.3460
17 0.8828 99.16 0.0000 0.2236 7.3062
18 0.8815 98.99 0.0000 0.2225 7.2690
19 0.8803 98.84 0.0000 0.2214 7.2343
20 0.8792 98.69 0.0000 0.2204 7.2016
21 0.8781 98.56 0.0000 0.2195 7.1708
22 0.8771 98.43 0.0000 0.2186 7.1417
23 0.8762 98.31 0.0000 0.2177 7.1141
24 0.8753 98.19 0.0000 0.2169 7.0867
25 0.8744 98.08 0.0000 0.2161 7.0601
26 0.8736 97.97 0.0000 0.2153 7.0346
27 0.8728 97.87 0.0000 0.2146 7.0102
28 0.8721 97.78 0.0000 0.2138 6.9869
29 0.8713 97.68 0.0000 0.2132 6.9645
30 0.8707 97.59 0.0000 0.2125 6.9429
31 0.8700 97.51 0.0000 0.2119 6.9222
32 0.8693 97.43 0.0000 0.2112 6.9023
33 0.8687 97.35 0.0000 0.2107 6.8830
34 0.8681 97.27 0.0000 0.2101 6.8644
35 0.8675 97.20 0.0000 0.2095 6.8464
36 0.8670 97.12 0.0000 0.2090 6.8290
37 0.8664 97.05 0.0000 0.2085 6.8122
38 0.8659 96.99 0.0000 0.2080 6.7959
39 0.8654 96.92 0.0000 0.2075 6.7800
40 0.8649 96.86 0.0000 0.2070 6.7646

***************************************************************
* HEAT AND/OR ELECTRICITY EXTRACTION AND GENERATION PROFILE *
***************************************************************
YEAR ELECTRICITY HEAT RESERVOIR PERCENTAGE OF
PROVIDED EXTRACTED HEAT CONTENT TOTAL HEAT MINED
(GWh/year) (GWh/year) (10^15 J) (%)
1 2.6 30.1 3.68 2.86
2 2.6 27.8 3.58 5.49
3 2.4 26.8 3.49 8.04
4 2.3 26.2 3.39 10.53
5 2.2 25.8 3.30 12.98
6 2.2 25.5 3.21 15.40
7 2.1 25.2 3.12 17.80
8 2.1 25.0 3.03 20.18
9 2.1 24.8 2.94 22.53
10 2.1 24.7 2.85 24.88
11 2.0 24.5 2.76 27.20
12 2.0 24.4 2.67 29.52
13 2.0 24.3 2.58 31.82
14 2.0 24.2 2.50 34.12
15 2.0 24.1 2.41 36.40
16 2.0 24.0 2.32 38.68
17 2.0 23.9 2.24 40.95
18 1.9 23.8 2.15 43.21
19 1.9 23.7 2.07 45.46
20 1.9 23.7 1.98 47.70
21 1.9 23.6 1.90 49.94
22 1.9 23.5 1.81 52.18
23 1.9 23.5 1.73 54.40
24 1.9 23.4 1.64 56.63
25 1.9 23.3 1.56 58.84
26 1.9 23.3 1.48 61.05
27 1.9 23.2 1.39 63.26
28 1.9 23.2 1.31 65.46
29 1.9 23.1 1.23 67.66
30 1.9 23.1 1.14 69.85
31 1.9 23.1 1.06 72.04
32 1.9 23.0 0.98 74.23
33 1.8 23.0 0.89 76.41
34 1.8 22.9 0.81 78.58
35 1.8 22.9 0.73 80.76
36 1.8 22.9 0.65 82.93
37 1.8 22.8 0.57 85.09
38 1.8 22.8 0.48 87.26
39 1.8 22.8 0.40 89.42
40 1.8 22.7 0.32 91.57
32 changes: 32 additions & 0 deletions tests/test_geophires_x.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,38 @@ def test_geophires_x_result_generation_profiles(self):
assert result.heat_electricity_extraction_generation_profile[1] == [1, 93.2, 164.4, 1090.2, 80.03, 4.67]
assert result.heat_electricity_extraction_generation_profile[-1] == [35, 72.5, 134.2, 958.47, -48.48, 157.75]

def test_ags_clgs_result_generation_profiles(self):
test_result_path = self._get_test_file_path('geophires-result_example-5.out')
result = GeophiresXResult(test_result_path)

assert result.power_generation_profile is not None
assert len(result.power_generation_profile) == 41
self.assertListEqual(
result.power_generation_profile[0],
[
'YEAR',
'THERMAL DRAWDOWN',
'GEOFLUID TEMPERATURE (degC)',
'PUMP POWER (MW)',
'NET POWER (MW)',
'FIRST LAW EFFICIENCY (%)',
],
)
self.assertListEqual(result.power_generation_profile[1], [1, 1.0000, 108.39, 0.0000, 0.2930, 9.5729])
assert result.power_generation_profile[-1] == [40, 0.8649, 96.86, 0.0000, 0.2070, 6.7646]

assert result.heat_electricity_extraction_generation_profile is not None
assert len(result.heat_electricity_extraction_generation_profile) == 41
assert result.heat_electricity_extraction_generation_profile[0] == [
'YEAR',
'ELECTRICITY PROVIDED (GWh/year)',
'HEAT EXTRACTED (GWh/year)',
'RESERVOIR HEAT CONTENT (10^15 J)',
'PERCENTAGE OF TOTAL HEAT MINED (%)',
]
assert result.heat_electricity_extraction_generation_profile[1] == [1, 2.6, 30.1, 3.68, 2.86]
assert result.heat_electricity_extraction_generation_profile[-1] == [40, 1.8, 22.7, 0.32, 91.57]

def test_geophires_examples(self):
client = GeophiresXClient()
example_files = self._list_test_files_dir(test_files_dir='examples')
Expand Down

0 comments on commit a085325

Please sign in to comment.