# -*- coding: utf-8 -*- """ Created on Fri Jul 7 18:07:33 2023 @author: sixyp """ import pvlib # Set system location test_location = pvlib.location.Location(36, 10) # Import a weather file built by PVGIS according to latitude and longitude weather_data_with_albedo, _, _, _ = pvlib.iotools.get_pvgis_tmy( map_variables=True, latitude=test_location.latitude, longitude=test_location.longitude, outputformat='epw') # Example albedo value print("Random albedo value from the weather data: ", weather_data_with_albedo.albedo[0]) # Create a version of the weather data without the albedo column weather_data_without_albedo = weather_data_with_albedo.drop("albedo", axis=1) # Set an albedo - this value will be ignored when data is present test_albedo = 0.3 # Get the module from the SAM database test_module_parameters = pvlib.pvsystem.retrieve_sam('cecmod')[ 'Canadian_Solar_Inc__CS5C_80M'] # Build the array test_array = pvlib.pvsystem.Array( mount=pvlib.pvsystem.FixedMount( 50, 180, 'open_rack'), albedo=test_albedo, module_parameters=test_module_parameters, module_type='glass_polymer', modules_per_string=5, strings=1, ) # Build the system test_system = pvlib.pvsystem.PVSystem( arrays=[test_array], inverter_parameters=dict(pdc0=3) ) # Build the ModelChain test_mc = pvlib.modelchain.ModelChain( system=test_system, location=test_location, aoi_model='physical', spectral_model='no_loss') print("****Starting model without albedo****") test_mc.run_model(weather_data_without_albedo) print("****Finished model without albedo****") print("****Starting model with albedo****") test_mc.run_model(weather_data_with_albedo) print("****Finished running model with albedo****")