Skip to content

Commit

Permalink
Adjustments to runme.py with fix #144
Browse files Browse the repository at this point in the history
* repositioning of input_file copying
* additionally copy runme.py
* fix scenario global limit due to renaming of global to global_prop
  • Loading branch information
maledo committed Sep 5, 2017
1 parent d3c5ff0 commit ef4b69a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions runme.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def scenario_stock_prices(data):

def scenario_co2_limit(data):
# change global CO2 limit
glob = data['global']
glob.loc['CO2 limit', 'value'] *= 0.05
global_prop = data['global_prop']
global_prop.loc['CO2 limit', 'value'] *= 0.05
return data


Expand Down Expand Up @@ -124,9 +124,6 @@ def run_scenario(input_file, timesteps, scenario, result_dir,
optim = setup_solver(optim, logfile=log_filename)
result = optim.solve(prob, tee=True)

# copy input file to result directory
shutil.copyfile(input_file, os.path.join(result_dir, input_file))

# save problem solution (and input data) to HDF5 file
urbs.save(prob, os.path.join(result_dir, '{}.h5'.format(sce)))

Expand All @@ -151,8 +148,13 @@ def run_scenario(input_file, timesteps, scenario, result_dir,
result_name = os.path.splitext(input_file)[0] # cut away file extension
result_dir = prepare_result_directory(result_name) # name + time stamp

# copy input file to result directory
shutil.copyfile(input_file, os.path.join(result_dir, input_file))
# copy runme.py to result directory
shutil.copyfile(__file__, os.path.join(result_dir, __file__))

# simulation timesteps
(offset, length) = (3500, 168) # time step selection
(offset, length) = (3500, 168) # time step selection
timesteps = range(offset, offset+length+1)

# plotting commodities/sites
Expand Down

0 comments on commit ef4b69a

Please sign in to comment.