def test_StaticCPVSystem_get_iam_interp(): static_cpvsystem = cpvsystem.StaticCPVSystem( module_parameters=mod_params_cpv) iam = static_cpvsystem.get_iam(42, iam_model='interp') assert np.round(iam, 4) == 0.814
def test_StaticCPVSystem_get_iam_ashrae(): static_cpvsystem = cpvsystem.StaticCPVSystem( module_parameters=mod_params_cpv) aoi = static_cpvsystem.get_aoi(30, 225) iam = static_cpvsystem.get_iam(aoi, iam_model='ashrae') assert np.round(iam, 4) == 0.8917
def test_StaticCPVSystem_energy_daily(dia, energy): filename = Path(__file__).resolve().parent / dia meteo = pd.read_csv(filename, sep='\t', index_col='yyyy/mm/dd hh:mm', parse_dates=True) meteo.index = meteo.index.tz_localize('Europe/Madrid') location = pvlib.location.Location(latitude=40.4, longitude=-3.7, altitude=695, tz='Europe/Madrid') static_cpv_sys = cpvsystem.StaticCPVSystem( surface_tilt=30, surface_azimuth=180, module=None, module_parameters=mod_params_cpv, temperature_model_parameters=pvlib.temperature. TEMPERATURE_MODEL_PARAMETERS['pvsyst']['insulated'], modules_per_string=1, strings_per_inverter=1, inverter=None, inverter_parameters=None, racking_model="insulated", losses_parameters=None, name=None, ) meteo['dii'] = pvlib.irradiance.beam_component( static_cpv_sys.surface_tilt, static_cpv_sys.surface_azimuth, solar_zenith=location.get_solarposition(meteo.index).zenith, solar_azimuth=location.get_solarposition(meteo.index).azimuth, dni=meteo['Bn']) celltemp = static_cpv_sys.pvsyst_celltemp(meteo['dii'], meteo['Temp. Ai 1'], meteo['V.Vien.1']) diode_parameters = static_cpv_sys.calcparams_pvsyst(meteo['dii'], celltemp) dc = static_cpv_sys.singlediode(*diode_parameters) uf_am = static_cpv_sys.get_am_util_factor(airmass=location.get_airmass( meteo.index).airmass_absolute, ) uf_ta = static_cpv_sys.get_tempair_util_factor( temp_air=meteo['Temp. Ai 1'], ) uf_am_at = uf_am * mod_params_cpv['weight_am'] + \ uf_ta * mod_params_cpv['weight_temp'] uf_global = uf_am_at # since uf_aoi was deprecated, it's no more applied in this test assert (dc['p_mp'] * uf_global).sum() == energy
def test_StaticCPVSystem_get_effective_irradiance(): static_cpvsystem = cpvsystem.StaticCPVSystem( surface_tilt=32, surface_azimuth=135, module_parameters=mod_params_cpv) times = pd.date_range(start='20160101 1200-0700', end='20160101 1800-0700', freq='6H') location = pvlib.location.Location(latitude=32, longitude=-111) solar_position = location.get_solarposition(times) dni = pd.Series([900, 0], index=times) eff_irr = static_cpvsystem.get_effective_irradiance( solar_position['apparent_zenith'], solar_position['azimuth'], dni) expected = pd.Series(data=np.array([637.964408, 0.0]), index=times) pd.testing.assert_series_equal(eff_irr, expected, rtol=0.0001)
def test_StaticCPVSystem_energy_2019_05(data, energy=90509.11811618837): location = pvlib.location.Location(latitude=40.4, longitude=-3.7, altitude=695, tz='Europe/Madrid') solar_zenith = location.get_solarposition(data.index).zenith solar_azimuth = location.get_solarposition(data.index).azimuth static_cpv_sys = cpvsystem.StaticCPVSystem( surface_tilt=30, surface_azimuth=180, module=None, module_parameters=mod_params_cpv, modules_per_string=1, strings_per_inverter=1, inverter=None, inverter_parameters=None, racking_model="insulated", losses_parameters=None, name=None, ) data['aoi'] = static_cpv_sys.get_aoi(solar_zenith, solar_azimuth) data['dii_effective'] = data['dii'] * pvlib.iam.ashrae(data['aoi'], b=0.7) diode_parameters_cpv = static_cpv_sys.calcparams_pvsyst( data['dii_effective'], data['temp_cell_35']) dc_cpv = static_cpv_sys.singlediode(*diode_parameters_cpv) airmass_absolute = location.get_airmass(data.index).airmass_absolute # OJO uf_global NO incluye uf_aoi!! uf_global = static_cpv_sys.get_global_utilization_factor( airmass_absolute, data['temp_air']) assert (dc_cpv['p_mp'] * uf_global).sum() == energy
def test_StaticCPVSystem_get_aoi(): static_cpvsystem = cpvsystem.StaticCPVSystem(surface_tilt=32, surface_azimuth=135) aoi = static_cpvsystem.get_aoi(30, 225) assert np.round(aoi, 4) == 42.7408
def test_StaticHybridSystem_composicion_2019_05(data): location = pvlib.location.Location(latitude=40.4, longitude=-3.7, altitude=695, tz='Europe/Madrid') solar_zenith = location.get_solarposition(data.index).zenith solar_azimuth = location.get_solarposition(data.index).azimuth # StaticCPVSystem static_cpv_sys = cpvsystem.StaticCPVSystem( surface_tilt=30, surface_azimuth=180, module=None, module_parameters=mod_params_cpv, temperature_model_parameters=pvlib.temperature. TEMPERATURE_MODEL_PARAMETERS['pvsyst']['insulated'], modules_per_string=1, strings_per_inverter=1, inverter=None, inverter_parameters=None, racking_model="insulated", losses_parameters=None, name=None, ) data['aoi'] = static_cpv_sys.get_aoi(solar_zenith, solar_azimuth) data['dii_effective'] = data['dii'] * pvlib.iam.ashrae(data['aoi'], b=0.7) diode_parameters_cpv = static_cpv_sys.calcparams_pvsyst( data['dii_effective'], data['temp_cell_35']) dc_cpv = static_cpv_sys.singlediode(*diode_parameters_cpv) airmass_absolute = location.get_airmass(data.index).airmass_absolute # OJO uf_global NO incluye uf_aoi!! uf_global = static_cpv_sys.get_global_utilization_factor( airmass_absolute, data['temp_air']) # StaticFlatPlateSystem static_flatplate_sys = cpvsystem.StaticFlatPlateSystem( surface_tilt=30, surface_azimuth=180, module=None, module_parameters=mod_params_flatplate, modules_per_string=1, strings_per_inverter=1, inverter=None, inverter_parameters=None, racking_model="insulated", losses_parameters=None, name=None, ) # el aoi de difusa es el mismo que cpv data['poa_flatplate_static'] = static_flatplate_sys.get_irradiance( solar_zenith, solar_azimuth, aoi=data['aoi'], # aoi_limit=55, # ahora pasa por module_params # dii_effective no aplica, ya que si no el calculo de difusa es artificialmente alto! dii=data['dii'], gii=data['gii']) celltemp_flatplate = static_flatplate_sys.pvsyst_celltemp( data['poa_flatplate_static'], data['temp_air'], data['wind_speed']) diode_parameters_flatplate = static_flatplate_sys.calcparams_pvsyst( data['poa_flatplate_static'], celltemp_flatplate) dc_flatplate = static_flatplate_sys.singlediode( *diode_parameters_flatplate) # StaticHybridSystem static_hybrid_sys = cpvsystem.StaticHybridSystem( surface_tilt=30, surface_azimuth=180, module_cpv=None, module_flatplate=None, module_parameters_cpv=mod_params_cpv, module_parameters_flatplate=mod_params_flatplate, modules_per_string=1, strings_per_inverter=1, inverter=None, inverter_parameters=None, racking_model="insulated", losses_parameters=None, name=None, ) # get_effective_irradiance dii_effective_h, poa_flatplate_static_h = static_hybrid_sys.get_effective_irradiance( solar_zenith, solar_azimuth, dni=data['dni'], dii= None, # dii_effective no aplica, ya que si no el calculo de difusa es artificialmente alto! gii=data['gii'], ) assert np.allclose(data['dii_effective'], dii_effective_h, atol=1) is True assert np.allclose( data['poa_flatplate_static'], poa_flatplate_static_h, atol=1) is True # pvsyst_celltemp _, celltemp_flatplate_h = static_hybrid_sys.pvsyst_celltemp( dii=dii_effective_h, poa_flatplate_static=poa_flatplate_static_h, temp_air=data['temp_air'], wind_speed=data['wind_speed']) assert np.allclose(celltemp_flatplate, celltemp_flatplate_h, atol=1) is True # calcparams_pvsyst diode_parameters_cpv_h, diode_parameters_flatplate_h = static_hybrid_sys.calcparams_pvsyst( dii=dii_effective_h, poa_flatplate_static=poa_flatplate_static_h, temp_cell_cpv=data['temp_cell_35'], temp_cell_flatplate=celltemp_flatplate_h, ) for diode_param, diode_param_h in zip(diode_parameters_cpv, diode_parameters_cpv_h): assert np.allclose(diode_param, diode_param_h, atol=10) is True # singlediode airmass_absolute = location.get_airmass(data.index).airmass_absolute dc_cpv_h, dc_flatplate_h = static_hybrid_sys.singlediode( diode_parameters_cpv_h, diode_parameters_flatplate_h) for dc_param in dc_cpv: assert np.allclose(dc_cpv[dc_param], dc_cpv_h[dc_param], atol=1) is True for dc_param in dc_cpv: assert np.allclose(dc_flatplate[dc_param].fillna(0), dc_flatplate_h[dc_param].fillna(0), atol=100) is True # uf_global airmass_absolute = location.get_airmass(data.index).airmass_absolute uf_global_h = static_hybrid_sys.get_global_utilization_factor_cpv( airmass_absolute, data['temp_air']) assert np.allclose(uf_global, uf_global_h, atol=0.001) is True