foxes 1.4__py3-none-any.whl → 1.5.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 +1 -1
- examples/abl_states/run.py +58 -56
- examples/dyn_wakes/run.py +110 -118
- examples/field_data_nc/run.py +23 -21
- examples/multi_height/run.py +8 -6
- examples/scan_row/run.py +89 -87
- examples/sector_management/run.py +40 -38
- examples/states_lookup_table/run.py +6 -4
- examples/streamline_wakes/run.py +10 -8
- examples/timelines/run.py +100 -98
- examples/timeseries/run.py +71 -76
- examples/wind_rose/run.py +27 -25
- examples/yawed_wake/run.py +85 -81
- foxes/algorithms/downwind/downwind.py +5 -5
- foxes/algorithms/downwind/models/init_farm_data.py +58 -28
- foxes/algorithms/downwind/models/set_amb_farm_results.py +1 -1
- foxes/core/algorithm.py +6 -5
- foxes/core/data.py +75 -4
- foxes/core/data_calc_model.py +4 -2
- foxes/core/engine.py +33 -40
- foxes/core/farm_data_model.py +16 -13
- foxes/core/model.py +19 -1
- foxes/core/point_data_model.py +19 -14
- foxes/core/rotor_model.py +1 -0
- foxes/core/wake_deflection.py +3 -3
- foxes/data/states/point_cloud_100.nc +0 -0
- foxes/data/states/weibull_cloud_4.nc +0 -0
- foxes/data/states/weibull_grid.nc +0 -0
- foxes/engines/dask.py +3 -6
- foxes/engines/default.py +2 -2
- foxes/engines/numpy.py +11 -10
- foxes/engines/pool.py +21 -11
- foxes/engines/single.py +8 -6
- foxes/input/farm_layout/__init__.py +1 -0
- foxes/input/farm_layout/from_arrays.py +68 -0
- foxes/input/states/__init__.py +7 -1
- foxes/input/states/dataset_states.py +710 -0
- foxes/input/states/field_data.py +531 -0
- foxes/input/states/multi_height.py +2 -0
- foxes/input/states/one_point_flow.py +1 -0
- foxes/input/states/point_cloud_data.py +618 -0
- foxes/input/states/scan.py +2 -0
- foxes/input/states/single.py +2 -0
- foxes/input/states/states_table.py +13 -23
- foxes/input/states/weibull_sectors.py +182 -77
- foxes/input/states/wrg_states.py +1 -1
- foxes/input/yaml/dict.py +25 -24
- foxes/input/yaml/windio/read_attributes.py +40 -27
- foxes/input/yaml/windio/read_farm.py +12 -10
- foxes/input/yaml/windio/read_outputs.py +25 -15
- foxes/input/yaml/windio/read_site.py +121 -12
- foxes/input/yaml/windio/windio.py +22 -10
- foxes/input/yaml/yaml.py +1 -0
- foxes/models/model_book.py +16 -15
- foxes/models/rotor_models/__init__.py +1 -0
- foxes/models/rotor_models/centre.py +1 -1
- foxes/models/rotor_models/direct_infusion.py +241 -0
- foxes/models/turbine_models/calculator.py +16 -3
- foxes/models/turbine_models/kTI_model.py +1 -0
- foxes/models/turbine_models/lookup_table.py +2 -0
- foxes/models/turbine_models/power_mask.py +1 -0
- foxes/models/turbine_models/rotor_centre_calc.py +2 -0
- foxes/models/turbine_models/sector_management.py +1 -0
- foxes/models/turbine_models/set_farm_vars.py +3 -8
- foxes/models/turbine_models/table_factors.py +2 -0
- foxes/models/turbine_models/thrust2ct.py +1 -0
- foxes/models/turbine_models/yaw2yawm.py +2 -0
- foxes/models/turbine_models/yawm2yaw.py +2 -0
- foxes/models/turbine_types/PCt_file.py +2 -4
- foxes/models/turbine_types/PCt_from_two.py +1 -0
- foxes/models/turbine_types/__init__.py +1 -0
- foxes/models/turbine_types/calculator_type.py +123 -0
- foxes/models/turbine_types/null_type.py +1 -0
- foxes/models/turbine_types/wsrho2PCt_from_two.py +2 -0
- foxes/models/turbine_types/wsti2PCt_from_two.py +3 -1
- foxes/output/farm_layout.py +2 -0
- foxes/output/farm_results_eval.py +4 -1
- foxes/output/flow_plots_2d/flow_plots.py +18 -0
- foxes/output/flow_plots_2d/get_fig.py +1 -0
- foxes/output/output.py +6 -1
- foxes/output/results_writer.py +1 -1
- foxes/output/rose_plot.py +10 -0
- foxes/output/rotor_point_plots.py +3 -0
- foxes/output/state_turbine_map.py +3 -0
- foxes/output/turbine_type_curves.py +3 -0
- foxes/utils/dict.py +46 -34
- foxes/utils/factory.py +2 -2
- foxes/utils/xarray_utils.py +20 -12
- {foxes-1.4.dist-info → foxes-1.5.1.dist-info}/METADATA +32 -52
- {foxes-1.4.dist-info → foxes-1.5.1.dist-info}/RECORD +94 -86
- foxes/input/states/field_data_nc.py +0 -833
- {foxes-1.4.dist-info → foxes-1.5.1.dist-info}/WHEEL +0 -0
- {foxes-1.4.dist-info → foxes-1.5.1.dist-info}/entry_points.txt +0 -0
- {foxes-1.4.dist-info → foxes-1.5.1.dist-info}/licenses/LICENSE +0 -0
- {foxes-1.4.dist-info → foxes-1.5.1.dist-info}/top_level.txt +0 -0
|
@@ -104,10 +104,6 @@ if __name__ == "__main__":
|
|
|
104
104
|
wake_frame="rotor_wd",
|
|
105
105
|
partial_wakes=args.pwakes,
|
|
106
106
|
mbook=mbook,
|
|
107
|
-
engine=args.engine,
|
|
108
|
-
n_procs=args.n_cpus,
|
|
109
|
-
chunk_size_states=args.chunksize_states,
|
|
110
|
-
chunk_size_points=args.chunksize_points,
|
|
111
107
|
)
|
|
112
108
|
|
|
113
109
|
outputs = [
|
|
@@ -124,43 +120,49 @@ if __name__ == "__main__":
|
|
|
124
120
|
FV.WEIGHT,
|
|
125
121
|
]
|
|
126
122
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
with foxes.Engine.new(
|
|
124
|
+
engine_type=args.engine,
|
|
125
|
+
n_procs=args.n_cpus,
|
|
126
|
+
chunk_size_states=args.chunksize_states,
|
|
127
|
+
chunk_size_points=args.chunksize_points,
|
|
128
|
+
):
|
|
129
|
+
time0 = time.time()
|
|
130
|
+
farm_results = algo.calc_farm(outputs=outputs)
|
|
131
|
+
time1 = time.time()
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
print("\nCalc time =", time1 - time0, "\n")
|
|
132
134
|
|
|
133
|
-
|
|
135
|
+
print(farm_results)
|
|
134
136
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
fr = farm_results.to_dataframe()
|
|
138
|
+
sel = fr[FV.MAX_P].dropna().index
|
|
139
|
+
fr = fr.loc[sel]
|
|
140
|
+
print(fr)
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
if not args.nofig:
|
|
143
|
+
fig = plt.figure(figsize=(12, 4))
|
|
144
|
+
ax1 = fig.add_subplot(121, polar=True)
|
|
145
|
+
ax2 = fig.add_subplot(122, polar=True)
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
o = foxes.output.RosePlotOutput(farm_results)
|
|
148
|
+
o.get_figure(
|
|
149
|
+
16,
|
|
150
|
+
FV.P,
|
|
151
|
+
[0, 100, 1000, 2000, 4000, 5001, 7000],
|
|
152
|
+
turbine=0,
|
|
153
|
+
title="Power turbine 0",
|
|
154
|
+
fig=fig,
|
|
155
|
+
ax=ax1,
|
|
156
|
+
)
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
158
|
+
o = foxes.output.RosePlotOutput(farm_results)
|
|
159
|
+
o.get_figure(
|
|
160
|
+
16,
|
|
161
|
+
FV.P,
|
|
162
|
+
[0, 100, 1000, 2000, 4000, 5001, 7000],
|
|
163
|
+
turbine=1,
|
|
164
|
+
title="Power turbine 1",
|
|
165
|
+
fig=fig,
|
|
166
|
+
ax=ax2,
|
|
167
|
+
)
|
|
168
|
+
plt.show()
|
|
@@ -117,13 +117,15 @@ if __name__ == "__main__":
|
|
|
117
117
|
wake_frame="rotor_wd",
|
|
118
118
|
partial_wakes=args.pwakes,
|
|
119
119
|
mbook=mbook,
|
|
120
|
-
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
with foxes.Engine.new(
|
|
123
|
+
engine_type=args.engine,
|
|
121
124
|
n_procs=args.n_cpus,
|
|
122
125
|
chunk_size_states=args.chunksize_states,
|
|
123
126
|
chunk_size_points=args.chunksize_points,
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
farm_results = algo.calc_farm()
|
|
127
|
+
):
|
|
128
|
+
farm_results = algo.calc_farm()
|
|
127
129
|
|
|
128
130
|
fr = farm_results.to_dataframe()
|
|
129
131
|
print(fr[[FV.WD, FV.H, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P, FV.CT, FV.WEIGHT]])
|
examples/streamline_wakes/run.py
CHANGED
|
@@ -97,7 +97,7 @@ if __name__ == "__main__":
|
|
|
97
97
|
mbook.turbine_models["set_yawm"].add_var(FV.YAWM, yawm)
|
|
98
98
|
ymodels = ["set_yawm"]
|
|
99
99
|
|
|
100
|
-
states = foxes.input.states.
|
|
100
|
+
states = foxes.input.states.FieldData(
|
|
101
101
|
args.file_pattern,
|
|
102
102
|
states_coord="state",
|
|
103
103
|
x_coord="x",
|
|
@@ -108,7 +108,7 @@ if __name__ == "__main__":
|
|
|
108
108
|
var2ncvar={FV.WS: "ws", FV.WD: "wd"},
|
|
109
109
|
fixed_vars={FV.RHO: 1.225, FV.TI: 0.1},
|
|
110
110
|
load_mode=args.load_mode,
|
|
111
|
-
bounds_error=False,
|
|
111
|
+
interpn_pars=dict(bounds_error=False),
|
|
112
112
|
)
|
|
113
113
|
|
|
114
114
|
farm = foxes.WindFarm()
|
|
@@ -129,15 +129,17 @@ if __name__ == "__main__":
|
|
|
129
129
|
wake_deflection=args.deflection,
|
|
130
130
|
partial_wakes=args.pwakes,
|
|
131
131
|
mbook=mbook,
|
|
132
|
-
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
with foxes.Engine.new(
|
|
135
|
+
engine_type=args.engine,
|
|
133
136
|
n_procs=args.n_cpus,
|
|
134
137
|
chunk_size_states=args.chunksize_states,
|
|
135
138
|
chunk_size_points=args.chunksize_points,
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
time1 = time.time()
|
|
139
|
+
):
|
|
140
|
+
time0 = time.time()
|
|
141
|
+
farm_results = algo.calc_farm()
|
|
142
|
+
time1 = time.time()
|
|
141
143
|
|
|
142
144
|
print("\nCalc time =", time1 - time0, "\n")
|
|
143
145
|
|
examples/timelines/run.py
CHANGED
|
@@ -173,119 +173,121 @@ if __name__ == "__main__":
|
|
|
173
173
|
wake_deflection=args.deflection,
|
|
174
174
|
partial_wakes=args.pwakes,
|
|
175
175
|
mbook=mbook,
|
|
176
|
-
engine=args.engine,
|
|
177
|
-
n_procs=args.n_cpus,
|
|
178
|
-
chunk_size_states=args.chunksize_states,
|
|
179
|
-
chunk_size_points=args.chunksize_points,
|
|
180
176
|
verbosity=1,
|
|
181
177
|
)
|
|
182
178
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
with foxes.Engine.new(
|
|
180
|
+
engine_type=args.engine,
|
|
181
|
+
n_procs=args.n_cpus,
|
|
182
|
+
chunk_size_states=args.chunksize_states,
|
|
183
|
+
chunk_size_points=args.chunksize_points,
|
|
184
|
+
):
|
|
185
|
+
time0 = time.time()
|
|
186
|
+
farm_results = algo.calc_farm()
|
|
187
|
+
time1 = time.time()
|
|
186
188
|
|
|
187
|
-
|
|
189
|
+
print("\nCalc time =", time1 - time0, "\n")
|
|
188
190
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
o = foxes.output.FarmResultsEval(farm_results)
|
|
192
|
+
o.add_capacity(algo)
|
|
193
|
+
o.add_capacity(algo, ambient=True)
|
|
194
|
+
o.add_efficiency()
|
|
193
195
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
print("\nFarm results:\n")
|
|
197
|
+
print(farm_results)
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
199
|
+
# state-turbine results
|
|
200
|
+
farm_df = farm_results.to_dataframe()
|
|
201
|
+
print("\nFarm results data:\n")
|
|
202
|
+
print(
|
|
203
|
+
farm_df[
|
|
204
|
+
[
|
|
205
|
+
FV.X,
|
|
206
|
+
FV.Y,
|
|
207
|
+
FV.WD,
|
|
208
|
+
FV.AMB_REWS,
|
|
209
|
+
FV.REWS,
|
|
210
|
+
FV.AMB_TI,
|
|
211
|
+
FV.TI,
|
|
212
|
+
FV.AMB_P,
|
|
213
|
+
FV.P,
|
|
214
|
+
FV.EFF,
|
|
215
|
+
]
|
|
213
216
|
]
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
print(farm_df[[FV.AMB_REWS, FV.REWS, FV.CT, FV.EFF]].describe())
|
|
217
|
+
)
|
|
218
|
+
print()
|
|
219
|
+
print(farm_df[[FV.AMB_REWS, FV.REWS, FV.CT, FV.EFF]].describe())
|
|
218
220
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
# power results
|
|
222
|
+
P0 = o.calc_mean_farm_power(ambient=True)
|
|
223
|
+
P = o.calc_mean_farm_power()
|
|
224
|
+
print(f"\nFarm power : {P / 1000:.1f} MW")
|
|
225
|
+
print(f"Farm ambient power: {P0 / 1000:.1f} MW")
|
|
226
|
+
print(f"Farm efficiency : {o.calc_farm_efficiency() * 100:.2f} %")
|
|
225
227
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
228
|
+
if not args.nofig:
|
|
229
|
+
sts = np.arange(farm_results.sizes["state"])
|
|
230
|
+
plt.plot(sts, farm_results.REWS[:, 4], label="Turbine 4")
|
|
231
|
+
plt.plot(sts, farm_results.REWS[:, 7], label="Turbine 7")
|
|
232
|
+
plt.legend()
|
|
233
|
+
plt.xlabel("State")
|
|
234
|
+
plt.ylabel("REWS [m/s]")
|
|
235
|
+
plt.show()
|
|
234
236
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
+
if not args.nofig and args.animation:
|
|
238
|
+
print("\nCalculating animation")
|
|
237
239
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
fig, axs = plt.subplots(
|
|
241
|
+
2, 1, figsize=(5.2, 7), gridspec_kw={"height_ratios": [3, 1]}
|
|
242
|
+
)
|
|
241
243
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
244
|
+
anim = foxes.output.Animator(fig)
|
|
245
|
+
of = foxes.output.FlowPlots2D(algo, farm_results)
|
|
246
|
+
anim.add_generator(
|
|
247
|
+
of.gen_states_fig_xy(
|
|
248
|
+
FV.WS,
|
|
249
|
+
resolution=30,
|
|
250
|
+
quiver_pars=dict(angles="xy", scale_units="xy", scale=0.013),
|
|
251
|
+
quiver_n=35,
|
|
252
|
+
xmax=5000,
|
|
253
|
+
ymax=5000,
|
|
254
|
+
vmin=0,
|
|
255
|
+
fig=fig,
|
|
256
|
+
ax=axs[0],
|
|
257
|
+
ret_im=True,
|
|
258
|
+
title=None,
|
|
259
|
+
animated=True,
|
|
260
|
+
rotor_color="red",
|
|
261
|
+
)
|
|
259
262
|
)
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
263
|
+
anim.add_generator(
|
|
264
|
+
o.gen_stdata(
|
|
265
|
+
turbines=[4, 7],
|
|
266
|
+
variable=FV.REWS,
|
|
267
|
+
fig=fig,
|
|
268
|
+
ax=axs[1],
|
|
269
|
+
ret_im=True,
|
|
270
|
+
legloc="upper left",
|
|
271
|
+
animated=True,
|
|
272
|
+
)
|
|
270
273
|
)
|
|
271
|
-
)
|
|
272
274
|
|
|
273
|
-
|
|
275
|
+
ani = anim.animate()
|
|
274
276
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
277
|
+
lo = foxes.output.FarmLayoutOutput(farm)
|
|
278
|
+
lo.get_figure(
|
|
279
|
+
fig=fig,
|
|
280
|
+
ax=axs[0],
|
|
281
|
+
title="",
|
|
282
|
+
annotate=1,
|
|
283
|
+
anno_delx=-120,
|
|
284
|
+
anno_dely=-60,
|
|
285
|
+
alpha=0,
|
|
286
|
+
)
|
|
285
287
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
288
|
+
fpath = Path(args.ani_file)
|
|
289
|
+
print("Writing file", fpath)
|
|
290
|
+
if fpath.suffix == ".gif":
|
|
291
|
+
ani.save(filename=fpath, writer="pillow", fps=args.fps)
|
|
292
|
+
else:
|
|
293
|
+
ani.save(filename=fpath, writer="ffmpeg", fps=args.fps)
|
examples/timeseries/run.py
CHANGED
|
@@ -99,15 +99,6 @@ if __name__ == "__main__":
|
|
|
99
99
|
plt.show()
|
|
100
100
|
plt.close(ax.get_figure())
|
|
101
101
|
|
|
102
|
-
engine = foxes.Engine.new(
|
|
103
|
-
args.engine,
|
|
104
|
-
n_procs=args.n_cpus,
|
|
105
|
-
chunk_size_states=args.chunksize_states,
|
|
106
|
-
chunk_size_points=args.chunksize_points,
|
|
107
|
-
verbosity=1,
|
|
108
|
-
)
|
|
109
|
-
engine.initialize()
|
|
110
|
-
|
|
111
102
|
Algo = foxes.algorithms.Iterative if args.iterative else foxes.algorithms.Downwind
|
|
112
103
|
algo = Algo(
|
|
113
104
|
farm,
|
|
@@ -120,71 +111,75 @@ if __name__ == "__main__":
|
|
|
120
111
|
verbosity=1,
|
|
121
112
|
)
|
|
122
113
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
114
|
+
with foxes.Engine.new(
|
|
115
|
+
engine_type=args.engine,
|
|
116
|
+
n_procs=args.n_cpus,
|
|
117
|
+
chunk_size_states=args.chunksize_states,
|
|
118
|
+
chunk_size_points=args.chunksize_points,
|
|
119
|
+
):
|
|
120
|
+
time0 = time.time()
|
|
121
|
+
farm_results = algo.calc_farm()
|
|
122
|
+
time1 = time.time()
|
|
123
|
+
|
|
124
|
+
print("\nFarm results:\n")
|
|
125
|
+
print(farm_results)
|
|
126
|
+
|
|
127
|
+
print("\nCalc time =", time1 - time0, "\n")
|
|
128
|
+
|
|
129
|
+
o = foxes.output.FarmResultsEval(farm_results)
|
|
130
|
+
o.add_capacity(algo)
|
|
131
|
+
o.add_capacity(algo, ambient=True)
|
|
132
|
+
o.add_efficiency()
|
|
133
|
+
|
|
134
|
+
print("\nFarm results:\n")
|
|
135
|
+
print(farm_results)
|
|
136
|
+
|
|
137
|
+
# state-turbine results
|
|
138
|
+
farm_df = farm_results.to_dataframe()
|
|
139
|
+
print("\nFarm results data:\n")
|
|
140
|
+
print(
|
|
141
|
+
farm_df[
|
|
142
|
+
[
|
|
143
|
+
FV.X,
|
|
144
|
+
FV.WD,
|
|
145
|
+
FV.AMB_REWS,
|
|
146
|
+
FV.REWS,
|
|
147
|
+
FV.AMB_TI,
|
|
148
|
+
FV.TI,
|
|
149
|
+
FV.AMB_P,
|
|
150
|
+
FV.P,
|
|
151
|
+
FV.EFF,
|
|
152
|
+
]
|
|
155
153
|
]
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
o = foxes.output.StateTurbineMap(farm_results)
|
|
189
|
-
ax = o.plot_map(FV.P, cmap="inferno", figsize=(6, 7))
|
|
190
|
-
plt.show()
|
|
154
|
+
)
|
|
155
|
+
print()
|
|
156
|
+
|
|
157
|
+
# results by turbine
|
|
158
|
+
turbine_results = o.reduce_states(
|
|
159
|
+
{
|
|
160
|
+
FV.AMB_P: "weights",
|
|
161
|
+
FV.P: "weights",
|
|
162
|
+
FV.AMB_CAP: "weights",
|
|
163
|
+
FV.CAP: "weights",
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
167
|
+
algo=algo, annual=True, ambient=True
|
|
168
|
+
)
|
|
169
|
+
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
170
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
171
|
+
print("\nResults by turbine:\n")
|
|
172
|
+
print(turbine_results)
|
|
173
|
+
|
|
174
|
+
# power results
|
|
175
|
+
P0 = o.calc_mean_farm_power(ambient=True)
|
|
176
|
+
P = o.calc_mean_farm_power()
|
|
177
|
+
print(f"\nFarm power : {P / 1000:.1f} MW")
|
|
178
|
+
print(f"Farm ambient power: {P0 / 1000:.1f} MW")
|
|
179
|
+
print(f"Farm efficiency : {o.calc_farm_efficiency() * 100:.2f} %")
|
|
180
|
+
print(f"Annual farm yield : {turbine_results[FV.YLD].sum():.2f} GWh")
|
|
181
|
+
|
|
182
|
+
if not args.nofig:
|
|
183
|
+
o = foxes.output.StateTurbineMap(farm_results)
|
|
184
|
+
ax = o.plot_map(FV.P, cmap="inferno", figsize=(6, 7))
|
|
185
|
+
plt.show()
|
examples/wind_rose/run.py
CHANGED
|
@@ -105,37 +105,39 @@ if __name__ == "__main__":
|
|
|
105
105
|
wake_frame="rotor_wd",
|
|
106
106
|
partial_wakes=args.pwakes,
|
|
107
107
|
mbook=mbook,
|
|
108
|
-
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
with foxes.Engine.new(
|
|
111
|
+
engine_type=args.engine,
|
|
109
112
|
n_procs=args.n_cpus,
|
|
110
113
|
chunk_size_states=args.chunksize_states,
|
|
111
114
|
chunk_size_points=args.chunksize_points,
|
|
112
|
-
)
|
|
115
|
+
):
|
|
116
|
+
if not args.nofig:
|
|
117
|
+
o = foxes.output.StatesRosePlotOutput(states, point=[0.0, 0.0, 100.0])
|
|
118
|
+
o.get_figure(16, FV.AMB_WS, [0, 3.5, 6, 10, 15, 20], add_inf=True)
|
|
119
|
+
plt.show()
|
|
113
120
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
plt.show()
|
|
118
|
-
|
|
119
|
-
time0 = time.time()
|
|
120
|
-
farm_results = algo.calc_farm()
|
|
121
|
-
time1 = time.time()
|
|
121
|
+
time0 = time.time()
|
|
122
|
+
farm_results = algo.calc_farm()
|
|
123
|
+
time1 = time.time()
|
|
122
124
|
|
|
123
|
-
|
|
125
|
+
print("\nCalc time =", time1 - time0, "\n")
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
print(farm_results)
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
fr = farm_results.to_dataframe()
|
|
130
|
+
print(fr[[FV.WD, FV.H, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P, FV.WEIGHT]])
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
o = foxes.output.FarmResultsEval(farm_results)
|
|
133
|
+
P0 = o.calc_mean_farm_power(ambient=True)
|
|
134
|
+
P = o.calc_mean_farm_power()
|
|
135
|
+
print(f"\nFarm power : {P / 1000:.1f} MW")
|
|
136
|
+
print(f"Farm ambient power: {P0 / 1000:.1f} MW")
|
|
137
|
+
print(f"Farm efficiency : {o.calc_farm_efficiency() * 100:.2f} %")
|
|
138
|
+
print(f"Annual farm yield : {o.calc_farm_yield(algo=algo):.2f} GWh")
|
|
137
139
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
if not args.nofig and args.calc_mean:
|
|
141
|
+
o = foxes.output.FlowPlots2D(algo, farm_results)
|
|
142
|
+
fig = o.get_mean_fig_xy(FV.WS, resolution=30)
|
|
143
|
+
plt.show()
|