示例#1
0
from datetime import datetime
import pytz
import matplotlib.pyplot as plt
import statsmodels.api as sm

# custom code
import stats
import readers
from misc import upsample_df

# main program
demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/2018/heatCopRef2018weather2018HDD15.5.csv'
gas_temp_filename = '/home/malcolm/uclan/data/DailyTempGasExplorer2018.csv'
met_temp_filename = '/home/malcolm/uclan/data/hadcet_mean_2018.csv'

era5_temp = readers.read_demand(demand_filename, 'temperature')
# resample from hourly to daily
era5_temp = era5_temp.resample('D').mean()
# change index so only have date not time
era5_temp.index = pd.DatetimeIndex(pd.to_datetime(era5_temp.index).date)
print('ERA5')
# print(era5_temp.index)
print(era5_temp)

gas_temp = readers.read_gas(gas_temp_filename)
print('GAS')
print(gas_temp.index)
print(gas_temp)

met_temp = readers.read_hadcet(met_temp_filename)
print('MET')
    'dailytemp', 'hour', 'temp_dp', 'hdh', 'temp', 'cdh', 'surface_pressure'
]
#variables = weather.columns
predicted17 = forecast_demand(weather18[variables], electric_2018,
                              weather17[variables])
daily_predicted17 = predicted17.resample('D').sum()

# read resistive heat for 2018 and 2017

demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/2018/GBRef2018Weather2018I-Bbdew_resistive.csv'
heat_demand2018 = readers.read_copheat(demand_filename,
                                       ['electricity', 'temperature'])
resistive_heat_2018 = heat_demand2018['electricity'] * 1e-6
temperature_2018 = heat_demand2018['temperature']
demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/2017/GBRef2018Weather2017I-Bbdew_resistive.csv'
resistive_heat_2017 = readers.read_demand(demand_filename) * 1e-6
resistive_heat_2017.index = resistive_heat_2018.index

# subtract 2018 heat demand from 2018 electric and add 2017 heat.
#heat_that_is_electric_2018 = 0.06
#heat_that_is_electric_2017 = 0.06
heat_that_is_electric_2018 = electric_2018.sum(
) * 0.14 / resistive_heat_2018.sum()
heat_that_is_electric_2017 = electric_2017.sum(
) * 0.14 / resistive_heat_2017.sum()
print('Heat electric 2018 {} 2017 {}'.format(heat_that_is_electric_2018,
                                             heat_that_is_electric_2017))

# get the portion of heat the is currently electric
electric2018_heat = resistive_heat_2018 * heat_that_is_electric_2018
electric2018_no_heat = electric_2018 - electric2018_heat
示例#3
0
# custom code
import stats
import readers
from misc import upsample_df

# main program
# demand_filename = '/home/malcolm/uclan/tools/python/output/2018/heatCopRef2018weather2018HDD15.5.csv'
# demand_filename = '/home/malcolm/uclan/tools/python/output/2018/heatCopRef2018weather2018Ruhnau.csv'
# demand_filename = '/home/malcolm/uclan/tools/python/output/2018/heatCopRef2018weather2018Watson.csv'
# demand_filename = '/home/malcolm/uclan/tools/python/output/2018/Ref2018Weather2018Sbdew.csv'
# demand_filename = '/home/malcolm/uclan/tools/python/output/2018/Ref2018Weather2018Sbdew.csv'
demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/2018/Ref2018Weather2018Rbdew.csv'
supply_filename = '/home/malcolm/uclan/data/ElectricityDemandData_2018.csv'

# read the electricity demand
demand = readers.read_demand(demand_filename)
print('DEMAND')
print(demand.index)
print(demand)

electric = readers.read_electric_hourly(supply_filename)
# factor the generation to match the demand
# (imagine we added just enough solar and wind annually and then we can
#  look at net to see how much storage we might need )
supply = electric['EMBEDDED_WIND_GENERATION'] + electric[
    'EMBEDDED_SOLAR_GENERATION']
# print('Annual supply before up sample {}'.format(supply.sum()) )
# supply = supply.resample('60min').pad()
# supply = upsample_df(supply.resample,'60min')
# print('Annual supply after up sample {}'.format(supply.sum()) )
# supply = supply.resample('60min')
示例#4
0
model['2018'] = d2018

scotland_factor = 1.1  # ( Fragaki et. al )

# read historical electricity demand for reference year

demand_filename = '/home/malcolm/uclan/data/ElectricityDemandData_' + reference_year + '.csv'
demand_ref = readers.read_electric_hourly(demand_filename)
electric_ref = demand_ref['ENGLAND_WALES_DEMAND'] * scotland_factor

# read reference year electric heat series based on purely resistive heating
# so that it can be removed from the reference year series.

demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/{0:}/GBRef{0:}Weather{0:}I-Sbdew_resistive.csv'.format(
    reference_year)
ref_resistive_heat = readers.read_demand(demand_filename)

# read weather year electric heat for ref year 2050
demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/{0:}/GBRef2050Weather{0:}I-Sbdew.csv'.format(
    weather_year)
demand = readers.read_copheat(demand_filename,
                              ['electricity', 'heat', 'temperature'])

heat_weather = demand['heat']

#  To remove existing space and water heating from the electricity demand time
#  series for the reference year - subtract the resistive heat series

mod_electric_ref = electric_ref - (ref_resistive_heat * heat_that_is_electric)
mod_electric_ref.index = heat_weather.index