foxes 1.1.1__py3-none-any.whl → 1.2.1__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/abl_states/run.py +5 -5
- examples/dyn_wakes/run.py +2 -2
- examples/induction/run.py +5 -5
- examples/random_timeseries/run.py +13 -13
- examples/scan_row/run.py +12 -7
- examples/sector_management/run.py +11 -7
- examples/single_state/run.py +5 -5
- examples/tab_file/run.py +1 -1
- examples/timelines/run.py +1 -1
- examples/timeseries/run.py +5 -5
- examples/timeseries_slurm/run.py +5 -5
- examples/wind_rose/run.py +1 -1
- examples/yawed_wake/run.py +5 -5
- foxes/__init__.py +13 -2
- foxes/algorithms/downwind/downwind.py +21 -6
- 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 +5 -4
- foxes/config/__init__.py +1 -0
- foxes/config/config.py +134 -0
- foxes/constants.py +15 -6
- foxes/core/algorithm.py +46 -30
- foxes/core/axial_induction_model.py +18 -0
- foxes/core/data.py +2 -1
- foxes/core/engine.py +43 -49
- foxes/core/farm_controller.py +22 -3
- foxes/core/farm_data_model.py +6 -2
- foxes/core/ground_model.py +19 -0
- foxes/core/model.py +2 -1
- foxes/core/partial_wakes_model.py +9 -21
- foxes/core/point_data_model.py +22 -2
- foxes/core/rotor_model.py +9 -21
- foxes/core/states.py +2 -17
- foxes/core/turbine_model.py +2 -18
- foxes/core/turbine_type.py +2 -18
- foxes/core/vertical_profile.py +8 -20
- foxes/core/wake_frame.py +9 -25
- foxes/core/wake_model.py +24 -20
- foxes/core/wake_superposition.py +19 -0
- 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/__init__.py +1 -1
- foxes/input/states/create/random_abl_states.py +5 -3
- foxes/input/states/field_data_nc.py +36 -15
- foxes/input/states/multi_height.py +26 -15
- foxes/input/states/one_point_flow.py +6 -5
- foxes/input/states/{scan_ws.py → scan.py} +42 -52
- 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 +381 -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/__init__.py +2 -1
- foxes/output/calc_points.py +7 -4
- foxes/output/farm_layout.py +30 -18
- foxes/output/farm_results_eval.py +61 -38
- foxes/output/grids.py +8 -7
- foxes/output/output.py +9 -20
- foxes/output/plt.py +19 -0
- foxes/output/results_writer.py +10 -11
- foxes/output/rose_plot.py +448 -224
- 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/__init__.py +1 -2
- foxes/utils/dict.py +107 -3
- foxes/utils/geopandas_utils.py +3 -2
- foxes/utils/subclasses.py +69 -0
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/METADATA +18 -18
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/RECORD +145 -145
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/WHEEL +1 -1
- foxes-1.2.1.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 +57 -52
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/test_row_Jensen_linear_tophat.py +58 -54
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/test_row_Jensen_linear_tophat_IECTI_2005.py +80 -76
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/test_row_Jensen_linear_tophat_IECTI_2019.py +80 -76
- tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/test_row_Jensen_quadratic_centre.py +58 -51
- 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 +67 -64
- tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py +58 -54
- 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/utils/windrose_plot.py +0 -152
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/LICENSE +0 -0
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/top_level.txt +0 -0
|
@@ -5,7 +5,6 @@ import inspect
|
|
|
5
5
|
|
|
6
6
|
import foxes
|
|
7
7
|
import foxes.variables as FV
|
|
8
|
-
import foxes.constants as FC
|
|
9
8
|
|
|
10
9
|
thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
11
10
|
|
|
@@ -13,7 +12,6 @@ thisdir = Path(inspect.getfile(inspect.currentframe())).parent
|
|
|
13
12
|
def test():
|
|
14
13
|
n_s = 800
|
|
15
14
|
n_t = 76
|
|
16
|
-
c = 1000
|
|
17
15
|
p0 = np.array([0.0, 0.0])
|
|
18
16
|
stp = np.array([497.0, 0.0])
|
|
19
17
|
cfile = thisdir / "flappy" / "results.csv.gz"
|
|
@@ -25,8 +23,13 @@ def test():
|
|
|
25
23
|
)
|
|
26
24
|
mbook.turbine_types[ttype.name] = ttype
|
|
27
25
|
|
|
28
|
-
states = foxes.input.states.
|
|
29
|
-
|
|
26
|
+
states = foxes.input.states.ScanStates(
|
|
27
|
+
{
|
|
28
|
+
FV.WS: np.linspace(3.0, 30.0, n_s),
|
|
29
|
+
FV.WD: [270],
|
|
30
|
+
FV.TI: [0.08],
|
|
31
|
+
FV.RHO: [1.225],
|
|
32
|
+
}
|
|
30
33
|
)
|
|
31
34
|
|
|
32
35
|
farm = foxes.WindFarm()
|
|
@@ -39,54 +42,56 @@ def test():
|
|
|
39
42
|
verbosity=0,
|
|
40
43
|
)
|
|
41
44
|
|
|
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
|
-
|
|
45
|
+
with foxes.Engine.new("threads", chunk_size_states=1000):
|
|
46
|
+
|
|
47
|
+
algo = foxes.algorithms.Downwind(
|
|
48
|
+
farm,
|
|
49
|
+
states,
|
|
50
|
+
mbook=mbook,
|
|
51
|
+
rotor_model="centre",
|
|
52
|
+
wake_models=["Jensen_linear_k007"],
|
|
53
|
+
wake_frame="rotor_wd",
|
|
54
|
+
partial_wakes={"Jensen_linear_k007": "rotor_points"},
|
|
55
|
+
verbosity=0,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
data = algo.calc_farm()
|
|
59
|
+
|
|
60
|
+
df = data.to_dataframe()[[FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]]
|
|
61
|
+
|
|
62
|
+
print("\nReading file", cfile)
|
|
63
|
+
fdata = pd.read_csv(cfile).set_index(["state", "turbine"])
|
|
64
|
+
|
|
65
|
+
print()
|
|
66
|
+
print("TRESULTS\n")
|
|
67
|
+
sel = (df[FV.P] > 0) & (fdata[FV.P] > 0)
|
|
68
|
+
df = df.loc[sel]
|
|
69
|
+
fdata = fdata.loc[sel]
|
|
70
|
+
print(df.loc[sel])
|
|
71
|
+
print(fdata.loc[sel])
|
|
72
|
+
|
|
73
|
+
print("\nVERIFYING\n")
|
|
74
|
+
df[FV.WS] = df["REWS"]
|
|
75
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
76
|
+
|
|
77
|
+
delta = df - fdata
|
|
78
|
+
print(delta)
|
|
79
|
+
|
|
80
|
+
chk = delta.abs()
|
|
81
|
+
print(chk.max())
|
|
82
|
+
|
|
83
|
+
var = FV.WS
|
|
84
|
+
print(f"\nCHECKING {var}")
|
|
85
|
+
sel = chk[var] >= 1e-7
|
|
86
|
+
print(df.loc[sel])
|
|
87
|
+
print(fdata.loc[sel])
|
|
88
|
+
print(chk.loc[sel])
|
|
89
|
+
assert (chk[var] < 1e-7).all()
|
|
90
|
+
|
|
91
|
+
var = FV.P
|
|
92
|
+
sel = chk[var] >= 1e-5
|
|
93
|
+
print(f"\nCHECKING {var}\n", delta.loc[sel])
|
|
94
|
+
assert (chk[var] < 1e-5).all()
|
|
90
95
|
|
|
91
96
|
|
|
92
97
|
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
|
|
|
@@ -19,16 +19,19 @@ def test():
|
|
|
19
19
|
cfile = thisdir / "flappy" / "results.csv.gz"
|
|
20
20
|
tfile = thisdir / "NREL-5MW-D126-H90.csv"
|
|
21
21
|
|
|
22
|
-
ck = {FC.STATE: c}
|
|
23
|
-
|
|
24
22
|
mbook = foxes.models.ModelBook()
|
|
25
23
|
ttype = foxes.models.turbine_types.PCtFile(
|
|
26
24
|
data_source=tfile, var_ws_ct=FV.REWS, var_ws_P=FV.REWS
|
|
27
25
|
)
|
|
28
26
|
mbook.turbine_types[ttype.name] = ttype
|
|
29
27
|
|
|
30
|
-
states = foxes.input.states.
|
|
31
|
-
|
|
28
|
+
states = foxes.input.states.ScanStates(
|
|
29
|
+
{
|
|
30
|
+
FV.WS: np.linspace(3.0, 30.0, n_s),
|
|
31
|
+
FV.WD: [270],
|
|
32
|
+
FV.TI: [0.08],
|
|
33
|
+
FV.RHO: [1.225],
|
|
34
|
+
}
|
|
32
35
|
)
|
|
33
36
|
|
|
34
37
|
farm = foxes.WindFarm()
|
|
@@ -41,55 +44,56 @@ def test():
|
|
|
41
44
|
verbosity=0,
|
|
42
45
|
)
|
|
43
46
|
|
|
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
|
-
|
|
47
|
+
with foxes.Engine.new("threads", chunk_size_states=c):
|
|
48
|
+
|
|
49
|
+
algo = foxes.algorithms.Downwind(
|
|
50
|
+
farm,
|
|
51
|
+
states,
|
|
52
|
+
mbook=mbook,
|
|
53
|
+
rotor_model="centre",
|
|
54
|
+
wake_models=["Jensen_linear_k007"],
|
|
55
|
+
wake_frame="rotor_wd",
|
|
56
|
+
partial_wakes={"Jensen_linear_k007": "top_hat"},
|
|
57
|
+
verbosity=0,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
data = algo.calc_farm()
|
|
61
|
+
|
|
62
|
+
df = data.to_dataframe()[[FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]]
|
|
63
|
+
|
|
64
|
+
print("\nReading file", cfile)
|
|
65
|
+
fdata = pd.read_csv(cfile).set_index(["state", "turbine"])
|
|
66
|
+
|
|
67
|
+
print()
|
|
68
|
+
print("TRESULTS\n")
|
|
69
|
+
sel = (df[FV.P] > 0) & (fdata[FV.P] > 0)
|
|
70
|
+
df = df.loc[sel]
|
|
71
|
+
fdata = fdata.loc[sel]
|
|
72
|
+
print(df.loc[sel])
|
|
73
|
+
print(fdata.loc[sel])
|
|
74
|
+
|
|
75
|
+
print("\nVERIFYING\n")
|
|
76
|
+
df[FV.WS] = df["REWS"]
|
|
77
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
78
|
+
|
|
79
|
+
delta = df - fdata
|
|
80
|
+
print(delta)
|
|
81
|
+
|
|
82
|
+
chk = delta.abs()
|
|
83
|
+
print(chk.max())
|
|
84
|
+
|
|
85
|
+
var = FV.WS
|
|
86
|
+
print(f"\nCHECKING {var}")
|
|
87
|
+
sel = chk[var] >= 1e-7
|
|
88
|
+
print(df.loc[sel])
|
|
89
|
+
print(fdata.loc[sel])
|
|
90
|
+
print(chk.loc[sel])
|
|
91
|
+
assert (chk[var] < 1e-7).all()
|
|
92
|
+
|
|
93
|
+
var = FV.P
|
|
94
|
+
sel = chk[var] >= 1e-5
|
|
95
|
+
print(f"\nCHECKING {var}\n", delta.loc[sel])
|
|
96
|
+
assert (chk[var] < 1e-5).all()
|
|
93
97
|
|
|
94
98
|
|
|
95
99
|
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,16 +22,19 @@ 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
|
|
30
28
|
)
|
|
31
29
|
mbook.turbine_types[ttype.name] = ttype
|
|
32
30
|
|
|
33
|
-
states = foxes.input.states.
|
|
34
|
-
|
|
31
|
+
states = foxes.input.states.ScanStates(
|
|
32
|
+
{
|
|
33
|
+
FV.WS: np.linspace(6.0, 16.0, n_s),
|
|
34
|
+
FV.WD: [wd],
|
|
35
|
+
FV.TI: [ti],
|
|
36
|
+
FV.RHO: [1.225],
|
|
37
|
+
}
|
|
35
38
|
)
|
|
36
39
|
|
|
37
40
|
farm = foxes.WindFarm()
|
|
@@ -44,78 +47,79 @@ def test():
|
|
|
44
47
|
verbosity=1,
|
|
45
48
|
)
|
|
46
49
|
|
|
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
|
-
|
|
50
|
+
with foxes.Engine.new("threads", chunk_size_states=c):
|
|
51
|
+
|
|
52
|
+
algo = foxes.algorithms.Downwind(
|
|
53
|
+
farm,
|
|
54
|
+
states,
|
|
55
|
+
rotor_model=rotor,
|
|
56
|
+
mbook=mbook,
|
|
57
|
+
wake_models=["Jensen_linear_k007", "IECTI2005_max"],
|
|
58
|
+
wake_frame="rotor_wd",
|
|
59
|
+
partial_wakes=["top_hat", "top_hat"],
|
|
60
|
+
verbosity=1,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
data = algo.calc_farm()
|
|
64
|
+
|
|
65
|
+
df = data.to_dataframe()[
|
|
66
|
+
[
|
|
67
|
+
FV.X,
|
|
68
|
+
FV.Y,
|
|
69
|
+
FV.WD,
|
|
70
|
+
FV.AMB_REWS,
|
|
71
|
+
FV.REWS,
|
|
72
|
+
FV.AMB_TI,
|
|
73
|
+
FV.TI,
|
|
74
|
+
FV.AMB_CT,
|
|
75
|
+
FV.CT,
|
|
76
|
+
]
|
|
72
77
|
]
|
|
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
|
-
assert (chk[var] < 3e-5).all()
|
|
78
|
+
|
|
79
|
+
print("\nReading file", cfile)
|
|
80
|
+
fdata = pd.read_csv(cfile).set_index(["state", "turbine"])
|
|
81
|
+
|
|
82
|
+
print()
|
|
83
|
+
print("TRESULTS\n")
|
|
84
|
+
"""sel = (df[FV.P] > 0) & (fdata[FV.P] > 0)
|
|
85
|
+
df = df.loc[sel]
|
|
86
|
+
fdata = fdata.loc[sel]"""
|
|
87
|
+
print(df)
|
|
88
|
+
print(fdata)
|
|
89
|
+
|
|
90
|
+
print("\nVERIFYING\n")
|
|
91
|
+
df[FV.WS] = df["REWS"]
|
|
92
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
93
|
+
|
|
94
|
+
delta = df - fdata
|
|
95
|
+
print(delta)
|
|
96
|
+
|
|
97
|
+
chk = delta.abs()
|
|
98
|
+
print(chk.max())
|
|
99
|
+
|
|
100
|
+
var = FV.WS
|
|
101
|
+
print(f"\nCHECKING {var}")
|
|
102
|
+
sel = chk[var] >= 3e-3
|
|
103
|
+
print(df.loc[sel])
|
|
104
|
+
print(fdata.loc[sel])
|
|
105
|
+
print(chk.loc[sel])
|
|
106
|
+
assert (chk[var] < 3e-3).all()
|
|
107
|
+
|
|
108
|
+
var = FV.TI
|
|
109
|
+
print(f"\nCHECKING {var}")
|
|
110
|
+
sel = chk[var] >= 3e-4
|
|
111
|
+
print(df.loc[sel])
|
|
112
|
+
print(fdata.loc[sel])
|
|
113
|
+
print(chk.loc[sel])
|
|
114
|
+
assert (chk[var] < 3e-4).all()
|
|
115
|
+
|
|
116
|
+
var = FV.CT
|
|
117
|
+
print(f"\nCHECKING {var}")
|
|
118
|
+
sel = chk[var] >= 3e-5
|
|
119
|
+
print(df.loc[sel])
|
|
120
|
+
print(fdata.loc[sel])
|
|
121
|
+
print(chk.loc[sel])
|
|
122
|
+
assert (chk[var] < 3e-5).all()
|
|
119
123
|
|
|
120
124
|
|
|
121
125
|
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,16 +22,19 @@ 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
|
|
30
28
|
)
|
|
31
29
|
mbook.turbine_types[ttype.name] = ttype
|
|
32
30
|
|
|
33
|
-
states = foxes.input.states.
|
|
34
|
-
|
|
31
|
+
states = foxes.input.states.ScanStates(
|
|
32
|
+
{
|
|
33
|
+
FV.WS: np.linspace(6.0, 16.0, n_s),
|
|
34
|
+
FV.WD: [wd],
|
|
35
|
+
FV.TI: [ti],
|
|
36
|
+
FV.RHO: [1.225],
|
|
37
|
+
}
|
|
35
38
|
)
|
|
36
39
|
|
|
37
40
|
farm = foxes.WindFarm()
|
|
@@ -44,78 +47,79 @@ def test():
|
|
|
44
47
|
verbosity=1,
|
|
45
48
|
)
|
|
46
49
|
|
|
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
|
-
|
|
50
|
+
with foxes.Engine.new("threads", chunk_size_states=c):
|
|
51
|
+
|
|
52
|
+
algo = foxes.algorithms.Downwind(
|
|
53
|
+
farm,
|
|
54
|
+
states,
|
|
55
|
+
mbook=mbook,
|
|
56
|
+
rotor_model=rotor,
|
|
57
|
+
wake_models=["Jensen_linear_k007", "IECTI2019_max"],
|
|
58
|
+
wake_frame="rotor_wd",
|
|
59
|
+
partial_wakes=["top_hat", "top_hat"],
|
|
60
|
+
verbosity=1,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
data = algo.calc_farm()
|
|
64
|
+
|
|
65
|
+
df = data.to_dataframe()[
|
|
66
|
+
[
|
|
67
|
+
FV.X,
|
|
68
|
+
FV.Y,
|
|
69
|
+
FV.WD,
|
|
70
|
+
FV.AMB_REWS,
|
|
71
|
+
FV.REWS,
|
|
72
|
+
FV.AMB_TI,
|
|
73
|
+
FV.TI,
|
|
74
|
+
FV.AMB_CT,
|
|
75
|
+
FV.CT,
|
|
76
|
+
]
|
|
72
77
|
]
|
|
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
|
-
assert (chk[var] < 3e-5).all()
|
|
78
|
+
|
|
79
|
+
print("\nReading file", cfile)
|
|
80
|
+
fdata = pd.read_csv(cfile).set_index(["state", "turbine"])
|
|
81
|
+
|
|
82
|
+
print()
|
|
83
|
+
print("TRESULTS\n")
|
|
84
|
+
"""sel = (df[FV.P] > 0) & (fdata[FV.P] > 0)
|
|
85
|
+
df = df.loc[sel]
|
|
86
|
+
fdata = fdata.loc[sel]"""
|
|
87
|
+
print(df)
|
|
88
|
+
print(fdata)
|
|
89
|
+
|
|
90
|
+
print("\nVERIFYING\n")
|
|
91
|
+
df[FV.WS] = df["REWS"]
|
|
92
|
+
df[FV.AMB_WS] = df["AMB_REWS"]
|
|
93
|
+
|
|
94
|
+
delta = df - fdata
|
|
95
|
+
print(delta)
|
|
96
|
+
|
|
97
|
+
chk = delta.abs()
|
|
98
|
+
print(chk.max())
|
|
99
|
+
|
|
100
|
+
var = FV.WS
|
|
101
|
+
print(f"\nCHECKING {var}")
|
|
102
|
+
sel = chk[var] >= 3e-3
|
|
103
|
+
print(df.loc[sel])
|
|
104
|
+
print(fdata.loc[sel])
|
|
105
|
+
print(chk.loc[sel])
|
|
106
|
+
assert (chk[var] < 3e-3).all()
|
|
107
|
+
|
|
108
|
+
var = FV.TI
|
|
109
|
+
print(f"\nCHECKING {var}")
|
|
110
|
+
sel = chk[var] >= 3e-4
|
|
111
|
+
print(df.loc[sel])
|
|
112
|
+
print(fdata.loc[sel])
|
|
113
|
+
print(chk.loc[sel])
|
|
114
|
+
assert (chk[var] < 3e-4).all()
|
|
115
|
+
|
|
116
|
+
var = FV.CT
|
|
117
|
+
print(f"\nCHECKING {var}")
|
|
118
|
+
sel = chk[var] >= 3e-5
|
|
119
|
+
print(df.loc[sel])
|
|
120
|
+
print(fdata.loc[sel])
|
|
121
|
+
print(chk.loc[sel])
|
|
122
|
+
assert (chk[var] < 3e-5).all()
|
|
119
123
|
|
|
120
124
|
|
|
121
125
|
if __name__ == "__main__":
|