File: System_Monitor_Functional.c

    1   /*
    2    * Code generation for system model 'System_Monitor_Functional'
    3    *
    4    * Model                      : System_Monitor_Functional
    5    * Model version              : 1.1157
    6    * Simulink Coder version : 8.4 (R2013a) 13-Feb-2013
    7    * C source code generated on : Thu Sep 12 09:50:24 2013
    8    *
    9    * Note that the functions contained in this file are part of a Simulink
   10    * model, and are not self-contained algorithms.
   11    */
   12   
   13   #include "System_Monitor_Functional.h"
   14   #include "System_Monitor_Functional_private.h"
   15   
   16   /* Named constants for Chart: '<Root>/System Monitor Sub-System' */
   17   #define System_Monitor_Functional_IN_NOT_ON ((uint8_T)1U)
   18   #define System_Monitor_Functional_IN_NO_ACTIVE_CHILD ((uint8_T)0U)
   19   #define System_Monitor_Functional_IN_System_Monitor ((uint8_T)2U)
   20   
   21   /* Initial conditions for referenced model: 'System_Monitor_Functional' */
   22   void System_Monitor_Functional_Init(B_System_Monitor_Functional_c_T *localB,
   23     DW_System_Monitor_Functional_f_T *localDW)
   24   {
   25     /* InitializeConditions for Chart: '<Root>/System Monitor Sub-System' */
   26     localDW->is_active_c1_System_Monitor_Functional = 0U;
   27     localDW->is_c1_System_Monitor_Functional =
   28       System_Monitor_Functional_IN_NO_ACTIVE_CHILD;
   29     localB->SYS_MON_OUT_System_Monitor_Failed = FALSE;
   30   }
   31   
   32   /* Output and update for referenced model: 'System_Monitor_Functional' */
   33   void System_Monitor_Functional(const Top_Level_Mode_Outputs *rtu_TLM_MODE_IN,
   34     System_Monitor_Output *rty_SYS_MON_OUT, B_System_Monitor_Functional_c_T
   35     *localB, DW_System_Monitor_Functional_f_T *localDW)
   36   {
   37     /* Chart: '<Root>/System Monitor Sub-System' */
   38     /* Gateway: System Monitor Sub-System */
   39     /* During: System Monitor Sub-System */
   40     if (localDW->is_active_c1_System_Monitor_Functional == 0U) {
   41       /* Entry: System Monitor Sub-System */
   42       localDW->is_active_c1_System_Monitor_Functional = 1U;
   43   
   44       /* Entry Internal: System Monitor Sub-System */
   45       if (rtu_TLM_MODE_IN->System_On) {
   46         /* Transition: '<S1>:1' */
   47         localDW->is_c1_System_Monitor_Functional =
   48           System_Monitor_Functional_IN_System_Monitor;
   49   
   50         /* Entry 'System_Monitor': '<S1>:6' */
   51         localB->SYS_MON_OUT_System_Monitor_Failed = FALSE;
   52       } else {
   53         /* Transition: '<S1>:5' */
   54         localDW->is_c1_System_Monitor_Functional =
   55           System_Monitor_Functional_IN_NOT_ON;
   56       }
   57     } else if (localDW->is_c1_System_Monitor_Functional ==
   58                System_Monitor_Functional_IN_NOT_ON) {
   59       /* During 'NOT_ON': '<S1>:3' */
   60       if (rtu_TLM_MODE_IN->System_On) {
   61         /* Transition: '<S1>:2' */
   62         localDW->is_c1_System_Monitor_Functional =
   63           System_Monitor_Functional_IN_System_Monitor;
   64   
   65         /* Entry 'System_Monitor': '<S1>:6' */
   66         localB->SYS_MON_OUT_System_Monitor_Failed = FALSE;
   67       }
   68     } else {
   69       /* During 'System_Monitor': '<S1>:6' */
   70       if (!rtu_TLM_MODE_IN->System_On) {
   71         /* Transition: '<S1>:4' */
   72         /* Exit 'System_Monitor': '<S1>:6' */
   73         localB->SYS_MON_OUT_System_Monitor_Failed = FALSE;
   74         localDW->is_c1_System_Monitor_Functional =
   75           System_Monitor_Functional_IN_NOT_ON;
   76       } else {
   77         localB->SYS_MON_OUT_System_Monitor_Failed = FALSE;
   78       }
   79     }
   80   
   81     /* End of Chart: '<Root>/System Monitor Sub-System' */
   82   
   83     /* BusCreator: '<Root>/BusConversion_InsertedFor_SYS_MON_OUT_at_inport_0' */
   84     rty_SYS_MON_OUT->System_Monitor_Failed =
   85       localB->SYS_MON_OUT_System_Monitor_Failed;
   86   }
   87   
   88   /* Model initialize function */
   89   void System_Monitor_Functional_initialize(const char_T **rt_errorStatus,
   90     RT_MODEL_System_Monitor_Functional_T *const System_Monitor_Functional_M,
   91     B_System_Monitor_Functional_c_T *localB, DW_System_Monitor_Functional_f_T
   92     *localDW)
   93   {
   94     /* Registration code */
   95   
   96     /* initialize error status */
   97     rtmSetErrorStatusPointer(System_Monitor_Functional_M, rt_errorStatus);
   98   
   99     /* block I/O */
  100     (void) memset(((void *) localB), 0,
  101                   sizeof(B_System_Monitor_Functional_c_T));
  102   
  103     /* states (dwork) */
  104     (void) memset((void *)localDW, 0,
  105                   sizeof(DW_System_Monitor_Functional_f_T));
  106   }
  107