Library for the master controller

Dependents:   Test_Controller_Master AEB

Controller_Master.c

Committer:
AndreaAndreoli
Date:
2016-06-04
Revision:
0:8e9e8bee3cf4
Child:
1:03ec2e1d1008

File content as of revision 0:8e9e8bee3cf4:

/*
 * Academic License - for use in teaching, academic research, and meeting
 * course requirements at degree granting institutions only.  Not for
 * government, commercial, or other organizational use.
 *
 * File: Controller_Master.c
 *
 * Code generated for Simulink model 'Controller_Master'.
 *
 * Model version                  : 1.0
 * Simulink Coder version         : 8.10 (R2016a) 10-Feb-2016
 * C/C++ source code generated on : Sat Jun 04 17:59:52 2016
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: NXP->Cortex-M4
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "Controller_Master.h"

/* Named constants for Chart: '<S1>/AEB' */
#define Controller_M_IN_NO_ACTIVE_CHILD ((uint8_T)0U)
#define Controller_Master_IN_ACTIVE    ((uint8_T)1U)
#define Controller_Master_IN_BRAKE     ((uint8_T)1U)
#define Controller_Master_IN_ERR       ((uint8_T)1U)
#define Controller_Master_IN_IDLE      ((uint8_T)2U)
#define Controller_Master_IN_OK        ((uint8_T)2U)
#define Controller_Master_IN_READY     ((uint8_T)2U)
#define Controller_Master_IN_WARNING   ((uint8_T)3U)

/* Named constants for Chart: '<S1>/select_command' */
#define Controller_Master_IN_BLINK     ((uint8_T)1U)
#define Controller_Master_IN_BLINK_OFF ((uint8_T)1U)
#define Controller_Master_IN_BLINK_ON  ((uint8_T)2U)
#define Controller_Master_IN_OFF1      ((uint8_T)2U)
#define Controller_Master_IN_ON        ((uint8_T)3U)

/*===========*
 * Constants *
 *===========*/
#define RT_PI                          3.14159265358979323846
#define RT_PIF                         3.1415927F
#define RT_LN_10                       2.30258509299404568402
#define RT_LN_10F                      2.3025851F
#define RT_LOG10E                      0.43429448190325182765
#define RT_LOG10EF                     0.43429449F
#define RT_E                           2.7182818284590452354
#define RT_EF                          2.7182817F

/*
 * UNUSED_PARAMETER(x)
 *   Used to specify that a function parameter (argument) is required but not
 *   accessed by the function body.
 */
#ifndef UNUSED_PARAMETER
# if defined(__LCC__)
#   define UNUSED_PARAMETER(x)                                   /* do nothing */
# else

/*
 * This is the semi-ANSI standard way of indicating that an
 * unused function parameter is required.
 */
#   define UNUSED_PARAMETER(x)         (void) (x)
# endif
#endif

/* Model step function */
void Controller_Master_step(RT_MODEL_Controller_Master_T *const
  Controller_Master_M, real_T Controller_Master_U_V, real_T
  Controller_Master_U_D_M, uint8_T Controller_Master_U_Slave, uint8_T
  *Controller_Master_Y_BRAKE, uint8_T *Controller_Master_Y_LED_BLUE, uint8_T
  *Controller_Master_Y_LED_RED, uint8_T *Controller_Master_Y_MASTER)
{
  B_Controller_Master_T *Controller_Master_B = ((B_Controller_Master_T *)
    Controller_Master_M->ModelData.blockIO);
  DW_Controller_Master_T *Controller_Master_DW = ((DW_Controller_Master_T *)
    Controller_Master_M->ModelData.dwork);
  real_T K;

  /* Outputs for Atomic SubSystem: '<Root>/Controller_Master' */
  /* Chart: '<S1>/AEB' incorporates:
   *  Inport: '<Root>/D_M'
   *  Inport: '<Root>/V'
   *  Memory: '<S1>/Memory'
   */
  /* Gateway: Controller_Master/AEB */
  /* During: Controller_Master/AEB */
  if (Controller_Master_DW->is_active_c3_Controller_Master == 0U) {
    /* Entry: Controller_Master/AEB */
    Controller_Master_DW->is_active_c3_Controller_Master = 1U;

    /* Entry Internal: Controller_Master/AEB */
    /* Entry Internal 'AEB': '<S2>:35' */
    /* Entry Internal 'ERRORS_CHECK_THREAD': '<S2>:33' */
    /* Transition: '<S2>:38' */
    Controller_Master_DW->is_ERRORS_CHECK_THREAD = Controller_Master_IN_OK;

    /* Outport: '<Root>/LED_RED' */
    /* Entry 'OK': '<S2>:37' */
    /* '<S2>:37:1' Led_Red =uint8(0); */
    *Controller_Master_Y_LED_RED = 0U;

    /* Outport: '<Root>/MASTER' */
    /* '<S2>:37:1' Master = uint8(1); */
    *Controller_Master_Y_MASTER = 1U;

    /* Entry Internal 'APPLICATION_THREAD': '<S2>:32' */
    /* Transition: '<S2>:27' */
    Controller_Master_DW->is_APPLICATION_THREAD = Controller_Master_IN_READY;

    /* Outport: '<Root>/BRAKE' */
    /* Entry 'READY': '<S2>:21' */
    /* '<S2>:21:1' Brake = uint8(0); */
    *Controller_Master_Y_BRAKE = 0U;

    /* '<S2>:21:1' Led_Blue = 0; */
    Controller_Master_B->Led_Blue = 0.0;
  } else {
    /* During 'AEB': '<S2>:35' */
    /* During 'ERRORS_CHECK_THREAD': '<S2>:33' */
    if (Controller_Master_DW->is_ERRORS_CHECK_THREAD != Controller_Master_IN_ERR)
    {
      /* During 'OK': '<S2>:37' */
      /* '<S2>:46:1' sf_internal_predicateOutput = ... */
      /* '<S2>:46:1' V > 180 || D > 200 || D < 0; */
      if ((Controller_Master_U_V > 180.0) || (Controller_Master_U_D_M > 200.0) ||
          (Controller_Master_U_D_M < 0.0)) {
        /* Transition: '<S2>:46' */
        Controller_Master_DW->is_ERRORS_CHECK_THREAD = Controller_Master_IN_ERR;

        /* Outport: '<Root>/LED_RED' */
        /* Entry 'ERR': '<S2>:42' */
        /* '<S2>:42:1' Led_Red = uint8(1); */
        *Controller_Master_Y_LED_RED = 1U;

        /* Outport: '<Root>/MASTER' */
        /* Entry 'SENSOR_ERR': '<S2>:39' */
        /* '<S2>:39:1' Master = uint8(0) ; */
        /* '<S2>:39:1' En = false; */
        /* '<S2>:39:1' Brake = uint8(0); */
        /* '<S2>:39:3' Led_Blue = 0; */
        /* Entry 'MCU_ERR': '<S2>:40' */
        /* '<S2>:40:1' Master = uint8(0) ; */
        *Controller_Master_Y_MASTER = 0U;

        /* '<S2>:40:1' En = false; */
        Controller_Master_DW->En = false;

        /* Outport: '<Root>/BRAKE' */
        /* '<S2>:40:1' Brake = uint8(0); */
        *Controller_Master_Y_BRAKE = 0U;

        /* '<S2>:40:3' Led_Blue = 0; */
        Controller_Master_B->Led_Blue = 0.0;
      } else {
        /* '<S2>:43:1' sf_internal_predicateOutput = ... */
        /* '<S2>:43:1' D == 0; */
        if (Controller_Master_U_D_M == 0.0) {
          /* Transition: '<S2>:43' */
          Controller_Master_DW->is_ERRORS_CHECK_THREAD =
            Controller_Master_IN_ERR;

          /* Outport: '<Root>/LED_RED' */
          /* Entry 'ERR': '<S2>:42' */
          /* '<S2>:42:1' Led_Red = uint8(1); */
          *Controller_Master_Y_LED_RED = 1U;

          /* Outport: '<Root>/MASTER' */
          /* Entry 'SENSOR_ERR': '<S2>:39' */
          /* '<S2>:39:1' Master = uint8(0) ; */
          /* '<S2>:39:1' En = false; */
          /* '<S2>:39:1' Brake = uint8(0); */
          /* '<S2>:39:3' Led_Blue = 0; */
          /* Entry 'MCU_ERR': '<S2>:40' */
          /* '<S2>:40:1' Master = uint8(0) ; */
          *Controller_Master_Y_MASTER = 0U;

          /* '<S2>:40:1' En = false; */
          Controller_Master_DW->En = false;

          /* Outport: '<Root>/BRAKE' */
          /* '<S2>:40:1' Brake = uint8(0); */
          *Controller_Master_Y_BRAKE = 0U;

          /* '<S2>:40:3' Led_Blue = 0; */
          Controller_Master_B->Led_Blue = 0.0;
        } else {
          /* '<S2>:45:1' sf_internal_predicateOutput = ... */
          /* '<S2>:45:1' Slave ~= 1; */
          if (Controller_Master_DW->Memory_PreviousInput != 1) {
            /* Transition: '<S2>:45' */
            Controller_Master_DW->is_ERRORS_CHECK_THREAD =
              Controller_Master_IN_ERR;

            /* Outport: '<Root>/LED_RED' */
            /* Entry 'ERR': '<S2>:42' */
            /* '<S2>:42:1' Led_Red = uint8(1); */
            *Controller_Master_Y_LED_RED = 1U;

            /* Outport: '<Root>/MASTER' */
            /* Entry 'SENSOR_ERR': '<S2>:39' */
            /* '<S2>:39:1' Master = uint8(0) ; */
            /* '<S2>:39:1' En = false; */
            /* '<S2>:39:1' Brake = uint8(0); */
            /* '<S2>:39:3' Led_Blue = 0; */
            /* Entry 'MCU_ERR': '<S2>:40' */
            /* '<S2>:40:1' Master = uint8(0) ; */
            *Controller_Master_Y_MASTER = 0U;

            /* '<S2>:40:1' En = false; */
            Controller_Master_DW->En = false;

            /* Outport: '<Root>/BRAKE' */
            /* '<S2>:40:1' Brake = uint8(0); */
            *Controller_Master_Y_BRAKE = 0U;

            /* '<S2>:40:3' Led_Blue = 0; */
            Controller_Master_B->Led_Blue = 0.0;
          }
        }
      }
    } else {
      /* During 'ERR': '<S2>:42' */
      /* During 'SENSOR_ERR': '<S2>:39' */
      /* During 'MCU_ERR': '<S2>:40' */
      /* During 'SLAVE_ERR': '<S2>:41' */
    }

    /* During 'APPLICATION_THREAD': '<S2>:32' */
    if (Controller_Master_DW->is_APPLICATION_THREAD ==
        Controller_Master_IN_ACTIVE) {
      /* During 'ACTIVE': '<S2>:1' */
      /* '<S2>:26:1' sf_internal_predicateOutput = ... */
      /* '<S2>:26:1' En == false; */
      if (!Controller_Master_DW->En) {
        /* Transition: '<S2>:26' */
        /* Exit Internal 'ACTIVE': '<S2>:1' */
        Controller_Master_DW->is_ACTIVE = Controller_M_IN_NO_ACTIVE_CHILD;
        Controller_Master_DW->is_APPLICATION_THREAD = Controller_Master_IN_READY;

        /* Outport: '<Root>/BRAKE' */
        /* Entry 'READY': '<S2>:21' */
        /* '<S2>:21:1' Brake = uint8(0); */
        *Controller_Master_Y_BRAKE = 0U;

        /* '<S2>:21:1' Led_Blue = 0; */
        Controller_Master_B->Led_Blue = 0.0;
      } else {
        /* '<S2>:1:1' K = (V^2)/D; */
        K = Controller_Master_U_V * Controller_Master_U_V /
          Controller_Master_U_D_M;
        switch (Controller_Master_DW->is_ACTIVE) {
         case Controller_Master_IN_BRAKE:
          /* During 'BRAKE': '<S2>:3' */
          /* '<S2>:10:1' sf_internal_predicateOutput = ... */
          /* '<S2>:10:1' K < 100; */
          if (K < 100.0) {
            /* Transition: '<S2>:10' */
            Controller_Master_DW->is_ACTIVE = Controller_Master_IN_WARNING;

            /* Outport: '<Root>/BRAKE' */
            /* Entry 'WARNING': '<S2>:5' */
            /* '<S2>:5:1' Brake = uint8(0); */
            *Controller_Master_Y_BRAKE = 0U;
          }
          break;

         case Controller_Master_IN_IDLE:
          /* During 'IDLE': '<S2>:6' */
          /* '<S2>:12:1' sf_internal_predicateOutput = ... */
          /* '<S2>:12:1' K >= 70; */
          if (K >= 70.0) {
            /* Transition: '<S2>:12' */
            Controller_Master_DW->is_ACTIVE = Controller_Master_IN_WARNING;

            /* Outport: '<Root>/BRAKE' */
            /* Entry 'WARNING': '<S2>:5' */
            /* '<S2>:5:1' Brake = uint8(0); */
            *Controller_Master_Y_BRAKE = 0U;
          }
          break;

         default:
          /* During 'WARNING': '<S2>:5' */
          /* '<S2>:9:1' sf_internal_predicateOutput = ... */
          /* '<S2>:9:1' K  >= 100; */
          if (K >= 100.0) {
            /* Transition: '<S2>:9' */
            Controller_Master_DW->is_ACTIVE = Controller_Master_IN_BRAKE;

            /* Outport: '<Root>/BRAKE' */
            /* Entry 'BRAKE': '<S2>:3' */
            /* '<S2>:3:1' Brake = uint8(1); */
            *Controller_Master_Y_BRAKE = 1U;

            /* '<S2>:3:1' Led_Blue = 1; */
            Controller_Master_B->Led_Blue = 1.0;
          } else {
            /* '<S2>:11:1' sf_internal_predicateOutput = ... */
            /* '<S2>:11:1' K < 70; */
            if (K < 70.0) {
              /* Transition: '<S2>:11' */
              Controller_Master_DW->is_ACTIVE = Controller_Master_IN_IDLE;

              /* Outport: '<Root>/BRAKE' */
              /* Entry 'IDLE': '<S2>:6' */
              /* '<S2>:6:1' Brake = uint8(0); */
              *Controller_Master_Y_BRAKE = 0U;

              /* '<S2>:6:1' Led_Blue = 0; */
              Controller_Master_B->Led_Blue = 0.0;
            } else {
              /* '<S2>:5:1' Led_Blue = (K-70)/30; */
              Controller_Master_B->Led_Blue = (K - 70.0) / 30.0;
            }
          }
          break;
        }
      }
    } else {
      /* During 'READY': '<S2>:21' */
      /* '<S2>:23:1' sf_internal_predicateOutput = ... */
      /* '<S2>:23:1' En == true; */
      if (Controller_Master_DW->En) {
        /* Transition: '<S2>:23' */
        Controller_Master_DW->is_APPLICATION_THREAD =
          Controller_Master_IN_ACTIVE;

        /* Entry 'ACTIVE': '<S2>:1' */
        /* '<S2>:1:1' K = (V^2)/D; */
        /* Entry Internal 'ACTIVE': '<S2>:1' */
        /* Transition: '<S2>:51' */
        Controller_Master_DW->is_ACTIVE = Controller_Master_IN_IDLE;

        /* Outport: '<Root>/BRAKE' */
        /* Entry 'IDLE': '<S2>:6' */
        /* '<S2>:6:1' Brake = uint8(0); */
        *Controller_Master_Y_BRAKE = 0U;

        /* '<S2>:6:1' Led_Blue = 0; */
        Controller_Master_B->Led_Blue = 0.0;
      }
    }
  }

  /* End of Chart: '<S1>/AEB' */

  /* Chart: '<S1>/select_command' */
  if (Controller_Master_DW->temporalCounter_i1 < MAX_uint32_T) {
    Controller_Master_DW->temporalCounter_i1++;
  }

  /* Gateway: Controller_Master/select_command */
  /* During: Controller_Master/select_command */
  if (Controller_Master_DW->is_active_c2_Controller_Master == 0U) {
    /* Entry: Controller_Master/select_command */
    Controller_Master_DW->is_active_c2_Controller_Master = 1U;

    /* Entry Internal: Controller_Master/select_command */
    /* Transition: '<S3>:2' */
    Controller_Master_DW->is_c2_Controller_Master = Controller_Master_IN_OFF1;

    /* Outport: '<Root>/LED_BLUE' */
    /* Entry 'OFF1': '<S3>:3' */
    /* '<S3>:3:1' led = uint8(0); */
    *Controller_Master_Y_LED_BLUE = 0U;
  } else {
    switch (Controller_Master_DW->is_c2_Controller_Master) {
     case Controller_Master_IN_BLINK:
      /* During 'BLINK': '<S3>:20' */
      /* '<S3>:7:1' sf_internal_predicateOutput = ... */
      /* '<S3>:7:1' enable == 1; */
      if (Controller_Master_B->Led_Blue == 1.0) {
        /* Transition: '<S3>:7' */
        /* Exit Internal 'BLINK': '<S3>:20' */
        Controller_Master_DW->is_BLINK = Controller_M_IN_NO_ACTIVE_CHILD;
        Controller_Master_DW->is_c2_Controller_Master = Controller_Master_IN_ON;

        /* Outport: '<Root>/LED_BLUE' */
        /* Entry 'ON': '<S3>:6' */
        /* '<S3>:6:1' led = uint8(1); */
        *Controller_Master_Y_LED_BLUE = 1U;
      } else {
        /* '<S3>:21:1' sf_internal_predicateOutput = ... */
        /* '<S3>:21:1' enable == 0; */
        if (Controller_Master_B->Led_Blue == 0.0) {
          /* Transition: '<S3>:21' */
          /* Exit Internal 'BLINK': '<S3>:20' */
          Controller_Master_DW->is_BLINK = Controller_M_IN_NO_ACTIVE_CHILD;
          Controller_Master_DW->is_c2_Controller_Master =
            Controller_Master_IN_OFF1;

          /* Outport: '<Root>/LED_BLUE' */
          /* Entry 'OFF1': '<S3>:3' */
          /* '<S3>:3:1' led = uint8(0); */
          *Controller_Master_Y_LED_BLUE = 0U;
        } else if (Controller_Master_DW->is_BLINK ==
                   Controller_Master_IN_BLINK_OFF) {
          /* During 'BLINK_OFF': '<S3>:11' */
          /* '<S3>:14:1' sf_internal_predicateOutput = ... */
          /* '<S3>:14:1' after(1-enable,sec); */
          if (Controller_Master_DW->temporalCounter_i1 >= (uint32_T)ceil((1.0 -
                Controller_Master_B->Led_Blue) / 0.2 - 2.0E-9)) {
            /* Transition: '<S3>:14' */
            Controller_Master_DW->is_BLINK = Controller_Master_IN_BLINK_ON;
            Controller_Master_DW->temporalCounter_i1 = 0U;

            /* Outport: '<Root>/LED_BLUE' */
            /* Entry 'BLINK_ON': '<S3>:13' */
            /* '<S3>:13:1' led = uint8(1); */
            *Controller_Master_Y_LED_BLUE = 1U;
          }
        } else {
          /* During 'BLINK_ON': '<S3>:13' */
          /* '<S3>:15:1' sf_internal_predicateOutput = ... */
          /* '<S3>:15:1' after(0.1,sec); */
          if (Controller_Master_DW->temporalCounter_i1 >= 1U) {
            /* Transition: '<S3>:15' */
            Controller_Master_DW->is_BLINK = Controller_Master_IN_BLINK_OFF;
            Controller_Master_DW->temporalCounter_i1 = 0U;

            /* Outport: '<Root>/LED_BLUE' */
            /* Entry 'BLINK_OFF': '<S3>:11' */
            /* '<S3>:11:1' led = uint8(0); */
            *Controller_Master_Y_LED_BLUE = 0U;
          }
        }
      }
      break;

     case Controller_Master_IN_OFF1:
      /* During 'OFF1': '<S3>:3' */
      /* '<S3>:22:1' sf_internal_predicateOutput = ... */
      /* '<S3>:22:1' enable == 1; */
      if (Controller_Master_B->Led_Blue == 1.0) {
        /* Transition: '<S3>:22' */
        Controller_Master_DW->is_c2_Controller_Master = Controller_Master_IN_ON;

        /* Outport: '<Root>/LED_BLUE' */
        /* Entry 'ON': '<S3>:6' */
        /* '<S3>:6:1' led = uint8(1); */
        *Controller_Master_Y_LED_BLUE = 1U;
      } else {
        /* '<S3>:12:1' sf_internal_predicateOutput = ... */
        /* '<S3>:12:1' enable >0 && enable <1; */
        if ((Controller_Master_B->Led_Blue > 0.0) &&
            (Controller_Master_B->Led_Blue < 1.0)) {
          /* Transition: '<S3>:12' */
          Controller_Master_DW->is_c2_Controller_Master =
            Controller_Master_IN_BLINK;

          /* Entry Internal 'BLINK': '<S3>:20' */
          /* Transition: '<S3>:24' */
          Controller_Master_DW->is_BLINK = Controller_Master_IN_BLINK_OFF;
          Controller_Master_DW->temporalCounter_i1 = 0U;

          /* Outport: '<Root>/LED_BLUE' */
          /* Entry 'BLINK_OFF': '<S3>:11' */
          /* '<S3>:11:1' led = uint8(0); */
          *Controller_Master_Y_LED_BLUE = 0U;
        }
      }
      break;

     default:
      /* During 'ON': '<S3>:6' */
      /* '<S3>:4:1' sf_internal_predicateOutput = ... */
      /* '<S3>:4:1' enable == 0; */
      if (Controller_Master_B->Led_Blue == 0.0) {
        /* Transition: '<S3>:4' */
        Controller_Master_DW->is_c2_Controller_Master =
          Controller_Master_IN_OFF1;

        /* Outport: '<Root>/LED_BLUE' */
        /* Entry 'OFF1': '<S3>:3' */
        /* '<S3>:3:1' led = uint8(0); */
        *Controller_Master_Y_LED_BLUE = 0U;
      } else {
        /* '<S3>:23:1' sf_internal_predicateOutput = ... */
        /* '<S3>:23:1' enable >0 && enable <1; */
        if ((Controller_Master_B->Led_Blue > 0.0) &&
            (Controller_Master_B->Led_Blue < 1.0)) {
          /* Transition: '<S3>:23' */
          Controller_Master_DW->is_c2_Controller_Master =
            Controller_Master_IN_BLINK;

          /* Entry Internal 'BLINK': '<S3>:20' */
          /* Transition: '<S3>:24' */
          Controller_Master_DW->is_BLINK = Controller_Master_IN_BLINK_OFF;
          Controller_Master_DW->temporalCounter_i1 = 0U;

          /* Outport: '<Root>/LED_BLUE' */
          /* Entry 'BLINK_OFF': '<S3>:11' */
          /* '<S3>:11:1' led = uint8(0); */
          *Controller_Master_Y_LED_BLUE = 0U;
        }
      }
      break;
    }
  }

  /* End of Chart: '<S1>/select_command' */

  /* Update for Memory: '<S1>/Memory' incorporates:
   *  Update for Inport: '<Root>/SLAVE'
   */
  Controller_Master_DW->Memory_PreviousInput = Controller_Master_U_Slave;

  /* End of Outputs for SubSystem: '<Root>/Controller_Master' */
}

/* Model initialize function */
void Controller_Master_initialize(RT_MODEL_Controller_Master_T *const
  Controller_Master_M, real_T *Controller_Master_U_V, real_T
  *Controller_Master_U_D_M, uint8_T *Controller_Master_U_Slave, uint8_T
  *Controller_Master_Y_BRAKE, uint8_T *Controller_Master_Y_LED_BLUE, uint8_T
  *Controller_Master_Y_LED_RED, uint8_T *Controller_Master_Y_MASTER)
{
  DW_Controller_Master_T *Controller_Master_DW = ((DW_Controller_Master_T *)
    Controller_Master_M->ModelData.dwork);
  B_Controller_Master_T *Controller_Master_B = ((B_Controller_Master_T *)
    Controller_Master_M->ModelData.blockIO);

  /* Registration code */

  /* block I/O */
  (void) memset(((void *) Controller_Master_B), 0,
                sizeof(B_Controller_Master_T));

  /* states (dwork) */
  (void) memset((void *)Controller_Master_DW, 0,
                sizeof(DW_Controller_Master_T));

  /* external inputs */
  (*Controller_Master_U_V) = 0.0;
  (*Controller_Master_U_D_M) = 0.0;
  (*Controller_Master_U_Slave) = 0U;

  /* external outputs */
  (*Controller_Master_Y_BRAKE) = 0U;
  (*Controller_Master_Y_LED_BLUE) = 0U;
  (*Controller_Master_Y_LED_RED) = 0U;
  (*Controller_Master_Y_MASTER) = 0U;

  /* SystemInitialize for Atomic SubSystem: '<Root>/Controller_Master' */
  /* InitializeConditions for Memory: '<S1>/Memory' */
  Controller_Master_DW->Memory_PreviousInput = 1U;

  /* SystemInitialize for Chart: '<S1>/AEB' */
  Controller_Master_DW->is_APPLICATION_THREAD = Controller_M_IN_NO_ACTIVE_CHILD;
  Controller_Master_DW->is_ACTIVE = Controller_M_IN_NO_ACTIVE_CHILD;
  Controller_Master_DW->is_ERRORS_CHECK_THREAD = Controller_M_IN_NO_ACTIVE_CHILD;
  Controller_Master_DW->is_active_c3_Controller_Master = 0U;
  Controller_Master_DW->En = true;

  /* SystemInitialize for Chart: '<S1>/select_command' */
  Controller_Master_DW->is_BLINK = Controller_M_IN_NO_ACTIVE_CHILD;
  Controller_Master_DW->temporalCounter_i1 = 0U;
  Controller_Master_DW->is_active_c2_Controller_Master = 0U;
  Controller_Master_DW->is_c2_Controller_Master =
    Controller_M_IN_NO_ACTIVE_CHILD;

  /* End of SystemInitialize for SubSystem: '<Root>/Controller_Master' */
}

/* Model terminate function */
void Controller_Master_terminate(RT_MODEL_Controller_Master_T *const
  Controller_Master_M)
{
  /* (no terminate code required) */
  UNUSED_PARAMETER(Controller_Master_M);
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */