S-Function Builder Outputs

5 次查看(过去 30 天)
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

更多回答(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