|
1
|
|
|
#!/usr/bin/python3 |
|
2
|
|
|
# -*- coding: utf-8 |
|
3
|
|
|
|
|
4
|
|
|
import logging |
|
5
|
|
|
import warnings |
|
6
|
|
|
|
|
7
|
|
|
from shapely import geometry as geopy |
|
8
|
|
|
|
|
9
|
|
|
import feedinlib.models as models |
|
10
|
|
|
import feedinlib.powerplants as plants |
|
11
|
|
|
|
|
12
|
|
|
from oemof.db import coastdat |
|
13
|
|
|
import oemof.db as db |
|
14
|
|
|
|
|
15
|
|
|
try: |
|
16
|
|
|
from matplotlib import pyplot as plt |
|
17
|
|
|
except ImportError: |
|
18
|
|
|
plt = None |
|
19
|
|
|
|
|
20
|
|
|
# Feel free to remove or change these lines |
|
21
|
|
|
warnings.simplefilter(action="ignore", category=RuntimeWarning) |
|
22
|
|
|
logging.getLogger().setLevel(logging.INFO) |
|
23
|
|
|
|
|
24
|
|
|
# Specification of the wind model |
|
25
|
|
|
required_parameter_wind = { |
|
26
|
|
|
'h_hub': 'height of the hub in meters', |
|
27
|
|
|
'd_rotor': 'diameter of the rotor in meters', |
|
28
|
|
|
'wind_conv_type': 'wind converter according to the list in the csv file.', |
|
29
|
|
|
'data_height': 'dictionary containing the heights of the data model', |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
# Specification of the pv model |
|
33
|
|
|
required_parameter_pv = { |
|
34
|
|
|
'azimuth': 'Azimuth angle of the pv module', |
|
35
|
|
|
'tilt': 'Tilt angle of the pv module', |
|
36
|
|
|
'module_name': 'According to the sandia module library.', |
|
37
|
|
|
'albedo': 'Albedo value', |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
# Specification of the weather data set CoastDat2 |
|
41
|
|
|
coastDat2 = { |
|
42
|
|
|
'dhi': 0, |
|
43
|
|
|
'dirhi': 0, |
|
44
|
|
|
'pressure': 0, |
|
45
|
|
|
'temp_air': 2, |
|
46
|
|
|
'v_wind': 10, |
|
47
|
|
|
'Z0': 0, |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
# Specification of the pv module |
|
51
|
|
|
advent210 = { |
|
52
|
|
|
'module_name': 'Advent_Solar_Ventura_210___2008_', |
|
53
|
|
|
'azimuth': 180, |
|
54
|
|
|
'tilt': 30, |
|
55
|
|
|
'albedo': 0.2, |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
# Specification of the pv module |
|
59
|
|
|
yingli210 = { |
|
60
|
|
|
'module_name': 'Yingli_YL210__2008__E__', |
|
61
|
|
|
'azimuth': 180, |
|
62
|
|
|
'tilt': 30, |
|
63
|
|
|
'albedo': 0.2, |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
loc_berlin = {'tz': 'Europe/Berlin', 'latitude': 52.5, 'longitude': 13.5} |
|
67
|
|
|
|
|
68
|
|
|
# Specifications of the wind turbines |
|
69
|
|
|
enerconE126 = { |
|
70
|
|
|
'h_hub': 135, |
|
71
|
|
|
'd_rotor': 127, |
|
72
|
|
|
'wind_conv_type': 'ENERCON E 126 7500', |
|
73
|
|
|
'data_height': coastDat2, |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
vestasV90 = { |
|
77
|
|
|
'h_hub': 105, |
|
78
|
|
|
'd_rotor': 90, |
|
79
|
|
|
'wind_conv_type': 'VESTAS V 90 3000', |
|
80
|
|
|
'data_height': coastDat2, |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
year = 2010 |
|
84
|
|
|
|
|
85
|
|
|
conn = db.connection() |
|
86
|
|
|
my_weather_single = coastdat.get_weather( |
|
87
|
|
|
conn, geopy.Point(loc_berlin['longitude'], loc_berlin['latitude']), year |
|
88
|
|
|
) |
|
89
|
|
|
|
|
90
|
|
|
geo = geopy.Polygon([(12.2, 52.2), (12.2, 51.6), (13.2, 51.6), (13.2, 52.2)]) |
|
91
|
|
|
multi_weather = coastdat.get_weather(conn, geo, year) |
|
92
|
|
|
|
|
93
|
|
|
my_weather = multi_weather[0] |
|
94
|
|
|
# my_weather = my_weather_single |
|
95
|
|
|
|
|
96
|
|
|
# Initialise different power plants |
|
97
|
|
|
E126_power_plant = plants.WindPowerPlant(**enerconE126) |
|
98
|
|
|
V90_power_plant = plants.WindPowerPlant(**vestasV90) |
|
99
|
|
|
|
|
100
|
|
|
# Create a feedin series for a specific powerplant under specific weather |
|
101
|
|
|
# conditions. One can define the number of turbines or the over all capacity. |
|
102
|
|
|
# If no multiplier is set, the time series will be for one turbine. |
|
103
|
|
|
E126_feedin = E126_power_plant.feedin(weather=my_weather, number=2) |
|
104
|
|
|
V90_feedin = V90_power_plant.feedin( |
|
105
|
|
|
weather=my_weather, installed_capacity=(15 * 10 ** 6) |
|
106
|
|
|
) |
|
107
|
|
|
|
|
108
|
|
|
E126_feedin.name = 'E126' |
|
109
|
|
|
V90_feedin.name = 'V90' |
|
110
|
|
|
|
|
111
|
|
|
if plt: |
|
112
|
|
|
E126_feedin.plot(legend=True) |
|
113
|
|
|
V90_feedin.plot(legend=True) |
|
114
|
|
|
plt.show() |
|
115
|
|
|
else: |
|
116
|
|
|
print(V90_feedin) |
|
117
|
|
|
|
|
118
|
|
|
# Apply the model |
|
119
|
|
|
yingli_module = plants.Photovoltaic(**yingli210) |
|
120
|
|
|
advent_module = plants.Photovoltaic(**advent210) |
|
121
|
|
|
|
|
122
|
|
|
# Apply the pv plant |
|
123
|
|
|
pv_feedin1 = yingli_module.feedin(weather=my_weather, number=30000) |
|
124
|
|
|
pv_feedin2 = yingli_module.feedin(weather=my_weather, area=15000) |
|
125
|
|
|
pv_feedin3 = yingli_module.feedin(weather=my_weather, peak_power=15000) |
|
126
|
|
|
pv_feedin4 = yingli_module.feedin(weather=my_weather) |
|
127
|
|
|
pv_feedin5 = advent_module.feedin(weather=my_weather) |
|
128
|
|
|
|
|
129
|
|
|
pv_feedin4.name = 'Yingli' |
|
130
|
|
|
pv_feedin5.name = 'Advent' |
|
131
|
|
|
|
|
132
|
|
|
# Output |
|
133
|
|
|
if plt: |
|
134
|
|
|
pv_feedin4.plot(legend=True) |
|
135
|
|
|
pv_feedin5.plot(legend=True) |
|
136
|
|
|
plt.show() |
|
137
|
|
|
else: |
|
138
|
|
|
print(pv_feedin5) |
|
139
|
|
|
|
|
140
|
|
|
# Use directly methods of the model |
|
141
|
|
|
w_model = models.SimpleWindTurbine() |
|
142
|
|
|
w_model.get_wind_pp_types() |
|
143
|
|
|
cp_values = models.SimpleWindTurbine().fetch_cp_values( |
|
144
|
|
|
wind_conv_type='ENERCON E 126 7500' |
|
145
|
|
|
) |
|
146
|
|
|
if plt: |
|
147
|
|
|
plt.plot( |
|
148
|
|
|
cp_values.loc[0, :][2:55].index, cp_values.loc[0, :][2:55].values, '*' |
|
149
|
|
|
) |
|
150
|
|
|
plt.show() |
|
151
|
|
|
else: |
|
152
|
|
|
print(cp_values.loc[0, :][2:55].values) |
|
153
|
|
|
|
|
154
|
|
|
logging.info('Done!') |
|
155
|
|
|
|