i am trying to add a spinning reserve constraint to my operational model.
here is the code:
SPINNING_RESERVE=0.2 srblock = Block() def spinning_reserve_rule(m, t): expr = om.BinaryFlow.status[generator, b_el, t] * (om.flows[generator, b_el].max[t]* om.flows[generator, b_el].nominal_value- om.flow[generator,b_el,t])\ >=feedin['demand_el'][t] * SPINNING_RESERVE return expr srblock.sr_constr = Constraint(om.TIMESTEPS, rule=spinning_reserve_rule) om.add_component('Spinning Reserve', srblock)
When i run the code, i get:
“ValueError: Solver unable to handle quadratic expressions. Constraint at issue: ‘Spinning Reserve.sr_constr’”
I don’t really see the problem. Why is that constraint considered a qudratic expression? Basically its a binary variable multiplied with a flow variable, similar to the constraints added to BinaryFlows within oemof.solph.blocks.BinaryFlows.
Thanks in advance for your advice!