⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c1_stateflow_heating_controller.c

📁 m files for SIAM book, Numerical Computing with MATLAB
💻 C
📖 第 1 页 / 共 5 页
字号:
        _SFD_CS_CALL(STATE_INACTIVE_TAG,11);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,11);
        if(chartInstance.c1_is_Process_Buttons != 9) {
          chartInstance.c1_is_Process_Buttons = (uint8_T)c1_b_IN_Start;
          _SFD_CS_CALL(STATE_ACTIVE_TAG,18);
          chartInstance.c1_b_tp_Start = 1U;
          *c1_SetClock = 0.0;
          _SFD_DATA_RANGE_CHECK(*c1_SetClock, 0U);
        }
      } else {
        _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,34);
        if(CV_TRANSITION_EVAL(34U, (int32_T)_SFD_CCP_CALL(34,0,((_sfEvent_ ==
             c1_event_time)!=0))) != 0U != 0) {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,34);
          _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,11);
          chartInstance.c1_tp_Temperature = 0U;
          chartInstance.c1_is_Process_Buttons = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
          _SFD_CS_CALL(STATE_INACTIVE_TAG,11);
          _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,11);
          if(chartInstance.c1_is_Process_Buttons != 9) {
            chartInstance.c1_is_Process_Buttons = (uint8_T)c1_b_IN_Start;
            _SFD_CS_CALL(STATE_ACTIVE_TAG,18);
            chartInstance.c1_b_tp_Start = 1U;
            *c1_SetClock = 0.0;
            _SFD_DATA_RANGE_CHECK(*c1_SetClock, 0U);
          }
        } else {
          _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,14);
          if(CV_TRANSITION_EVAL(14U, (int32_T)_SFD_CCP_CALL(14,0,((*c1_Enter ==
               -1.0)!=0))) != 0U != 0) {
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,14);
            _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,22);
            if(CV_TRANSITION_EVAL(22U, (_SFD_CCP_CALL(22,0,((_sfEvent_ ==
                  c1_event_tic)!=0)) != 0) &&
              (_SFD_CCP_CALL(22,1,((*c1_PushButton >=
                  0.0)!=0)) != 0)) != 0U != 0) {
              _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,22);
              _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,11);
              chartInstance.c1_tp_Temperature = 0U;
              _SFD_CS_CALL(STATE_INACTIVE_TAG,11);
              _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,11);
              chartInstance.c1_is_Process_Buttons = (uint8_T)c1_IN_Tens1;
              _SFD_CS_CALL(STATE_ACTIVE_TAG,14);
              chartInstance.c1_tp_Tens1 = 1U;
              chartInstance.c1_m2 = *c1_PushButton;
              _SFD_DATA_RANGE_CHECK(chartInstance.c1_m2, 15U);
            }
          }
        }
      }
    }
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,11);
}

static void c1_SetTime(void)
{
  real_T *c1_PushButton;
  real_T *c1_SetClock;
  c1_PushButton = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c1_SetClock = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,9);
  if(chartInstance.c1_is_Process_Buttons == 8) {
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,29);
    if(CV_TRANSITION_EVAL(29U, (_SFD_CCP_CALL(29,0,((_sfEvent_ ==
          c1_event_tic)!=0)) != 0) && (_SFD_CCP_CALL(29,1,((*c1_PushButton >=
          0.0)!=0)) != 0)) != 0U != 0) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,29);
      _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,9);
      chartInstance.c1_tp_SetTime = 0U;
      _SFD_CS_CALL(STATE_INACTIVE_TAG,9);
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,9);
      chartInstance.c1_is_Process_Buttons = (uint8_T)c1_IN_Hour2;
      _SFD_CS_CALL(STATE_ACTIVE_TAG,4);
      chartInstance.c1_tp_Hour2 = 1U;
      chartInstance.c1_h2 = *c1_PushButton;
      _SFD_DATA_RANGE_CHECK(chartInstance.c1_h2, 10U);
    } else {
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,15);
      if(CV_TRANSITION_EVAL(15U, (int32_T)_SFD_CCP_CALL(15,0,((_sfEvent_ ==
           c1_event_temperature)!=0))) != 0U != 0) {
        if(sf_debug_transition_conflict_check_enabled()) {
          unsigned int transitionList[2];
          unsigned int numTransitions=1;
          transitionList[0] = 15;
          sf_debug_transition_conflict_check_begin();
          if(_sfEvent_ == c1_event_run) {
            transitionList[numTransitions] = 31;
            numTransitions++;
          }
          sf_debug_transition_conflict_check_end();
          if(numTransitions>1) {
            _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
          }
        }
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,15);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,9);
        chartInstance.c1_tp_SetTime = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,9);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,9);
        chartInstance.c1_is_Process_Buttons = (uint8_T)c1_b_IN_Start;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,18);
        chartInstance.c1_b_tp_Start = 1U;
        *c1_SetClock = 0.0;
        _SFD_DATA_RANGE_CHECK(*c1_SetClock, 0U);
      } else {
        _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,31);
        if(CV_TRANSITION_EVAL(31U, (int32_T)_SFD_CCP_CALL(31,0,((_sfEvent_ ==
             c1_event_run)!=0))) != 0U != 0) {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,31);
          _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,9);
          chartInstance.c1_tp_SetTime = 0U;
          _SFD_CS_CALL(STATE_INACTIVE_TAG,9);
          _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,9);
          chartInstance.c1_is_Process_Buttons = (uint8_T)c1_b_IN_Start;
          _SFD_CS_CALL(STATE_ACTIVE_TAG,18);
          chartInstance.c1_b_tp_Start = 1U;
          *c1_SetClock = 0.0;
          _SFD_DATA_RANGE_CHECK(*c1_SetClock, 0U);
        }
      }
    }
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,9);
}

static void c1_Wait1(void)
{
  real_T *c1_PushButton;
  real_T *c1_SetClock;
  c1_PushButton = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c1_SetClock = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,12);
  if(chartInstance.c1_is_Process_Buttons == 13) {
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,0);
    if(CV_TRANSITION_EVAL(0U, (_SFD_CCP_CALL(0,0,((_sfEvent_ ==
          c1_event_next)!=0)) != 0) && (_SFD_CCP_CALL(0,1,((*c1_PushButton >=
          0.0)!=0))
       != 0)) != 0U != 0) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
      _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,12);
      chartInstance.c1_tp_Wait1 = 0U;
      _SFD_CS_CALL(STATE_INACTIVE_TAG,12);
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,12);
      chartInstance.c1_is_Process_Buttons = (uint8_T)c1_IN_Tens2;
      _SFD_CS_CALL(STATE_ACTIVE_TAG,10);
      chartInstance.c1_tp_Tens2 = 1U;
      chartInstance.c1_m1 = *c1_PushButton;
      _SFD_DATA_RANGE_CHECK(chartInstance.c1_m1, 11U);
    } else {
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,38);
      if(CV_TRANSITION_EVAL(38U, (_SFD_CCP_CALL(38,0,((_sfEvent_ ==
            c1_event_next)!=0)) != 0) && (_SFD_CCP_CALL(38,1,((chartInstance.
            c1_temporalCounter_i1 >= 45)!=0)) != 0)) != 0U != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,38);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,12);
        chartInstance.c1_tp_Wait1 = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,12);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,12);
        _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,25);
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,25);
        chartInstance.c1_is_Process_Buttons = (uint8_T)c1_b_IN_Start;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,18);
        chartInstance.c1_b_tp_Start = 1U;
        *c1_SetClock = 0.0;
        _SFD_DATA_RANGE_CHECK(*c1_SetClock, 0U);
      }
    }
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,12);
}

static void c1_Wait2(void)
{
  real_T *c1_PushButton;
  real_T *c1_SetClock;
  c1_PushButton = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c1_SetClock = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,3);
  if(chartInstance.c1_is_Process_Buttons == 14) {
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,18);
    if(CV_TRANSITION_EVAL(18U, (_SFD_CCP_CALL(18,0,((_sfEvent_ ==
          c1_event_next)!=0)) != 0) && (_SFD_CCP_CALL(18,1,((chartInstance.
          c1_temporalCounter_i1 >= 45)!=0)) != 0)) != 0U != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[2];
        unsigned int numTransitions=1;
        transitionList[0] = 18;
        sf_debug_transition_conflict_check_begin();
        if((_sfEvent_ == c1_event_next) && (*c1_PushButton >= 0.0)) {
          transitionList[numTransitions] = 19;
          numTransitions++;
        }
        sf_debug_transition_conflict_check_end();
        if(numTransitions>1) {
          _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
        }
      }
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,18);
      _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,3);
      chartInstance.c1_tp_Wait2 = 0U;
      _SFD_CS_CALL(STATE_INACTIVE_TAG,3);
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,25);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,25);
      chartInstance.c1_is_Process_Buttons = (uint8_T)c1_b_IN_Start;
      _SFD_CS_CALL(STATE_ACTIVE_TAG,18);
      chartInstance.c1_b_tp_Start = 1U;
      *c1_SetClock = 0.0;
      _SFD_DATA_RANGE_CHECK(*c1_SetClock, 0U);
    } else {
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,19);
      if(CV_TRANSITION_EVAL(19U, (_SFD_CCP_CALL(19,0,((_sfEvent_ ==
            c1_event_next)!=0)) != 0) && (_SFD_CCP_CALL(19,1,((*c1_PushButton >=

            0.0)!=0)) != 0)) != 0U != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,19);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,3);
        chartInstance.c1_tp_Wait2 = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,3);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
        chartInstance.c1_is_Process_Buttons = (uint8_T)c1_IN_Hour1;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,0);
        chartInstance.c1_tp_Hour1 = 1U;
        chartInstance.c1_h1 = *c1_PushButton;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_h1, 1U);
      }
    }
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
}

static void c1_Wait3(void)
{
  real_T *c1_PushButton;
  real_T *c1_SetClock;
  c1_PushButton = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c1_SetClock = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,8);
  if(chartInstance.c1_is_Process_Buttons == 15) {
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,36);
    if(CV_TRANSITION_EVAL(36U, (_SFD_CCP_CALL(36,0,((_sfEvent_ ==
          c1_event_next)!=0)) != 0) && (_SFD_CCP_CALL(36,1,((chartInstance.
          c1_temporalCounter_i1 >= 45)!=0)) != 0)) != 0U != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[2];
        unsigned int numTransitions=1;
        transitionList[0] = 36;
        sf_debug_transition_conflict_check_begin();
        if((_sfEvent_ == c1_event_next) && (*c1_PushButton >= 0.0)) {
          transitionList[numTransitions] = 21;
          numTransitions++;
        }
        sf_debug_transition_conflict_check_end();
        if(numTransitions>1) {
          _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
        }
      }
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,36);
      _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,8);
      chartInstance.c1_tp_Wait3 = 0U;
      _SFD_CS_CALL(STATE_INACTIVE_TAG,8);
      _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,8);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,25);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,25);
      chartInstance.c1_is_Process_Buttons = (uint8_T)c1_b_IN_Start;
      _SFD_CS_CALL(STATE_ACTIVE_TAG,18);
      chartInstance.c1_b_tp_Start = 1U;
      *c1_SetClock = 0.0;
      _SFD_DATA_RANGE_CHECK(*c1_SetClock, 0U);
    } else {
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,21);
      if(CV_TRANSITION_EVAL(21U, (_SFD_CCP_CALL(21,0,((_sfEvent_ ==
            c1_event_next)!=0)) != 0) && (_SFD_CCP_CALL(21,1,((*c1_PushButton >=

            0.0)!=0)) != 0)) != 0U != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,21);
        _SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,8);
        chartInstance.c1_tp_Wait3 = 0U;
        _SFD_CS_CALL(STATE_INACTIVE_TAG,8);
        _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,8);
        chartInstance.c1_is_Process_Buttons = (uint8_T)c1_IN_Minutes2;
        _SFD_CS_CALL(STATE_ACTIVE_TAG,15);
        chartInstance.c1_tp_Minutes2 = 1U;
        chartInstance.c1_m2 = *c1_PushButton;
        _SFD_DATA_RANGE_CHECK(chartInstance.c1_m2, 15U);
      }
    }
  }
  _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,8);
}

static void c1_Wait4(void)
{
  real_T *c1_PushButton;
  real_T *c1_Reset;
  real_T *c1_SetClock;
  c1_PushButton = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c1_SetClock = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c1_Reset = (real_T *)ssGetOutputPortSignal(chartInstance.S, 3);
  _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,2);
  if(chartInstance.c1_is_Process_Buttons == 16) {
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,13);
    if(CV_TRANSITION_EVAL(13U, (_SFD_CCP_CALL(13,0,((_sfEvent_ ==
          c1_event_next)!=0)) != 0) && (_SFD_CCP_CALL(13,1,((chartInstance.
          c1_temporalCounter_i1 >= 45)!=0)) != 0)) != 0U != 0) {
      if(sf_debug_transition_conflict_check_enabled()) {
        unsigned int transitionList[2];
        unsigned int numTransitions=1;
        transitionList[0] = 13;
        sf_debug_transition_conflict_check_begin();
        if((_sfEvent_ == c1_event_next) && (*c1_PushButton >= 0.0)) {
          transitionList[numTransitions] = 33;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -