Skip to content

Commit

Permalink
push to test docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
eggimasv authored and eggimasv committed Feb 22, 2017
1 parent 9c4a992 commit 11abdc1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
19 changes: 9 additions & 10 deletions energy_demand/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import main_functions as mf # Functions main module
import residential_model # Residential sub-module
import yaml
import numpy as np
#import datetime
#import os
#import numpy as np

print("Start Energy Demand Model with python version: " + str(sys.version))

Expand Down Expand Up @@ -91,7 +89,7 @@ def load_data():
fuel_bd_data = mf.read_csv(path_base_data_fuel, float) # All disaggregated fuels for different regions
csv_temp_2015 = mf.read_csv(path_temp_2015) # csv_temp_2015
hourly_gas_shape = mf.read_csv(path_hourly_gas_shape, float) # Load hourly shape for gas from Robert Sansom
# Read in more date such as floor area, nr of households etc. for base year
# Read in more date such as floor area, nr of households etc. for base year

#print("reg_pop: " + str(reg_pop))
#print("Fuel data: " + str(fuel_bd_data))
Expand Down Expand Up @@ -241,17 +239,18 @@ def energy_demand_model(bd_internal, pop_data_external):

# Add electricity data to result dict for wrapper
fuel_type = 0 # Elec
result_dict = mf.add_electricity_demand(e_app_bd, fuel_type_lu, reg_pop, fuel_type, timesteps, result_dict, timesteps_own_selection)
result_dict = mf.add_demand_result_dict(e_app_bd, fuel_type_lu, reg_pop, fuel_type, timesteps, result_dict, timesteps_own_selection)

# Add gas data
fuel_type = 1 # gas
result_dict = mf.add_electricity_demand(g_hd_bd, fuel_type_lu, reg_pop, fuel_type, timesteps, result_dict, timesteps_own_selection)
result_dict = mf.add_demand_result_dict(g_hd_bd, fuel_type_lu, reg_pop, fuel_type, timesteps, result_dict, timesteps_own_selection)

# Write YAML file
# ---------------
#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)
yaml_write = False
if yaml_write: # == True:
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])))
Expand Down
18 changes: 5 additions & 13 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, own_timesteps):
def create_timesteps_app(date_list, bd_app_elec, reg_lu, fuel_type_lu, app_type_lu, timestep_dates):
'''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 @@ -188,10 +188,6 @@ def create_timesteps_app(date_list, bd_app_elec, reg_lu, fuel_type_lu, app_type_
# Region, Fuel
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 = own_timesteps

# Nuber of timesteps containing all days and hours
timesteps = range(len(timestep_dates))

Expand Down Expand Up @@ -228,7 +224,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, own_timesteps): # TODO: HIER GIBTS NOCH ERROR
def create_timesteps_hd(date_list, bd_hd_gas, reg_lu, fuel_type_lu, timestep_dates): # 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,10 +247,6 @@ def create_timesteps_hd(date_list, bd_hd_gas, reg_lu, fuel_type_lu, own_timestep
hours = range(24)
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 = own_timesteps

# Number of timesteps
timesteps = range(len(timestep_dates))

Expand Down Expand Up @@ -792,7 +784,7 @@ def get_own_position(daytype, _season, hour_container, timesteps_own_selection):



def add_electricity_demand(e_app_bd, fuel_type_lu, reg_pop, fuel_type, timesteps, result_dict, timesteps_own_selection):
def add_demand_result_dict(e_app_bd, fuel_type_lu, reg_pop, fuel_type, timesteps, result_dict, timesteps_own_selection):
"""Add data to wrapper timesteps
"""
Expand All @@ -809,7 +801,7 @@ def add_electricity_demand(e_app_bd, fuel_type_lu, reg_pop, fuel_type, timesteps
timestep_id = str(timestep)
_yearday = int(timestep.split("_")[0]) # Yearday
_h = int(timestep.split("_")[1]) # Hour
start_period, end_period = timesteps[timestep]['start'], timesteps[timestep]['end']
#start_period, end_period = timesteps[timestep]['start'], timesteps[timestep]['end']

# Assign correct data from selection
# Get season
Expand All @@ -823,7 +815,7 @@ def add_electricity_demand(e_app_bd, fuel_type_lu, reg_pop, fuel_type, timesteps

# Get position in own timesteps
hour_own_container = year_hour - _yearday * 24 #Hour of the day
day_own_container_position = get_own_position(daytype, _season, hour_own_container, timesteps_own_selection) # AS input should
#day_own_container_position = get_own_position(daytype, _season, hour_own_container, timesteps_own_selection) # AS input should
day_own_container_position = 1
#print("day_own_container: " + str(day_own_container))

Expand Down
3 changes: 3 additions & 0 deletions inputs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
decision variables: []
parameters: []
dependencies: []

0 comments on commit 11abdc1

Please sign in to comment.