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.
Best Answer