User`s guide
Quick Start Tutorials
3-61
/* Output and update for referenced model: 'vdpmult'*/
void mr_vdpmult(const real_T *rtu_0, const real_T *rtu_1,
real_T *rty_0, RT_MODEL_vdpmult *vdpmult_M)
{
/* local block i/o variables */
/* Gain: '<Root>/Mu' incorporates:
* Fcn: '<Root>/Fcn'
* Product: '<Root>/Product'
*/
(*rty_0) = (1.0 - (*rtu_0) * (*rtu_0)) * (*rtu_1);
/* Update absolute time for base rate */
if(!(++vdpmult_M->Timing.clockTick0))
++vdpmult_M->Timing.clockTickH0;
}
Note the function’s prefix, mr_; this indicates that it comes from a
referenced model, which also uses inlined parameters. Here is generated
GRT code for the vdpmult subsystem in the
vdptop model; the RTW
system code
property has been set to Reusable function.
/* Output and update for atomic system: '<Root>/vdpmult' */
void vdptop_vdpmult(real_T rtu_In1, real_T rtu_In2,
rtB_vdptop_vdpmult *localB)
{
/* local block i/o variables */
/* Gain: '<S1>/Mu' incorporates:
* Fcn: '<S1>/Fcn'
* Product: '<S1>/Product'
*/
localB->Mu = (1.0 - rtu_In1 * rtu_In1) * rtu_In2;
}
The reusable function is prefixed with the model name. You can modify the
construction of such identifiers when using ERT and ERT-derived targets.