foxes 1.1.0.2__py3-none-any.whl → 1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of foxes might be problematic. Click here for more details.
- docs/source/conf.py +3 -2
- examples/dyn_wakes/run.py +2 -2
- examples/timelines/run.py +1 -1
- foxes/__init__.py +13 -2
- foxes/algorithms/downwind/downwind.py +6 -1
- foxes/algorithms/downwind/models/init_farm_data.py +5 -2
- foxes/algorithms/downwind/models/point_wakes_calc.py +0 -1
- foxes/algorithms/iterative/iterative.py +1 -1
- foxes/algorithms/sequential/sequential.py +4 -3
- foxes/config/__init__.py +1 -0
- foxes/config/config.py +134 -0
- foxes/constants.py +15 -6
- foxes/core/algorithm.py +22 -10
- foxes/core/data.py +2 -1
- foxes/core/engine.py +40 -34
- foxes/core/farm_controller.py +4 -3
- foxes/core/farm_data_model.py +6 -2
- foxes/core/model.py +2 -1
- foxes/core/point_data_model.py +4 -2
- foxes/core/rotor_model.py +8 -4
- foxes/core/turbine_type.py +1 -1
- foxes/core/wake_frame.py +7 -5
- foxes/core/wake_model.py +6 -1
- foxes/data/__init__.py +1 -1
- foxes/data/static_data.py +0 -7
- foxes/engines/dask.py +4 -3
- foxes/engines/single.py +1 -1
- foxes/input/__init__.py +1 -1
- foxes/input/farm_layout/from_csv.py +3 -1
- foxes/input/farm_layout/from_file.py +10 -10
- foxes/input/farm_layout/from_json.py +4 -3
- foxes/input/farm_layout/grid.py +3 -3
- foxes/input/states/create/random_abl_states.py +5 -3
- foxes/input/states/field_data_nc.py +22 -14
- foxes/input/states/multi_height.py +26 -15
- foxes/input/states/one_point_flow.py +6 -5
- foxes/input/states/scan_ws.py +4 -1
- foxes/input/states/single.py +15 -6
- foxes/input/states/slice_data_nc.py +18 -12
- foxes/input/states/states_table.py +17 -10
- foxes/input/yaml/__init__.py +3 -0
- foxes/input/yaml/dict.py +210 -0
- foxes/input/yaml/windio/__init__.py +4 -0
- foxes/input/{windio → yaml/windio}/get_states.py +7 -7
- foxes/input/{windio → yaml/windio}/read_attributes.py +61 -40
- foxes/input/{windio → yaml/windio}/read_farm.py +34 -43
- foxes/input/{windio → yaml/windio}/read_fields.py +11 -10
- foxes/input/yaml/windio/read_outputs.py +147 -0
- foxes/input/yaml/windio/windio.py +269 -0
- foxes/input/yaml/yaml.py +103 -0
- foxes/models/partial_wakes/axiwake.py +7 -6
- foxes/models/partial_wakes/centre.py +3 -2
- foxes/models/partial_wakes/segregated.py +5 -2
- foxes/models/point_models/set_uniform_data.py +5 -3
- foxes/models/rotor_models/centre.py +2 -2
- foxes/models/rotor_models/grid.py +5 -5
- foxes/models/rotor_models/levels.py +6 -6
- foxes/models/turbine_models/kTI_model.py +3 -1
- foxes/models/turbine_models/lookup_table.py +7 -4
- foxes/models/turbine_models/power_mask.py +14 -8
- foxes/models/turbine_models/sector_management.py +4 -2
- foxes/models/turbine_models/set_farm_vars.py +53 -23
- foxes/models/turbine_models/table_factors.py +8 -7
- foxes/models/turbine_models/yaw2yawm.py +0 -1
- foxes/models/turbine_models/yawm2yaw.py +0 -1
- foxes/models/turbine_types/CpCt_file.py +6 -3
- foxes/models/turbine_types/CpCt_from_two.py +6 -3
- foxes/models/turbine_types/PCt_file.py +7 -6
- foxes/models/turbine_types/PCt_from_two.py +11 -2
- foxes/models/turbine_types/TBL_file.py +3 -4
- foxes/models/turbine_types/wsrho2PCt_from_two.py +19 -11
- foxes/models/turbine_types/wsti2PCt_from_two.py +19 -11
- foxes/models/vertical_profiles/abl_log_neutral_ws.py +1 -1
- foxes/models/vertical_profiles/abl_log_stable_ws.py +1 -1
- foxes/models/vertical_profiles/abl_log_unstable_ws.py +1 -1
- foxes/models/vertical_profiles/abl_log_ws.py +1 -1
- foxes/models/wake_frames/dynamic_wakes.py +17 -9
- foxes/models/wake_frames/farm_order.py +4 -3
- foxes/models/wake_frames/rotor_wd.py +3 -1
- foxes/models/wake_frames/seq_dynamic_wakes.py +14 -7
- foxes/models/wake_frames/streamlines.py +9 -6
- foxes/models/wake_frames/timelines.py +21 -14
- foxes/models/wake_frames/yawed_wakes.py +3 -1
- foxes/models/wake_models/induction/vortex_sheet.py +0 -1
- foxes/models/wake_models/ti/crespo_hernandez.py +2 -1
- foxes/models/wake_models/wind/bastankhah14.py +3 -2
- foxes/models/wake_models/wind/bastankhah16.py +2 -1
- foxes/models/wake_models/wind/turbopark.py +9 -7
- foxes/models/wake_superpositions/ws_product.py +0 -1
- foxes/output/calc_points.py +7 -4
- foxes/output/farm_layout.py +30 -18
- foxes/output/farm_results_eval.py +4 -3
- foxes/output/grids.py +8 -7
- foxes/output/output.py +7 -2
- foxes/output/results_writer.py +10 -11
- foxes/output/rose_plot.py +38 -20
- foxes/output/rotor_point_plots.py +7 -3
- foxes/output/slice_data.py +1 -1
- foxes/output/state_turbine_map.py +5 -1
- foxes/output/state_turbine_table.py +7 -3
- foxes/output/turbine_type_curves.py +7 -2
- foxes/utils/dict.py +107 -3
- foxes/utils/geopandas_utils.py +3 -2
- {foxes-1.1.0.2.dist-info → foxes-1.2.dist-info}/METADATA +20 -21
- {foxes-1.1.0.2.dist-info → foxes-1.2.dist-info}/RECORD +122 -122
- {foxes-1.1.0.2.dist-info → foxes-1.2.dist-info}/WHEEL +1 -1
- foxes-1.2.dist-info/entry_points.txt +3 -0
- tests/0_consistency/iterative/test_iterative.py +65 -67
- tests/0_consistency/partial_wakes/test_partial_wakes.py +58 -61
- tests/1_verification/flappy_0_6/PCt_files/test_PCt_files.py +56 -53
- tests/1_verification/flappy_0_6/abl_states/test_abl_states.py +41 -41
- tests/1_verification/flappy_0_6/partial_top_hat/test_partial_top_hat.py +34 -34
- tests/1_verification/flappy_0_6/row_Jensen_linear_centre/test_row_Jensen_linear_centre.py +50 -50
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/test_row_Jensen_linear_tophat.py +51 -52
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/test_row_Jensen_linear_tophat_IECTI_2005.py +73 -74
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/test_row_Jensen_linear_tophat_IECTI_2019.py +73 -74
- tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/test_row_Jensen_quadratic_centre.py +51 -49
- tests/1_verification/flappy_0_6_2/grid_rotors/test_grid_rotors.py +101 -103
- tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/test_row_Bastankhah_Crespo.py +61 -62
- tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py +51 -52
- examples/windio/run.py +0 -29
- foxes/data/states/windio_timeseries_5000.nc +0 -0
- foxes/data/windio/DTU_10MW_turbine.yaml +0 -10
- foxes/data/windio/__init__.py +0 -0
- foxes/data/windio/windio_5turbines_timeseries.yaml +0 -79
- foxes/input/windio/__init__.py +0 -11
- foxes/input/windio/read_outputs.py +0 -172
- foxes/input/windio/runner.py +0 -183
- foxes/input/windio/windio.py +0 -193
- {foxes-1.1.0.2.dist-info → foxes-1.2.dist-info}/LICENSE +0 -0
- {foxes-1.1.0.2.dist-info → foxes-1.2.dist-info}/top_level.txt +0 -0
|
@@ -3,13 +3,13 @@ import inspect
|
|
|
3
3
|
|
|
4
4
|
import foxes
|
|
5
5
|
import foxes.variables as FV
|
|
6
|
-
|
|
6
|
+
from foxes.config import config
|
|
7
7
|
|
|
8
8
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def test():
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
ttype = "DTU10MW"
|
|
14
14
|
sfile = "wind_rose_bremen.csv"
|
|
15
15
|
lfile = thisdir / "test_farm.csv"
|
|
@@ -20,72 +20,70 @@ def test():
|
|
|
20
20
|
]
|
|
21
21
|
lims = {FV.REWS: 5e-7, FV.P: 5e-4}
|
|
22
22
|
|
|
23
|
-
ck = {FC.STATE: c}
|
|
24
|
-
|
|
25
23
|
base_results = None
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
24
|
+
with foxes.Engine.new("process", chunk_size_states=1000):
|
|
25
|
+
for Algo, frame in cases:
|
|
26
|
+
print(f"\nENTERING CASE {(Algo.__name__, frame)}\n")
|
|
27
|
+
|
|
28
|
+
mbook = foxes.models.ModelBook()
|
|
29
|
+
|
|
30
|
+
states = foxes.input.states.StatesTable(
|
|
31
|
+
data_source=sfile,
|
|
32
|
+
output_vars=[FV.WS, FV.WD, FV.TI, FV.RHO],
|
|
33
|
+
var2col={FV.WS: "ws", FV.WD: "wd", FV.WEIGHT: "weight"},
|
|
34
|
+
fixed_vars={FV.RHO: 1.225, FV.TI: 0.05},
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
farm = foxes.WindFarm()
|
|
38
|
+
foxes.input.farm_layout.add_from_file(
|
|
39
|
+
farm, lfile, turbine_models=[ttype], verbosity=1
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
kwargs = {}
|
|
43
|
+
if Algo is foxes.algorithms.Iterative:
|
|
44
|
+
kwargs["mod_cutin"] = {"modify_ct": False, "modify_P": False}
|
|
45
|
+
|
|
46
|
+
algo = Algo(
|
|
47
|
+
farm,
|
|
48
|
+
states,
|
|
49
|
+
mbook=mbook,
|
|
50
|
+
rotor_model="grid16",
|
|
51
|
+
wake_models=["Bastankhah2014_linear_k004", "IECTI2019_max"],
|
|
52
|
+
wake_frame=frame,
|
|
53
|
+
partial_wakes="rotor_points",
|
|
54
|
+
verbosity=1,
|
|
55
|
+
**kwargs,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# f Algo is foxes.algorithms.Iterative:
|
|
59
|
+
# algo.set_urelax("post_rotor", CT=0.9)
|
|
60
|
+
|
|
61
|
+
data = algo.calc_farm()
|
|
62
|
+
|
|
63
|
+
df = data.to_dataframe()[
|
|
64
|
+
[FV.AMB_WD, FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
print()
|
|
68
|
+
print("TRESULTS\n")
|
|
69
|
+
print(df)
|
|
70
|
+
|
|
71
|
+
df = df.reset_index()
|
|
72
|
+
|
|
73
|
+
if base_results is None:
|
|
74
|
+
base_results = df
|
|
75
|
+
|
|
76
|
+
else:
|
|
77
|
+
print(f"CASE {(Algo.__name__, frame)}")
|
|
78
|
+
delta = df - base_results
|
|
79
|
+
print(delta)
|
|
80
|
+
print(delta.min(), delta.max())
|
|
81
|
+
|
|
82
|
+
for v, lim in lims.items():
|
|
83
|
+
chk = delta[v].abs().loc[df["AMB_REWS"] > 7]
|
|
84
|
+
print(f"CASE {(Algo.__name__, frame, v, lim)}:", chk.max())
|
|
85
|
+
|
|
86
|
+
assert (chk < lim).all()
|
|
89
87
|
|
|
90
88
|
|
|
91
89
|
if __name__ == "__main__":
|
|
@@ -3,13 +3,12 @@ import inspect
|
|
|
3
3
|
|
|
4
4
|
import foxes
|
|
5
5
|
import foxes.variables as FV
|
|
6
|
-
import foxes.constants as FC
|
|
7
6
|
|
|
8
7
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
def test():
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
tfile = thisdir / "NREL-5MW-D126-H90.csv"
|
|
14
13
|
sfile = thisdir / "states.csv.gz"
|
|
15
14
|
lfile = thisdir / "test_farm.csv"
|
|
@@ -24,66 +23,64 @@ def test():
|
|
|
24
23
|
("centre", "grid36", 0.025),
|
|
25
24
|
]
|
|
26
25
|
|
|
27
|
-
ck = {FC.STATE: c}
|
|
28
|
-
|
|
29
26
|
base_results = None
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
27
|
+
with foxes.Engine.new("process", chunk_size_states=100):
|
|
28
|
+
for rotor, pwake, lim in cases:
|
|
29
|
+
print(f"\nENTERING CASE {(rotor, pwake, lim)}\n")
|
|
30
|
+
|
|
31
|
+
mbook = foxes.models.ModelBook()
|
|
32
|
+
ttype = foxes.models.turbine_types.PCtFile(
|
|
33
|
+
data_source=tfile, var_ws_ct=FV.REWS, var_ws_P=FV.REWS
|
|
34
|
+
)
|
|
35
|
+
mbook.turbine_types[ttype.name] = ttype
|
|
36
|
+
|
|
37
|
+
states = foxes.input.states.StatesTable(
|
|
38
|
+
data_source=sfile,
|
|
39
|
+
output_vars=[FV.WS, FV.WD, FV.TI, FV.RHO],
|
|
40
|
+
var2col={FV.WS: "ws", FV.WD: "wd", FV.TI: "ti"},
|
|
41
|
+
fixed_vars={FV.RHO: 1.225},
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
farm = foxes.WindFarm()
|
|
45
|
+
foxes.input.farm_layout.add_from_file(
|
|
46
|
+
farm, lfile, turbine_models=[ttype.name], verbosity=1
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
algo = foxes.algorithms.Downwind(
|
|
50
|
+
farm,
|
|
51
|
+
states,
|
|
52
|
+
mbook=mbook,
|
|
53
|
+
rotor_model=rotor,
|
|
54
|
+
wake_models=["Bastankhah025_linear_k002"],
|
|
55
|
+
wake_frame="rotor_wd",
|
|
56
|
+
partial_wakes=pwake,
|
|
57
|
+
verbosity=1,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
data = algo.calc_farm()
|
|
61
|
+
|
|
62
|
+
df = data.to_dataframe()[
|
|
63
|
+
[FV.AMB_WD, FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
print()
|
|
67
|
+
print("TRESULTS\n")
|
|
68
|
+
print(df)
|
|
69
|
+
|
|
70
|
+
df = df.reset_index()
|
|
71
|
+
|
|
72
|
+
if base_results is None:
|
|
73
|
+
base_results = df
|
|
74
|
+
|
|
75
|
+
else:
|
|
76
|
+
print(f"CASE {(rotor, pwake, lim)}")
|
|
77
|
+
delta = df - base_results
|
|
78
|
+
print(delta)
|
|
79
|
+
print(delta.min(), delta.max())
|
|
80
|
+
chk = delta[FV.REWS].abs()
|
|
81
|
+
print(f"CASE {(rotor, pwake, lim)}:", chk.max())
|
|
82
|
+
|
|
83
|
+
assert (chk < lim).all()
|
|
87
84
|
|
|
88
85
|
|
|
89
86
|
if __name__ == "__main__":
|
|
@@ -4,7 +4,7 @@ import inspect
|
|
|
4
4
|
|
|
5
5
|
import foxes
|
|
6
6
|
import foxes.variables as FV
|
|
7
|
-
|
|
7
|
+
from foxes.config import config
|
|
8
8
|
|
|
9
9
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
10
10
|
|
|
@@ -12,15 +12,12 @@ thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
|
12
12
|
def test():
|
|
13
13
|
print(thisdir)
|
|
14
14
|
|
|
15
|
-
c = 2000
|
|
16
15
|
cfile = thisdir / "flappy" / "results.csv.gz"
|
|
17
16
|
tPfile = thisdir / "NREL-5MW-D126-H90-P.csv"
|
|
18
17
|
tCtfile = thisdir / "NREL-5MW-D126-H90-Ct.csv"
|
|
19
18
|
sfile = thisdir / "states.csv.gz"
|
|
20
19
|
lfile = thisdir / "test_farm.csv"
|
|
21
20
|
|
|
22
|
-
ck = {FC.STATE: c}
|
|
23
|
-
|
|
24
21
|
mbook = foxes.models.ModelBook()
|
|
25
22
|
ttype = foxes.models.turbine_types.PCtFromTwo(
|
|
26
23
|
data_source_P=tPfile,
|
|
@@ -48,55 +45,61 @@ def test():
|
|
|
48
45
|
farm, lfile, turbine_models=[ttype.name], verbosity=0
|
|
49
46
|
)
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
48
|
+
with foxes.Engine.new("threads", chunk_size_states=1000):
|
|
49
|
+
|
|
50
|
+
algo = foxes.algorithms.Downwind(
|
|
51
|
+
farm,
|
|
52
|
+
states,
|
|
53
|
+
mbook=mbook,
|
|
54
|
+
rotor_model="centre",
|
|
55
|
+
wake_models=["Jensen_linear_k007"],
|
|
56
|
+
wake_frame="rotor_wd",
|
|
57
|
+
partial_wakes={"Jensen_linear_k007": "top_hat"},
|
|
58
|
+
verbosity=0,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
data = algo.calc_farm()
|
|
62
|
+
|
|
63
|
+
df = data.to_dataframe()[
|
|
64
|
+
[FV.AMB_WD, FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]
|
|
65
|
+
]
|
|
66
|
+
df = df.reset_index()
|
|
67
|
+
|
|
68
|
+
print()
|
|
69
|
+
print("TRESULTS\n")
|
|
70
|
+
print(df)
|
|
71
|
+
|
|
72
|
+
# print("\Reading file", cfile)
|
|
73
|
+
fdata = pd.read_csv(cfile)
|
|
74
|
+
print(fdata)
|
|
75
|
+
|
|
76
|
+
print("\nVERIFYING\n")
|
|
77
|
+
df[FV.WS] = df["REWS"]
|
|
78
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
79
|
+
|
|
80
|
+
# neglecting ws < 5 and ws > 20
|
|
81
|
+
sel_ws = (
|
|
82
|
+
(fdata[FV.WS] > 5)
|
|
83
|
+
& (fdata[FV.WS] < 20)
|
|
84
|
+
& (df["REWS"] > 5)
|
|
85
|
+
& (df["REWS"] < 20)
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# calculating difference
|
|
89
|
+
delta = df.reset_index() - fdata
|
|
90
|
+
delta = delta[sel_ws]
|
|
91
|
+
print(delta)
|
|
92
|
+
print(delta.max())
|
|
93
|
+
chk = delta[[FV.AMB_WS, FV.AMB_P, FV.WS, FV.P]].abs()
|
|
94
|
+
sel = chk[FV.WS] >= 1e-5
|
|
95
|
+
print(sel)
|
|
96
|
+
print(df[sel & sel_ws])
|
|
97
|
+
print(fdata[sel & sel_ws])
|
|
98
|
+
print(chk.loc[sel & sel_ws])
|
|
99
|
+
print(chk.max())
|
|
100
|
+
|
|
101
|
+
assert ((chk[FV.WS] < 1e-5)).all()
|
|
102
|
+
assert (chk[FV.P] < 1e-3).all()
|
|
100
103
|
|
|
101
104
|
|
|
102
105
|
if __name__ == "__main__":
|
|
@@ -4,7 +4,6 @@ import inspect
|
|
|
4
4
|
|
|
5
5
|
import foxes
|
|
6
6
|
import foxes.variables as FV
|
|
7
|
-
import foxes.constants as FC
|
|
8
7
|
|
|
9
8
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
10
9
|
|
|
@@ -16,8 +15,6 @@ def test():
|
|
|
16
15
|
sfile = thisdir / "states.csv.gz"
|
|
17
16
|
lfile = thisdir / "test_farm.csv"
|
|
18
17
|
|
|
19
|
-
ck = {FC.STATE: c}
|
|
20
|
-
|
|
21
18
|
mbook = foxes.models.ModelBook()
|
|
22
19
|
ttype = foxes.models.turbine_types.PCtFile(
|
|
23
20
|
data_source=tfile, var_ws_ct=FV.REWS, var_ws_P=FV.REWS
|
|
@@ -43,44 +40,47 @@ def test():
|
|
|
43
40
|
verbosity=0,
|
|
44
41
|
)
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
43
|
+
with foxes.Engine.new("threads", chunk_size_states=c):
|
|
44
|
+
|
|
45
|
+
algo = foxes.algorithms.Downwind(
|
|
46
|
+
farm,
|
|
47
|
+
states,
|
|
48
|
+
mbook=mbook,
|
|
49
|
+
rotor_model="centre",
|
|
50
|
+
wake_models=["Jensen_linear_k007"],
|
|
51
|
+
wake_frame="rotor_wd",
|
|
52
|
+
partial_wakes={"Jensen_linear_k007": "centre"},
|
|
53
|
+
verbosity=0,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
data = algo.calc_farm()
|
|
57
|
+
|
|
58
|
+
df = data.to_dataframe()[
|
|
59
|
+
[FV.AMB_WD, FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
print()
|
|
63
|
+
print("TRESULTS\n")
|
|
64
|
+
print(df)
|
|
65
|
+
|
|
66
|
+
print("\nReading file", cfile)
|
|
67
|
+
fdata = pd.read_csv(cfile)
|
|
68
|
+
print(fdata)
|
|
69
|
+
|
|
70
|
+
print("\nVERIFYING\n")
|
|
71
|
+
df[FV.WS] = df["REWS"]
|
|
72
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
73
|
+
|
|
74
|
+
delta = df.reset_index() - fdata
|
|
75
|
+
print(delta)
|
|
76
|
+
print(delta.max())
|
|
77
|
+
chk = delta[[FV.AMB_WS, FV.AMB_P, FV.WS, FV.P]].abs()
|
|
78
|
+
print(chk.max())
|
|
79
|
+
|
|
80
|
+
assert (chk[FV.AMB_WS] < 1e-5).all()
|
|
81
|
+
assert (chk[FV.AMB_P] < 1e-3).all()
|
|
82
|
+
assert (chk[FV.WS] < 1e-5).all()
|
|
83
|
+
assert (chk[FV.P] < 1e-3).all()
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
if __name__ == "__main__":
|
|
@@ -4,7 +4,7 @@ import inspect
|
|
|
4
4
|
|
|
5
5
|
import foxes
|
|
6
6
|
import foxes.variables as FV
|
|
7
|
-
|
|
7
|
+
from foxes.config import config
|
|
8
8
|
|
|
9
9
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
10
10
|
|
|
@@ -12,14 +12,11 @@ thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
|
12
12
|
def test():
|
|
13
13
|
print(thisdir)
|
|
14
14
|
|
|
15
|
-
c = 2000
|
|
16
15
|
cfile = thisdir / "flappy" / "results.csv.gz"
|
|
17
16
|
tfile = thisdir / "NREL-5MW-D126-H90.csv"
|
|
18
17
|
sfile = thisdir / "states.csv.gz"
|
|
19
18
|
lfile = thisdir / "test_farm.csv"
|
|
20
19
|
|
|
21
|
-
ck = {FC.STATE: c}
|
|
22
|
-
|
|
23
20
|
mbook = foxes.models.ModelBook()
|
|
24
21
|
ttype = foxes.models.turbine_types.PCtFile(
|
|
25
22
|
data_source=tfile, var_ws_ct=FV.REWS, var_ws_P=FV.REWS
|
|
@@ -38,44 +35,47 @@ def test():
|
|
|
38
35
|
farm, lfile, turbine_models=[ttype.name], verbosity=0
|
|
39
36
|
)
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
with foxes.Engine.new("threads", chunk_size_states=1000):
|
|
39
|
+
|
|
40
|
+
algo = foxes.algorithms.Downwind(
|
|
41
|
+
farm,
|
|
42
|
+
states,
|
|
43
|
+
mbook=mbook,
|
|
44
|
+
rotor_model="centre",
|
|
45
|
+
wake_models=["Jensen_linear_k007"],
|
|
46
|
+
wake_frame="rotor_wd",
|
|
47
|
+
partial_wakes={"Jensen_linear_k007": "top_hat"},
|
|
48
|
+
verbosity=0,
|
|
49
|
+
)
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
data = algo.calc_farm()
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
df = data.to_dataframe()[
|
|
54
|
+
[FV.AMB_WD, FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]
|
|
55
|
+
]
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
print()
|
|
58
|
+
print("TRESULTS\n")
|
|
59
|
+
print(df)
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
print("\nReading file", cfile)
|
|
62
|
+
fdata = pd.read_csv(cfile)
|
|
63
|
+
print(fdata)
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
print("\nVERIFYING\n")
|
|
66
|
+
df[FV.WS] = df["REWS"]
|
|
67
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
delta = (df.reset_index() - fdata)[[FV.AMB_WS, FV.AMB_P, FV.WS, FV.P]]
|
|
70
|
+
print("\nDELTA\n", delta.describe())
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
chk = delta.abs().max()
|
|
73
|
+
print("\nCHK\n", chk)
|
|
74
|
+
print("CHK WS =", chk[FV.WS])
|
|
75
|
+
print("CHK P =", chk[FV.P])
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
assert chk[FV.WS] < 1e-5
|
|
78
|
+
assert chk[FV.P] < 1e-3
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
if __name__ == "__main__":
|