foxes 1.1.1__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 -1
- 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.1.dist-info → foxes-1.2.dist-info}/METADATA +18 -17
- {foxes-1.1.1.dist-info → foxes-1.2.dist-info}/RECORD +122 -122
- {foxes-1.1.1.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.1.dist-info → foxes-1.2.dist-info}/LICENSE +0 -0
- {foxes-1.1.1.dist-info → foxes-1.2.dist-info}/top_level.txt +0 -0
tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/test_row_Jensen_quadratic_centre.py
CHANGED
|
@@ -5,7 +5,7 @@ import inspect
|
|
|
5
5
|
|
|
6
6
|
import foxes
|
|
7
7
|
import foxes.variables as FV
|
|
8
|
-
|
|
8
|
+
from foxes.config import config
|
|
9
9
|
|
|
10
10
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
11
11
|
|
|
@@ -39,54 +39,56 @@ def test():
|
|
|
39
39
|
verbosity=0,
|
|
40
40
|
)
|
|
41
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
|
-
|
|
89
|
-
|
|
42
|
+
with foxes.Engine.new("threads", chunk_size_states=c):
|
|
43
|
+
|
|
44
|
+
algo = foxes.algorithms.Downwind(
|
|
45
|
+
farm,
|
|
46
|
+
states,
|
|
47
|
+
mbook=mbook,
|
|
48
|
+
rotor_model="centre",
|
|
49
|
+
wake_models=["Jensen_quadratic_k007"],
|
|
50
|
+
wake_frame="rotor_wd",
|
|
51
|
+
partial_wakes={"Jensen_linear_k007": "centre"},
|
|
52
|
+
verbosity=0,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
data = algo.calc_farm()
|
|
56
|
+
|
|
57
|
+
df = data.to_dataframe()[[FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]]
|
|
58
|
+
|
|
59
|
+
print("\nReading file", cfile)
|
|
60
|
+
fdata = pd.read_csv(cfile).set_index(["state", "turbine"])
|
|
61
|
+
|
|
62
|
+
print()
|
|
63
|
+
print("TRESULTS\n")
|
|
64
|
+
sel = (df[FV.P] > 0) & (fdata[FV.P] > 0)
|
|
65
|
+
df = df.loc[sel]
|
|
66
|
+
fdata = fdata.loc[sel]
|
|
67
|
+
print(df.loc[sel])
|
|
68
|
+
print(fdata.loc[sel])
|
|
69
|
+
|
|
70
|
+
print("\nVERIFYING\n")
|
|
71
|
+
df[FV.WS] = df["REWS"]
|
|
72
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
73
|
+
|
|
74
|
+
delta = df - fdata
|
|
75
|
+
print(delta)
|
|
76
|
+
|
|
77
|
+
chk = delta.abs()
|
|
78
|
+
print(chk.max())
|
|
79
|
+
|
|
80
|
+
var = FV.WS
|
|
81
|
+
print(f"\nCHECKING {var}")
|
|
82
|
+
sel = chk[var] >= 1e-7
|
|
83
|
+
print(df.loc[sel])
|
|
84
|
+
print(fdata.loc[sel])
|
|
85
|
+
print(chk.loc[sel])
|
|
86
|
+
assert (chk[var] < 1e-7).all()
|
|
87
|
+
|
|
88
|
+
var = FV.P
|
|
89
|
+
sel = chk[var] >= 1e-5
|
|
90
|
+
print(f"\nCHECKING {var}\n", delta.loc[sel])
|
|
91
|
+
assert (chk[var] < 1e-5).all()
|
|
90
92
|
|
|
91
93
|
|
|
92
94
|
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
|
|
|
@@ -22,108 +22,106 @@ def test():
|
|
|
22
22
|
(["Basta"], "grid64", "grid64"),
|
|
23
23
|
]
|
|
24
24
|
|
|
25
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
print()
|
|
25
|
+
with foxes.Engine.new("threads", chunk_size_states=c):
|
|
26
|
+
for i, (wakes, rotor, pwake) in enumerate(cases):
|
|
27
|
+
print(f"\nENTERING CASE {(wakes, rotor, pwake)}\n")
|
|
28
|
+
|
|
29
|
+
mbook = foxes.models.ModelBook()
|
|
30
|
+
ttype = foxes.models.turbine_types.PCtFile(
|
|
31
|
+
data_source=tfile, var_ws_ct=FV.REWS, var_ws_P=FV.REWS
|
|
32
|
+
)
|
|
33
|
+
mbook.turbine_types[ttype.name] = ttype
|
|
34
|
+
|
|
35
|
+
mbook.wake_models["Basta"] = foxes.models.wake_models.wind.Bastankhah2014(
|
|
36
|
+
sbeta_factor=0.25, superposition="ws_linear", induction="Betz"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
states = foxes.input.states.StatesTable(
|
|
40
|
+
data_source=sfile,
|
|
41
|
+
output_vars=[FV.WS, FV.WD, FV.TI, FV.RHO],
|
|
42
|
+
var2col={FV.WS: "ws", FV.WD: "wd", FV.TI: "ti"},
|
|
43
|
+
fixed_vars={FV.RHO: 1.225, FV.Z0: 0.1, FV.H: 100.0},
|
|
44
|
+
profiles={FV.WS: "ABLLogNeutralWsProfile"},
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
farm = foxes.WindFarm()
|
|
48
|
+
foxes.input.farm_layout.add_from_file(
|
|
49
|
+
farm,
|
|
50
|
+
lfile,
|
|
51
|
+
turbine_models=["kTI_amb_02", ttype.name],
|
|
52
|
+
verbosity=1,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
algo = foxes.algorithms.Downwind(
|
|
56
|
+
farm,
|
|
57
|
+
states,
|
|
58
|
+
mbook=mbook,
|
|
59
|
+
rotor_model=rotor,
|
|
60
|
+
wake_models=wakes,
|
|
61
|
+
wake_frame="rotor_wd",
|
|
62
|
+
partial_wakes=pwake,
|
|
63
|
+
verbosity=1,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
data = algo.calc_farm()
|
|
67
|
+
|
|
68
|
+
df = data.to_dataframe()[
|
|
69
|
+
[FV.AMB_WD, FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
cfile = cpath / f"results_{i}.csv.gz"
|
|
73
|
+
print("\nReading file", cfile)
|
|
74
|
+
fdata = pd.read_csv(cfile).set_index(["state", "turbine"])
|
|
75
|
+
|
|
76
|
+
print()
|
|
77
|
+
print("TRESULTS\n")
|
|
78
|
+
print(df)
|
|
79
|
+
print(fdata)
|
|
80
|
+
|
|
81
|
+
print("\nVERIFYING\n")
|
|
82
|
+
df[FV.WS] = df["REWS"]
|
|
83
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
84
|
+
|
|
85
|
+
delta = df - fdata
|
|
86
|
+
print(delta)
|
|
87
|
+
chk = delta[[FV.AMB_WS, FV.AMB_P, FV.WS, FV.P]]
|
|
88
|
+
print(chk)
|
|
89
|
+
chk = chk.abs()
|
|
90
|
+
print(chk.max())
|
|
91
|
+
|
|
92
|
+
var = FV.AMB_WS
|
|
93
|
+
sel = chk[var] >= 1e-7
|
|
94
|
+
print(f"\nCHECKING {var}, {(wakes, rotor, pwake)}\n")
|
|
95
|
+
print(df.loc[sel])
|
|
96
|
+
print(fdata.loc[sel])
|
|
97
|
+
print(delta.loc[sel])
|
|
98
|
+
assert (chk[var] < 1e-7).all()
|
|
99
|
+
|
|
100
|
+
var = FV.AMB_P
|
|
101
|
+
sel = chk[var] >= 1e-5
|
|
102
|
+
print(f"\nCHECKING {var}, {(wakes, rotor, pwake)}\n")
|
|
103
|
+
print(df.loc[sel])
|
|
104
|
+
print(fdata.loc[sel])
|
|
105
|
+
print(delta.loc[sel])
|
|
106
|
+
assert (chk[var] < 1e-5).all()
|
|
107
|
+
|
|
108
|
+
var = FV.WS
|
|
109
|
+
sel = chk[var] >= 1.7e-3
|
|
110
|
+
print(f"\nCHECKING {var}, {(wakes, rotor, pwake)}\n")
|
|
111
|
+
print(df.loc[sel])
|
|
112
|
+
print(fdata.loc[sel])
|
|
113
|
+
print(delta.loc[sel])
|
|
114
|
+
assert (chk[var] < 1.7e-3).all()
|
|
115
|
+
|
|
116
|
+
var = FV.P
|
|
117
|
+
sel = chk[var] >= 1.51
|
|
118
|
+
print(f"\nCHECKING {var}, {(wakes, rotor, pwake)}\n")
|
|
119
|
+
print(df.loc[sel])
|
|
120
|
+
print(fdata.loc[sel])
|
|
121
|
+
print(delta.loc[sel])
|
|
122
|
+
assert (chk[var] < 1.51).all()
|
|
123
|
+
|
|
124
|
+
print()
|
|
127
125
|
|
|
128
126
|
|
|
129
127
|
if __name__ == "__main__":
|
|
@@ -5,7 +5,7 @@ import inspect
|
|
|
5
5
|
|
|
6
6
|
import foxes
|
|
7
7
|
import foxes.variables as FV
|
|
8
|
-
|
|
8
|
+
from foxes.config import config
|
|
9
9
|
|
|
10
10
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
11
11
|
|
|
@@ -22,8 +22,6 @@ def test():
|
|
|
22
22
|
cfile = thisdir / "flappy" / "results.csv.gz"
|
|
23
23
|
tfile = thisdir / "NREL-5MW-D126-H90.csv"
|
|
24
24
|
|
|
25
|
-
ck = {FC.STATE: c}
|
|
26
|
-
|
|
27
25
|
mbook = foxes.models.ModelBook()
|
|
28
26
|
ttype = foxes.models.turbine_types.PCtFile(
|
|
29
27
|
data_source=tfile, var_ws_ct=FV.REWS, var_ws_P=FV.REWS
|
|
@@ -51,65 +49,66 @@ def test():
|
|
|
51
49
|
verbosity=1,
|
|
52
50
|
)
|
|
53
51
|
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
52
|
+
with foxes.Engine.new("threads", chunk_size_states=c):
|
|
53
|
+
|
|
54
|
+
algo = foxes.algorithms.Downwind(
|
|
55
|
+
farm,
|
|
56
|
+
states,
|
|
57
|
+
mbook=mbook,
|
|
58
|
+
rotor_model=rotor,
|
|
59
|
+
wake_models=["Basta", "Crespo"],
|
|
60
|
+
wake_frame="rotor_wd",
|
|
61
|
+
partial_wakes=["axiwake6", "top_hat"],
|
|
62
|
+
verbosity=1,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
data = algo.calc_farm()
|
|
66
|
+
|
|
67
|
+
df = data.to_dataframe()[
|
|
68
|
+
[FV.X, FV.Y, FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_TI, FV.TI]
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
print()
|
|
72
|
+
print("TRESULTS\n")
|
|
73
|
+
print(df)
|
|
74
|
+
|
|
75
|
+
print("\nReading file", cfile)
|
|
76
|
+
fdata = pd.read_csv(cfile).set_index(["state", "turbine"])
|
|
77
|
+
|
|
78
|
+
print()
|
|
79
|
+
print("TRESULTS\n")
|
|
80
|
+
# sel = (df[FV.P]>0) & (fdata[FV.P]>0)
|
|
81
|
+
# df = df.loc[sel]
|
|
82
|
+
# fdata = fdata.loc[sel]
|
|
83
|
+
print(df)
|
|
84
|
+
print(fdata)
|
|
85
|
+
|
|
86
|
+
print("\nVERIFYING\n")
|
|
87
|
+
df[FV.WS] = df["REWS"]
|
|
88
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
89
|
+
|
|
90
|
+
delta = df - fdata
|
|
91
|
+
print(df)
|
|
92
|
+
print(delta[[FV.WS, FV.TI]])
|
|
93
|
+
|
|
94
|
+
chk = delta.abs()
|
|
95
|
+
print(chk.max())
|
|
96
|
+
|
|
97
|
+
var = FV.WS
|
|
98
|
+
print(f"\nCHECKING {var}")
|
|
99
|
+
sel = chk[var] >= 3e-3
|
|
100
|
+
print(df.loc[sel])
|
|
101
|
+
print(fdata.loc[sel])
|
|
102
|
+
print(chk.loc[sel])
|
|
103
|
+
assert (chk[var] < 3e-3).all()
|
|
104
|
+
|
|
105
|
+
var = FV.TI
|
|
106
|
+
print(f"\nCHECKING {var}")
|
|
107
|
+
sel = chk[var] >= 3e-4
|
|
108
|
+
print(df.loc[sel])
|
|
109
|
+
print(fdata.loc[sel])
|
|
110
|
+
print(chk.loc[sel])
|
|
111
|
+
assert (chk[var] < 3e-4).all()
|
|
113
112
|
|
|
114
113
|
|
|
115
114
|
if __name__ == "__main__":
|
tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py
CHANGED
|
@@ -5,7 +5,7 @@ import inspect
|
|
|
5
5
|
|
|
6
6
|
import foxes
|
|
7
7
|
import foxes.variables as FV
|
|
8
|
-
|
|
8
|
+
from foxes.config import config
|
|
9
9
|
|
|
10
10
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
11
11
|
|
|
@@ -22,8 +22,6 @@ def test():
|
|
|
22
22
|
cfile = thisdir / "flappy" / "results.csv.gz"
|
|
23
23
|
tfile = thisdir / "NREL-5MW-D126-H90.csv"
|
|
24
24
|
|
|
25
|
-
ck = {FC.STATE: c}
|
|
26
|
-
|
|
27
25
|
mbook = foxes.models.ModelBook()
|
|
28
26
|
ttype = foxes.models.turbine_types.PCtFile(
|
|
29
27
|
data_source=tfile, var_ws_ct=FV.REWS, var_ws_P=FV.REWS
|
|
@@ -48,52 +46,53 @@ def test():
|
|
|
48
46
|
verbosity=1,
|
|
49
47
|
)
|
|
50
48
|
|
|
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
|
-
|
|
49
|
+
with foxes.Engine.new("threads", chunk_size_states=c):
|
|
50
|
+
|
|
51
|
+
algo = foxes.algorithms.Downwind(
|
|
52
|
+
farm,
|
|
53
|
+
states,
|
|
54
|
+
mbook=mbook,
|
|
55
|
+
rotor_model=rotor,
|
|
56
|
+
wake_models=["Basta"],
|
|
57
|
+
wake_frame="rotor_wd",
|
|
58
|
+
partial_wakes="rotor_points",
|
|
59
|
+
verbosity=1,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
data = algo.calc_farm()
|
|
63
|
+
|
|
64
|
+
df = data.to_dataframe()[[FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]]
|
|
65
|
+
|
|
66
|
+
print("\nReading file", cfile)
|
|
67
|
+
fdata = pd.read_csv(cfile).set_index(["state", "turbine"])
|
|
68
|
+
|
|
69
|
+
print()
|
|
70
|
+
print("TRESULTS\n")
|
|
71
|
+
sel = (df[FV.P] > 0) & (fdata[FV.P] > 0)
|
|
72
|
+
df = df.loc[sel]
|
|
73
|
+
fdata = fdata.loc[sel]
|
|
74
|
+
print(df.loc[sel])
|
|
75
|
+
print(fdata.loc[sel])
|
|
76
|
+
|
|
77
|
+
print("\nVERIFYING\n")
|
|
78
|
+
df[FV.WS] = df["REWS"]
|
|
79
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
80
|
+
|
|
81
|
+
delta = df - fdata
|
|
82
|
+
print(delta)
|
|
83
|
+
|
|
84
|
+
chk = delta.abs()
|
|
85
|
+
print(chk.max())
|
|
86
|
+
|
|
87
|
+
var = FV.WS
|
|
88
|
+
print(f"\nCHECKING {var}")
|
|
89
|
+
sel = chk[var] >= 1e-7
|
|
90
|
+
print(df.loc[sel])
|
|
91
|
+
print(fdata.loc[sel])
|
|
92
|
+
print(chk.loc[sel])
|
|
93
|
+
assert (chk[var] < 1e-7).all()
|
|
94
|
+
|
|
95
|
+
var = FV.P
|
|
96
|
+
sel = chk[var] >= 1e-5
|
|
97
|
+
print(f"\nCHECKING {var}\n", delta.loc[sel])
|
|
98
|
+
assert (chk[var] < 1e-5).all()
|
examples/windio/run.py
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
|
|
3
|
-
import foxes
|
|
4
|
-
|
|
5
|
-
if __name__ == "__main__":
|
|
6
|
-
# define arguments and options:
|
|
7
|
-
parser = argparse.ArgumentParser()
|
|
8
|
-
parser.add_argument(
|
|
9
|
-
"-wio",
|
|
10
|
-
"--windio_yaml",
|
|
11
|
-
help="The windio wind energy systems yaml file",
|
|
12
|
-
default="windio_5turbines_timeseries.yaml",
|
|
13
|
-
)
|
|
14
|
-
parser.add_argument(
|
|
15
|
-
"-nf", "--nofig", help="Do not show figures", action="store_true"
|
|
16
|
-
)
|
|
17
|
-
parser.add_argument(
|
|
18
|
-
"-V", "--verbosity", help="The verbosity level, 0=silent", type=int, default=1
|
|
19
|
-
)
|
|
20
|
-
args = parser.parse_args()
|
|
21
|
-
|
|
22
|
-
try:
|
|
23
|
-
wio_runner = foxes.input.windio.read_windio(
|
|
24
|
-
args.windio_yaml, verbosity=args.verbosity
|
|
25
|
-
)
|
|
26
|
-
with wio_runner as runner:
|
|
27
|
-
runner.run()
|
|
28
|
-
except ModuleNotFoundError as e:
|
|
29
|
-
print(e.msg)
|
|
Binary file
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
name: DTU 10MW Offshore Reference Turbine
|
|
2
|
-
performance:
|
|
3
|
-
power_curve:
|
|
4
|
-
power_values: [263388., 751154., 1440738., 2355734., 3506858., 4993092., 6849310., 9116402., 10000754., 10009590., 10000942., 10042678., 10003480., 10001600., 10001506., 10013632., 10007428., 10005360., 10002728., 10001130., 10004984., 9997558.]
|
|
5
|
-
power_wind_speeds: [4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.]
|
|
6
|
-
Ct_curve:
|
|
7
|
-
Ct_values: [0.923,0.919,0.904,0.858,0.814,0.814,0.814,0.814,0.577,0.419,0.323,0.259,0.211,0.175,0.148,0.126,0.109,0.095,0.084,0.074,0.066,0.059]
|
|
8
|
-
Ct_wind_speeds: [4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.]
|
|
9
|
-
hub_height: 119.0
|
|
10
|
-
rotor_diameter: 178.3
|
foxes/data/windio/__init__.py
DELETED
|
File without changes
|