How can I set up a custom root level I/O that generates reusable code?
Show older comments
The Interface should contain all model inputs and outputs in the model data structure as follows:
typedef struct{
int32_T *input1;
int16_T *input2;
...
int32_T *inputn
} ExtU_modelname_T
typedef struct{
int32_T output1;
int16_T output2;
...
int32_T outputm;
} ExtY_modelname_T
struct tag_RTM_I_controller_T {
...
struct {
ExtU_I_controller_T *inputs;
ExtY_I_controller_T *outputs;
} ModelData;
};
The structure definition ExtU_modelname_T should contain pointer to the inputs. So I can link the inputs to other variables in the programm. The used target language for the coder is C. With the code generation Pane -> interface i can only set that the inputs and outputs are part of the model data structure. In this case the structure ExtU_modelname_T contains the signals and not pointer to the signals.
In the last few days i learned many about simulink modells and code generation, so i think ist possible to customize the interface that way. I think if i modify the .tlc files, wich control the structure of the code interface, the job is done. Do somone know the location and names of the .tlc files, that control the structure of the code interface?
Another way is to write an own advanced custom storage class for this problem. But i think that these ACSCs are always global and it isn´t possible to generate reusable code with them. Is this right?
Answers (0)
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!