Model predictive control using Vensim?

Use this forum to post Vensim related questions.
Post Reply
billh
Member
Posts: 45
Joined: Tue Jan 10, 2017 11:48 pm
Vensim version: DSS

Model predictive control using Vensim?

Post by billh »

Does anyone know of implementations of model predictive control (MPC) using Vensim?

I suspect it's just a matter of creating a model of the plant, complete with a VOC file to control optimization, and then writing wrapper code in R or Python or ... that sets up a command file that sets up and runs the optimization at the start of each action horizon.

I'm mostly curious if the infrastructure to do that has already been created and made publicly available (I haven't found anything yet), but I'd also be interested in hearing if anyone has had good--or bad--experiences trying MPC using a Vensim model for the plant and Powell optimization for the optimizer.
billh
Member
Posts: 45
Joined: Tue Jan 10, 2017 11:48 pm
Vensim version: DSS

Re: Model predictive control using Vensim?

Post by billh »

Small correction: I did find "Analysis and control design of sustainable policies for greenhouse gas emissions" (https://ac.els-cdn.com/S135943111200265 ... 33333a60aa), which claims they started in Vensim and then moved to Simulink.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Model predictive control using Vensim?

Post by Administrator »

Tom is really the person to answer questions regarding the optimizer, he's far more familiar with it than I am. In theory though it should be possible to modify it to optimize based on a model parameter to trigger the optimization (but I don't know for sure, the code might require significant modification to do this).

Other alternatives.
1. LP Solve. If you can construct your problem in such a way that a linear/integer program, then you could use this plugin to try and optimize (http://vensim.com/workbench/#lp-solve-link).

2. Use of the FIND ZERO function. Again, if you can construct the problem where an optimal solution is near "0", the FIND ZERO function in Vensim will loop through model structure to try and solve it.

As you say, the only other alternative is to continuously optimize using a programming language.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
LAUJJL
Senior Member
Posts: 1421
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Model predictive control using Vensim?

Post by LAUJJL »

Hi

I had a look at the greenhouse model.

The conclusions do not improve the general understanding of the problem and propose classical already known solutions.

But what seems strange is that the model does not study the real problem: the decision system, how it works, who take the decisions, can they be coordinated, the influence of the electoral system.
As many studies, one puts all the efforts to study the system but not how policies are taken and the constraints of policy makers.

Regards.

JJ
billh
Member
Posts: 45
Joined: Tue Jan 10, 2017 11:48 pm
Vensim version: DSS

Re: Model predictive control using Vensim?

Post by billh »

@JJ: Thanks. I agree that, in many and perhaps most cases (and certainly the greenhouse problem), the decision process is key, and people are key parts of that. This problem is, I think, different: we want to maintain the temperature in a river such that the resident fish can thrive. The decision rules have been worked out by a group, and we've committed to those. Simply put, the design task is to design policies by which we adjust valves that control the release temperature and flow from a dam to keep water temperatures downstream of the dam within the limits. There are other constraints, too. For example, every cubic meter of water spilled from the dam is a cubic meter that won't generate electricity.

@Administrator: Thanks for encouraging me to think of alternatives. I have currently picked MPC, because the river is a complex system, my model will be imperfect, solar irradiance is a key factor in water temperature, and weather forecasts aren't perfect, either. Some system constraints are short-term (the water temperature must be within certain limits), and some are season-long (lakes such as this one stratify during the summer, and we don't want to exhaust our stock of either of the strata before the lake "turns over" and becomes isothermal in the fall. Oh, and we don't want to adjust moderately big valves needlessly.

MPC should let me fit (calibrate) a model to this river. Then I can use the model, the current state of the river today, the best weather forecast we have, and the Powell optimizer to pick an optimal set of control actions for the rest of the season, thus attending both to short- and long-term constraints. We then implement those actions for today (perhaps making no adjustments at all).

Tomorrow, we repeat the process with a new measured state of the system and new weather forecast. That addresses the issue of longer-term weather forecast inaccuracy and model inaccuracy.

It sounds sorta simple, but each run of the simulator needs new information about the state of the system, a new forecast, and new time bounds. Because I often program in R, I'm planning to write R code to manage that process.

If someone had done this and there was a publicly available Venapp, for example, (or perhaps R or ... code) that took care of all the housekeeping required to run each new simulation, it might make sense to do that and avoid the design and debugging of what I might write.

If someone had tried this and found it didn't really work well (or only worked well if certain conditions were met), then that could be useful to know, too. I'm not an MPC expert.

If you see holes in my thinking, feel free to point them out.
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Model predictive control using Vensim?

Post by tomfid »

I can think of several examples, none of which are readily shareable. However, the basic code needed is quite simple. The hard part, if there is one, is setting up the infrastructure to feed data.

You could definitely run into convergence problems, but that's largely a matter of model robustness. The algorithm itself is likely to work for most non-perverse payoff surfaces.

Compute time is not likely to be a problem, unless the model is huge/slow. You can borrow my quad E7-8895 in a pinch. :)
billh
Member
Posts: 45
Joined: Tue Jan 10, 2017 11:48 pm
Vensim version: DSS

Re: Model predictive control using Vensim?

Post by billh »

Thanks, Tom. That's sorta what I expected--not the loaner quad, though! I think I'll run this on a daily cycle, which /should/ give me more than enough time to run the optimizer on what I've got.

I figure it's easiest to set up the data feeding infrastructure externally in R or Python or Matlab--whatever one's favorite language might be.
Post Reply