Hi!
I used the simulink coder to generate c++ code of a simscape models. The resulting MyModel.h contains a class called <MyModel>ModelClass. Usually this class has has public members for input and output data structs: <MyModel_U> and <MyModel_Y> respectively.
Now I generated code, but in the resulting .h file the <MyModel_U> and <MyModel_Y> are private members and there are a getter and a setter function.
Which settings do I need to get back the old behavior? Getter/Setter are not bad, but for compatibility reasons need the structs to be public.
Thanks in advance!
Christian
Edit:
I compared every settings entry of the new and the old models. I can't find anything that differs anymore. Are there other settings than the "Configuration Settings" window?
To make it more visual here is the generated code section I get with the new model:
/* Class declaration for model MyModel */class MyModelModelClass { /* public data and function members */ public: /* model initialize function */ void initialize(); /* model step function */ void step(); /* model terminate function */ void terminate(); /* Constructor */ MyModelModelClass(); /* Destructor */ ~MyModelModelClass(); /* Root-level structure-based inputs set method */ /* Root inports set method */ void setExternalInputs(const ExtU_MyModel_T * pExtU_MyModel_T) { MyModel_U = *pExtU_MyModel_T; } /* Root-level structure-based outputs get method */ /* Root outports get method */ const ExtY_MyModel_T & getExternalOutputs() const { return MyModel_Y; } /* Real-Time Model get method */ RT_MODEL_MyModel_T * getRTM(); /* private data and function members */ private: /* Block signals */ B_MyModel_T MyModel_B; /* Block states */ DW_MyModel_T MyModel_DW; // // The next two members are the ones of interest !!! // /* External inputs */ ExtU_MyModel_T MyModel_U; /* External outputs */ ExtY_MyModel_T MyModel_Y; /* Real-Time Model */ RT_MODEL_MyModel_T MyModel_M;};
And here is the generated code section how I used to get it (that's what I want):
/* Class declaration for model MyOldModel */class MyOldModelModelClass { /* public data and function members */ public: // // The next two members are the ones of interest !!! // /* External inputs */ ExtU_MyOldModel_T MyOldModel_U; /* External outputs */ ExtY_MyOldModel_T MyOldModel_Y; /* model initialize function */ void initialize(); /* model step function */ void step(); /* model terminate function */ void terminate(); /* Constructor */ MyOldModelModelClass(); /* Destructor */ ~MyOldModelModelClass(); /* Real-Time Model get method */ RT_MODEL_MyOldModel_T * getRTM(); /* private data and function members */ private: /* Block signals */ B_MyOldModel_T MyOldModel_B; /* Block states */ DW_MyOldModel_T MyOldModel_DW; /* Real-Time Model */ RT_MODEL_MyOldModel_T MyOldModel_M;};
Best Answer