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 Center および File ExchangeSimulink Coder についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by