Menu

Issues while embedded implementation of GRAMPC

2019-02-24
2019-11-15
  • Sayli Patil

    Sayli Patil - 2019-02-24

    Hello,

    I am trying for the embedded implementation of the GRAMPC for nonlinear model predictive control. But C code that provided by GRAMPC contains structure memory allocation functions such as calloc which are not supported on my embedded platform. How do I replace calloc function with the other one? I’m looking forward to your reply.
    Regards,
    Sayli.

     
  • Andreas Völz

    Andreas Völz - 2019-02-25

    Hello Sayli,

    do you have functions for dynamic memory allocation on your platform? If yes, then it is not difficult to replace the calloc-funtions in the source code of GRAMPC. There are less than ten places in grampc_init.c and grampc_util.c where calloc is used. If no, then more effort is necessary. The size of most fields depends on the dimension of the states, controls, parameters, constraints, as well as on the length of the horizon. In order to avoid dynamic memory allocation, you would have to fix the size of these arrays at compile-time. which is of course only possible for a specific problem instance. Maybe, we implement some kind of support functions for generating such problem-specific code in a future version of GRAMPC. However, at the moment, you have to implement it yourself.

    Best regards,
    Andreas

     
  • Andreas Völz

    Andreas Völz - 2019-11-15

    Hello Sayli,

    for your information, the new version 2.2 of GRAMPC supports compilation without dynamic memory allocation, i.e. without any calls to malloc, calloc or realloc. Please have a look at Section 5.1.5 of the updated documentation, where this new functionality is explained.

    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.