s-function tlc

3 visualizaciones (últimos 30 días)
Dalmo Silva Júnior
Dalmo Silva Júnior el 28 de Jul. de 2021
Comentada: Mohammad el 15 de Jun. de 2023
We are using MATLAB/Simulink to generate a real-time executable model to embed into dSPACE's Microautobox hardware.
Our system under study is mainly constituted by an optimization algorithm that aims to return an optimized battery charge/discharge decision in a microgrid. In this sense, our optimization algorithm code is encapsulated in the “S-function” block, where we can incorporate functions such as the Yalmip solver. The file with the extension (.slx) works as it should when simulating offline through Simulation Model (Run).
However, when performing the procedure of building a model for realtime (via Ctrl+B), we ran into a problem that the “S-function” block is not an inlined function, so, as we understand it, it does not have enough resources to generate all the auxiliary codes like the file with the extension (.tlc) for example.
In this sense, we identified that the “S-function Builder” block is capable of generating these auxiliary files, however, it is necessary to program it in (.c) language, and our code is written entirely in MATLAB (.m) language.
As a test, we tried to convert the MATLAB (.m) code to language (.c) by the MATLAB Coder app, however, without success because some functions used in the algorithm are not transcribed to the language (.c).
So we would like to know if it is possible to perform a transcription of the "S-function" block to the "S-function Builder" without the need for us to rewrite our code in the language (.c) in the "S-function Builder" block? Or, some procedure in which we can convert the file with MATLAB language (.m) to language (.C)?
  1 comentario
Mohammad
Mohammad el 15 de Jun. de 2023
Hi Dalmo,
I am new to Yalmip and also seek to flash simulink code on to Dspace hardware. Were you successfull in flashing code to the dSPACE's Microautobox hardware?
Your reply would be of high significance.
Thanks

Iniciar sesión para comentar.

Respuestas (1)

Benjamin Thompson
Benjamin Thompson el 2 de Feb. de 2022
Do you still need help with this? S-Function builder or the legacy c code tool can both produce skeleton C or C++ source files and skeleton TLC files to use as a starting point. For any custom blocks that you add to Simulink, Embedded Coder will need information about how to reproduce the C/C++ code for that block at the time of code generation.

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by