Example #1
0
def ajuste_temp_pvsyst_cell(data, grafica=True):
    def f(meteo_inputs, u_c, u_v, eta_m, alpha_absorption):
        poa_global, temp_air, wind_speed = meteo_inputs
        return pvsyst_cell(poa_global, temp_air, wind_speed, u_c, u_v, eta_m,
                           alpha_absorption)

    (u_c, u_v, eta_m, alpha_absorption), pcov = curve_fit(
        f, (data.dni, data.temp_air, data.wind_speed), data.temp_cell_35)

    temp_cell_35_est_pvsyst = pvsyst_cell(data.dni, data.temp_air,
                                          data.wind_speed, u_c, u_v, eta_m,
                                          alpha_absorption)

    residuals_pvsyst = data.temp_cell_35 - temp_cell_35_est_pvsyst
    RMSE_pvsyst = np.sqrt(((residuals_pvsyst)**2).mean())
    print('RMSE PVSyst_cell:', RMSE_pvsyst)

    if grafica:
        plt.figure()
        plt.hist2d(data.temp_cell_35, temp_cell_35_est_pvsyst, bins=30)
        plt.grid(True)

        plt.figure()
        plt.hist(residuals_pvsyst, bins=100)

    return u_c, u_v, eta_m, alpha_absorption
def test_pvsyst_cell_ndarray():
    temps = np.array([0, 10, 5])
    irrads = np.array([0, 500, 0])
    winds = np.array([10, 5, 0])
    result = temperature.pvsyst_cell(irrads, temps, wind_speed=winds)
    expected = np.array([0.0, 23.96551, 5.0])
    assert_allclose(expected, result, 3)
def test_pvsyst_cell_kwargs():
    result = temperature.pvsyst_cell(900,
                                     20,
                                     wind_speed=5.0,
                                     u_c=23.5,
                                     u_v=6.25,
                                     eta_m=0.1)
    assert_allclose(result, 33.315, 0.001)
def test_pvsyst_cell_series():
    times = pd.date_range(start="2015-01-01", end="2015-01-02", freq="12H")
    temps = pd.Series([0, 10, 5], index=times)
    irrads = pd.Series([0, 500, 0], index=times)
    winds = pd.Series([10, 5, 0], index=times)

    result = temperature.pvsyst_cell(irrads, temps, wind_speed=winds)
    expected = pd.Series([0.0, 23.96551, 5.0], index=times)
    assert_series_equal(expected, result)
def test_pvsyst_cell_eta_m_deprecated():
    with pytest.warns(pvlibDeprecationWarning):
        result = temperature.pvsyst_cell(900,
                                         20,
                                         wind_speed=5.0,
                                         u_c=23.5,
                                         u_v=6.25,
                                         eta_m=0.1)
        assert_allclose(result, 33.315, 0.001)
def test_pvsyst_cell_default():
    result = temperature.pvsyst_cell(900, 20, 5)
    assert_allclose(result, 45.137, 0.001)
Example #7
0
 def f(meteo_inputs, u_c, u_v, eta_m, alpha_absorption):
     poa_global, temp_air, wind_speed = meteo_inputs
     return pvsyst_cell(poa_global, temp_air, wind_speed, u_c, u_v, eta_m,
                        alpha_absorption)
Example #8
0
plt.figure()
plt.hist2d(data.temp_cell_35, temp_cell_35_est_sapm, bins=30)
plt.grid(True)
plt.figure()
plt.hist(residuals_sapm, bins=100)


#%% Ajuste pvsyst_cell
def f_pvsyst(meteo_inputs, u_c, u_v, eta_m, alpha_absorption):
    poa_global, temp_air, wind_speed = meteo_inputs
    return pvsyst_cell(poa_global, temp_air, wind_speed, u_c, u_v, eta_m,
                       alpha_absorption)


(u_c, u_v, eta_m, alpha_absorption), pcov = curve_fit(
    f_pvsyst, (data.dii, data.temp_air, data.wind_speed), data.temp_cell_35)
print("u_c, u_v, eta_m, alpha_absorption =", u_c, u_v, eta_m, alpha_absorption)

temp_cell_35_est_pvsyst = pvsyst_cell(data.dii, data.temp_air, data.wind_speed,
                                      u_c, u_v, eta_m, alpha_absorption)

residuals_pvsyst = data.temp_cell_35 - temp_cell_35_est_pvsyst
RMSE_pvsyst = np.sqrt(((residuals_pvsyst)**2).mean())
print(RMSE_pvsyst)

plt.figure()
plt.hist2d(data.temp_cell_35, temp_cell_35_est_pvsyst, bins=30)
plt.grid(True)
plt.figure()
plt.hist(residuals_pvsyst, bins=100)