Implementing a two staged MPC

Hey Jonathan,

that is a good idea to create a new category. Hopefully this will encourage poeple to exchange their “special tricks” that made their MPC applications work even better. :slight_smile:

Thanks for your reference to automous driving and solving the OCP in different time scales. It makes totally sense to use the MPC in the same cascaded way as in classical control loops.

My idea to solve two different OCPs arises from the limitations that come from using a simple least squares cost function. What I want to achive is to preheat the building or the thermal storage during periods of low energy prices, so that the heat demand during high-price periods is lower. My very first approach was in the form of J = (T_setpoint-T_indoor)^2 + Energy_costs^2. Of course this form has the limitation, that the optimal solution will not result in heating the building above the setpoint significantly.

@FreyJo: Your feedback encourages me to try the two staged approach. If I have any first results, I will post them.

For the interested reader: My model is implemented in Matlab/Simulink and I use the generated s-function. For the two staged MPC one needs the full horizon control sequence. Therefore the s-function has to be modified as discussed in this topic:

If anyone else has any hints: those are very welcome! :slight_smile:

Best,
Christian