foxes 1.5__py3-none-any.whl → 1.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of foxes might be problematic. Click here for more details.
- 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/input/yaml/windio/read_attributes.py +8 -2
- foxes/input/yaml/windio/read_farm.py +20 -0
- foxes/input/yaml/windio/read_fields.py +3 -0
- foxes/input/yaml/windio/read_outputs.py +24 -12
- foxes/input/yaml/windio/read_site.py +33 -12
- foxes/input/yaml/windio/windio.py +1 -0
- foxes/models/farm_controllers/__init__.py +1 -0
- foxes/models/farm_controllers/op_flag.py +196 -0
- foxes/models/wake_models/induction/self_similar.py +22 -4
- foxes/models/wake_models/induction/self_similar2020.py +1 -1
- foxes/models/wake_models/ti/crespo_hernandez.py +1 -1
- foxes/models/wake_models/wind/bastankhah14.py +1 -1
- foxes/models/wake_models/wind/bastankhah16.py +1 -1
- foxes/models/wake_models/wind/turbopark.py +1 -1
- foxes/output/state_turbine_map.py +7 -4
- foxes/utils/xarray_utils.py +20 -12
- foxes/variables.py +8 -3
- {foxes-1.5.dist-info → foxes-1.5.2.dist-info}/METADATA +5 -6
- {foxes-1.5.dist-info → foxes-1.5.2.dist-info}/RECORD +38 -36
- tests/2_models/turbine_models/test_set_farm_vars.py +64 -0
- {foxes-1.5.dist-info → foxes-1.5.2.dist-info}/WHEEL +0 -0
- {foxes-1.5.dist-info → foxes-1.5.2.dist-info}/entry_points.txt +0 -0
- {foxes-1.5.dist-info → foxes-1.5.2.dist-info}/licenses/LICENSE +0 -0
- {foxes-1.5.dist-info → foxes-1.5.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
import foxes
|
|
4
|
+
import foxes.variables as FV
|
|
5
|
+
import foxes.constants as FC
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_set_farm_vars():
|
|
9
|
+
n_s = 360
|
|
10
|
+
n_tr = 3
|
|
11
|
+
|
|
12
|
+
wd = np.arange(0.0, 360.0, 360 / n_s)
|
|
13
|
+
states = foxes.input.states.ScanStates(
|
|
14
|
+
scans={
|
|
15
|
+
FV.WD: wd,
|
|
16
|
+
FV.WS: [9.0],
|
|
17
|
+
FV.TI: [0.04],
|
|
18
|
+
FV.RHO: [1.225],
|
|
19
|
+
},
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
n_t = n_tr**2
|
|
23
|
+
x = np.zeros((n_s, n_t), dtype=foxes.config.dtype_double)
|
|
24
|
+
x[:] = wd[:, None] + np.arange(n_t)[None, :] / 10
|
|
25
|
+
|
|
26
|
+
farm = foxes.WindFarm()
|
|
27
|
+
foxes.input.farm_layout.add_grid(
|
|
28
|
+
farm,
|
|
29
|
+
xy_base=[0.0, 0.0],
|
|
30
|
+
step_vectors=[[800.0, 0.0], [0.0, 800.0]],
|
|
31
|
+
steps=[n_tr, n_tr],
|
|
32
|
+
turbine_models=["NREL5MW", "set_x"],
|
|
33
|
+
verbosity=0,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
with foxes.Engine.new("default", verbosity=0):
|
|
37
|
+
for pr in [False, True]:
|
|
38
|
+
print(f"\npre_rotor = {pr}\n")
|
|
39
|
+
|
|
40
|
+
mbook = foxes.ModelBook()
|
|
41
|
+
mbook.turbine_models["set_x"] = foxes.models.turbine_models.SetFarmVars(
|
|
42
|
+
pre_rotor=pr
|
|
43
|
+
)
|
|
44
|
+
mbook.turbine_models["set_x"].add_var("x", x)
|
|
45
|
+
|
|
46
|
+
algo = foxes.algorithms.Downwind(
|
|
47
|
+
farm=farm,
|
|
48
|
+
states=states,
|
|
49
|
+
wake_models=["Bastankhah2014_linear_lim_k004"],
|
|
50
|
+
mbook=mbook,
|
|
51
|
+
verbosity=0,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
farm_results = algo.calc_farm()
|
|
55
|
+
|
|
56
|
+
fr = farm_results.to_dataframe()
|
|
57
|
+
print(fr[[FV.WD, "x"]])
|
|
58
|
+
|
|
59
|
+
for i, g in fr.reset_index().groupby(FC.TURBINE):
|
|
60
|
+
assert np.allclose(g["x"].values, g[FV.WD].values + i / 10)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
test_set_farm_vars()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|