コード例 #1
0
def test_CPVSystem_get_irradiance():
    cpv_system = cpvsystem.CPVSystem()
    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)
    irrads = pd.DataFrame({
        'dni': [900, 0],
        'ghi': [600, 0],
        'dhi': [100, 0]
    },
                          index=times)

    irradiance = cpv_system.get_irradiance(solar_position['apparent_zenith'],
                                           solar_position['azimuth'],
                                           irrads['dni'], irrads['ghi'],
                                           irrads['dhi'])

    expected = pd.DataFrame(data=np.array(
        [[992.902225, 841.741664, 151.160560, 137.869177, 13.291383],
         [0., -0., 0., 0., 0.]]),
                            columns=[
                                'poa_global', 'poa_direct', 'poa_diffuse',
                                'poa_sky_diffuse', 'poa_ground_diffuse'
                            ],
                            index=times)

    pd.testing.assert_frame_equal(irradiance, expected, rtol=0.0001)
コード例 #2
0
def test_CPVSystem_get_tempair_util_factor():
    cpv_system = cpvsystem.CPVSystem(module_parameters=mod_params_cpv)

    times = pd.date_range(start='20160101 1200',
                          end='20160101 1500',
                          freq='3H')

    temp_air = pd.Series(data=np.array([5, 35]), index=times)

    ta_uf = cpv_system.get_am_util_factor(temp_air)

    expected = pd.Series(data=np.array([0.986546, 0.038553]), index=times)

    pd.testing.assert_series_equal(ta_uf, expected, rtol=0.0001)
コード例 #3
0
def test_CPVSystem_get_am_util_factor():
    cpv_system = cpvsystem.CPVSystem(module_parameters=mod_params_cpv)

    times = pd.date_range(start='20160101 1200',
                          end='20160101 1500',
                          freq='3H')

    airmass_absolute = pd.Series(data=np.array([2.056997, 3.241064]),
                                 index=times)

    am_uf = cpv_system.get_am_util_factor(airmass_absolute)

    expected = pd.Series(data=np.array([0.989757, 0.994575]), index=times)

    pd.testing.assert_series_equal(am_uf, expected, rtol=0.0001)
コード例 #4
0
def test_CPVSystem_get_global_utilization_factor():
    cpv_system = cpvsystem.CPVSystem(module_parameters=mod_params_cpv)

    times = pd.date_range(start='20160101 1200',
                          end='20160101 1500',
                          freq='3H')

    airmass_absolute = pd.Series(data=np.array([2.056997, 3.241064]),
                                 index=times)
    temp_air = pd.Series(data=np.array([5, 35]), index=times)

    uf_global = cpv_system.get_global_utilization_factor(
        airmass_absolute, temp_air)

    expected = pd.Series(data=np.array([0.822522, 0.940439]), index=times)

    pd.testing.assert_series_equal(uf_global, expected, rtol=0.0001)
コード例 #5
0
def test_CPVSystem_pvsyst_celltemp(mocker):
    parameter_set = 'freestanding'
    temp_model_params = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS[
        'pvsyst'][parameter_set]

    cpv_system = cpvsystem.CPVSystem(
        module_parameters=mod_params_cpv,
        temperature_model_parameters=temp_model_params)
    irrad = 800
    temp = 45
    wind = 0.5

    mocker.spy(pvlib.temperature, 'pvsyst_cell')
    out = cpv_system.pvsyst_celltemp(irrad, temp, wind)

    pvlib.temperature.pvsyst_cell.assert_called_once_with(
        irrad, temp, wind, temp_model_params['u_c'], temp_model_params['u_v'],
        mod_params_cpv['eta_m'], mod_params_cpv['alpha_absorption'])

    assert np.round(out, 4) == 61.8828