Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用PVLIB构建通用pvsystem_Python_Pvlib - Fatal编程技术网

Python 如何使用PVLIB构建通用pvsystem

Python 如何使用PVLIB构建通用pvsystem,python,pvlib,Python,Pvlib,我正在尝试建立一个通用的PVS系统,用于建模,而不需要特定的模块和逆变器。我有所有关键变量(地面方位角、倾斜、反照率、跟踪技术(固定、单、双)、位置、直流大小(千瓦)、损耗系数、直流/交流比) 我知道PVWatts是最好的方法,但我不知道它是如何工作的。如何在PVLIB中最好地构建这样一个pvsystem 目前的代码附加,它的工作,但希望改变系统的建设 # import packages import os import itertools import matplotlib.pyplot as

我正在尝试建立一个通用的PVS系统,用于建模,而不需要特定的模块和逆变器。我有所有关键变量(地面方位角、倾斜、反照率、跟踪技术(固定、单、双)、位置、直流大小(千瓦)、损耗系数、直流/交流比)

我知道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()

用指定PVW参数的字典替换您的
sandia_模块
cec_逆变器
。本文档部分中的代码演示了如何指定PVWatts参数:

谢谢!!,非常感谢你的帮助。