Filter löschen
Filter löschen

Non-static tunable parameters in C++ class code generation.

2 Ansichten (letzte 30 Tage)
db1024
db1024 am 7 Mai 2019
Beantwortet: David Balbuena am 26 Jul. 2023
Hello,
I use Simulink Coder and Embedded Coder to auto-generate a C++ class from a Simulink model. The Simulink model contains only Simulink function blocks (Simulink/User-Defined Functions/Simulink Function) on the root level. The C++ class is instantiated several times from a C++ wrapper and its functions (Simulink function blocks) are called. A parameter structure with a bus data type in the base workspace is used to parametrize the Simulink function blocks. The storage class of the parameter structure is set to Model default.
The code generation uses the following settings:
  • Code interface packaging: C++ class
  • Parameter visibility: public
In MATLAB R2018b the generated C++ class contains:
// Class declaration for model Test
class TestModelClass {
// public data and function members
public:
// Tunable parameters
P_Test_t Test_P;
In MATLAB R2019a the generated C++ class contains:
// Class declaration for model Test
class TestModelClass {
// public data and function members
public:
// Tunable parameters
static P_Test_t Test_P;
The only difference is the static keyword for the tunable parameters.
As a result, I cannot change the tunable parameters for a single instance, since the parameters are declared as static and, therefore, shared across all instances. Is there a possibility to avoid the static keyword or should I use a different approach in MATLAB R2019a?
Thx for helping...
  8 Kommentare
db1024
db1024 am 15 Okt. 2020
I updated the release of this question to R2020b, since the issue exists in R2019a, R2019b, R2020a, and R2020b.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

David Balbuena
David Balbuena am 26 Jul. 2023

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by