i have a simple oemof model and i want to use it in an outer loop.
since v3.0 there is a native way to solve a single time step, but how can i feedback the solve results to my model and start the next time step?
i found this file git hub and line 84 should # write back results from optimization object to energysystem optimization_model.results()
but this only returns a dict or did i misunderstood something?
yes - after the model is solved in the first time step, i want to use the new SOC (found by the solver) of the storage for the next time step. furthermore, i have to change the demand of some sinks. these values are given by an outer loop.
the next time step is to be optimized with these new parameters.
Unfortunately, the access differs depending on the actual object you are changing. But generally it should work like this whereas om is your optimization model:
# Flow: Set upper bound
om.flow[(source, target), timestep].setub(my_value)
# Flow: Set value
om.flow[(source, target), timestep].value = my_value
# GenericStorage: Set upper bound (capacity)
om.GenericStorageBlock[(my_storage,), timestep].setub(my_value)
# GenericStorage: Set initial/end state of charge
om.GenericStorageBlock[(my_storage,),om.TIMESTEPS[-1]] = my_value * 0.5
om.GenericStorageBlock[(my_storage,),om.TIMESTEPS[-1]].fix()
# Other components: Set upper bound
om.MyComponent[my_component_instance, timestep].setub = my_value
# Other components: Set value
om.MyComponent[my_component_instance, timestep].value = my_value
Depending on the component you want to change, you might also have a look into the modules here which hold the different model blocks (blocks, components, custom): https://github.com/oemof/oemof/tree/dev/oemof/solph