-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/constraint flow idle #852
base: dev
Are you sure you want to change the base?
Conversation
To linearize the constraints, could express the products of two status variables x and y as a new variable z and set
Update This is outdated, as another approach has been chosen, described as an update in the first post. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the constraint, however, some improvements are needed:
- What's about time before the initial time step? Can you modify the constraint so that the status at (before) that time can be given?
- An example has to be added anyway.
- Giving time instead of steps would be great, but it's not a must, imho.
Adds a new constraint to the solph.constraints module which allows to define an "idle time" for a flow (flow2) depending on another flow (flow1), i.e. a number of timesteps that flow1 has to be inactive before flow2 can be active.
It can be created by
set_idle_time(model, f1, f2, n)
It involves a product of two binary variables and thus leads to a quadratic program. Pyomo thinks it is a valid lp file, though. I have read that some solvers do automatically convert this into a linear formulation. If any reviewer comes up with a simple way to set this up using linear terms only, your suggestion is welcome.
Update Tested it with cbc and gurobi. Cbc refuses to run because of the quadratic constraint, gurobi manages to solve it.
Update: I rewrote the constraint to make it linear. Now, there are separate conditions for the different timesteps. To be precise, for each timestep
t
the status of the dependent flow (which has to be idle for n timesteps after the first flow was active) is compared with the status of the independent flow in timestept,...,t-n
.TODOs: