Model Predictive Control on Python

1,036 views
Skip to first unread message

Madhushan Tennakoon

unread,
Dec 6, 2017, 1:06:19 PM12/6/17
to apmonitor
I'm currently working on designing an MPC using only Scipy and I found a great implementation at the end of the page here:
However, I'm still confused about why this uses the previous time-steps (i-P where i is the current time-step and P is the prediction horizon) when minimizing the cost function. I thought we only looked at the state at the current time-step and the evaluated states for the next P states. Why do we need the P previous states as well? Like John kindly pointed out, only the next P states are actually used in the minimization function. Is this related to a specific problem? Can someone please point me to the sample problem associated with this code?

Thank you!

Best,
Madhu

Junho Park

unread,
Dec 6, 2017, 1:58:52 PM12/6/17
to apmo...@googlegroups.com
Madhu,

You can also use the state at the current time step for prediction as you mentioned. But, in the example, I used the ‘receding horizon control’ algorithm which employs past movements of MVs for prediction instead of using state. This is more traditional way of MPC implementation especially when the Finite Impulse Response models are involved for dynamic model. I referred Model Predictive Control section of 'Process Dynamics and Control' text book (Seborg, Mellichamp, Edgar) for that example. Please let me know if you have more questions.

Junho



--
--
APMonitor user's group e-mail list.
- To post a message, send email to apmo...@googlegroups.com
- To unsubscribe, send email to apmonitor+...@googlegroups.com
- Visit this group at http://groups.google.com/group/apmonitor

---
You received this message because you are subscribed to the Google Groups "apmonitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apmonitor+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Madhushan Tennakoon

unread,
Dec 7, 2017, 7:55:37 PM12/7/17
to apmonitor
Brilliant. I always wondered where the phrase 'receding horizon' came from. Would a receding horizon model be better equipped at handling spikes in disturbance data than an MPC that measured the current state for prediction? I noticed that sudden impulses in a variable that was being used in the cost function but not in the model would cause the MV to oscillate.

Thanks a lot for your response Junho. That was very helpful!

Kind regards,
Madhu

Junho Park

unread,
Dec 7, 2017, 8:15:11 PM12/7/17
to apmo...@googlegroups.com

Madhu,

 

Great to hear that. But, please make sure that the RHC is just a part of MPC that handles the horizons for prediction and control calculation, not a different algorithm. MPC is a combination of several different algorithms.

 

Junho

Madhushan Tennakoon

unread,
Dec 8, 2017, 12:04:27 PM12/8/17
to apmonitor
I see. Thanks for all your help Junho!

Kind regards,
Madhu
Reply all
Reply to author
Forward
0 new messages