# (if its not, this could go negative) gas_energy = gas_energy - (non_heat_gas / 365.0) # temporary hack to test effect of scaling instead on # gas_energy = gas_energy * (space_and_water_gas[year] / total_gas) # print(gas_energy.head(7)) print('GAS ENERGY SMALLEST') print(gas_energy.nsmallest()) # account for boiler efficiency of 90% # (this is inconsistent as 80% is used for the EU buildings figures) gas_energy = gas_energy * 0.8 # optionally convert to net demand if net: electric = readers.read_electric(electric_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 ) electric_total = electric['EMBEDDED_WIND_GENERATION'] + electric[ 'EMBEDDED_SOLAR_GENERATION'] electric_total = electric_total * (gas_energy.sum() / electric_total.sum()) print(electric_total.head()) print(electric_total.tail()) # convert all to net demand gas_energy = gas_energy - electric_total space_and_water = space_and_water - electric_total watson_space_and_water = watson_space_and_water - electric_total hdd_space_and_water15 = hdd_space_and_water15 - electric_total hdd_space_and_water12 = hdd_space_and_water12 - electric_total
# create mean to represent whole country era_total = era_cf.sum(axis=1) / len(locations) midas_total = midas_cf.sum(axis=1) / len(locations) print(era_total) print(midas_total) # read in the ninja PV cf's for 2018 ninja = readers.read_ninja_country(ninja_filename_cfs) ninja = ninja['2018-01-01 00:00:00':'2018-12-31 23:00:00'] # convert to hourly by summing ninja = ninja.resample('D').mean() print(ninja) # read in national grid embedded generation and capacity national_grid = readers.read_electric(national_grid_filename) print(national_grid) # and calculate capacity factor. national_grid_cf = national_grid['EMBEDDED_SOLAR_GENERATION'] / national_grid[ 'EMBEDDED_SOLAR_CAPACITY'] print(national_grid_cf) # plot all 3 era_total.plot(label='era5') midas_total.plot(label='midas') ninja['national'].plot(label='ninja') national_grid_cf.plot(label='national grid') plt.title('2018 PV power capacity factors') plt.xlabel('Day of the year') plt.ylabel('Capacity factor') plt.legend(loc='upper right')
# water - water (100%) ashp_water = water * 0.9 / dt_water.apply(cop_ashp) # (10%) GSHP = 10.29 - 0.21 DT + 0.0012 DT2 # space - radiator (90%) gshp_space_radiator = space * 0.1 * 0.9 / dt_radiator.apply(cop_gshp) # space - floor (10%) gshp_space_floor = space * 0.1 * 0.1 / dt_floor.apply(cop_gshp) # water - water (10%) gshp_water = water * 0.1 / dt_water.apply(cop_gshp) electric_heat = ashp_space_radiator + ashp_space_floor + ashp_water + gshp_space_radiator + gshp_space_floor + gshp_water print(electric_heat) # read electric demand electric = readers.read_electric(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') print('SUPPLY') print(supply.index) print(supply) supply = supply * (electric_heat.sum() / supply.sum())
# output plots gas.plot(label='Gas Energy', fontsize=15) heat.plot(label='Heat Demand', fontsize=15) electric.plot(label='Electricity', fontsize=15) plt.title('Electricity gas and heat 2018') plt.xlabel('Day of the year', fontsize=15) plt.ylabel('Daily Demand (TWh)', fontsize=15) plt.legend(loc='upper right', fontsize=16) plt.show() # generation year = '2018' generation_filename = '/home/malcolm/uclan/data/ElectricityDemandData_' + year + '.csv' generation = readers.read_electric(generation_filename) pv = generation['EMBEDDED_SOLAR_GENERATION'] wind = generation['EMBEDDED_WIND_GENERATION'] pv = pv.resample('D').sum() wind = wind.resample('D').sum() pv = pv['2018-01-01':'2018-05-30'] wind = wind['2018-01-01':'2018-05-30'] gas.plot(label='Gas Energy', fontsize=15) heat.plot(label='Heat Demand', fontsize=15) electric.plot(label='Electricity', fontsize=15) wind.plot(label='Wind Generation', fontsize=15) pv.plot(label='Solar Generation', fontsize=15) plt.title('Electricity gas and heat 2018') plt.xlabel('Day of the year', fontsize=15) plt.ylabel('Daily Demand (TWh)', fontsize=15)