使用 run_model 时出现 PVLIB UFuncTypeError
PVLIB UFuncTypeError while using run_model
我已经定义了我的模型,当我遇到以下错误时,我正在寻找生成结果:
UFuncTypeError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('float64'), dtype('<U5')) -> None
我的模型的简单版本如下所示:
temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
cec_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')
sandia_module = sandia_modules['Canadian_Solar_CS6X_300M__2013_']
cec_inverter = cec_inverters['ABB__PVI_3_0_OUTD_S_US__240V_']
pvlib_location = Location(latitude=self.latitude, longitude=self.longitude,
name=name, altitude=self.altitude, tz=self.tz)
system = PVSystem(surface_tilt=20, surface_azimuth=210,
module_parameters=sandia_module,
inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters,
modules_per_string=5, strings_per_inverter=3,
albedo='urban', module_type='glass_polymer',
racking_model='insulated_back', name='Inverter1')
mc = ModelChain(system, self.pvlib_location)
weather = pvlib.iotools.get_psm3(self.latitude, self.longitude, self.nrel_key,
self.nrel_email, names=name,interval=60,
attributes=('air_temperature', 'dew_point', 'dhi', 'dni',
'ghi', 'surface_albedo', 'surface_pressure',
'wind_direction', 'wind_speed'),
leap_day=False, full_name='pvlib python',
affiliation='pvlib python', map_variables=True, timeout=30)[0]
weather.index.name = "utc_time"
result = mc.run_model(weather)
问题是 PVSystem
的 albedo
参数。参数 albedo
需要一个浮点数。另一方面,参数 surface_type
接受来自一种可能的表面类型的字符串。
PVSystem documentation
Surface types
正确的 PVSystem
调用应该是:
system = PVSystem(surface_tilt=20, surface_azimuth=210,
module_parameters=sandia_module,
inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters,
modules_per_string=5, strings_per_inverter=3,
surface_type='urban', module_type='glass_polymer',
racking_model='insulated_back', name='Inverter1')
我已经定义了我的模型,当我遇到以下错误时,我正在寻找生成结果:
UFuncTypeError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('float64'), dtype('<U5')) -> None
我的模型的简单版本如下所示:
temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
cec_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')
sandia_module = sandia_modules['Canadian_Solar_CS6X_300M__2013_']
cec_inverter = cec_inverters['ABB__PVI_3_0_OUTD_S_US__240V_']
pvlib_location = Location(latitude=self.latitude, longitude=self.longitude,
name=name, altitude=self.altitude, tz=self.tz)
system = PVSystem(surface_tilt=20, surface_azimuth=210,
module_parameters=sandia_module,
inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters,
modules_per_string=5, strings_per_inverter=3,
albedo='urban', module_type='glass_polymer',
racking_model='insulated_back', name='Inverter1')
mc = ModelChain(system, self.pvlib_location)
weather = pvlib.iotools.get_psm3(self.latitude, self.longitude, self.nrel_key,
self.nrel_email, names=name,interval=60,
attributes=('air_temperature', 'dew_point', 'dhi', 'dni',
'ghi', 'surface_albedo', 'surface_pressure',
'wind_direction', 'wind_speed'),
leap_day=False, full_name='pvlib python',
affiliation='pvlib python', map_variables=True, timeout=30)[0]
weather.index.name = "utc_time"
result = mc.run_model(weather)
问题是 PVSystem
的 albedo
参数。参数 albedo
需要一个浮点数。另一方面,参数 surface_type
接受来自一种可能的表面类型的字符串。
PVSystem documentation
Surface types
正确的 PVSystem
调用应该是:
system = PVSystem(surface_tilt=20, surface_azimuth=210,
module_parameters=sandia_module,
inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters,
modules_per_string=5, strings_per_inverter=3,
surface_type='urban', module_type='glass_polymer',
racking_model='insulated_back', name='Inverter1')