Generating a C code DLL for an S-function with continuous states
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to generate a DLL from an S-function (via Embedded Coder) which has continous states and then call the respective functions via a C# script. I have written a tlc file and the DLL has been succesfully generated.
One of the functions generated is of the following template:
static void rt_ertODEUpdateContinuousStates(RTWSolverInfo *si, RT_MODEL_mav_dynamics0_T *const mav_dynamics0_M, real_T mav_dynamics0_U_forces_and_moments[6], real_T mav_dynamics0_Y_x[12])
However, the data type RTWSolverInfo isn't defined anywhere. Many other functions have been called inside the function definition as well such as rtsiGetT(), rtsiGetSolverStopTime(), rtsiGetStepSize(), rtsiGetContStates() and rtsiGetSolverData() which have not been defined anywhere.
Even the step function uses a structure variable as a parameter. One of the members of that structure is a variable of data type RTWSolverInfo, which has not been defined anywhere.
Has anybody encountered this issue before? Could you show me how I can define this data type in C# or any way to work around this so I can succesfully use this DLL in C#?
0 Commenti
Risposte (1)
Harsh
il 11 Gen 2025
Hi Vighnesh,
The “RTWSolverInfo” and associated functions like “rtsiGetT()” are part of the Real-Time Workshop (RTW) infrastructure used by Simulink for managing solver information. These are defined in header files that are part of the Simulink Coder environment. Check the generated code directory for header files. Look for files with extensions like ‘.h’ that might define ‘RTWSolverInfo’ and other related functions. Common header files include ‘rtwtypes.h’, ‘rtwsolver.h’, and other model-specific headers.
For example, you can find the definition of “rtsiGetT()” for the following public project on github in the ‘rtwsolver.h’ file (line 230) - https://github.com/jmscslgroup/delay_brake/blob/main/rtw_solver.h
Hope this resolves your query. Keep coding!
0 Commenti
Vedere anche
Categorie
Scopri di più su Simulink Coder in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!