-
-
Save jurand71/8d1f96d48b9ff5c171a00c1efc0ba2f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# wczytanie bibliotek | |
# | |
import numpy as np | |
import pandas as pd | |
import pvlib | |
from pvlib.pvsystem import PVSystem | |
from pvlib.location import Location | |
from pvlib.modelchain import ModelChain | |
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS as PARAMS | |
import warnings | |
warnings.filterwarnings(action='ignore') | |
# | |
# Określenie lokalizacji instalacji | |
# | |
latitute, longitute = 50.84093845231934, 18.908785660900786 | |
tz = 'Europe/Warsaw' | |
altitude = 315 | |
# utworzenie instancji obiektu lokalizacji instalacji | |
location = Location(latitute, longitute, tz, altitude) | |
# | |
# Budowa instalacji fotowoltaicznej | |
# | |
# wybór bazy urządzeń, a nastepnie inwertera i modułu z bazy danych | |
cec_inverters = pvlib.pvsystem.retrieve_sam('CECInverter') | |
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod') | |
inverter_parameters = cec_inverters['ABB__MICRO_0_25_I_OUTD_US_208__208V_'] | |
module_parameters = sandia_modules['Canadian_Solar_CS5P_220M___2009_'] | |
#model temperaturowy modułu | |
temp_model_parameters = PARAMS['sapm']['open_rack_glass_polymer'] | |
#konfiguracja instalacji | |
PV_system = PVSystem(surface_tilt=35, surface_azimuth=180, | |
module_parameters=module_parameters, | |
inverter_parameters = inverter_parameters, | |
temperature_model_parameters = temp_model_parameters | |
) | |
# | |
# utworzenie instancji obiektu ModelChain | |
# | |
mc = ModelChain(PV_system, location) | |
# | |
# Uruchomienie modelu | |
# | |
# Pobranie danych pogodowych i przypisanie ich do roku 2020 | |
COERCE_YEAR = 2020 | |
weather, months, input_data, metadata = pvlib.iotools.read_pvgis_tmy('CZ_tmy_2005_2020.csv', map_variables=True) | |
weather.index = weather.index.map(lambda weather: weather.replace(year = COERCE_YEAR)) | |
#uruchomienie modelowania | |
mc.run_model(weather) | |
import matplotlib.pyplot as plt | |
plt.figure(figsize=(12,6)) | |
ax = mc.results.dc['p_mp'].resample('D').sum().plot(label = 'moc DC') | |
mc.results.ac.resample('D').sum().plot(ax=ax, label = 'moc AC') | |
plt.ylabel('Moc [W]') | |
plt.xlabel('Miesiące') | |
plt.title('Różnica w mocy instalacji po stronie DC i AC') | |
plt.legend() | |
plt.show() | |
df_irradiation = pd.DataFrame({ | |
'ghi': mc.results.weather['ghi'], | |
'poa': mc.results.total_irrad['poa_global'] | |
}) | |
df_monthly = df_irradiation.resample('M').sum() | |
df_monthly.plot.bar(figsize=(12,6)) | |
plt.ylabel('Napromieniowanie słoneczne [Wh/m$^2$]') | |
plt.xlabel('Miesiące TMY') | |
plt.xticks([0,1,2,3,4,5,6,7,8,9,10,11], labels = ['styczeń','luty','marzec','kwiecień','maj','czerwiec','lipiec','sierpień','wrzesień', 'październik', 'listopad','grudzień']) | |
plt.title('Różnica pomiędzy globalnym poziomym napromieniowaniem\n a całkowitym napromienieniem w płaszczyźnie modułu dla poszczególnych miesięcy TMY') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment