Пример #1
0
/* Model update function */
void RA4_student_update(void)
{
  /* Update for UnitDelay: '<Root>/Unit Delay2' */
  RA4_student_DW.UnitDelay2_DSTATE[0] = RA4_student_B.Sum4;
  RA4_student_DW.UnitDelay2_DSTATE[1] = RA4_student_B.Sum5;
  RA4_student_DW.UnitDelay2_DSTATE[2] = RA4_student_B.Sum6;

  /* Update for UnitDelay: '<Root>/Unit Delay1' */
  RA4_student_DW.UnitDelay1_DSTATE = RA4_student_B.ReferenceSolenoid;

  /* RTW Generated Level2 S-Function Block: '<S2>/Robot Arm_sfcn' (Robot_sf) */
  {
    SimStruct *rts = RA4_student_M->childSfunctions[1];
    sfcnUpdate(rts, 0);
    if (ssGetErrorStatus(rts) != (NULL))
      return;
  }

  /* Update absolute time for base rate */
  /* The "clockTick0" counts the number of times the code of this task has
   * been executed. The absolute time is the multiplication of "clockTick0"
   * and "Timing.stepSize0". Size of "clockTick0" ensures timer will not
   * overflow during the application lifespan selected.
   * Timer of this task consists of two 32 bit unsigned integers.
   * The two integers represent the low bits Timing.clockTick0 and the high bits
   * Timing.clockTickH0. When the low bit overflows to 0, the high bits increment.
   */
  if (!(++RA4_student_M->Timing.clockTick0)) {
    ++RA4_student_M->Timing.clockTickH0;
  }

  RA4_student_M->Timing.t[0] = RA4_student_M->Timing.clockTick0 *
    RA4_student_M->Timing.stepSize0 + RA4_student_M->Timing.clockTickH0 *
    RA4_student_M->Timing.stepSize0 * 4294967296.0;

  {
    /* Update absolute timer for sample time: [0.000244140625s, 0.0s] */
    /* The "clockTick1" counts the number of times the code of this task has
     * been executed. The absolute time is the multiplication of "clockTick1"
     * and "Timing.stepSize1". Size of "clockTick1" ensures timer will not
     * overflow during the application lifespan selected.
     * Timer of this task consists of two 32 bit unsigned integers.
     * The two integers represent the low bits Timing.clockTick1 and the high bits
     * Timing.clockTickH1. When the low bit overflows to 0, the high bits increment.
     */
    if (!(++RA4_student_M->Timing.clockTick1)) {
      ++RA4_student_M->Timing.clockTickH1;
    }

    RA4_student_M->Timing.t[1] = RA4_student_M->Timing.clockTick1 *
      RA4_student_M->Timing.stepSize1 + RA4_student_M->Timing.clockTickH1 *
      RA4_student_M->Timing.stepSize1 * 4294967296.0;
  }
}
Пример #2
0
/* Model update function */
static void testSHM_update(int_T tid)
{
  /* Level2 S-Function Block: '<Root>/S-Function' (sSHM) */
  {
    SimStruct *rts = testSHM_M->childSfunctions[0];
    sfcnUpdate(rts, 0);
    if (ssGetErrorStatus(rts) != (NULL))
      return;
  }

  /* Update absolute time for base rate */
  if (!(++testSHM_M->Timing.clockTick0))
    ++testSHM_M->Timing.clockTickH0;
  testSHM_M->Timing.t[0] = testSHM_M->Timing.clockTick0 *
    testSHM_M->Timing.stepSize0 + testSHM_M->Timing.clockTickH0 *
    testSHM_M->Timing.stepSize0 * 4294967296.0;

  /* tid is required for a uniform function interface.
   * Argument tid is not used in the function. */
  UNUSED_PARAMETER(tid);
}