Skip to content

Commit

Permalink
working on peak
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Eggimann committed Jan 10, 2019
1 parent 595b675 commit c09655f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 15 deletions.
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ More information on the model can be found in:

Eggimann, S., Hall, W.J., Eyre, N. (2019): A high-resolution spatio-temporal
energy demand simulation of large-scale heat pump diffusion to explore the
potential of heating demand side management. Applied Energy ,236, 997–1010.
potential of heating demand side management. Applied Energy, 236, 997–1010.
`https://doi.org/10.1016/j.apenergy.2018.12.052 <https://doi.org/10.1016/j.apenergy.2018.12.052>`_.


1. Download input data
---
-------------------------------------
Most data for running HIRE are freely available online. However,
for certain input data it is necessary to request access (for more information
on all necessary input datasets see `here <https://ed.readthedocs.io/en/latest/documentation.html#data-sets>`_)
Expand All @@ -40,7 +41,7 @@ For data inquires, plese contact sven.eggimann@ouce.ox.ac.uk or `the consortium
Also check whether data area available `here <https://www.nismod.ac.uk>`_).

2. Initialising and running the model (local)
---
-------------------------------------
The recommended installation method is to use `conda <http://conda.pydata.org/miniconda.html>`_,
which handles packages and virtual environments. First, create a conda environment

Expand Down
26 changes: 23 additions & 3 deletions energy_demand/enduse_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ def load_shifting(
fuel_yh : array
Fuel of yh
"""

# Get assumed load shift
if dm_improvement[enduse][curr_yr] == 0:
pass # no load management
Expand All @@ -421,12 +420,32 @@ def load_shifting(
param_lf_improved_cy,
loadfactor_yd_cy)

#import copy
#_a = copy.copy(fuel_yh)

fuel_yh = lf.peak_shaving_max_min(
lf_improved_cy,
average_fuel_yd,
fuel_yh,
mode_constrained)


'''import matplotlib.pyplot as plt
print(fuel_yh.shape)
plt.plot(fuel_yh[10], label="after")
plt.plot(_a[10], label="before")
plt.legend()
plt.show()
print("----")
# Get maximum hour for electricity demand
_sum_dayily = np.sum(fuel_yh, axis=0)
_peak_day = np.argmax(_sum_dayily)
__max_after = fuel_yh.argmax(fuel_yh[_peak_day])
__max_before = fuel_yh.argmax(_a[_peak_day])
print("befire; {} after: {}".format(__max_before, __max_after))'''

# -------------------------------------------------
# Convert all load profiles into flat load profiles
# -------------------------------------------------
Expand Down Expand Up @@ -466,10 +485,11 @@ def calc_lf_improvement(
True: Peak is shifted, False: Peak isn't shifed
"""
# Add load factor improvement to current year load factor
lf_improved_cy = loadfactor_yd_cy + param_lf_improved_cy * 100
lf_improved_cy = loadfactor_yd_cy + param_lf_improved_cy #* 100

# Where load factor larger than zero, set to 1
lf_improved_cy[lf_improved_cy > 100] = 100
#lf_improved_cy[lf_improved_cy > 1] = 100
lf_improved_cy[lf_improved_cy > 1] = 1

return lf_improved_cy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def main(
path_shapefile_input="C:/Users/cenv0553/ED/data/energy_demand/region_definitions/lad_2016_uk_simplified.shp"

main(
scenarios_path="C:/_FF",
scenarios_path="C:/_FFF",
path_shapefile_input=path_shapefile_input,
base_yr=2015,
simulation_yrs_to_plot=[2015, 2050])
Expand Down
1 change: 0 additions & 1 deletion energy_demand/result_processing/paper_II.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def paper_II_plots(
# Chose which plots should be generated
plot_crit_dict = {


# Scenario plots
'scenario_plots': False, #True,

Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions energy_demand/scripts/cluster_execution_weather_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ def my_function(simulation_number):

run_name = '_low'

all_weather_stations = False

same_weather_yr = True
defined_weather_yr = 2015

run_smif = False

# --------------------------
Expand Down
6 changes: 4 additions & 2 deletions tests/profiles/test_load_factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_peak_shaving_max_min():
fuel_yh,
mode_constrained=False)

'''import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
print(fuel_yh.shape)
print(fuel_yh[0][0])
print("--")
Expand All @@ -45,7 +45,7 @@ def test_peak_shaving_max_min():
plt.plot(result[0][0], label="after")
plt.legend()
plt.show()
print("----")'''
print("----")

# ---------
# expected
Expand All @@ -64,6 +64,8 @@ def test_peak_shaving_max_min():

np.testing.assert_equal(result, fuel_yh_expected)

test_peak_shaving_max_min()

def test_calc_lf_d():
"""Test
"""
Expand Down

0 comments on commit c09655f

Please sign in to comment.