Why is the generated code different for the same model using Real-Time Workshop 5.0 (R13) and Real-Time Workshop 6.2 (R14SP2)?
Show older comments
I am using the FCN block with a relational expression such as:
u[5]>u[4] + u[5]<u[3] + u[2] + u[2] <u[3] > u[4]
The code generated by Real Time Workshop 6.2 (R14SP2) for this block is different from the code generated by Real Time Workshop 5.0 (R13). The code for R13 is as follows:
/* Fcn: '<Root>/Fcn' incorporates:
* Constant: '<Root>/Constant'
*
* Regarding '<Root>/Fcn':
* Expression: u[5]>u[4] + u[5]<u[3] + u[2] + u[2] <u[3] > u[4]
*/
rtb_Fcn = rtP.Constant_Value[4] > rtP.Constant_Value[3] +
rtP.Constant_Value[4] < rtP.Constant_Value[2] +
rtP.Constant_Value[1] + rtP.Constant_Value[1] <
rtP.Constant_Value[2] > rtP.Constant_Value[3];
The code for R14SP2 is as follows:
/* Fcn: '<Root>/Fcn' incorporates:
* Constant: '<Root>/Constant'
*/
rtb_Fcn = (real_T)((real_T)((real_T)((real_T)
(fcn_block_P.Constant_Value[4] > fcn_block_P.Constant_Value[3] + fcn_block_P.Constant_Value[4])
< (fcn_block_P.Constant_Value[2] + fcn_block_P.Constant_Value[1]) + fcn_block_P.Constant_Value[1])
< fcn_block_P.Constant_Value[2])
> fcn_block_P.Constant_Value[3]);
The result seems to be the same, but the code generated is different.
Accepted Answer
More Answers (0)
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!