S-Function Builder Outputs

11 ビュー (過去 30 日間)
Mark
Mark 2012 年 11 月 29 日
Hello everyone, i think my problem is pretty simple, but I just can't figure out the problem. I want to build a standard S-Function with the help of the S-Function Builder. I have 4 Inputs, 4 Parameters and 2 Outputs. I entered my Inputs and Parameters in the respective fields in the Sfun-Builder. My formula for the output look like this: Tho = (Pel + Mh * Thi * c + Ms * Tsi * c - (Ms * c * (sqrt(pow(CG,2) * pow(Ms,2) * pow(Pel,2) + 4 * CG * pow(Mh,2) * Ms * Pel * Thi * c + 4 * CG * pow(Mh,2) * Ms * Pel * c * k + ... (its pretty long but it goes on like the part i posted).
When i click on "Build" in the Sfun-Builder i get a lot of errors but they are mostly the same. All refering to the line with my formula. The errors are:
error C2296 '*' : illegal, left operand has type 'const real_T *'
error C2297 '*' : illegal, right operand has type 'const real_T *'
error C2440 'function' ; cannot convert from 'const real_T *' to double
warning C4024 'pow' : different types for formal and actual parameter 1
I get these errors all over again until the error count exceeds 100 and the compiling stops. I need this to run for an important work! So please help me out here =)

採用された回答

Titus Edelhofer
Titus Edelhofer 2012 年 11 月 29 日
Hi,
please keep in mind, that Simulink (and S-Function Builder) assumes all signals to possibly be vector valued. Therefore, all inputs and outputs are arrays. You will need to write e.g. PEL[0] instead of PEL.
Titus
  1 件のコメント
Mark
Mark 2012 年 11 月 29 日
Works perfectly! Thank you very much, Titus!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by