foxes 1.5__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.
- examples/abl_states/run.py +58 -56
- examples/dyn_wakes/run.py +110 -118
- examples/field_data_nc/run.py +22 -20
- 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 +8 -6
- examples/timelines/run.py +100 -98
- examples/timeseries/run.py +71 -76
- examples/wind_rose/run.py +27 -25
- examples/yawed_wake/run.py +82 -80
- foxes/core/algorithm.py +1 -0
- foxes/engines/pool.py +1 -0
- foxes/utils/xarray_utils.py +20 -12
- {foxes-1.5.dist-info → foxes-1.5.1.dist-info}/METADATA +1 -1
- {foxes-1.5.dist-info → foxes-1.5.1.dist-info}/RECORD +21 -21
- {foxes-1.5.dist-info → foxes-1.5.1.dist-info}/WHEEL +0 -0
- {foxes-1.5.dist-info → foxes-1.5.1.dist-info}/entry_points.txt +0 -0
- {foxes-1.5.dist-info → foxes-1.5.1.dist-info}/licenses/LICENSE +0 -0
- {foxes-1.5.dist-info → foxes-1.5.1.dist-info}/top_level.txt +0 -0
examples/abl_states/run.py
CHANGED
|
@@ -91,70 +91,72 @@ if __name__ == "__main__":
|
|
|
91
91
|
wake_frame="rotor_wd",
|
|
92
92
|
partial_wakes=args.pwakes,
|
|
93
93
|
mbook=mbook,
|
|
94
|
-
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
with foxes.Engine.new(
|
|
97
|
+
engine_type=args.engine,
|
|
95
98
|
n_procs=args.n_cpus,
|
|
96
99
|
chunk_size_states=args.chunksize_states,
|
|
97
100
|
chunk_size_points=args.chunksize_points,
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
time1 = time.time()
|
|
101
|
+
):
|
|
102
|
+
time0 = time.time()
|
|
103
|
+
farm_results = algo.calc_farm()
|
|
104
|
+
time1 = time.time()
|
|
103
105
|
|
|
104
|
-
|
|
106
|
+
print("\nCalc time =", time1 - time0, "\n")
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
print(farm_results)
|
|
107
109
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
fr = farm_results.to_dataframe()
|
|
111
|
+
print(fr[[FV.WD, FV.H, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]])
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
o = foxes.output.FarmResultsEval(farm_results)
|
|
114
|
+
o = foxes.output.FarmResultsEval(farm_results)
|
|
115
|
+
o.add_capacity(algo)
|
|
116
|
+
o.add_capacity(algo, ambient=True)
|
|
117
|
+
o.add_efficiency()
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
119
|
+
# state-turbine results
|
|
120
|
+
farm_df = farm_results.to_dataframe()
|
|
121
|
+
print("\nFarm results data:\n")
|
|
122
|
+
print(
|
|
123
|
+
farm_df[
|
|
124
|
+
[
|
|
125
|
+
FV.X,
|
|
126
|
+
FV.WD,
|
|
127
|
+
FV.AMB_REWS,
|
|
128
|
+
FV.REWS,
|
|
129
|
+
FV.AMB_TI,
|
|
130
|
+
FV.TI,
|
|
131
|
+
FV.AMB_P,
|
|
132
|
+
FV.P,
|
|
133
|
+
FV.EFF,
|
|
134
|
+
]
|
|
132
135
|
]
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
print()
|
|
136
|
+
)
|
|
137
|
+
print()
|
|
136
138
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
139
|
+
# results by turbine
|
|
140
|
+
turbine_results = o.reduce_states(
|
|
141
|
+
{
|
|
142
|
+
FV.AMB_P: "weights",
|
|
143
|
+
FV.P: "weights",
|
|
144
|
+
FV.AMB_CAP: "weights",
|
|
145
|
+
FV.CAP: "weights",
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
149
|
+
algo=algo, annual=True, ambient=True
|
|
150
|
+
)
|
|
151
|
+
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
152
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
153
|
+
print("\nResults by turbine:\n")
|
|
154
|
+
print(turbine_results)
|
|
153
155
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
# power results
|
|
157
|
+
P0 = o.calc_mean_farm_power(ambient=True)
|
|
158
|
+
P = o.calc_mean_farm_power()
|
|
159
|
+
print(f"\nFarm power : {P / 1000:.1f} MW")
|
|
160
|
+
print(f"Farm ambient power: {P0 / 1000:.1f} MW")
|
|
161
|
+
print(f"Farm efficiency : {o.calc_farm_efficiency():.2f}")
|
|
162
|
+
print(f"Annual farm yield : {turbine_results[FV.YLD].sum():.2f} GWh.")
|
examples/dyn_wakes/run.py
CHANGED
|
@@ -182,14 +182,6 @@ if __name__ == "__main__":
|
|
|
182
182
|
plt.show()
|
|
183
183
|
plt.close(ax.get_figure())
|
|
184
184
|
|
|
185
|
-
engine = foxes.Engine.new(
|
|
186
|
-
engine_type=args.engine,
|
|
187
|
-
n_procs=args.n_cpus,
|
|
188
|
-
chunk_size_states=args.chunksize_states,
|
|
189
|
-
chunk_size_points=args.chunksize_points,
|
|
190
|
-
)
|
|
191
|
-
engine.initialize()
|
|
192
|
-
|
|
193
185
|
algo = foxes.algorithms.Iterative(
|
|
194
186
|
farm,
|
|
195
187
|
states=states,
|
|
@@ -204,131 +196,131 @@ if __name__ == "__main__":
|
|
|
204
196
|
verbosity=1,
|
|
205
197
|
)
|
|
206
198
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
199
|
+
with foxes.Engine.new(
|
|
200
|
+
engine_type=args.engine,
|
|
201
|
+
n_procs=args.n_cpus,
|
|
202
|
+
chunk_size_states=args.chunksize_states,
|
|
203
|
+
chunk_size_points=args.chunksize_points,
|
|
204
|
+
):
|
|
205
|
+
time0 = time.time()
|
|
206
|
+
farm_results = algo.calc_farm()
|
|
207
|
+
time1 = time.time()
|
|
210
208
|
|
|
211
|
-
|
|
209
|
+
print("\nCalc time =", time1 - time0, "\n")
|
|
212
210
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
211
|
+
o = foxes.output.FarmResultsEval(farm_results)
|
|
212
|
+
o.add_capacity(algo)
|
|
213
|
+
o.add_capacity(algo, ambient=True)
|
|
214
|
+
o.add_efficiency()
|
|
217
215
|
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
print("\nFarm results:\n")
|
|
217
|
+
print(farm_results)
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
219
|
+
# state-turbine results
|
|
220
|
+
farm_df = farm_results.to_dataframe()
|
|
221
|
+
print("\nFarm results data:\n")
|
|
222
|
+
print(
|
|
223
|
+
farm_df[
|
|
224
|
+
[
|
|
225
|
+
FV.X,
|
|
226
|
+
FV.Y,
|
|
227
|
+
FV.WD,
|
|
228
|
+
FV.AMB_REWS,
|
|
229
|
+
FV.REWS,
|
|
230
|
+
FV.AMB_TI,
|
|
231
|
+
FV.TI,
|
|
232
|
+
FV.AMB_P,
|
|
233
|
+
FV.P,
|
|
234
|
+
FV.EFF,
|
|
235
|
+
]
|
|
237
236
|
]
|
|
238
|
-
]
|
|
239
|
-
)
|
|
240
|
-
print()
|
|
241
|
-
print(farm_df[[FV.AMB_REWS, FV.REWS, FV.CT, FV.EFF]].describe())
|
|
242
|
-
|
|
243
|
-
# power results
|
|
244
|
-
P0 = o.calc_mean_farm_power(ambient=True)
|
|
245
|
-
P = o.calc_mean_farm_power()
|
|
246
|
-
print(f"\nFarm power : {P / 1000:.1f} MW")
|
|
247
|
-
print(f"Farm ambient power: {P0 / 1000:.1f} MW")
|
|
248
|
-
print(f"Farm efficiency : {o.calc_farm_efficiency() * 100:.2f} %")
|
|
249
|
-
|
|
250
|
-
engine.finalize()
|
|
251
|
-
|
|
252
|
-
if not args.nofig:
|
|
253
|
-
sts = np.arange(farm_results.sizes["state"])
|
|
254
|
-
plt.plot(sts, farm_results.REWS[:, 1], label="Turbine 1")
|
|
255
|
-
plt.plot(sts, farm_results.REWS[:, 4], label="Turbine 4")
|
|
256
|
-
plt.plot(sts, farm_results.REWS[:, 7], label="Turbine 7")
|
|
257
|
-
plt.legend()
|
|
258
|
-
plt.xlabel("State")
|
|
259
|
-
plt.ylabel("REWS [m/s]")
|
|
260
|
-
plt.show()
|
|
261
|
-
plt.close()
|
|
262
|
-
|
|
263
|
-
if not args.nofig and args.animation:
|
|
264
|
-
print("\nCalculating animation")
|
|
265
|
-
|
|
266
|
-
fig, axs = plt.subplots(
|
|
267
|
-
2, 1, figsize=(5.2, 7), gridspec_kw={"height_ratios": [3, 1]}
|
|
268
237
|
)
|
|
238
|
+
print()
|
|
239
|
+
print(farm_df[[FV.AMB_REWS, FV.REWS, FV.CT, FV.EFF]].describe())
|
|
269
240
|
|
|
270
|
-
|
|
241
|
+
# power results
|
|
242
|
+
P0 = o.calc_mean_farm_power(ambient=True)
|
|
243
|
+
P = o.calc_mean_farm_power()
|
|
244
|
+
print(f"\nFarm power : {P / 1000:.1f} MW")
|
|
245
|
+
print(f"Farm ambient power: {P0 / 1000:.1f} MW")
|
|
246
|
+
print(f"Farm efficiency : {o.calc_farm_efficiency() * 100:.2f} %")
|
|
271
247
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
ax=axs[0],
|
|
283
|
-
ret_im=True,
|
|
284
|
-
title=None,
|
|
285
|
-
animated=True,
|
|
286
|
-
precalc=True,
|
|
287
|
-
rotor_color="red",
|
|
288
|
-
)
|
|
289
|
-
next(ofg)
|
|
248
|
+
if not args.nofig:
|
|
249
|
+
sts = np.arange(farm_results.sizes["state"])
|
|
250
|
+
plt.plot(sts, farm_results.REWS[:, 1], label="Turbine 1")
|
|
251
|
+
plt.plot(sts, farm_results.REWS[:, 4], label="Turbine 4")
|
|
252
|
+
plt.plot(sts, farm_results.REWS[:, 7], label="Turbine 7")
|
|
253
|
+
plt.legend()
|
|
254
|
+
plt.xlabel("State")
|
|
255
|
+
plt.ylabel("REWS [m/s]")
|
|
256
|
+
plt.show()
|
|
257
|
+
plt.close()
|
|
290
258
|
|
|
291
|
-
|
|
259
|
+
if not args.nofig and args.animation:
|
|
260
|
+
print("\nCalculating animation")
|
|
292
261
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
262
|
+
fig, axs = plt.subplots(
|
|
263
|
+
2, 1, figsize=(5.2, 7), gridspec_kw={"height_ratios": [3, 1]}
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
of = foxes.output.FlowPlots2D(algo, farm_results)
|
|
267
|
+
ofg = of.gen_states_fig_xy(
|
|
268
|
+
FV.WS,
|
|
269
|
+
resolution=30,
|
|
270
|
+
quiver_pars=dict(angles="xy", scale_units="xy", scale=0.013),
|
|
271
|
+
quiver_n=35,
|
|
272
|
+
xmax=5000,
|
|
273
|
+
ymax=5000,
|
|
274
|
+
vmin=0,
|
|
299
275
|
fig=fig,
|
|
300
|
-
ax=axs[
|
|
276
|
+
ax=axs[0],
|
|
301
277
|
ret_im=True,
|
|
302
|
-
|
|
278
|
+
title=None,
|
|
303
279
|
animated=True,
|
|
280
|
+
precalc=True,
|
|
281
|
+
rotor_color="red",
|
|
282
|
+
)
|
|
283
|
+
next(ofg)
|
|
284
|
+
|
|
285
|
+
anim = foxes.output.Animator(fig)
|
|
286
|
+
anim.add_generator(ofg)
|
|
287
|
+
anim.add_generator(
|
|
288
|
+
o.gen_stdata(
|
|
289
|
+
turbines=[1, 4, 7],
|
|
290
|
+
variable=FV.REWS,
|
|
291
|
+
fig=fig,
|
|
292
|
+
ax=axs[1],
|
|
293
|
+
ret_im=True,
|
|
294
|
+
legloc="upper right",
|
|
295
|
+
animated=True,
|
|
296
|
+
)
|
|
304
297
|
)
|
|
305
|
-
)
|
|
306
298
|
|
|
307
|
-
|
|
299
|
+
ani = anim.animate()
|
|
308
300
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
301
|
+
lo = foxes.output.FarmLayoutOutput(farm)
|
|
302
|
+
lo.get_figure(
|
|
303
|
+
fig=fig,
|
|
304
|
+
ax=axs[0],
|
|
305
|
+
title="",
|
|
306
|
+
annotate=1,
|
|
307
|
+
anno_delx=-120,
|
|
308
|
+
anno_dely=-60,
|
|
309
|
+
alpha=0,
|
|
310
|
+
)
|
|
319
311
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
312
|
+
axs[0].scatter(
|
|
313
|
+
[args.ref_xy[0]],
|
|
314
|
+
[args.ref_xy[1]],
|
|
315
|
+
marker="x",
|
|
316
|
+
color="red",
|
|
317
|
+
s=80,
|
|
318
|
+
animated=True,
|
|
319
|
+
)
|
|
328
320
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
321
|
+
fpath = Path(args.ani_file)
|
|
322
|
+
print("Writing file", fpath)
|
|
323
|
+
if fpath.suffix == ".gif":
|
|
324
|
+
ani.save(filename=fpath, writer="pillow", fps=args.fps)
|
|
325
|
+
else:
|
|
326
|
+
ani.save(filename=fpath, writer="ffmpeg", fps=args.fps)
|
examples/field_data_nc/run.py
CHANGED
|
@@ -98,31 +98,33 @@ if __name__ == "__main__":
|
|
|
98
98
|
wake_frame=args.wake_frame,
|
|
99
99
|
partial_wakes=args.pwakes,
|
|
100
100
|
mbook=mbook,
|
|
101
|
-
engine=args.engine,
|
|
102
|
-
n_procs=args.n_cpus,
|
|
103
|
-
chunk_size_states=args.chunksize_states,
|
|
104
|
-
chunk_size_points=args.chunksize_points,
|
|
105
101
|
verbosity=1,
|
|
106
102
|
)
|
|
107
103
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
with foxes.Engine.new(
|
|
105
|
+
engine_type=args.engine,
|
|
106
|
+
n_procs=args.n_cpus,
|
|
107
|
+
chunk_size_states=args.chunksize_states,
|
|
108
|
+
chunk_size_points=args.chunksize_points,
|
|
109
|
+
):
|
|
110
|
+
time0 = time.time()
|
|
111
|
+
farm_results = algo.calc_farm()
|
|
112
|
+
time1 = time.time()
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
print("\nCalc time =", time1 - time0, "\n")
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
print(farm_results)
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
fr = farm_results.to_dataframe()
|
|
119
|
+
print(fr[[FV.WD, FV.AMB_REWS, FV.REWS, FV.AMB_P, FV.P]])
|
|
118
120
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
o = foxes.output.SlicesData(algo, farm_results)
|
|
122
|
+
ds = o.get_states_data_xy(
|
|
123
|
+
z_list=[90, 100], variables=[FV.WS], resolution=50, verbosity=1
|
|
124
|
+
)
|
|
125
|
+
print(ds)
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
if not args.nofig:
|
|
128
|
+
o = foxes.output.FlowPlots2D(algo, farm_results)
|
|
129
|
+
o.get_mean_fig_xy(FV.WS, resolution=10)
|
|
130
|
+
plt.show()
|
examples/multi_height/run.py
CHANGED
|
@@ -91,14 +91,16 @@ if __name__ == "__main__":
|
|
|
91
91
|
wake_frame="rotor_wd",
|
|
92
92
|
partial_wakes=args.pwakes,
|
|
93
93
|
mbook=mbook,
|
|
94
|
-
engine=args.engine,
|
|
95
|
-
n_procs=args.n_cpus,
|
|
96
|
-
chunk_size_states=args.chunksize_states,
|
|
97
94
|
)
|
|
98
95
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
with foxes.Engine.new(
|
|
97
|
+
engine_type=args.engine,
|
|
98
|
+
n_procs=args.n_cpus,
|
|
99
|
+
chunk_size_states=args.chunksize_states,
|
|
100
|
+
):
|
|
101
|
+
time0 = time.time()
|
|
102
|
+
farm_results = algo.calc_farm()
|
|
103
|
+
time1 = time.time()
|
|
102
104
|
|
|
103
105
|
print("\nCalc time =", time1 - time0, "\n")
|
|
104
106
|
|
examples/scan_row/run.py
CHANGED
|
@@ -102,97 +102,99 @@ if __name__ == "__main__":
|
|
|
102
102
|
wake_frame="rotor_wd",
|
|
103
103
|
partial_wakes=args.pwakes,
|
|
104
104
|
mbook=mbook,
|
|
105
|
-
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
with foxes.Engine.new(
|
|
108
|
+
engine_type=args.engine,
|
|
106
109
|
n_procs=args.n_cpus,
|
|
107
110
|
chunk_size_states=args.chunksize_states,
|
|
108
111
|
chunk_size_points=args.chunksize_points,
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
time0 = time.time()
|
|
112
|
-
farm_results = algo.calc_farm()
|
|
113
|
-
time1 = time.time()
|
|
114
|
-
|
|
115
|
-
print("\nCalc time =", time1 - time0, "\n")
|
|
116
|
-
|
|
117
|
-
print("\nFarm results:\n", farm_results)
|
|
118
|
-
|
|
119
|
-
o = foxes.output.FarmResultsEval(farm_results)
|
|
120
|
-
o.add_capacity(algo)
|
|
121
|
-
o.add_capacity(algo, ambient=True)
|
|
122
|
-
o.add_efficiency()
|
|
123
|
-
|
|
124
|
-
# state-turbine results
|
|
125
|
-
farm_df = farm_results.to_dataframe()
|
|
126
|
-
print("\nFarm results data:\n")
|
|
127
|
-
print(
|
|
128
|
-
farm_df[
|
|
129
|
-
[
|
|
130
|
-
FV.X,
|
|
131
|
-
FV.WD,
|
|
132
|
-
FV.AMB_REWS,
|
|
133
|
-
FV.REWS,
|
|
134
|
-
FV.AMB_TI,
|
|
135
|
-
FV.TI,
|
|
136
|
-
FV.AMB_P,
|
|
137
|
-
FV.P,
|
|
138
|
-
FV.EFF,
|
|
139
|
-
]
|
|
140
|
-
]
|
|
141
|
-
)
|
|
142
|
-
print()
|
|
143
|
-
|
|
144
|
-
# results by turbine
|
|
145
|
-
turbine_results = o.reduce_states(
|
|
146
|
-
{
|
|
147
|
-
FV.AMB_P: "weights",
|
|
148
|
-
FV.P: "weights",
|
|
149
|
-
FV.AMB_CAP: "weights",
|
|
150
|
-
FV.CAP: "weights",
|
|
151
|
-
}
|
|
152
|
-
)
|
|
153
|
-
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
154
|
-
algo=algo, annual=True, ambient=True
|
|
155
|
-
)
|
|
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]
|
|
158
|
-
print("\nResults by turbine:\n")
|
|
159
|
-
print(turbine_results)
|
|
160
|
-
|
|
161
|
-
# power results
|
|
162
|
-
P0 = o.calc_mean_farm_power(ambient=True)
|
|
163
|
-
P = o.calc_mean_farm_power()
|
|
164
|
-
print(f"\nFarm power : {P / 1000:.1f} MW")
|
|
165
|
-
print(f"Farm ambient power: {P0 / 1000:.1f} MW")
|
|
166
|
-
print(f"Farm efficiency : {o.calc_farm_efficiency() * 100:.2f} %")
|
|
167
|
-
print(f"Annual farm yield : {turbine_results[FV.YLD].sum():.2f} GWh.")
|
|
168
|
-
print()
|
|
169
|
-
|
|
170
|
-
if not args.nofig and args.calc_cline:
|
|
171
|
-
points = np.zeros((n_s, n_p, 3))
|
|
172
|
-
points[:, :, 0] = np.linspace(p0[0], p0[0] + n_t * stp[0] + 10 * D, n_p)[
|
|
173
|
-
None, :
|
|
174
|
-
]
|
|
175
|
-
points[:, :, 1] = p0[1]
|
|
176
|
-
points[:, :, 2] = H
|
|
177
|
-
print("\nPOINTS:\n", points[0])
|
|
178
|
-
|
|
112
|
+
):
|
|
179
113
|
time0 = time.time()
|
|
180
|
-
|
|
114
|
+
farm_results = algo.calc_farm()
|
|
181
115
|
time1 = time.time()
|
|
116
|
+
|
|
182
117
|
print("\nCalc time =", time1 - time0, "\n")
|
|
183
118
|
|
|
184
|
-
print(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
119
|
+
print("\nFarm results:\n", farm_results)
|
|
120
|
+
|
|
121
|
+
o = foxes.output.FarmResultsEval(farm_results)
|
|
122
|
+
o.add_capacity(algo)
|
|
123
|
+
o.add_capacity(algo, ambient=True)
|
|
124
|
+
o.add_efficiency()
|
|
125
|
+
|
|
126
|
+
# state-turbine results
|
|
127
|
+
farm_df = farm_results.to_dataframe()
|
|
128
|
+
print("\nFarm results data:\n")
|
|
129
|
+
print(
|
|
130
|
+
farm_df[
|
|
131
|
+
[
|
|
132
|
+
FV.X,
|
|
133
|
+
FV.WD,
|
|
134
|
+
FV.AMB_REWS,
|
|
135
|
+
FV.REWS,
|
|
136
|
+
FV.AMB_TI,
|
|
137
|
+
FV.TI,
|
|
138
|
+
FV.AMB_P,
|
|
139
|
+
FV.P,
|
|
140
|
+
FV.EFF,
|
|
141
|
+
]
|
|
142
|
+
]
|
|
143
|
+
)
|
|
144
|
+
print()
|
|
145
|
+
|
|
146
|
+
# results by turbine
|
|
147
|
+
turbine_results = o.reduce_states(
|
|
148
|
+
{
|
|
149
|
+
FV.AMB_P: "weights",
|
|
150
|
+
FV.P: "weights",
|
|
151
|
+
FV.AMB_CAP: "weights",
|
|
152
|
+
FV.CAP: "weights",
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
turbine_results[FV.AMB_YLD] = o.calc_turbine_yield(
|
|
156
|
+
algo=algo, annual=True, ambient=True
|
|
157
|
+
)
|
|
158
|
+
turbine_results[FV.YLD] = o.calc_turbine_yield(algo=algo, annual=True)
|
|
159
|
+
turbine_results[FV.EFF] = turbine_results[FV.P] / turbine_results[FV.AMB_P]
|
|
160
|
+
print("\nResults by turbine:\n")
|
|
161
|
+
print(turbine_results)
|
|
162
|
+
|
|
163
|
+
# power results
|
|
164
|
+
P0 = o.calc_mean_farm_power(ambient=True)
|
|
165
|
+
P = o.calc_mean_farm_power()
|
|
166
|
+
print(f"\nFarm power : {P / 1000:.1f} MW")
|
|
167
|
+
print(f"Farm ambient power: {P0 / 1000:.1f} MW")
|
|
168
|
+
print(f"Farm efficiency : {o.calc_farm_efficiency() * 100:.2f} %")
|
|
169
|
+
print(f"Annual farm yield : {turbine_results[FV.YLD].sum():.2f} GWh.")
|
|
170
|
+
print()
|
|
171
|
+
|
|
172
|
+
if not args.nofig and args.calc_cline:
|
|
173
|
+
points = np.zeros((n_s, n_p, 3))
|
|
174
|
+
points[:, :, 0] = np.linspace(p0[0], p0[0] + n_t * stp[0] + 10 * D, n_p)[
|
|
175
|
+
None, :
|
|
176
|
+
]
|
|
177
|
+
points[:, :, 1] = p0[1]
|
|
178
|
+
points[:, :, 2] = H
|
|
179
|
+
print("\nPOINTS:\n", points[0])
|
|
180
|
+
|
|
181
|
+
time0 = time.time()
|
|
182
|
+
point_results = algo.calc_points(farm_results, points)
|
|
183
|
+
time1 = time.time()
|
|
184
|
+
print("\nCalc time =", time1 - time0, "\n")
|
|
185
|
+
|
|
186
|
+
print(point_results)
|
|
187
|
+
|
|
188
|
+
fig, ax = plt.subplots()
|
|
189
|
+
for s in range(points.shape[0]):
|
|
190
|
+
ax.plot(points[s, :, 0], point_results[FV.WS][s, :])
|
|
191
|
+
ax.set_xlabel("x [m]")
|
|
192
|
+
ax.set_ylabel("Wind speed [m/s]")
|
|
193
|
+
ax.set_title("Centreline wind speed")
|
|
194
|
+
plt.show()
|
|
195
|
+
plt.close(fig)
|
|
196
|
+
|
|
197
|
+
if not args.nofig and args.calc_mean:
|
|
198
|
+
o = foxes.output.FlowPlots2D(algo, farm_results)
|
|
199
|
+
fig = o.get_mean_fig_xy(FV.WS, resolution=10)
|
|
200
|
+
plt.show()
|