Skip to content

Commit

Permalink
added all yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Eggimann authored and Sven Eggimann committed Feb 22, 2017
1 parent f38a589 commit 9c4a992
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 12 deletions.
16 changes: 8 additions & 8 deletions energy_demand/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def load_data():
"""

# -------------------
# -------------------
# Local paths to data
# -------------------
path_main = r'C:\Users\cenv0553\GIT\NISMODII\data'
Expand Down Expand Up @@ -137,13 +137,13 @@ def load_data():
)

# Create own timesteps
#own_timesteps = mf.create_own_timesteps(timesteps_own_selection)
own_timesteps = mf.own_timesteps(timesteps_own_selection)

# Populate timesteps base year data (appliances, electricity)
timesteps_app_bd = mf.create_timesteps_app(timesteps_own_selection, bd_app_elec, reg_lu, fuel_type_lu, app_type_lu) # [GWh]
timesteps_app_bd = mf.create_timesteps_app(timesteps_own_selection, bd_app_elec, reg_lu, fuel_type_lu, app_type_lu, own_timesteps) # [GWh]

# Populate timesteps base year data (heating demand, ga)
timesteps_hd_bd = mf.create_timesteps_hd(timesteps_own_selection, bd_hd_gas, reg_lu, fuel_type_lu) # [GWh]
timesteps_hd_bd = mf.create_timesteps_hd(timesteps_own_selection, bd_hd_gas, reg_lu, fuel_type_lu, own_timesteps) # [GWh]

print("----------------------Statistics--------------------")
print("Number of timesteps appliances: " + str(len(timesteps_app_bd[0][0])))
Expand Down Expand Up @@ -249,10 +249,10 @@ def energy_demand_model(bd_internal, pop_data_external):

# Write YAML file
# ---------------
path_YAML = r'C:\Users\cenv0553\GIT\NISMODII\TESTYAML.yaml'
with open(path_YAML, 'w') as outfile:
yaml.dump(yaml_list, outfile, default_flow_style=False)
# l = [{'id': value, 'start': 'p', 'end': 'P2', }
#path_YAML = r'C:\Users\cenv0553\GIT\NISMODII\TESTYAML.yaml' # l = [{'id': value, 'start': 'p', 'end': 'P2', }
#with open(path_YAML, 'w') as outfile:
# yaml.dump(yaml_list, outfile, default_flow_style=False)

print("FINAL Fueltype: " + str(len(result_dict)))
print("FINAL region: " + str(len(result_dict[0])))
print("FINAL timesteps: " + str(len(result_dict[0][0])))
Expand Down
10 changes: 6 additions & 4 deletions energy_demand/main_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def get_dates_datelist(date_list):
timestep_dates.append(j)
return timestep_dates

def create_timesteps_app(date_list, bd_app_elec, reg_lu, fuel_type_lu, app_type_lu):
def create_timesteps_app(date_list, bd_app_elec, reg_lu, fuel_type_lu, app_type_lu, own_timesteps):
'''Creates the timesteps for which the energy demand of the appliances is calculated.
Then base energy demand is added for each timestep read in from yearly demand aray.
Expand All @@ -189,7 +189,8 @@ def create_timesteps_app(date_list, bd_app_elec, reg_lu, fuel_type_lu, app_type_
fuel_type = 0 #elec

# Generate a list with all dates (the same date is added 24 times each because of 24 hours)
timestep_dates = get_dates_datelist(date_list)
#timestep_dates = get_dates_datelist(date_list)
timestep_dates = own_timesteps

# Nuber of timesteps containing all days and hours
timesteps = range(len(timestep_dates))
Expand Down Expand Up @@ -227,7 +228,7 @@ def create_timesteps_app(date_list, bd_app_elec, reg_lu, fuel_type_lu, app_type_

return data_timesteps_elec

def create_timesteps_hd(date_list, bd_hd_gas, reg_lu, fuel_type_lu): # TODO: HIER GIBTS NOCH ERROR
def create_timesteps_hd(date_list, bd_hd_gas, reg_lu, fuel_type_lu, own_timesteps): # TODO: HIER GIBTS NOCH ERROR
'''
This function creates the simulation time steps for which the heating energy is calculated.
Then it selects energy demand from the yearl list for the simulation period.
Expand All @@ -251,7 +252,8 @@ def create_timesteps_hd(date_list, bd_hd_gas, reg_lu, fuel_type_lu): # TODO: HIE
fuel_type = 1 #gas

# Generate a list with all dates (the same date is added 24 times each because of 24 hours)
timestep_dates = get_dates_datelist(date_list)
#timestep_dates = get_dates_datelist(date_list)
timestep_dates = own_timesteps

# Number of timesteps
timesteps = range(len(timestep_dates))
Expand Down
Empty file added inputs.yaml
Empty file.
17 changes: 17 additions & 0 deletions model.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sector_models:
- name: energy_demand
path: /vagrant/models/energy_demand/run.py
classname: EnergyDemandModel
config_dir: "."
timesteps: timesteps.yaml
planning:
pre_specified:
use: true
files:
- pre-specified.yaml # The build instructions
rule_based:
use: false
files: []
optimisation:
use: false
files: []
1 change: 1 addition & 0 deletions outputs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metrics: []
19 changes: 19 additions & 0 deletions TESTYAML.yaml → time_intervals.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# Specify the mapping of model timesteps to durations within a year
# assume modelling 365 days (no extra day in leap years, no leap seconds)

# Each time interval must have
# - start (period since beginning of year)
# - end (period since beginning of year)
# - id (label to use when passing between integration layer and sector model)

# use ISO 8601 duration format to specify periods = P[n]Y[n]M[n]DT[n]H[n]M[n]S
# - https://en.wikipedia.org/wiki/ISO_8601#Durations

# Here we specify monthly values, assuming the model has a four outputs, each
# corresponding to a typical month in the given season, we map the model outputs
# to the whole year's duration.

# If the model were to output an hourly value instead, we would map that to 8760
# intervals, each one hour long, again covering the whole year.


- end: P1H
id: '0_0'
start: P0H
Expand Down
4 changes: 4 additions & 0 deletions timestepy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- 2010
- 2011
- 2012
- 2013

0 comments on commit 9c4a992

Please sign in to comment.