East-west model with PV GIS data

97 views
Skip to first unread message

Richard L.

unread,
Apr 4, 2024, 5:22:53 AM4/4/24
to pvlib-python
 Hello everyone!

I am currently working on a model for a PV system with east-west orientation and am trying to import data from PVGIS. However, I am encountering a problem that I do not fully understand and would appreciate your help.

The error occurs when I run modelchain.run_model in my code and is: TypeError: Input must be a tuple of length 2, got DataFrame.

Unfortunately, I've reached a point where I don't know what to do and hope that someone of you can shed some light on this. I would greatly appreciate any assistance or advice on how to solve this problem.

Many thanks in advance and best regards,
Richard
PV Simulation # Location lat = row['Coord_lat'] lon = row['Coord_long'] alti = row['altitude'] location = Location(latitude=lat, longitude=lon, tz='Europe/Berlin', altitude=alti, name='EDID NR_Test') arrays = [ Array(FixedMount(surface_tilt=(30), surface_azimuth=(270)), name = "West Facing Arra", module_parameters=module, temperature_model_parameters=temperature_parameters, modules_per_string=m_string, strings=s_inverter), Array(FixedMount(surface_tilt=(30), surface_azimuth=(90)), name = "East Facing Arra", module_parameters=module, temperature_model_parameters=temperature_parameters, modules_per_string=m_string, strings=s_inverter) ] system = PVSystem(arrays=arrays, inverter_parameters=inverter) modelchain = ModelChain(system, location) # PV-GIS of east-west system # east orientation poa_data_east, meta_east, inputs_east = pvlib.iotools.get_pvgis_hourly( latitude=lat, longitude=lon, start=start_, end=end_, raddatabase="PVGIS-SARAH2", components=True, surface_tilt=(30), # fixed tilt angle surface_azimuth=90, # Fixed alignment for east orientation outputformat='json', usehorizon=True, userhorizon=None, pvcalculation=False, peakpower=None, pvtechchoice='crystSi', mountingplace='free', loss=0, trackingtype=0, optimal_surface_tilt=False, optimalangles=False, url='https://re.jrc.ec.europa.eu/api/v5_2/', map_variables=True, timeout=30) # west orientation poa_data_west, meta_west, inputs_west = pvlib.iotools.get_pvgis_hourly( latitude=lat, longitude=lon, start=start_, end=end_, raddatabase="PVGIS-SARAH2", components=True, surface_tilt=(30), # fixed tilt angle surface_azimuth=-90, # Fixed alignment for west orientation outputformat='json', usehorizon=True, userhorizon=None, pvcalculation=False, peakpower=None, pvtechchoice='crystSi', mountingplace='free', loss=0, trackingtype=0, optimal_surface_tilt=False, optimalangles=False, url='https://re.jrc.ec.europa.eu/api/v5_2/', map_variables=True, timeout=30) poa_data_2020 = poa_data_east.add(poa_data_west, fill_value=0) poa_data_2020['poa_diffuse'] = poa_data_2020['poa_sky_diffuse'] + poa_data_2020['poa_ground_diffuse'] poa_data_2020['poa_global'] = poa_data_2020['poa_diffuse'] + poa_data_2020['poa_direct'] poa_data_2020.index = pd.to_datetime(poa_data_2020.index) modelchain.run_model_from_poa(poa_data_2020) total_production = modelchain.results.ac.sum()

kevina...@gmail.com

unread,
Apr 4, 2024, 8:13:16 AM4/4/24
to pvlib-python
Hello Richard,

When using run_model_from_poa, a separate weather/irradiance dataframe must be supplied for each Array:

> If the ModelChain’s PVSystem has multiple arrays, data must be a list or tuple with the same length and order as the PVsystem’s Arrays. Each element of data provides the irradiance and weather for the corresponding array.


So since you're using two Arrays, you need to pass in a list of the two dataframes you got back from PVGIS.  I'm not sure what the current code is doing (adding the dataframes together) makes any sense anyway (~2000 W/m2 irradiance and twice the ambient temperature?).

Cheers,
Kevin

Richard L.

unread,
Apr 4, 2024, 8:38:01 AM4/4/24
to pvlib-python
Hi Kevin

Many thanks for your reply. The hint has given me the right impulse and I think I have found my error. It seems to be working so far.

Thank you very much!

Richard

Here is the revised code snippet:

arrays = [ Array(FixedMount(surface_tilt=30, surface_azimuth=90), name="East Facing Array", module_parameters=module, temperature_model_parameters=temperature_parameters, modules_per_string=m_string, strings=s_inverter), Array(FixedMount(surface_tilt=30, surface_azimuth=270), name="West Facing Array", module_parameters=module, temperature_model_parameters=temperature_parameters, modules_per_string=m_string, strings=s_inverter) ] system = PVSystem(arrays=arrays, inverter_parameters=inverter) modelchain = ModelChain(system, location) # PV-GIS of east-west system # east orientation poa_data_east, meta_east, inputs_east = pvlib.iotools.get_pvgis_hourly( latitude=lat, longitude=lon, start=start_, end=end_, raddatabase="PVGIS-SARAH2", components=True, surface_tilt=(30), # fixed tilt angle surface_azimuth=90, # Fixed alignment for east orientation outputformat='json', usehorizon=True, userhorizon=None, pvcalculation=False, peakpower=None, pvtechchoice='crystSi', mountingplace='free', loss=0, trackingtype=0, optimal_surface_tilt=False, optimalangles=False, url='https://re.jrc.ec.europa.eu/api/v5_2/', map_variables=True, timeout=30) poa_data_east['poa_diffuse'] = poa_data_east['poa_sky_diffuse'] + poa_data_east['poa_ground_diffuse'] poa_data_east['poa_global'] = poa_data_east['poa_diffuse'] + poa_data_east['poa_direct'] # west orientation poa_data_west, meta_west, inputs_west = pvlib.iotools.get_pvgis_hourly( latitude=lat, longitude=lon, start=start_, end=end_, raddatabase="PVGIS-SARAH2", components=True, surface_tilt=(30), # fixed tilt angle surface_azimuth=-90, # Fixed alignment for west orientation outputformat='json', usehorizon=True, userhorizon=None, pvcalculation=False, peakpower=None, pvtechchoice='crystSi', mountingplace='free', loss=0, trackingtype=0, optimal_surface_tilt=False, optimalangles=False, url='https://re.jrc.ec.europa.eu/api/v5_2/', map_variables=True, timeout=30) poa_data_west['poa_diffuse'] = poa_data_west['poa_sky_diffuse'] + poa_data_west['poa_ground_diffuse'] poa_data_west['poa_global'] = poa_data_west['poa_diffuse'] + poa_data_west['poa_direct'] poa_data_east.index = pd.to_datetime(poa_data_east.index) poa_data_west.index = pd.to_datetime(poa_data_west.index) poa_data_2020 = (poa_data_east, poa_data_west) modelchain.run_model_from_poa(poa_data_2020)
Reply all
Reply to author
Forward
0 new messages