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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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
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