如何使用PVLIB构建通用的PV系统

时间:2019-07-17 03:00:14

标签: python pvlib

我正在尝试构建通用的pvsystem进行建模,而不需要特定的模块和逆变器。我拥有所有关键变量(表面方位角,倾斜度,反照率,跟踪技术(固定,单,双),位置,以KW为单位的DC大小,损耗因子,DC / AC比)

我了解PVWatts是执行此操作的最佳方法,但我不知道它是如何工作的。我怎样才能在PVLIB中建立这样的光伏系统?

附加了当前代码,它可以工作,但希望更改pvsystem的构建

# import packages
import os
import itertools
import matplotlib.pyplot as plt
import pandas as pd
from pandas.plotting import register_matplotlib_converters
import numpy as np

# pvlib imports
import pvlib
from pvlib import clearsky, atmosphere, solarposition
from pvlib.iotools import read_tmy3
from pvlib.pvsystem import PVSystem
from pvlib.location import Location
from pvlib.modelchain import ModelChain

# Set Location
latitude, longitude, tz, altitude, name = -17.0, 145.4, 'Etc/GMT+10', 400, 'Mareeba/QLD'
location = Location(latitude, longitude, tz, altitude, name)

# load some module and inverter specifications
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
cec_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')
sandia_module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
cec_inverter = cec_inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_']
system = PVSystem(
                    surface_tilt=20,
                    surface_azimuth=0,
                    module_parameters=sandia_module,
                    inverter_parameters=cec_inverter,
                    albedo=0.2,
                    # modules_per_string=5,
                    # strings_per_inverter=5
                  )   

# Get Irradiance and weather
times = pd.date_range(start='2018-01-01', end='2018-12-31', freq='5min', tz=location.tz)
solpos = pvlib.solarposition.get_solarposition(times, latitude, longitude)
apparent_zenith = solpos['apparent_zenith']
airmass = pvlib.atmosphere.get_relative_airmass(apparent_zenith)
pressure = pvlib.atmosphere.alt2pres(altitude)
airmass = pvlib.atmosphere.get_absolute_airmass(airmass, pressure)
linke_turbidity = pvlib.clearsky.lookup_linke_turbidity(times, latitude, longitude)
dni_extra = pvlib.irradiance.get_extra_radiation(times)
ineichen = clearsky.ineichen(apparent_zenith, airmass, linke_turbidity, altitude, dni_extra)
print(ineichen.head(3))

# Graph Irriadiance
# plt.figure();
# ax = ineichen.plot()
# ax.set_ylabel('Irradiance $W/m^2$');
# ax.set_title('Ineichen Clear Sky Model');
# ax.legend(loc=2);
# plt.show()

# build weather data
weather = pd.concat(
    [
        ineichen,
        pd.DataFrame(
            [[20.0, 5.0] for _ in range(ineichen.shape[0])],
            ineichen.index, ['temp_air', 'wind_speed']
        )
    ], axis=1)
print(weather.head(3))

# build model chain
mc = ModelChain(system, location)

# run model chain
mc.run_model(times=weather.index, weather=weather)

register_matplotlib_converters()
plt.plot(mc.ac)
plt.show()

1 个答案:

答案 0 :(得分:0)

用指定PVWatts参数的字典替换sandia_modulecec_inverter。本文档部分中的代码演示了如何指定PVWatts参数:https://pvlib-python.readthedocs.io/en/stable/pvsystem.html#design-philosophy