Hello everybody, i am pretty new in oemof and i have a question.
I have created a new component based on the “GenericStorage” component (through inheritance). So far everything is clear.
I now want to add further restrictions (pyomo constraints) to my new component like this:
def _my_function(energy_system_model):
for timestep in energy_system_model.TIMESTEPS:
.....
.....
setattr(energy_system_model, "myconstraint", pyomo.Constraint(energy_system_model.TIMESTEPS, noruleinit=True))
setattr(energy_system_model, "myconstraint_build", pyomo.BuildAction(rule=_my_function))
Previously i always added these constraints at the end, before solving the model and after creating the pyomo model. Like the following:
energy_system_model = oemof.solph.Model(energy_system)
add_all_model_constraints()
energy_system_model.solve('cbc', ....)
But now i want to add these restrictions automatically to the model when i create the model with the first instruction above.
How can i realize this?
Is there a special function for every component that is called automatically when the model is created?