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
docs/source/conf.py
CHANGED
|
@@ -314,13 +314,15 @@ python_apigen_modules = {
|
|
|
314
314
|
"foxes.algorithms.iterative.models": "_foxes/algorithms/iterative/models/",
|
|
315
315
|
"foxes.algorithms.sequential": "_foxes/algorithms/sequential/",
|
|
316
316
|
"foxes.algorithms.sequential.models": "_foxes/algorithms/sequential/models/",
|
|
317
|
+
"foxes.config": "_foxes/config/",
|
|
317
318
|
"foxes.core": "_foxes/core/",
|
|
318
319
|
"foxes.data": "_foxes/data/",
|
|
319
320
|
"foxes.engines": "_foxes/engines/",
|
|
320
321
|
"foxes.input.farm_layout": "_foxes/input/farm_layout/",
|
|
321
322
|
"foxes.input.states": "_foxes/input/states/",
|
|
322
323
|
"foxes.input.states.create": "_foxes/input/states/create/",
|
|
323
|
-
"foxes.input.
|
|
324
|
+
"foxes.input.yaml": "_foxes/input/yaml/",
|
|
325
|
+
"foxes.input.yaml.windio": "_foxes/input/yaml/windio/",
|
|
324
326
|
"foxes.output": "_foxes/output/",
|
|
325
327
|
"foxes.output.flow_plots_2d": "_foxes/output/flow_plots_2d/",
|
|
326
328
|
"foxes.output.seq_plugins": "_foxes/output/seq_plugins/",
|
examples/abl_states/run.py
CHANGED
|
@@ -137,17 +137,17 @@ if __name__ == "__main__":
|
|
|
137
137
|
# results by turbine
|
|
138
138
|
turbine_results = o.reduce_states(
|
|
139
139
|
{
|
|
140
|
-
FV.AMB_P: "
|
|
141
|
-
FV.P: "
|
|
142
|
-
FV.AMB_CAP: "
|
|
143
|
-
FV.CAP: "
|
|
144
|
-
FV.EFF: "mean",
|
|
140
|
+
FV.AMB_P: "weights",
|
|
141
|
+
FV.P: "weights",
|
|
142
|
+
FV.AMB_CAP: "weights",
|
|
143
|
+
FV.CAP: "weights",
|
|
145
144
|
}
|
|
146
145
|
)
|
|
147
146
|
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
148
147
|
algo=algo, annual=True, ambient=True
|
|
149
148
|
)
|
|
150
149
|
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
150
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
151
151
|
print("\nResults by turbine:\n")
|
|
152
152
|
print(turbine_results)
|
|
153
153
|
|
examples/dyn_wakes/run.py
CHANGED
|
@@ -99,14 +99,14 @@ if __name__ == "__main__":
|
|
|
99
99
|
"-c",
|
|
100
100
|
"--chunksize_states",
|
|
101
101
|
help="The chunk size for states",
|
|
102
|
-
default=
|
|
102
|
+
default=20,
|
|
103
103
|
type=int,
|
|
104
104
|
)
|
|
105
105
|
parser.add_argument(
|
|
106
106
|
"-C",
|
|
107
107
|
"--chunksize_points",
|
|
108
108
|
help="The chunk size for points",
|
|
109
|
-
default=
|
|
109
|
+
default=None,
|
|
110
110
|
type=int,
|
|
111
111
|
)
|
|
112
112
|
parser.add_argument(
|
examples/induction/run.py
CHANGED
|
@@ -130,17 +130,17 @@ if __name__ == "__main__":
|
|
|
130
130
|
# results by turbine
|
|
131
131
|
turbine_results = o.reduce_states(
|
|
132
132
|
{
|
|
133
|
-
FV.AMB_P: "
|
|
134
|
-
FV.P: "
|
|
135
|
-
FV.AMB_CAP: "
|
|
136
|
-
FV.CAP: "
|
|
137
|
-
FV.EFF: "mean",
|
|
133
|
+
FV.AMB_P: "weights",
|
|
134
|
+
FV.P: "weights",
|
|
135
|
+
FV.AMB_CAP: "weights",
|
|
136
|
+
FV.CAP: "weights",
|
|
138
137
|
}
|
|
139
138
|
)
|
|
140
139
|
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
141
140
|
algo=algo, annual=True, ambient=True
|
|
142
141
|
)
|
|
143
142
|
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
143
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
144
144
|
print("\nResults by turbine:\n")
|
|
145
145
|
print(turbine_results)
|
|
146
146
|
|
|
@@ -101,21 +101,21 @@ if __name__ == "__main__":
|
|
|
101
101
|
):
|
|
102
102
|
|
|
103
103
|
if not args.nofig:
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
fig = plt.figure(figsize=(14.5, 7))
|
|
105
|
+
ax1 = fig.add_subplot(121)
|
|
106
|
+
ax2 = fig.add_subplot(122, polar=True)
|
|
107
|
+
foxes.output.FarmLayoutOutput(farm).get_figure(fig=fig, ax=ax1)
|
|
106
108
|
|
|
107
109
|
o = foxes.output.StatesRosePlotOutput(states, point=[0.0, 0.0, 100.0])
|
|
108
|
-
|
|
110
|
+
o.get_figure(
|
|
109
111
|
16,
|
|
110
112
|
FV.AMB_WS,
|
|
111
113
|
[0, 3.5, 6, 10, 15, 20],
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
fig=fig,
|
|
115
|
+
ax=ax2,
|
|
116
|
+
freq_delta=2,
|
|
114
117
|
)
|
|
115
118
|
|
|
116
|
-
ax = plt.Axes(fig, rect=[0.3, 0.1, 0.8, 0.8])
|
|
117
|
-
fig.add_axes(ax)
|
|
118
|
-
foxes.output.FarmLayoutOutput(farm).get_figure(fig=fig, ax=ax)
|
|
119
119
|
plt.show()
|
|
120
120
|
plt.close(fig)
|
|
121
121
|
|
|
@@ -187,17 +187,17 @@ if __name__ == "__main__":
|
|
|
187
187
|
# results by turbine
|
|
188
188
|
turbine_results = o.reduce_states(
|
|
189
189
|
{
|
|
190
|
-
FV.AMB_P: "
|
|
191
|
-
FV.P: "
|
|
192
|
-
FV.AMB_CAP: "
|
|
193
|
-
FV.CAP: "
|
|
194
|
-
FV.EFF: "mean",
|
|
190
|
+
FV.AMB_P: "weights",
|
|
191
|
+
FV.P: "weights",
|
|
192
|
+
FV.AMB_CAP: "weights",
|
|
193
|
+
FV.CAP: "weights",
|
|
195
194
|
}
|
|
196
195
|
)
|
|
197
196
|
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
198
197
|
algo=algo, annual=True, ambient=True
|
|
199
198
|
)
|
|
200
199
|
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
200
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
201
201
|
print("\nResults by turbine:\n")
|
|
202
202
|
print(turbine_results)
|
|
203
203
|
|
examples/scan_row/run.py
CHANGED
|
@@ -76,8 +76,13 @@ if __name__ == "__main__":
|
|
|
76
76
|
D = ttype.D
|
|
77
77
|
H = ttype.H
|
|
78
78
|
|
|
79
|
-
states = foxes.input.states.
|
|
80
|
-
|
|
79
|
+
states = foxes.input.states.ScanStates(
|
|
80
|
+
{
|
|
81
|
+
FV.WS: np.linspace(args.ws0, args.ws1, n_s),
|
|
82
|
+
FV.WD: [270],
|
|
83
|
+
FV.TI: [0.08],
|
|
84
|
+
FV.RHO: [1.225],
|
|
85
|
+
}
|
|
81
86
|
)
|
|
82
87
|
|
|
83
88
|
farm = foxes.WindFarm()
|
|
@@ -139,17 +144,17 @@ if __name__ == "__main__":
|
|
|
139
144
|
# results by turbine
|
|
140
145
|
turbine_results = o.reduce_states(
|
|
141
146
|
{
|
|
142
|
-
FV.AMB_P: "
|
|
143
|
-
FV.P: "
|
|
144
|
-
FV.AMB_CAP: "
|
|
145
|
-
FV.CAP: "
|
|
146
|
-
FV.EFF: "mean",
|
|
147
|
+
FV.AMB_P: "weights",
|
|
148
|
+
FV.P: "weights",
|
|
149
|
+
FV.AMB_CAP: "weights",
|
|
150
|
+
FV.CAP: "weights",
|
|
147
151
|
}
|
|
148
152
|
)
|
|
149
153
|
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
150
154
|
algo=algo, annual=True, ambient=True
|
|
151
155
|
)
|
|
152
156
|
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
157
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
153
158
|
print("\nResults by turbine:\n")
|
|
154
159
|
print(turbine_results)
|
|
155
160
|
|
|
@@ -138,25 +138,29 @@ if __name__ == "__main__":
|
|
|
138
138
|
print(fr)
|
|
139
139
|
|
|
140
140
|
if not args.nofig:
|
|
141
|
+
fig = plt.figure(figsize=(12, 4))
|
|
142
|
+
ax1 = fig.add_subplot(121, polar=True)
|
|
143
|
+
ax2 = fig.add_subplot(122, polar=True)
|
|
144
|
+
|
|
141
145
|
o = foxes.output.RosePlotOutput(farm_results)
|
|
142
|
-
|
|
146
|
+
o.get_figure(
|
|
143
147
|
16,
|
|
144
148
|
FV.P,
|
|
145
|
-
[100, 1000, 2000, 4000, 5001, 7000],
|
|
149
|
+
[0, 100, 1000, 2000, 4000, 5001, 7000],
|
|
146
150
|
turbine=0,
|
|
147
151
|
title="Power turbine 0",
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
fig=fig,
|
|
153
|
+
ax=ax1,
|
|
150
154
|
)
|
|
151
155
|
|
|
152
156
|
o = foxes.output.RosePlotOutput(farm_results)
|
|
153
|
-
|
|
157
|
+
o.get_figure(
|
|
154
158
|
16,
|
|
155
159
|
FV.P,
|
|
156
|
-
[100, 1000, 2000, 4000, 5001, 7000],
|
|
160
|
+
[0, 100, 1000, 2000, 4000, 5001, 7000],
|
|
157
161
|
turbine=1,
|
|
158
162
|
title="Power turbine 1",
|
|
159
163
|
fig=fig,
|
|
160
|
-
|
|
164
|
+
ax=ax2,
|
|
161
165
|
)
|
|
162
166
|
plt.show()
|
examples/single_state/run.py
CHANGED
|
@@ -155,17 +155,17 @@ if __name__ == "__main__":
|
|
|
155
155
|
# results by turbine
|
|
156
156
|
turbine_results = o.reduce_states(
|
|
157
157
|
{
|
|
158
|
-
FV.AMB_P: "
|
|
159
|
-
FV.P: "
|
|
160
|
-
FV.AMB_CAP: "
|
|
161
|
-
FV.CAP: "
|
|
162
|
-
FV.EFF: "mean",
|
|
158
|
+
FV.AMB_P: "weights",
|
|
159
|
+
FV.P: "weights",
|
|
160
|
+
FV.AMB_CAP: "weights",
|
|
161
|
+
FV.CAP: "weights",
|
|
163
162
|
}
|
|
164
163
|
)
|
|
165
164
|
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
166
165
|
algo=algo, annual=True, ambient=True
|
|
167
166
|
)
|
|
168
167
|
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
168
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
169
169
|
print("\nResults by turbine:\n")
|
|
170
170
|
print(turbine_results)
|
|
171
171
|
|
examples/tab_file/run.py
CHANGED
|
@@ -89,7 +89,7 @@ if __name__ == "__main__":
|
|
|
89
89
|
):
|
|
90
90
|
if not args.nofig:
|
|
91
91
|
o = foxes.output.StatesRosePlotOutput(states, point=[0.0, 0.0, 100.0])
|
|
92
|
-
|
|
92
|
+
o.get_figure(12, FV.AMB_WS, [0, 3.5, 6, 10, 15, 20])
|
|
93
93
|
plt.show()
|
|
94
94
|
|
|
95
95
|
farm = foxes.WindFarm()
|
examples/timelines/run.py
CHANGED
examples/timeseries/run.py
CHANGED
|
@@ -160,17 +160,17 @@ if __name__ == "__main__":
|
|
|
160
160
|
# results by turbine
|
|
161
161
|
turbine_results = o.reduce_states(
|
|
162
162
|
{
|
|
163
|
-
FV.AMB_P: "
|
|
164
|
-
FV.P: "
|
|
165
|
-
FV.AMB_CAP: "
|
|
166
|
-
FV.CAP: "
|
|
167
|
-
FV.EFF: "mean",
|
|
163
|
+
FV.AMB_P: "weights",
|
|
164
|
+
FV.P: "weights",
|
|
165
|
+
FV.AMB_CAP: "weights",
|
|
166
|
+
FV.CAP: "weights",
|
|
168
167
|
}
|
|
169
168
|
)
|
|
170
169
|
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
171
170
|
algo=algo, annual=True, ambient=True
|
|
172
171
|
)
|
|
173
172
|
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
173
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
174
174
|
print("\nResults by turbine:\n")
|
|
175
175
|
print(turbine_results)
|
|
176
176
|
|
examples/timeseries_slurm/run.py
CHANGED
|
@@ -162,17 +162,17 @@ if __name__ == "__main__":
|
|
|
162
162
|
# results by turbine
|
|
163
163
|
turbine_results = o.reduce_states(
|
|
164
164
|
{
|
|
165
|
-
FV.AMB_P: "
|
|
166
|
-
FV.P: "
|
|
167
|
-
FV.AMB_CAP: "
|
|
168
|
-
FV.CAP: "
|
|
169
|
-
FV.EFF: "mean",
|
|
165
|
+
FV.AMB_P: "weights",
|
|
166
|
+
FV.P: "weights",
|
|
167
|
+
FV.AMB_CAP: "weights",
|
|
168
|
+
FV.CAP: "weights",
|
|
170
169
|
}
|
|
171
170
|
)
|
|
172
171
|
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
173
172
|
algo=algo, annual=True, ambient=True
|
|
174
173
|
)
|
|
175
174
|
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
175
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
176
176
|
print("\nResults by turbine:\n")
|
|
177
177
|
print(turbine_results)
|
|
178
178
|
|
examples/wind_rose/run.py
CHANGED
|
@@ -113,7 +113,7 @@ if __name__ == "__main__":
|
|
|
113
113
|
|
|
114
114
|
if not args.nofig:
|
|
115
115
|
o = foxes.output.StatesRosePlotOutput(states, point=[0.0, 0.0, 100.0])
|
|
116
|
-
|
|
116
|
+
o.get_figure(16, FV.AMB_WS, [0, 3.5, 6, 10, 15, 20], add_inf=True)
|
|
117
117
|
plt.show()
|
|
118
118
|
|
|
119
119
|
time0 = time.time()
|
examples/yawed_wake/run.py
CHANGED
|
@@ -173,17 +173,17 @@ if __name__ == "__main__":
|
|
|
173
173
|
# results by turbine
|
|
174
174
|
turbine_results = o.reduce_states(
|
|
175
175
|
{
|
|
176
|
-
FV.AMB_P: "
|
|
177
|
-
FV.P: "
|
|
178
|
-
FV.AMB_CAP: "
|
|
179
|
-
FV.CAP: "
|
|
180
|
-
FV.EFF: "mean",
|
|
176
|
+
FV.AMB_P: "weights",
|
|
177
|
+
FV.P: "weights",
|
|
178
|
+
FV.AMB_CAP: "weights",
|
|
179
|
+
FV.CAP: "weights",
|
|
181
180
|
}
|
|
182
181
|
)
|
|
183
182
|
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
184
183
|
algo=algo, annual=True, ambient=True
|
|
185
184
|
)
|
|
186
185
|
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
186
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
187
187
|
print("\nResults by turbine:\n")
|
|
188
188
|
print(turbine_results)
|
|
189
189
|
|
foxes/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@ Farm Optimization and eXtended yield Evaluation Software
|
|
|
3
3
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
+
from .config import config, get_path # noqa: F401
|
|
6
7
|
from .core import Engine, WindFarm, Turbine, get_engine, reset_engine # noqa: F401
|
|
7
8
|
from .models import ModelBook # noqa: F401
|
|
8
9
|
from .data import (
|
|
@@ -21,6 +22,16 @@ from . import input # noqa: F401
|
|
|
21
22
|
from . import output # noqa: F401
|
|
22
23
|
from . import utils # noqa: F401
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
import importlib
|
|
26
|
+
from pathlib import Path
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
try:
|
|
29
|
+
tomllib = importlib.import_module("tomllib")
|
|
30
|
+
source_location = Path(__file__).parent
|
|
31
|
+
if (source_location.parent / "pyproject.toml").exists():
|
|
32
|
+
with open(source_location.parent / "pyproject.toml", "rb") as f:
|
|
33
|
+
__version__ = tomllib.load(f)["project"]["version"]
|
|
34
|
+
else:
|
|
35
|
+
__version__ = importlib.metadata.version(__package__ or __name__)
|
|
36
|
+
except ModuleNotFoundError:
|
|
37
|
+
__version__ = importlib.metadata.version(__package__ or __name__)
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
1
3
|
from foxes.core import Algorithm, FarmDataModelList, get_engine
|
|
2
4
|
from foxes.core import PointDataModel, PointDataModelList, FarmController
|
|
5
|
+
from foxes.config import config
|
|
3
6
|
import foxes.models as fm
|
|
4
7
|
import foxes.variables as FV
|
|
5
8
|
import foxes.constants as FC
|
|
9
|
+
|
|
6
10
|
from . import models as mdls
|
|
7
11
|
|
|
8
12
|
|
|
@@ -307,14 +311,24 @@ class Downwind(Algorithm):
|
|
|
307
311
|
"""
|
|
308
312
|
return getattr(mdls, name)
|
|
309
313
|
|
|
310
|
-
def
|
|
314
|
+
def print_deco(self, func_name=None, n_points=None):
|
|
311
315
|
"""
|
|
312
316
|
Helper function for printing model names
|
|
317
|
+
|
|
318
|
+
Parameters
|
|
319
|
+
----------
|
|
320
|
+
func_name: str, optional
|
|
321
|
+
Name of the calling function
|
|
322
|
+
n_points: int, optional
|
|
323
|
+
The number of points
|
|
324
|
+
|
|
313
325
|
"""
|
|
314
326
|
if self.verbosity > 0:
|
|
315
|
-
deco = "-" *
|
|
327
|
+
deco = "-" * 60
|
|
316
328
|
print(f"\n{deco}")
|
|
317
|
-
print(f"
|
|
329
|
+
print(f" Algorithm: {type(self).__name__}")
|
|
330
|
+
if func_name is not None:
|
|
331
|
+
print(f" Running {self.name}: {func_name}")
|
|
318
332
|
print(deco)
|
|
319
333
|
print(f" n_states : {self.n_states}")
|
|
320
334
|
print(f" n_turbines: {self.n_turbines}")
|
|
@@ -534,7 +548,7 @@ class Downwind(Algorithm):
|
|
|
534
548
|
self.initialize()
|
|
535
549
|
|
|
536
550
|
# welcome:
|
|
537
|
-
self.
|
|
551
|
+
self.print_deco("calc_farm")
|
|
538
552
|
|
|
539
553
|
# collect models:
|
|
540
554
|
if outputs == "default":
|
|
@@ -570,7 +584,7 @@ class Downwind(Algorithm):
|
|
|
570
584
|
farm_results[FC.TNAME] = ((FC.TURBINE,), self.farm.turbine_names)
|
|
571
585
|
for v in [FV.ORDER, FV.ORDER_SSEL, FV.ORDER_INV]:
|
|
572
586
|
if v in farm_results:
|
|
573
|
-
farm_results[v] = farm_results[v].astype(
|
|
587
|
+
farm_results[v] = farm_results[v].astype(config.dtype_int)
|
|
574
588
|
del model_data
|
|
575
589
|
|
|
576
590
|
# finalize models:
|
|
@@ -742,7 +756,8 @@ class Downwind(Algorithm):
|
|
|
742
756
|
)
|
|
743
757
|
|
|
744
758
|
# welcome:
|
|
745
|
-
|
|
759
|
+
points = np.asarray(points)
|
|
760
|
+
self.print_deco("calc_points", n_points=points.shape[1])
|
|
746
761
|
|
|
747
762
|
# collect models and initialize:
|
|
748
763
|
mlist, calc_pars = self._collect_point_models(
|
|
@@ -3,6 +3,7 @@ import numpy as np
|
|
|
3
3
|
from foxes.core import FarmDataModel, TData
|
|
4
4
|
import foxes.variables as FV
|
|
5
5
|
import foxes.constants as FC
|
|
6
|
+
from foxes.config import config
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class InitFarmData(FarmDataModel):
|
|
@@ -75,14 +76,16 @@ class InitFarmData(FarmDataModel):
|
|
|
75
76
|
n_turbines = algo.n_turbines
|
|
76
77
|
|
|
77
78
|
# define FV.TXYH as vector [X, Y, H]:
|
|
78
|
-
fdata[FV.TXYH] = np.full(
|
|
79
|
+
fdata[FV.TXYH] = np.full(
|
|
80
|
+
(n_states, n_turbines, 3), np.nan, dtype=config.dtype_double
|
|
81
|
+
)
|
|
79
82
|
fdata.dims[FV.TXYH] = (FC.STATE, FC.TURBINE, FC.XYH)
|
|
80
83
|
for i, v in enumerate([FV.X, FV.Y, FV.H]):
|
|
81
84
|
fdata[v] = fdata[FV.TXYH][..., i]
|
|
82
85
|
fdata.dims[v] = (FC.STATE, FC.TURBINE)
|
|
83
86
|
|
|
84
87
|
# set X, Y, H, D:
|
|
85
|
-
fdata[FV.D] = np.zeros((n_states, n_turbines), dtype=
|
|
88
|
+
fdata[FV.D] = np.zeros((n_states, n_turbines), dtype=config.dtype_double)
|
|
86
89
|
for ti, t in enumerate(algo.farm.turbines):
|
|
87
90
|
|
|
88
91
|
if len(t.xy.shape) == 1:
|
|
@@ -2,9 +2,10 @@ import numpy as np
|
|
|
2
2
|
from xarray import Dataset
|
|
3
3
|
|
|
4
4
|
from foxes.algorithms import Iterative
|
|
5
|
-
|
|
6
|
-
import foxes.variables as FV
|
|
5
|
+
from foxes.config import config
|
|
7
6
|
from foxes.core import get_engine
|
|
7
|
+
import foxes.variables as FV
|
|
8
|
+
import foxes.constants as FC
|
|
8
9
|
|
|
9
10
|
from . import models as mdls
|
|
10
11
|
|
|
@@ -135,7 +136,7 @@ class Sequential(Iterative):
|
|
|
135
136
|
if not self.iterating:
|
|
136
137
|
if not self.initialized:
|
|
137
138
|
self.initialize()
|
|
138
|
-
self.
|
|
139
|
+
self.print_deco("calc_farm")
|
|
139
140
|
|
|
140
141
|
self._inds = self.states0.index()
|
|
141
142
|
self._weights = self.states0.weights(self)
|
|
@@ -170,7 +171,7 @@ class Sequential(Iterative):
|
|
|
170
171
|
self._farm_results[FC.TNAME] = ((FC.TURBINE,), self.farm.turbine_names)
|
|
171
172
|
if FV.ORDER in self._farm_results:
|
|
172
173
|
self._farm_results[FV.ORDER] = self._farm_results[FV.ORDER].astype(
|
|
173
|
-
|
|
174
|
+
config.dtype_int
|
|
174
175
|
)
|
|
175
176
|
self._farm_results_dwnd = self._farm_results.copy(deep=True)
|
|
176
177
|
|
foxes/config/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .config import Config, config, get_path, get_output_path
|
foxes/config/config.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from foxes.utils.dict import Dict
|
|
5
|
+
import foxes.constants as FC
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Config(Dict):
|
|
9
|
+
"""
|
|
10
|
+
Container for configurational data
|
|
11
|
+
|
|
12
|
+
:group: foxes.config
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self):
|
|
16
|
+
"""Constructor"""
|
|
17
|
+
super().__init__(
|
|
18
|
+
{
|
|
19
|
+
FC.DTYPE: np.float64,
|
|
20
|
+
FC.ITYPE: np.int64,
|
|
21
|
+
FC.WORK_DIR: Path("."),
|
|
22
|
+
FC.OUT_DIR: Path("."),
|
|
23
|
+
},
|
|
24
|
+
name="config",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def dtype_double(self):
|
|
29
|
+
"""
|
|
30
|
+
The default double data type
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
dtp: type
|
|
35
|
+
The default double data type
|
|
36
|
+
|
|
37
|
+
"""
|
|
38
|
+
return self.get_item(FC.DTYPE)
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def dtype_int(self):
|
|
42
|
+
"""
|
|
43
|
+
The default int data type
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
dtp: type
|
|
48
|
+
The default integer data type
|
|
49
|
+
|
|
50
|
+
"""
|
|
51
|
+
return self.get_item(FC.ITYPE)
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def work_dir(self):
|
|
55
|
+
"""
|
|
56
|
+
The foxes working directory
|
|
57
|
+
|
|
58
|
+
Returns
|
|
59
|
+
-------
|
|
60
|
+
pth: pathlib.Path
|
|
61
|
+
Path to the foxes working directory
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
pth = self.get_item(FC.WORK_DIR)
|
|
65
|
+
if not isinstance(pth, Path):
|
|
66
|
+
self[FC.WORK_DIR] = Path(pth)
|
|
67
|
+
return self[FC.WORK_DIR]
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def out_dir(self):
|
|
71
|
+
"""
|
|
72
|
+
The default output directory
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
pth: pathlib.Path
|
|
77
|
+
Path to the default output directory
|
|
78
|
+
|
|
79
|
+
"""
|
|
80
|
+
return get_path(self.get_item(FC.OUT_DIR))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
config = Config()
|
|
84
|
+
"""Foxes configurational data object
|
|
85
|
+
:group: foxes.config
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def get_path(pth):
|
|
90
|
+
"""
|
|
91
|
+
Gets path object, respecting the configurations
|
|
92
|
+
work directory
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
pth: str or pathlib.Path
|
|
97
|
+
The path, optionally relative
|
|
98
|
+
|
|
99
|
+
Returns
|
|
100
|
+
-------
|
|
101
|
+
out: pathlib.Path
|
|
102
|
+
The path, absolute or relative to working directory
|
|
103
|
+
from config
|
|
104
|
+
|
|
105
|
+
:group: foxes.config
|
|
106
|
+
|
|
107
|
+
"""
|
|
108
|
+
if not isinstance(pth, Path):
|
|
109
|
+
pth = Path(pth)
|
|
110
|
+
return pth if pth.is_absolute() else config.work_dir / pth
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def get_output_path(pth):
|
|
114
|
+
"""
|
|
115
|
+
Gets path object, respecting the configurations
|
|
116
|
+
output directory
|
|
117
|
+
|
|
118
|
+
Parameters
|
|
119
|
+
----------
|
|
120
|
+
pth: str or pathlib.Path
|
|
121
|
+
The path, optionally relative
|
|
122
|
+
|
|
123
|
+
Returns
|
|
124
|
+
-------
|
|
125
|
+
out: pathlib.Path
|
|
126
|
+
The path, absolute or relative to output directory
|
|
127
|
+
from config
|
|
128
|
+
|
|
129
|
+
:group: foxes.config
|
|
130
|
+
|
|
131
|
+
"""
|
|
132
|
+
if not isinstance(pth, Path):
|
|
133
|
+
pth = Path(pth)
|
|
134
|
+
return pth if pth.is_absolute() else config.out_dir / pth
|