Research Article
Towards Online Model Predictive Control on a Programmable Logic Controller: Practical Considerations
Algorithm 1
Steps to compute the inputs of the experimental set-up.
Offline: Calculate H’, G1 and G2 | Online: Start PLC or PAC | Store all precomputed matrices in working memory, together with the reference for | inputs and output | while CPU is running do | if 1 second passed since last call then | Scale the temperatures | Calculate current state | Calculate g, and | case Hildreth algorithm | Calculate the unconstrained inputs of the process. | if unconstrained inputs violate constraints then | while maximum numbers of iterations is not reached and solution not | found do | Solve one iteration of the QP | end | if maximum numbers of iterations is reached then | Use unconstrained solution with inputs violating the constraint | limited to the constraint | end | end | endsw | case qpOASES | while maximum numbers of iterations is not reached and solution not | found do | Solve one iteration of the QP | end | if maximum numbers of iterations is reached then | Use last sub-optimal solution | end | endsw | case CVXGEN | while maximum numbers of iterations is not reached and solution not | found do | Solve one iteration of the QP | end | if maximum numbers of iterations is reached then | Use unconstrained solution with inputs violating the constraint limited | to the constraint | end | endsw | Apply the inputs to the system | end | end |
|