#print(weather['hour'])
#print(weather['hour'].isna().sum())

espini = args.espini
year = '2018'
electric_2018 = get_demand('2018', espini)
#print(electric_2018)

# input assumptions for reference year
heat_that_is_electric = 0.06  # my spreadsheet from DUKES
heat_that_is_heat_pumps = 0.01  # greenmatch.co.uk, renewableenergyhub.co.uk
# remove the existing heat
if args.noheat:
    demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/{0:}/GBRef{0:}Weather{0:}I-Bbdew_resistive.csv'.format(
        year)
    ref_resistive = readers.read_copheat(demand_filename,
                                         ['electricity', 'temperature'])
    ref_resistive_heat = ref_resistive['electricity']
    ref_temperature = ref_resistive['temperature']

    #  To remove existing space and water heating from the electricity demand time
    #  series for the reference year - subtract the resistive heat series
    #  ( even if using historic series we calculate it so can scale to it )

    unmodified = electric_2018.copy()
    existing_heat = ref_resistive_heat * heat_that_is_electric * 1e-6
    electric_2018 = electric_2018 - existing_heat

    if args.plot:
        unmodified.resample('D').sum().plot(color='blue',
                                            label='Unmodified electicity')
        existing_heat.resample('D').sum().plot(color='red', label='Heat')
                    default=False)
args = parser.parse_args()

# gas % of heat
gas_heat = {'2016': 0.696, '2017': 0.695, '2018': 0.703, '2019': 0.70}

demand_filename = '/home/malcolm/uclan/data/electricity/espeni.csv'
demand = readers.read_espeni(demand_filename, args.year)
# convert from MWh to GWh
electric = demand * 1e-3

# read electric heat

demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/{}/GBRef{}Weather{}I-{}{}.csv'.format(
    args.year, args.year, args.year, args.method, args.profile)
heat_demand = readers.read_copheat(demand_filename,
                                   ['electricity', 'temperature'])
# convert from MWh to GWh
electric_heat = heat_demand['electricity'] * 1e-3

# factor electric heat to all current gas heating
electric_heat = electric_heat * gas_heat[args.year]

# add electric heat to historic
new_electric = electric + electric_heat

# look at ramp rates etc and annual demands and peak
peaks_header()
peaks(args.method, args.profile, new_electric)
peaks('Historic', 'Historic', electric)

# daily plots
Beispiel #3
0
import statsmodels.api as sm

# custom code
import stats
import readers
from misc import upsample_df

# main program
weather_year = '2018'
gas_filename = '/home/malcolm/uclan/data/GasLDZOfftakeEnergy' + weather_year + '.csv'
supply_filename = '/home/malcolm/uclan/data/ElectricityDemandData_2018.csv'
demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/2018/Ref2018Weather2018Rbdew.csv'

# read the cop from the heatandcop ouput
demand = readers.read_copheat(demand_filename, [
    'ASHP_floor', 'ASHP_radiator', 'ASHP_water', 'GSHP_floor', 'GSHP_radiator',
    'GSHP_water'
])

# convert to daily
demand = demand.resample('D').mean()
print(demand)

# read the gas
gas = readers.read_gas(gas_filename)

# convert to TWh
gas = gas * 1e-9
print(gas)

# scale gas by 0.8 to convert to heat
gas = gas * 0.8
Beispiel #4
0
    cop = 6.08 - (0.09 * temperature) + (0.0005 * temperature * temperature)
    return cop * 0.85


# 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/Ref2018Weather2018Wbdew.csv'
demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/2018/GBRef2018Weather2018I-Sbdew.csv'
# demand_filename = '/home/malcolm/uclan/tools/python/output/2018/Ref2018Weather2018Sbdew.csv'
# demand_filename = '/home/malcolm/uclan/tools/python/output/2018/Ref2018Weather2018Rbdew.csv'
supply_filename = '/home/malcolm/uclan/data/ElectricityDemandData_2018.csv'

# read heat demand and temp
demand = readers.read_copheat(demand_filename,
                              ['space', 'water', 'temperature'])
# print('DEMAND')
# print(demand)
space = demand['space']
space = space.resample('D').sum()
print('space')
print(space)
water = demand['water']
water = water.resample('D').sum()
temperature = demand['temperature']
temperature = temperature.resample('D').mean()
print('temp')
print(temperature)

# sink = 40-T, minimum 15
# NOTE: this is wierd because if sink=40-T, then DeltaT = sink - T = 40-2*T
Beispiel #5
0
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

#  annual demand of reference year with resistive heating removed.
annual_ref = mod_electric_ref.sum()
#  from fes 2019
annual_model = (model[model_year]['electricity_residential'] +
                model[model_year]['electricity_industry']) * 1000000
# scale to 2050
Beispiel #6
0
import sys
import pandas as pd
from datetime import datetime
import pytz
import matplotlib.pyplot as plt
import statsmodels.api as sm

# custom code
import stats
import readers

# 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/Ref2018Weather2018Sflat.csv'
daily_filename = '/home/malcolm/uclan/tools/python/output/2018/Ref2018Weather2018SflatDaily.csv'

demand = readers.read_copheat(demand_filename, ['space', 'water', 'heat'])
print('DEMAND')
print(demand.index)
print(demand)
daily = demand.resample('D').sum()
print('DAILY')
print(daily.index)
print(daily)
# Timestamp
index = pd.DatetimeIndex(daily.index)
daily.index = index.strftime('%Y-%m-%dT%H:%M:%SZ')
daily.to_csv(daily_filename, sep=',', decimal='.', float_format='%g')
Beispiel #7
0
import matplotlib.pyplot as plt
import readers

# main program

# read 2018 historical electricity demand

scotland_factor = 1.1  # ( Fragaki et. al )
demand_filename = '/home/malcolm/uclan/data/ElectricityDemandData_2018.csv'
demand18 = readers.read_electric_hourly(demand_filename)
electric = demand18['ENGLAND_WALES_DEMAND'] * scotland_factor

# read 2018 heat demand for each method

hdd155_filename = "/home/malcolm/uclan/tools/python/scripts/heat/output/2018/GBRef2018Weather2018I-Sbdew.csv"
heat = readers.read_copheat(hdd155_filename, ['heat'])

# read historic gas demand
year = '2018'
gas_filename = '/home/malcolm/uclan/data/GasLDZOfftakeEnergy' + year + '.csv'
gas = readers.read_gas(gas_filename)

# read the distribution of heating and pumps etc
# Read in combination of ASHP GSHP etc.

heating_path = "/home/malcolm/uclan/tools/python/scripts/heat/input"
parm_heat, parm_water = read.electric_parameters(heating_path, 'GB')

# Convert gas energy from kWh to MWh
gas = gas * (10**-3)
Beispiel #8
0
plt.legend(loc='upper right')
plt.show()

#  plot of combined
plt.plot(ref_method, label='Reference year method')
plt.plot(hist_method, label='Historic year method')
plt.title('GB Addition of Electric Heat')
plt.xlabel('Hour of the year')
plt.ylabel('Demand (MWh)')
plt.legend(loc='upper right')
plt.show()

#  heat demand and data for daily and monthly plots

cop_heat17 = readers.read_copheat(
    demand_filename,
    parms=['heat', 'temperature', 'ASHP_radiator', 'ASHP_water'])
# mod_electric17 = electric18.values - (resistive_heat.values * heat_that_is_electric)
# mod_electric17 = electric18.values - (resistive_heat.values * heat_that_is_electric)
print('heat_that_is_electric {}'.format(heat_that_is_electric))
print('resistive_heat')
print(resistive_heat)
heat_in17 = resistive_heat * heat_that_is_electric
print('heat_in17')
print(heat_in17)
mod_electric17 = electric18 - heat_in17
print('mod_electric17')
mod_electric17.index = heat17.index
print(mod_electric17)
print('ref_method')
ref_method = mod_electric17 + heat17
Beispiel #9
0
import pandas as pd
import matplotlib.pyplot as plt
# custom code
import stats
import readers

year = 2018
reference = 2018
file_base = 'Brhpp_copS'
demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/{0:}/GBRef{1:}Weather{0:}I-{2:}.csv'.format(year, reference, file_base)
demand_r = readers.read_copheat(demand_filename,['electricity','heat','temperature'])
file_base = 'Brhpp_copR'
demand_filename = '/home/malcolm/uclan/tools/python/scripts/heat/output/{0:}/GBRef{1:}Weather{0:}I-{2:}.csv'.format(year, reference, file_base)
demand_s = readers.read_copheat(demand_filename,['electricity','heat','temperature'])

stats.print_stats_header()
stats.print_stats(demand_r['electricity'], demand_s['electricity'], 'BDEW', 2, False)


dailyr = demand_r['electricity'].resample('D').sum() * 1e-6
dailys = demand_s['electricity'].resample('D').sum() * 1e-6

print('Total electric heat: Ruhnau {:.2f} Staffel {:.2f}'.format(dailyr.sum(), dailys.sum() ) )

dailyr.plot(label='Electric Heat Ruhnau COP')
dailys.plot(label='Electric Heat Staffel COP')
plt.title('Comparison of using different COP curve for electric heat')
plt.xlabel('Day of the year', fontsize=15)
plt.ylabel('Demand (kWh)', fontsize=15)
plt.legend(loc='upper right', fontsize=15)
plt.show()