s-function tlc

조회 수: 10 (최근 30일)
Dalmo Silva Júnior
Dalmo Silva Júnior 2021년 7월 28일
댓글: Mohammad 2023년 6월 15일
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
Mohammad
Mohammad 2023년 6월 15일
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

댓글을 달려면 로그인하십시오.

답변 (1개)

Benjamin Thompson
Benjamin Thompson 2022년 2월 2일
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.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by