1
1
from __future__ import annotations
2
2
3
-
4
3
from base_test_case import BaseTestCase
5
4
6
5
# ruff: noqa: I001 # Successful module initialization is dependent on this specific import order.
16
15
class WellBoresTestCase (BaseTestCase ):
17
16
18
17
def test_number_of_doublets (self ):
19
- def _get_result (_params ) -> GeophiresXResult :
20
- params = GeophiresInputParameters (
21
- {
22
- 'Reservoir Depth' : 5 ,
23
- 'Gradient 1' : 74 ,
24
- 'Power Plant Type' : 2 ,
25
- 'Maximum Temperature' : 600 ,
26
- }
27
- | _params
28
- )
29
- return GeophiresXClient ().get_geophires_result (params )
30
-
31
- def _prod_inj_lcoe (_r : GeophiresXResult ) -> tuple [int , int ]:
32
- return (
33
- _r .result ['ENGINEERING PARAMETERS' ]['Number of Production Wells' ]['value' ],
34
- _r .result ['ENGINEERING PARAMETERS' ]['Number of Injection Wells' ]['value' ],
35
- _r .result ['SUMMARY OF RESULTS' ]['Electricity breakeven price' ]['value' ],
36
- _r .result ['SUMMARY OF RESULTS' ]['Electricity breakeven price' ]['value' ],
37
- _r .result ['SURFACE EQUIPMENT SIMULATION RESULTS' ]['Average Net Electricity Generation' ]['value' ],
38
- )
39
-
40
- r_prod_inj : GeophiresXResult = _get_result (
18
+ r_prod_inj : GeophiresXResult = self ._get_result (
41
19
{
42
20
'Number of Production Wells' : 10 ,
43
21
'Number of Injection Wells' : 10 ,
44
22
}
45
23
)
46
24
47
- r_doublets : GeophiresXResult = _get_result (
25
+ r_doublets : GeophiresXResult = self . _get_result (
48
26
{
49
27
'Number of Doublets' : 10 ,
50
28
}
51
29
)
52
30
53
- self .assertEqual (_prod_inj_lcoe (r_doublets ), _prod_inj_lcoe (r_prod_inj ))
31
+ self .assertEqual (self . _prod_inj_lcoe_production (r_doublets ), self . _prod_inj_lcoe_production (r_prod_inj ))
54
32
55
33
def test_number_of_doublets_validation (self ):
56
- def _get_result (_params ) -> GeophiresXResult :
57
- params = GeophiresInputParameters (
58
- {
59
- 'Reservoir Depth' : 5 ,
60
- 'Gradient 1' : 74 ,
61
- 'Power Plant Type' : 2 ,
62
- 'Maximum Temperature' : 600 ,
63
- }
64
- | _params
65
- )
66
- return GeophiresXClient ().get_geophires_result (params )
67
-
68
34
with self .assertRaises (RuntimeError ):
69
- _get_result (
35
+ self . _get_result (
70
36
{
71
37
'Number of Production Wells' : 10 ,
72
38
'Number of Injection Wells' : 10 ,
@@ -75,17 +41,67 @@ def _get_result(_params) -> GeophiresXResult:
75
41
)
76
42
77
43
with self .assertRaises (RuntimeError ):
78
- _get_result (
44
+ self . _get_result (
79
45
{
80
46
'Number of Production Wells' : 10 ,
81
47
'Number of Doublets' : 10 ,
82
48
}
83
49
)
84
50
85
51
with self .assertRaises (RuntimeError ):
86
- _get_result (
52
+ self . _get_result (
87
53
{
88
54
'Number of Injection Wells' : 10 ,
89
55
'Number of Doublets' : 10 ,
90
56
}
91
57
)
58
+
59
+ def test_number_of_doublets_non_integer (self ):
60
+ """
61
+ Non-integer values are relevant for MC simulations, since distributions produce floats, and we want
62
+ Number of Doublets to be compatible with MC.
63
+ """
64
+
65
+ prod_inj_lcoe = self ._prod_inj_lcoe_production (
66
+ self ._get_result (
67
+ {
68
+ 'Number of Doublets' : 40.7381 ,
69
+ }
70
+ )
71
+ )
72
+
73
+ self .assertEqual (prod_inj_lcoe [0 ], 40 )
74
+ self .assertEqual (prod_inj_lcoe [1 ], 40 )
75
+
76
+ prod_inj_lcoe_2 = self ._prod_inj_lcoe_production (
77
+ self ._get_result (
78
+ {
79
+ 'Number of Doublets' : 199.2 ,
80
+ }
81
+ )
82
+ )
83
+
84
+ self .assertEqual (prod_inj_lcoe_2 [0 ], 199 )
85
+ self .assertEqual (prod_inj_lcoe_2 [1 ], 199 )
86
+
87
+ # noinspection PyMethodMayBeStatic
88
+ def _get_result (self , _params ) -> GeophiresXResult :
89
+ params = GeophiresInputParameters (
90
+ {
91
+ 'Reservoir Depth' : 5 ,
92
+ 'Gradient 1' : 74 ,
93
+ 'Power Plant Type' : 2 ,
94
+ 'Maximum Temperature' : 600 ,
95
+ }
96
+ | _params
97
+ )
98
+ return GeophiresXClient ().get_geophires_result (params )
99
+
100
+ # noinspection PyMethodMayBeStatic
101
+ def _prod_inj_lcoe_production (self , _r : GeophiresXResult ) -> tuple [int , int , float , float ]:
102
+ return (
103
+ _r .result ['ENGINEERING PARAMETERS' ]['Number of Production Wells' ]['value' ],
104
+ _r .result ['ENGINEERING PARAMETERS' ]['Number of Injection Wells' ]['value' ],
105
+ _r .result ['SUMMARY OF RESULTS' ]['Electricity breakeven price' ]['value' ],
106
+ _r .result ['SURFACE EQUIPMENT SIMULATION RESULTS' ]['Average Net Electricity Generation' ]['value' ],
107
+ )
0 commit comments