// // 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: FSMTreppe.cpp // // Code generated for Simulink model 'FSMTreppe'. // // Model version : 1.49 // Simulink Coder version : 9.5 (R2021a) 14-Nov-2020 // C/C++ source code generated on : Wed Jul 7 15:27:06 2021 // // Target selection: ert.tlc // Embedded hardware selection: ARM Compatible->ARM Cortex-M // Code generation objectives: Unspecified // Validation result: Not run // #include "FSMTreppe3.h" // Named constants for Chart: '/FSMTreppe' const uint8_t FSMTreppe_IN_abdimmen_hoch = 1U; const uint8_t FSMTreppe_IN_abdimmen_ldr = 2U; const uint8_t FSMTreppe_IN_abdimmen_runter = 3U; const uint8_t FSMTreppe_IN_aufdimmen_hoch = 4U; const uint8_t FSMTreppe_IN_aufdimmen_ldr = 5U; const uint8_t FSMTreppe_IN_aufdimmen_runter = 6U; const uint8_t FSMTreppe_IN_inaktiv = 7U; const uint8_t FSMTreppe_IN_ruhezustand = 8U; const uint8_t FSMTreppe_IN_warten_hoch = 9U; const uint8_t FSMTreppe_IN_warten_runter = 10U; // Model step function void FSMTreppeModelClass::step() { // Chart: '/FSMTreppe' incorporates: // Inport: '/anim_beendet' // Inport: '/ldr_schwelle' // Inport: '/sensor_oben' // Inport: '/sensor_unten' if (FSMTreppe_DW.temporalCounter_i1 < 511U) { FSMTreppe_DW.temporalCounter_i1 = static_cast (FSMTreppe_DW.temporalCounter_i1 + 1U); } if (FSMTreppe_DW.is_active_c3_FSMTreppe == 0U) { FSMTreppe_DW.is_active_c3_FSMTreppe = 1U; FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_inaktiv; // Outport: '/status' FSMTreppe_Y.status = 0U; } else { switch (FSMTreppe_DW.is_c3_FSMTreppe) { case FSMTreppe_IN_abdimmen_hoch: // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 0U; // Outport: '/status' FSMTreppe_Y.status = 6U; if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >= 500U)) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand; // Outport: '/status' FSMTreppe_Y.status = 3U; } break; case FSMTreppe_IN_abdimmen_ldr: // Outport: '/status' FSMTreppe_Y.status = 2U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 0U; if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >= 500U)) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_inaktiv; // Outport: '/status' FSMTreppe_Y.status = 0U; } break; case FSMTreppe_IN_abdimmen_runter: // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 0U; // Outport: '/status' FSMTreppe_Y.status = 9U; if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >= 500U)) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand; // Outport: '/status' FSMTreppe_Y.status = 3U; } break; case FSMTreppe_IN_aufdimmen_hoch: // Outport: '/laufrichtung' FSMTreppe_Y.laufrichtung = 1U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 1U; // Outport: '/status' FSMTreppe_Y.status = 4U; if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >= 500U)) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_warten_hoch; FSMTreppe_DW.temporalCounter_i1 = 0U; // Outport: '/status' FSMTreppe_Y.status = 5U; } break; case FSMTreppe_IN_aufdimmen_ldr: // Outport: '/status' FSMTreppe_Y.status = 1U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 1U; if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >= 500U)) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand; // Outport: '/status' FSMTreppe_Y.status = 3U; } break; case FSMTreppe_IN_aufdimmen_runter: // Outport: '/laufrichtung' FSMTreppe_Y.laufrichtung = 0U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 1U; // Outport: '/status' FSMTreppe_Y.status = 7U; if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >= 500U)) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_warten_runter; FSMTreppe_DW.temporalCounter_i1 = 0U; // Outport: '/status' FSMTreppe_Y.status = 8U; } break; case FSMTreppe_IN_inaktiv: // Outport: '/status' FSMTreppe_Y.status = 0U; if (FSMTreppe_U.ldr_schwelle == 1U) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_ldr; FSMTreppe_DW.temporalCounter_i1 = 0U; // Outport: '/status' FSMTreppe_Y.status = 1U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 1U; } break; case FSMTreppe_IN_ruhezustand: // Outport: '/status' FSMTreppe_Y.status = 3U; if (FSMTreppe_U.ldr_schwelle == 0U) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_ldr; FSMTreppe_DW.temporalCounter_i1 = 0U; // Outport: '/status' FSMTreppe_Y.status = 2U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 0U; } else if (FSMTreppe_U.sensor_unten == 1U) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_hoch; FSMTreppe_DW.temporalCounter_i1 = 0U; // Outport: '/laufrichtung' FSMTreppe_Y.laufrichtung = 1U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 1U; // Outport: '/status' FSMTreppe_Y.status = 4U; } else if (FSMTreppe_U.sensor_oben == 1U) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_runter; FSMTreppe_DW.temporalCounter_i1 = 0U; // Outport: '/laufrichtung' FSMTreppe_Y.laufrichtung = 0U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 1U; // Outport: '/status' FSMTreppe_Y.status = 7U; } break; case FSMTreppe_IN_warten_hoch: // Outport: '/status' FSMTreppe_Y.status = 5U; if ((FSMTreppe_U.sensor_oben == 1U) || (FSMTreppe_DW.temporalCounter_i1 >= 500U)) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_hoch; FSMTreppe_DW.temporalCounter_i1 = 0U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 0U; // Outport: '/status' FSMTreppe_Y.status = 6U; } break; default: // Outport: '/status' // case IN_warten_runter: FSMTreppe_Y.status = 8U; if ((FSMTreppe_U.sensor_unten == 1U) || (FSMTreppe_DW.temporalCounter_i1 >= 500U)) { FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_runter; FSMTreppe_DW.temporalCounter_i1 = 0U; // Outport: '/dimmrichtung' FSMTreppe_Y.dimmrichtung = 0U; // Outport: '/status' FSMTreppe_Y.status = 9U; } break; } } // End of Chart: '/FSMTreppe' } // Model initialize function void FSMTreppeModelClass::initialize() { // (no initialization code required) } // Model terminate function void FSMTreppeModelClass::terminate() { // (no terminate code required) } // Constructor FSMTreppeModelClass::FSMTreppeModelClass() : FSMTreppe_DW(), FSMTreppe_U(), FSMTreppe_Y() { // Currently there is no constructor body generated. } // Destructor FSMTreppeModelClass::~FSMTreppeModelClass() { // Currently there is no destructor body generated. } // // File trailer for generated code. // // [EOF] //