I would like to define a difference equation in pyomo for a temperature variable. The equation (simplified) looks like: $Temperature(t) = Temperature (t-1) + x(t)$ , for t>0
$Temperature (0) = 20 $
So this is what I tried in Pyomo
model.set_timeslots = pyo.RangeSet(0,95) model.variable_x = pyo.Var(model.set_timeslots, within=pyo.Binary) model.variable_temperature.fix(20) def temperatureConstraintRule(model): model.variable_temperature(t) = model.variable_temperature(t-1) + model.variable_x(t) model.constraint_temperature = pyo.Constraint (model.set_timeslots, rule=temperatureConstraintRule)
However, I get the error message "SyntaxError: can't assign to function call"
Can anybody tell me how I can implement this difference equation in Pyomo?