Menu

Predicted State Vector

Hao Nguyen
2019-01-02
2019-03-04
  • Hao Nguyen

    Hao Nguyen - 2019-01-02

    To whom it may concern,

    Hi, i would like to know if its possible to use the predicted states vector in case my real system loses its feedback for a very short time.
    So, my question is: Can i access the latest computed predicted state vector using GRAMPC?

    Thanks a lot
    Regards,
    Hao

     
  • Andreas Völz

    Andreas Völz - 2019-01-02

    Hello Hao,

    the predicted states are stored in grampc.rws.x and the predicted controls in grampc.rws.u. Note that the values in rws are scaled if the respective option is activated. If only the predicted state at the next sampling instant is required, i.e. x(\Delta t), then you can simply use grampc.sol.xnext. Thus, if you have feedback, set x0 for the next step to the measured state. Otherwise, set x0 for the next step to the predicted state grampc.sol.xnext.

    Regards,
    Andreas

     
    ❤️
    1
  • Hao Nguyen

    Hao Nguyen - 2019-03-02

    Dear Andreas,

    Fortunately i was able to implement the MPC Controller in Matlab and Simulink smoothly. But i only have access to "grampc.rws.x" and "grampc.rws.u" vectors after the simulation is completely finished.

    I was wondering if its possible to access the grampc Structure data (i.e. grampc.rws) while the simulation is running on simulink?
    Since the Grampc Controller in Simulink uses a S-function i don't know where can i enable these Outputs in order to use them.

    Truly thank you and blue skies!

     
  • Andreas Völz

    Andreas Völz - 2019-03-04

    Hello Hao,

    you have to modify the S-function grampc_run_Sfct.c if you need further inputs or outputs. In the function mdlInitializeSizes you can add outputs for predicted states and controls and in the function mdlOutputs you have access to grampc->rws->x and grampc->rws->u and can copy them to the respective output port. Furthermore, note that you already get xnext as output, which is the predicted state after the sampling time, i.e. grampc.rws.x(\Delta t).

    Regards,
    Andreas

     

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.