def test_csp_different_timeindex(): r""" Test if differing time index raises error. """ E_dir_hor = pd.Series([30, 40], index=[1, 2]) t_amb = pd.Series([30, 40], index=[2, 3]) with pytest.raises(IndexError): csp.csp_precalc(20, 60, 10, 180, 0.9, 0.78, 0.816, 0.0622, 235, 300, t_amb, -8.65e-4, 8.87e-4, loss_method='Janotte', E_dir_hor=E_dir_hor)
def test_csp_wrong_loss_method(): with pytest.raises(ValueError): df = pd.DataFrame(data={ 'date': [1, 2], 'E_dir_hor': [30, 40], 't_amb': [30, 40] }) latitude = 23.614328 longitude = 58.545284 collector_tilt = 10 collector_azimuth = 180 cleanliness = 0.9 a_1 = -8.65e-4 a_2 = 8.87e-4 eta_0 = 0.78 c_1 = 0.816 c_2 = 0.0622 temp_collector_inlet = 235 temp_collector_outlet = 300 csp.csp_precalc(latitude, longitude, collector_tilt, collector_azimuth, cleanliness, eta_0, c_1, c_2, temp_collector_inlet, temp_collector_outlet, df['t_amb'], a_1, a_2, a_3=0, a_4=0, a_5=0, a_6=0, loss_method='quatsch')
collector_tilt = 10 collector_azimuth = 180 x = 0.9 a_1 = -0.00159 a_2 = 0.0000977 eta_0 = 0.816 c_1 = 0.0622 c_2 = 0.00023 temp_collector_inlet = 435 temp_collector_outlet = 500 # plot showing the difference between a constant efficiency without considering # cleaniness for the heat of the collector during a day data_precalc = csp_precalc(dataframe, periods, latitude, longitude, timezone, collector_tilt, collector_azimuth, x, a_1, a_2, eta_0, c_1, c_2, temp_collector_inlet, temp_collector_outlet, date_col='Datum', temp_amb_col='t_amb') heat_calc = data_precalc['collector_heat'] irradiance_on_collector = data_precalc['collector_irradiance'] / (x**1.5) heat_compare = irradiance_on_collector * eta_0 t = list(range(1, 25)) fig, ax = plt.subplots() ax.plot(t, heat_calc, label='CSP precalculation') ax.plot(t, heat_compare, label='constant efficiency') ax.set(xlabel='time (h)', ylabel='Q_coll', title='Heat of the collector') ax.grid()
def __init__(self, *args, **kwargs): kwargs.update({"_facade_requires_": ["longitude"]}) super().__init__(*args, **kwargs) self.label = kwargs.get("label") self.heat_bus = kwargs.get("heat_bus") self.electrical_bus = kwargs.get("electrical_bus") self.electrical_consumption = kwargs.get("electrical_consumption") self.additional_losses = kwargs.get("additional_losses") self.aperture_area = kwargs.get("aperture_area") self.latitude = kwargs.get("latitude") self.longitude = kwargs.get("longitude") self.collector_tilt = kwargs.get("collector_tilt") self.collector_azimuth = kwargs.get("collector_azimuth") self.cleanliness = kwargs.get("cleanliness") self.eta_0 = kwargs.get("eta_0") self.c_1 = kwargs.get("c_1") self.c_2 = kwargs.get("c_2") self.a_1 = kwargs.get("a_1") self.a_2 = kwargs.get("a_2") self.a_3 = kwargs.get("a_3", 0) self.a_4 = kwargs.get("a_4", 0) self.a_5 = kwargs.get("a_5", 0) self.a_6 = kwargs.get("a_6", 0) self.temp_collector_inlet = kwargs.get("temp_collector_inlet") self.temp_collector_outlet = kwargs.get("temp_collector_outlet") self.temp_amb = kwargs.get("temp_amb") self.loss_method = kwargs.get("loss_method") self.irradiance_method = kwargs.get("irradiance_method") self.irradiance = kwargs.get("irradiance") self.expandable = bool(kwargs.get("expandable", False)) if self.irradiance_method == "horizontal": heat = csp_precalc(self.latitude, self.longitude, self.collector_tilt, self.collector_azimuth, self.cleanliness, self.eta_0, self.c_1, self.c_2, self.temp_collector_inlet, self.temp_collector_outlet, self.temp_amb, self.a_1, self.a_2, self.a_3, self.a_4, self.a_5, self.a_6, loss_method=self.loss_method, irradiance_method=self.irradiance_method, E_dir_hor=self.irradiance) if self.irradiance_method == "normal": heat = csp_precalc(self.latitude, self.longitude, self.collector_tilt, self.collector_azimuth, self.cleanliness, self.eta_0, self.c_1, self.c_2, self.temp_collector_inlet, self.temp_collector_outlet, self.temp_amb, self.a_1, self.a_2, self.a_3, self.a_4, self.a_5, self.a_6, loss_method=self.loss_method, irradiance_method=self.irradiance_method, dni=self.irradiance) self.collectors_heat = heat['collector_heat'] self.build_solph_components()
a_2 = 0.0000977 eta_0 = 0.816 c_1 = 0.0622 c_2 = 0.00023 temp_collector_inlet = 435 temp_collector_outlet = 500 # plot showing the difference between a constant efficiency without considering # cleaniness for the heat of the collector during a day data_precalc = csp_precalc(latitude, longitude, collector_tilt, collector_azimuth, cleanliness, eta_0, c_1, c_2, temp_collector_inlet, temp_collector_outlet, dataframe['t_amb'], a_1, a_2, E_dir_hor=dataframe['E_dir_hor']) heat_calc = data_precalc['collector_heat'] irradiance_on_collector = (data_precalc['collector_irradiance'] / (cleanliness**1.5)) heat_compare = irradiance_on_collector * eta_0 t = list(range(1, 25)) fig, ax = plt.subplots() ax.plot(t, heat_calc, label='CSP precalculation')