def default_residential_outputs_1(request, gsod_722880_2012_2014_weather_source): elec_model_params, gas_model_params, \ elec_annualized_usage, gas_annualized_usage, \ elec_gross_savings, gas_gross_savings, \ elec_rmse, gas_rmse, elec_r_squared, gas_r_squared, \ temp_unit, cdd_tmy, hdd_tmy, total_cdd, total_hdd \ = request.param period = Period(datetime(2012,1,1,tzinfo=pytz.utc), datetime(2014,12,31,tzinfo=pytz.utc)) retrofit_start_date = datetime(2013,6,1,tzinfo=pytz.utc) retrofit_completion_date = datetime(2013,8,1,tzinfo=pytz.utc) datetimes = generate_monthly_billing_datetimes(period,randint(30,31)) # generate electricity consumption elec_model = AverageDailyTemperatureSensitivityModel(cooling=True,heating=True) elec_params = { "base_daily_consumption": elec_model_params[0], "heating_balance_temperature": elec_model_params[1], "heating_slope": elec_model_params[2], "cooling_balance_temperature": elec_model_params[3], "cooling_slope": elec_model_params[4], } elec_gen = MonthlyBillingConsumptionGenerator("electricity", "kWh", temp_unit, elec_model, elec_params) elec_consumption_data = elec_gen.generate(gsod_722880_2012_2014_weather_source, datetimes) elec_consumption_kWh_per_day, elec_consumption_n_days = \ elec_consumption_data.average_daily_consumptions() elec_params = elec_model.param_type(elec_params) # generate natural_gas consumption gas_model = AverageDailyTemperatureSensitivityModel(cooling=False,heating=True) gas_params = { "base_daily_consumption": gas_model_params[0], "heating_balance_temperature": gas_model_params[1], "heating_slope": gas_model_params[2], } gas_gen = MonthlyBillingConsumptionGenerator("natural_gas", "therm", temp_unit, gas_model, gas_params) gas_consumption_data = gas_gen.generate(gsod_722880_2012_2014_weather_source, datetimes) gas_consumption_kWh_per_day, gas_consumption_n_days = \ gas_consumption_data.average_daily_consumptions() gas_params = gas_model.param_type(gas_params) fixture = elec_consumption_data, gas_consumption_data, \ elec_params, gas_params, \ elec_annualized_usage, gas_annualized_usage, \ elec_gross_savings, gas_gross_savings, \ elec_rmse, gas_rmse, \ elec_r_squared, gas_r_squared, \ elec_consumption_kWh_per_day, gas_consumption_kWh_per_day, \ elec_consumption_n_days, gas_consumption_n_days, \ temp_unit, retrofit_start_date, retrofit_completion_date, \ cdd_tmy, hdd_tmy, total_cdd, total_hdd return fixture
def bpi_2400_1(request,gsod_722880_2012_2014_weather_source): elec_param_list, gas_param_list, normal_cdd, normal_hdd, \ cvrmse_electricity, cvrmse_natural_gas, n_periods, time_span, \ total_cdd, total_hdd, temp_unit = request.param elec_params = { "base_daily_consumption": elec_param_list[0], "heating_balance_temperature": elec_param_list[1], "heating_slope": elec_param_list[2], "cooling_balance_temperature": elec_param_list[3], "cooling_slope": elec_param_list[4], } gas_params = { "base_daily_consumption": gas_param_list[0], "heating_balance_temperature": gas_param_list[1], "heating_slope": gas_param_list[2], } period = Period(datetime(2012, 1, 1, tzinfo=pytz.utc), datetime(2014, 12, 31, tzinfo=pytz.utc)) datetimes = generate_monthly_billing_datetimes(period, randint(30,31)) elec_model = AverageDailyTemperatureSensitivityModel(cooling=True, heating=True) gas_model = AverageDailyTemperatureSensitivityModel(cooling=False, heating=True) gen_elec = MonthlyBillingConsumptionGenerator("electricity", "kWh", temp_unit, elec_model, elec_params) gen_gas = MonthlyBillingConsumptionGenerator("natural_gas", "therm", temp_unit, gas_model, gas_params) elec_consumptions = gen_elec.generate(gsod_722880_2012_2014_weather_source, datetimes) gas_consumptions = gen_gas.generate(gsod_722880_2012_2014_weather_source, datetimes) average_daily_usages_elec = elec_consumptions.average_daily_consumptions()[0] average_daily_usages_gas = gas_consumptions.average_daily_consumptions()[0] return elec_consumptions, gas_consumptions, elec_param_list,\ gas_param_list, normal_cdd, normal_hdd, \ cvrmse_electricity, cvrmse_natural_gas, \ n_periods, time_span, total_cdd, total_hdd, temp_unit, \ average_daily_usages_elec, average_daily_usages_gas
def generated_consumption_data_with_n_periods_cdd_1(request, gsod_722880_2012_2014_weather_source): model_params, period, n_periods_1, n_periods_2, n_periods_3 = request.param model = AverageDailyTemperatureSensitivityModel(cooling=True,heating=True) params = { "base_daily_consumption": model_params[0], "heating_slope": model_params[1], "heating_balance_temperature": model_params[2], "cooling_slope": model_params[3], "cooling_balance_temperature": model_params[4] } gen = MonthlyBillingConsumptionGenerator("electricity", "kWh", "degF", model, params) datetimes = generate_monthly_billing_datetimes(period, dist=randint(30,31)) consumption_data = gen.generate(gsod_722880_2012_2014_weather_source, datetimes) return consumption_data, n_periods_1, n_periods_2, n_periods_3
def get_example_project(zipcode): # location location = Location(zipcode=zipcode) station = location.station weather_source = GSODWeatherSource(station,2011,2015) # model model_e = AverageDailyTemperatureSensitivityModel(cooling=True, heating=True) model_g = AverageDailyTemperatureSensitivityModel(cooling=False, heating=True) # model params params_e_b = { "cooling_slope": 1, "heating_slope": 1, "base_daily_consumption": 30, "cooling_balance_temperature": 73, "heating_balance_temperature": 68, } params_e_r = { "cooling_slope": .5, "heating_slope": .5, "base_daily_consumption": 15, "cooling_balance_temperature": 73, "heating_balance_temperature": 68, } params_g_b = { "heating_slope": .2, "base_daily_consumption": 2, "heating_balance_temperature": 68, } params_g_r = { "heating_slope": .1, "base_daily_consumption": 1, "heating_balance_temperature": 68, } #generators gen_e_b = MonthlyBillingConsumptionGenerator("electricity", "kWh", "degF", model_e, params_e_b) gen_e_r = MonthlyBillingConsumptionGenerator("electricity", "kWh", "degF", model_e, params_e_r) gen_g_b = MonthlyBillingConsumptionGenerator("natural_gas", "therm", "degF", model_g, params_g_b) gen_g_r = MonthlyBillingConsumptionGenerator("natural_gas", "therm", "degF", model_g, params_g_r) # time periods period = Period(datetime(2011,1,1,tzinfo=pytz.utc), datetime(2015,1,1,tzinfo=pytz.utc)) datetimes = generate_monthly_billing_datetimes(period, dist=randint(30,31)) # consumption data cd_e_b = gen_e_b.generate(weather_source, datetimes, daily_noise_dist=None) cd_e_r = gen_e_r.generate(weather_source, datetimes, daily_noise_dist=None) cd_g_b = gen_g_b.generate(weather_source, datetimes, daily_noise_dist=None) cd_g_r = gen_g_r.generate(weather_source, datetimes, daily_noise_dist=None) # periods periods = cd_e_b.periods() reporting_period = Period(datetime(2013,1,1,tzinfo=pytz.utc), datetime(2015,1,1,tzinfo=pytz.utc)) baseline_period = Period(datetime(2011,1,1,tzinfo=pytz.utc), datetime(2013,1,1,tzinfo=pytz.utc)) # records records_e = [] records_g = [] for e_b, e_r, g_b, g_r, p in zip(cd_e_b.data, cd_e_r.data, cd_g_b.data, cd_g_r.data, periods): e = e_r if p in reporting_period else e_b g = g_r if p in reporting_period else g_b record_e = {"start": p.start, "end": p.end, "value": e} record_g = {"start": p.start, "end": p.end, "value": g} records_e.append(record_e) records_g.append(record_g) # consumption_data cd_e = ConsumptionData(records_e, "electricity", "kWh", record_type="arbitrary") cd_g = ConsumptionData(records_g, "natural_gas", "therm", record_type="arbitrary") consumptions = [cd_e, cd_g] # project project = Project(location, consumptions, baseline_period, reporting_period) return project