I am trying to model a system which supplies its electrical energy demand either out of grid energy which causes costs for the operator or supplies the demand out of renewable sources e.g. pv. Excess pv-energy is fed into the grid which causes negative costs or income for the operator. This is modeled by a two-way-transformer see sketch below:
The simulations result is an energy flow in both directions at the same timestep which I want to avoid. So my attempt was to formulate a constraint using the BinaryFlow-Class:
my_block = environ.Block()
def connect_flow_rule(m,t): expr = (om.BinaryFlow.status[load, Bus1, t] * om.flow[Bus1, feed,t] == 0 return expr my_block.flow_connect_constr = environ.Constraint(om.TIMESTEPS, rule = connect_flow_rule) om.add_component('ConnectFlow', my_block)
This causes a nonlinear problem similar to the topic in : Add constraints to Binary Flow
I guess there must be another formulation of the constraint but I can’t see it. Maybe someone has already had the same problem and can give advice!
Thanks in advance!