Menu

MHE implementation in Simulink

Pierre
2019-05-02
2019-05-09
  • Pierre

    Pierre - 2019-05-02

    Hello everyone,
    I have problems implementing MHE in closed loop with MPC in simulink, even with the doc and the CSTR example.
    In my Simulink model, I have a MPC controller and a MHE block. I created another set of push buttons to compile and init the probfct and initData of each problem (MPC, MHE). I do not know if it is necessary but i also created another set of _Cmex.c functions for the second block.

    I have difficulties to choose the correct inputs of the MHE block and on how to modify grampc_run_Sfct_MHE.c so that the MHE is possible.
    I wanted to know if you had some guidelines

    Best regards,
    Pierre

     
  • Felix Mesmer

    Felix Mesmer - 2019-05-03

    Hi Pierre,

    your approach sounds fine.
    You need to supply your MHE-block/probfct with your measurements. This is best done with the userparam (see the CSTR example). To be able to do change the userparam with the S-function in simulink, see
    https://sourceforge.net/p/grampc/discussion/general/thread/c6123760c1/
    where this problem was already discussed.
    If you have any further questions, feel free to ask.

    Regards,
    Felix

     
  • Pierre

    Pierre - 2019-05-03

    Thank you for your answer,

    I modified grampc_run_Sfct_MHE.c, to collect N measures of the plant outputs.
    I believe I also need the values of the previous values of the control signal. Since MHE and MPC are two different blocks, I do not have directly access to the control signal previous values. Is it correct to fill userparam with those values and replace the control u of the functions : ffct, dfdx_vec,dfdu_vec by the corresponding value of the control signal ?
    I also need values of the states x for the system function ffct and the integral cost lfct.
    I would give as an input of the MHE block the value of the state estimate at time (t - Thor) .
    But, from what i understood from the CSTR example, it need the previous state estimate (at time t). Is that it ?

    Regards,
    Pierre

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.