S-Function Builder Outputs

조회 수: 5 (최근 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 CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by