Menu

Two MPC

2018-06-14
2021-10-21
  • Joel Gamal Girgis

    How to solve 2 mpc problems in the same file?
    The output of the first one is used in the second one

     
  • Hassan Jafarzadeh

    Hi Joel,

    After saving the result of the first MPC you need to clear the differntialstates, control inputs, and differential equation. I will give you an example:

    if the variables of the first MPC would be:

    DifferentialStates x1, y1,v1;
    Control a1;
    DifferentialEquation f1;

    you need to clear them by using the following format:

        x1.clearStaticCounters();
        y1.clearStaticCounters();
        v1.clearStaticCounters();
        a1.clearStaticCounters();
        f1.clearBuffer();
    

    Then deffine your second MPC from the begining by introducing your variables, ...

    If they are in a loop, you should clear the variables of the second MPC as well at the end of loop.

    Good Luck,
    Hassan

     
  • Mohammad Alokili

    hello Hassan,
    how can I clear the static counter from matlab, I use 2 MPC in the same Project in Matlab
    best regards

     

Log in to post a comment.