GepocUS / Spcies

Suite of Predictive Controllers for Industrial Embedded Systems. A Matlab toolbox for automatic code generation of solvers for MPC controllers.
Apache License 2.0
14 stars 2 forks source link

Solve the name-conflict issue #38

Open pablokrupa opened 1 year ago

pablokrupa commented 1 year ago

Currently, all solvers declare #defines with the same names, such as nn for the state dimension. They also all call the MPC solver the same way, independently of the value given to options.save_name. This can cause a name-conflict issue if two or more solvers are included in the same .c file.

The solution is for all #defines to be called after the save_name, e.g., if save_name is myMPC, then the #defines will be something like: #define myMPC_nn. This would require a search and substitute in the generated files, substituting nn for myMPC_nn.

Same goes for the function name, which should be called like the save_name, instead of by the name of the MPC formulation and the solver.