forked from Pyosch/vpplib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_wind.py
101 lines (78 loc) · 2.56 KB
/
test_wind.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
90
91
92
93
94
95
96
97
98
99
100
101
# -*- coding: utf-8 -*-
"""
Info
----
In this testfile the basic functionalities of the WindPower class are tested.
Run each time you make changes on an existing function.
Adjust if a new function is added or parameters in an existing function are
changed.
"""
import matplotlib.pyplot as plt
from vpplib.environment import Environment
from vpplib.wind_power import WindPower
# For Debugging uncomment:
# import logging
# logging.getLogger().setLevel(logging.DEBUG)
start = "2015-01-01 00:00:00"
end = "2015-01-31 23:45:00"
timezone = "Europe/Berlin"
timestamp_int = 12
timestamp_str = "2015-01-01 12:00:00"
# create environment and load wind data
environment = Environment(start=start, end=end, timezone=timezone)
# to use custom wind data:
environment.get_wind_data(
file="./input/wind/dwd_wind_data_2015.csv", utc=False
)
# WindTurbine data
turbine_type = "E-126/4200"
hub_height = 135
rotor_diameter = 127
fetch_curve = "power_curve"
data_source = "oedb"
# ModelChain data
# possible wind_speed_model: 'logarithmic', 'hellman',
#'interpolation_extrapolation', 'log_interpolation_extrapolation'
wind_speed_model = "logarithmic"
density_model = "ideal_gas"
temperature_model = "linear_gradient"
power_output_model = "power_coefficient_curve" #'power_curve'
density_correction = True
obstacle_height = 0
hellman_exp = None
wind = WindPower(
unit="kW",
identifier=None,
environment=environment,
user_profile=None,
turbine_type=turbine_type,
hub_height=hub_height,
rotor_diameter=rotor_diameter,
fetch_curve=fetch_curve,
data_source=data_source,
wind_speed_model=wind_speed_model,
density_model=density_model,
temperature_model=temperature_model,
power_output_model=power_output_model,
density_correction=density_correction,
obstacle_height=obstacle_height,
hellman_exp=hellman_exp,
)
def test_prepare_time_series(wind):
wind.prepare_time_series()
print("prepare_time_series:")
print(wind.timeseries.head())
wind.timeseries.plot(figsize=(16, 9))
plt.show()
def test_value_for_timestamp(wind, timestamp):
timestepvalue = wind.value_for_timestamp(timestamp)
print("\nvalue_for_timestamp:\n", timestepvalue)
def observations_for_timestamp(wind, timestamp):
print("observations_for_timestamp:")
observation = wind.observations_for_timestamp(timestamp)
print(observation, "\n")
test_prepare_time_series(wind)
test_value_for_timestamp(wind, timestamp_int)
test_value_for_timestamp(wind, timestamp_str)
observations_for_timestamp(wind, timestamp_int)
observations_for_timestamp(wind, timestamp_str)