Skip to content

Commit

Permalink
Merge pull request #233 from maledo/pro-io-tuples
Browse files Browse the repository at this point in the history
Reduced e_pro_in and e_pro_out via already existing tuple sets
  • Loading branch information
KSchoenleber authored Mar 13, 2019
2 parents b17f53d + 7998cfa commit d51a777
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions urbs/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ def create_model(data, dt=1, timesteps=None, objective='cost',
within=pyomo.NonNegativeReals,
doc='Power flow (MW) through process')
m.e_pro_in = pyomo.Var(
m.tm, m.pro_tuples, m.com,
m.tm, m.pro_input_tuples,
within=pyomo.NonNegativeReals,
doc='Power flow of commodity into process (MW) per timestep')
m.e_pro_out = pyomo.Var(
m.tm, m.pro_tuples, m.com,
m.tm, m.pro_output_tuples,
within=pyomo.NonNegativeReals,
doc='Power flow out of process (MW) per timestep')

Expand Down
4 changes: 2 additions & 2 deletions urbs/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ def get_timeseries(instance, stf, com, sites, timesteps=None):
created = pd.DataFrame(index=timesteps)

consumed = get_entity(instance, 'e_pro_in')
consumed = consumed.xs([stf, com], level=['stf', 'com']).loc[timesteps]
try:
consumed = consumed.xs([stf, com], level=['stf', 'com']).loc[timesteps]
consumed = consumed.unstack(level='sit')[sites].fillna(0).sum(axis=1)
consumed = consumed.unstack(level='pro')
consumed = drop_all_zero_columns(consumed)
except KeyError:
consumed = pd.DataFrame(index=timesteps)
consumed = pd.DataFrame(index=timesteps[1:])

# TRANSMISSION
other_sites = (get_input(instance, 'site')
Expand Down

0 comments on commit d51a777

Please sign in to comment.