When building a Simulink model, my s-function output is generated as a constant and the build process stops with an error

3 ビュー (過去 30 日間)
I've created an S-Function block with 6 inputs and 1 output, but when I build the project, the output is being generated as a constant and the build exits with an error.
In the TLC file I use the InitializeConditions function to initialize the output, but it crashes because the output is being generated as a constant:
"f_test_ecu.c", line 9529: error (etoa:4137): expression must be a modifiable lvalue
f_test_ecu_ConstB.SFunction = 4;
^
What are the constrainst that may cause an output of a S-Function to be generated as a constant?
Is it something that must be specified in the S-Function? I've compared with other working S-Functions and I don't see diferences.

回答 (1 件)

Amit Dhakite
Amit Dhakite 2023 年 3 月 14 日
Hi Nelson,
As per my understanding, your S-Function block is generating a constant as the output, which results in an error in the build process.
Upon further investigation, I have identified certain constraints within the S-Function which causes the output port to generate constant values. To address this, I recommend reviewing the information provided in the following link, which contains valuable insights on the topic:
  1 件のコメント
Nelson Bernardino
Nelson Bernardino 2023 年 3 月 17 日
Thank you. The S-Function sample time was set to -1 (inherit) and all the inputs where of the constant type with sample time inf.
After setting the sample times to different values, I had success.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBlock and Blockset Authoring についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by