diff --git a/doc/api.rst b/doc/api.rst index 1096624d..38e57126 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -123,7 +123,7 @@ result analysis scripts might be needed. These can be built on top of the following two **medium-level** functions. They retrieve all time-dependent and -independent quantities and return them as ready-to-use DataFrames. -.. function:: urbs.get_constants(prob) +.. function:: get_constants(prob) Return summary DataFrames for time-independent variables @@ -132,7 +132,7 @@ following two **medium-level** functions. They retrieve all time-dependent and :return: tuple of constants (costs, process, transmission, storage) -.. function:: urbs.get_timeseries(prob, com, sit, timesteps=None) +.. function:: get_timeseries(prob, com, sit, timesteps=None) Return DataFrames of all timeseries referring to a given commodity and site diff --git a/urbs.py b/urbs.py index 741b6e9c..4812bb2d 100644 --- a/urbs.py +++ b/urbs.py @@ -132,7 +132,7 @@ def create_model(data, timesteps=None, dt=1): """ m = pyomo.ConcreteModel() m.name = 'URBS' - m.created = datetime.now().strftime(%Y%m%dT%H%M%S) + m.created = datetime.now().strftime('%Y%m%dT%H%M%S') # Optional if not timesteps: @@ -151,7 +151,8 @@ def create_model(data, timesteps=None, dt=1): m.transmission = data['transmission'] m.storage = data['storage'] m.demand = data['demand'] - m.supim = data['supim'] + m.supim = data['supim'] + m.timesteps = timesteps # process input/output ratios m.r_in = m.process_commodity.xs('In', level='Direction')['ratio'] @@ -166,14 +167,14 @@ def create_model(data, timesteps=None, dt=1): # generate ordered time step sets m.t = pyomo.Set( - initialize=m.settings['timesteps'], + initialize=m.timesteps, ordered=True, doc='Set of timesteps') # modelled (i.e. excluding init time step for storage) time steps m.tm = pyomo.Set( within=m.t, - initialize=m.settings['timesteps'][1:], + initialize=m.timesteps[1:], ordered=True, doc='Set of modelled timesteps')