From 44f30d5f7a3d723eef01320c6a5b8b535bacb939 Mon Sep 17 00:00:00 2001
From: darya
Date: Tue, 17 Feb 2026 18:21:24 +0300
Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?=
=?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B8?=
=?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
HVAC_model.c | 6096 ++++++++++++++++++++++++++----------------
HVAC_model.h | 717 +++--
HVAC_model_data.c | 757 ++++--
HVAC_model_private.h | 90 +-
HVAC_model_types.h | 418 +--
5 files changed, 5084 insertions(+), 2994 deletions(-)
mode change 100644 => 100755 HVAC_model.c
mode change 100644 => 100755 HVAC_model.h
mode change 100644 => 100755 HVAC_model_data.c
mode change 100644 => 100755 HVAC_model_private.h
mode change 100644 => 100755 HVAC_model_types.h
diff --git a/HVAC_model.c b/HVAC_model.c
old mode 100644
new mode 100755
index 1f8cc8b..361e2cc
--- a/HVAC_model.c
+++ b/HVAC_model.c
@@ -1,2246 +1,3850 @@
-/*
- * File: HVAC_model.c
- *
- * Code generated for Simulink model 'HVAC_model'.
- *
- * Model version : 1.614
- * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023
- * C/C++ source code generated on : Mon Feb 16 16:26:45 2026
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: ARM Compatible->ARM Cortex-M
- * Emulation hardware selection:
- * Differs from embedded hardware (MATLAB Host)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#include "HVAC_model.h"
-#include
-#include "HVAC_model_private.h"
-#include "HVAC_model_types.h"
-#include
-
-/* Exported block states */
-ActuatorCmdBus Actuator_Ch0_Command_Model;/* '/Data Store Memory15' */
-ActuatorCmdBus Actuator_Ch1_Command_Model;/* '/Data Store Memory15' */
-ActuatorCmdBus Actuator_Ch2_Command_Model;/* '/Data Store Memory15' */
-CmdBusStatus Status_Sensor_Model; /* '/Data Store Memory' */
-CmdBusError CCU_Errors_Model; /* '/Data Store Memory3' */
-CmdBusPWMGet PWM_Get; /* '/Data Store Memory1' */
-
-/* Block signals (default storage) */
-B rtB;
-
-/* Block states (default storage) */
-DW rtDW;
-
-/* External outputs (root outports fed by signals with default storage) */
-ExtY rtY;
-
-/* Real-time model */
-static RT_MODEL rtM_;
-RT_MODEL *const rtM = &rtM_;
-
-/*
- * Output and update for action system:
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- */
-void IfActionSubsystem3(int8_t rtu_stepIn, int8_t *rty_step)
-{
- int32_t i;
-
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch0_Command_Model.POS[i] = 0U;
- Actuator_Ch0_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch0_Command_Model.MODE[i] = 0U;
- Actuator_Ch0_Command_Model.COM[i] = 0U;
- Actuator_Ch0_Command_Model.Stall_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Autos_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Speed_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* SignalConversion generated from: '/stepIn' */
- *rty_step = rtu_stepIn;
-}
-
-/*
- * Output and update for atomic system:
- * '/Initial CPOS Min'
- * '/Initial CPOS Min'
- */
-void InitialCPOSMin(double rtu_LOGGER, int8_t rtu_step, int8_t *rty_y)
-{
- *rty_y = rtu_step;
-
- /* : y = step; */
- /* : if(LOGGER) */
- if (rtu_LOGGER != 0.0) {
- /* : fprintf('SIMULINK Initial CPOS Min - 6000\n'); */
- printf("SIMULINK Initial CPOS Min - 6000\n");
- fflush(stdout);
- }
-}
-
-/*
- * Output and update for atomic system:
- * '/Normal Mode'
- * '/Normal Mode'
- */
-void NormalMode(double rtu_LOGGER, int8_t rtu_step, int8_t *rty_y)
-{
- *rty_y = rtu_step;
-
- /* : y = step; */
- /* : if(LOGGER) */
- if (rtu_LOGGER != 0.0) {
- /* : fprintf('SIMULINK Normal Mode\n'); */
- printf("SIMULINK Normal Mode\n");
- fflush(stdout);
- }
-}
-
-/*
- * Output and update for atomic system:
- * '/Move to position Min'
- * '/Move to position Min'
- * '/Move to position Min'
- */
-void MovetopositionMin(double rtu_LOGGER, int8_t rtu_step, int8_t *rty_y)
-{
- *rty_y = rtu_step;
-
- /* : y = step; */
- /* : if(LOGGER) */
- if (rtu_LOGGER != 0.0) {
- /* : fprintf('SIMULINK Move to position Min - 1\n'); */
- printf("SIMULINK Move to position Min - 1\n");
- fflush(stdout);
- }
-}
-
-/*
- * Output and update for atomic system:
- * '/MIN POSITION'
- * '/MIN POSITION'
- * '/MIN POSITION'
- */
-void MINPOSITION(int16_t rty_y[9], double rtu_LOGGER)
-{
- int32_t i;
-
- /* : y = step; */
- /* : if(LOGGER) */
- if (rtu_LOGGER != 0.0) {
- /* : fprintf('SIMULINK Min_position_Ch0 '); */
- printf("SIMULINK Min_position_Ch0 ");
- fflush(stdout);
-
- /* : for i = 1:numel(step) */
- for (i = 0; i < 9; i++) {
- /* : fprintf('%d ', int16(step(i))); */
- printf("%d ", rty_y[i]);
- fflush(stdout);
- }
-
- /* : fprintf('\n'); */
- printf("\n");
- fflush(stdout);
- }
-}
-
-/*
- * Output and update for atomic system:
- * '/Initial CPOS Max'
- * '/Initial CPOS Max'
- * '/Initial CPOS Max'
- */
-void InitialCPOSMax(double rtu_LOGGER, int8_t rtu_step, int8_t *rty_y)
-{
- *rty_y = rtu_step;
-
- /* : y = step; */
- /* : if(LOGGER) */
- if (rtu_LOGGER != 0.0) {
- /* : fprintf('SIMULINK Initial CPOS Max - 1\n'); */
- printf("SIMULINK Initial CPOS Max - 1\n");
- fflush(stdout);
- }
-}
-
-/*
- * Output and update for atomic system:
- * '/Move to position Max'
- * '/Move to position Max'
- * '/Move to position Max'
- */
-void MovetopositionMax(int8_t rtu_step, double rtu_LOGGER, int8_t *rty_y)
-{
- *rty_y = rtu_step;
-
- /* : y = step; */
- /* : if(LOGGER) */
- if (rtu_LOGGER != 0.0) {
- /* : fprintf('SIMULINK Move to position Max - 6000\n'); */
- printf("SIMULINK Move to position Max - 6000\n");
- fflush(stdout);
- }
-}
-
-/*
- * Output and update for atomic system:
- * '/MIN POSITION'
- * '/MIN POSITION'
- * '/MIN POSITION'
- */
-void MINPOSITION_g(int16_t rty_y[9], double rtu_LOGGER)
-{
- int32_t i;
-
- /* : y = step; */
- /* : if(LOGGER) */
- if (rtu_LOGGER != 0.0) {
- /* : fprintf('SIMULINK Max_position_Ch0 '); */
- printf("SIMULINK Max_position_Ch0 ");
- fflush(stdout);
-
- /* : for i = 1:numel(step) */
- for (i = 0; i < 9; i++) {
- /* : fprintf('%d ', int16(step(i))); */
- printf("%d ", rty_y[i]);
- fflush(stdout);
- }
-
- /* : fprintf('\n'); */
- printf("\n");
- fflush(stdout);
- }
-}
-
-/*
- * Output and update for atomic system:
- * '/Write Ignition'
- * '/Write Ignition'
- */
-void WriteIgnition(double rtu_LOGGER, int8_t rtu_step)
-{
- /* : if(LOGGER) */
- if (rtu_LOGGER != 0.0) {
- /* : fprintf('step = %d\n',step); */
- printf("step = %d\n", rtu_step);
- fflush(stdout);
- }
-}
-
-/*
- * Output and update for action system:
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- */
-void IfActionSubsystem3_m(int8_t rtu_stepIn, int8_t *rty_step)
-{
- int32_t i;
-
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch1_Command_Model.POS[i] = 0U;
- Actuator_Ch1_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch1_Command_Model.MODE[i] = 0U;
- Actuator_Ch1_Command_Model.COM[i] = 0U;
- Actuator_Ch1_Command_Model.Stall_SET[i] = 0U;
- Actuator_Ch1_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch1_Command_Model.Autos_SET[i] = 0U;
- Actuator_Ch1_Command_Model.Speed_SET[i] = 0U;
- Actuator_Ch1_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* SignalConversion generated from: '/stepIn' */
- *rty_step = rtu_stepIn;
-}
-
-/*
- * Output and update for action system:
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- * '/If Action Subsystem3'
- */
-void IfActionSubsystem3_n(int8_t rtu_stepIn, int8_t *rty_step)
-{
- int32_t i;
-
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch2_Command_Model.POS[i] = 0U;
- Actuator_Ch2_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch2_Command_Model.MODE[i] = 0U;
- Actuator_Ch2_Command_Model.COM[i] = 0U;
- Actuator_Ch2_Command_Model.Stall_SET[i] = 0U;
- Actuator_Ch2_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch2_Command_Model.Autos_SET[i] = 0U;
- Actuator_Ch2_Command_Model.Speed_SET[i] = 0U;
- Actuator_Ch2_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* SignalConversion generated from: '/stepIn' */
- *rty_step = rtu_stepIn;
-}
-
-/* Model step function */
-void HVAC_model_step(void)
-{
- int32_t i;
- int16_t rtb_y_ey[9];
- int8_t rtb_Switch;
- int8_t rtb_y_fb;
- bool rtb_RelationalOperator_j[9];
- bool tmp;
- bool tmp_0;
-
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write'
- */
- CCU_Errors_Model.CCU_IncarTempErrF_Stat = 0U;
- CCU_Errors_Model.CCU_IncarTempErrR_Stat = 0U;
- CCU_Errors_Model.CCU_DuctTempSenErrF_Stat = 0U;
- CCU_Errors_Model.CCU_DuctTempSenErrR_Stat = 0U;
- CCU_Errors_Model.CCU_EvaTempSenErrF_Stat = 0U;
- CCU_Errors_Model.CCU_EvaTempSenErrR_Stat = 0U;
- CCU_Errors_Model.CCU_DeflectorSwErrF_Stat = 0U;
- CCU_Errors_Model.CCU_DeflectorSwErrR_Stat = 0U;
- CCU_Errors_Model.CCU_PressSenErr_Stat = 0U;
- CCU_Errors_Model.CCU_AmbienTemptSenErr_Stat = 0U;
- CCU_Errors_Model.CCU_SealingValveErr_Stat = 0U;
- CCU_Errors_Model.CCU_ETXVerr_Stat = 0U;
- CCU_Errors_Model.CCU_HVACfanOrTXVerrF_Stat = 0U;
- CCU_Errors_Model.CCU_HVACfanOrTXVerrR_Stat = 0U;
- CCU_Errors_Model.CCU_ActuatorErrF_Stat = 0U;
- CCU_Errors_Model.CCU_ActuatorErrR_Stat = 0U;
- CCU_Errors_Model.CCU_UltravioletErr_Stat = 0U;
- CCU_Errors_Model.CCU_VinRecordErr_Stat = 0U;
- CCU_Errors_Model.CCU_AirQualSenErr_Stat = 0U;
- CCU_Errors_Model.CCU_CommErr_Stat = 0U;
- CCU_Errors_Model.CCU_TWVerr_Stat = 0U;
- CCU_Errors_Model.CCU_IonizationErr_Stat = 0U;
- CCU_Errors_Model.CCU_AromaErr_Stat = 0U;
-
- /* Switch: '/Switch' incorporates:
- * Constant: '/Constant1'
- * DataStoreRead: '/Data Store Read'
- * DataStoreRead: '/Data Store Read2'
- */
- if (rtDW.stepSig_private > 0) {
- rtb_Switch = rtDW.stepSig_private;
- } else {
- rtb_Switch = 1;
- }
-
- /* End of Switch: '/Switch' */
-
- /* SwitchCase: '/Switch Case' */
- switch (rtb_Switch) {
- case 1:
- /* Outputs for IfAction SubSystem: '/Stop Mode' incorporates:
- * ActionPort: '/Action Port'
- */
- /* If: '/If1' incorporates:
- * DataStoreRead: '/Data Store Read1'
- * DataStoreWrite: '/Data Store Write'
- * DataStoreWrite: '/Data Store Write1'
- */
- if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) &&
- (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates:
- * ActionPort: '/Action Port'
- */
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch0_Command_Model.POS[i] = 0U;
- Actuator_Ch0_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch0_Command_Model.MODE[i] = 2U;
- Actuator_Ch0_Command_Model.COM[i] = 1U;
- Actuator_Ch0_Command_Model.Stall_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Autos_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Speed_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* Merge: '/Merge' incorporates:
- * Constant: '/Constant'
- * Sum: '/step inc'
- */
- rtB.Merge = (int8_t)(rtb_Switch + 1);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem2' */
- } else {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates:
- * ActionPort: '/Action Port'
- */
- IfActionSubsystem3(rtb_Switch, &rtB.Merge);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem3' */
- }
-
- /* End of If: '/If1' */
- /* End of Outputs for SubSystem: '/Stop Mode' */
- break;
-
- case 2:
- /* Outputs for IfAction SubSystem: '/Initial CPOS Min' incorporates:
- * ActionPort: '/Action Port'
- */
- /* If: '/If' incorporates:
- * DataStoreRead: '/Data Store Read1'
- * DataStoreWrite: '/Data Store Write'
- * DataStoreWrite: '/Data Store Write1'
- */
- if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) &&
- (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates:
- * ActionPort: '/Action Port'
- */
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write2'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch0_Command_Model.POS[i] = 6000U;
- Actuator_Ch0_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch0_Command_Model.MODE[i] = 0U;
- Actuator_Ch0_Command_Model.COM[i] = 2U;
- Actuator_Ch0_Command_Model.Stall_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Autos_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Speed_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* MATLAB Function: '/Initial CPOS Min' incorporates:
- * Constant: '/Constant'
- * DataStoreRead: '/Data Store Read3'
- * Sum: '/step inc'
- */
- InitialCPOSMin(rtDW.LOGGER_LIN, (int8_t)(rtb_Switch + 1), &rtb_y_fb);
-
- /* Merge: '/Merge' incorporates:
- * Constant: '/Constant'
- * Merge: '/Merge'
- * SignalConversion generated from: '/step'
- * Sum: '/step inc'
- */
- rtB.Merge = (int8_t)(rtb_Switch + 1);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem' */
- } else {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates:
- * ActionPort: '/Action Port'
- */
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch0_Command_Model.POS[i] = 0U;
- Actuator_Ch0_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch0_Command_Model.MODE[i] = 0U;
- Actuator_Ch0_Command_Model.COM[i] = 0U;
- Actuator_Ch0_Command_Model.Stall_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Autos_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Speed_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* Merge: '/Merge' incorporates:
- * Merge: '/Merge'
- * SignalConversion generated from: '/stepIn1'
- */
- rtB.Merge = rtb_Switch;
-
- /* End of Outputs for SubSystem: '/If Action Subsystem3' */
- }
-
- /* End of If: '/If' */
- /* End of Outputs for SubSystem: '/Initial CPOS Min' */
- break;
-
- case 3:
- /* Outputs for IfAction SubSystem: '/Normal Mode' incorporates:
- * ActionPort: '/Action Port'
- */
- /* If: '/If1' incorporates:
- * DataStoreRead: '/Data Store Read1'
- * DataStoreWrite: '/Data Store Write'
- * DataStoreWrite: '/Data Store Write1'
- */
- if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) &&
- (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates:
- * ActionPort: '/Action Port'
- */
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write1'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch0_Command_Model.POS[i] = 0U;
- Actuator_Ch0_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch0_Command_Model.MODE[i] = 0U;
- Actuator_Ch0_Command_Model.COM[i] = 1U;
- Actuator_Ch0_Command_Model.Stall_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Autos_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Speed_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* MATLAB Function: '/Normal Mode' incorporates:
- * Constant: '/Constant'
- * DataStoreRead: '/Data Store Read3'
- * Sum: '/step inc'
- */
- NormalMode(rtDW.LOGGER_LIN, (int8_t)(rtb_Switch + 1), &rtb_y_fb);
-
- /* Merge: '/Merge' incorporates:
- * Constant: '/Constant'
- * SignalConversion generated from: '/step'
- * Sum: '/step inc'
- */
- rtB.Merge = (int8_t)(rtb_Switch + 1);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem2' */
- } else {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates:
- * ActionPort: '/Action Port'
- */
- IfActionSubsystem3(rtb_Switch, &rtB.Merge);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem3' */
- }
-
- /* End of If: '/If1' */
- /* End of Outputs for SubSystem: '/Normal Mode' */
- break;
-
- case 4:
- /* Outputs for IfAction SubSystem: '/Move to position Min' incorporates:
- * ActionPort: '/Action Port'
- */
- /* If: '/If1' incorporates:
- * DataStoreRead: '/Data Store Read1'
- * DataStoreWrite: '/Data Store Write'
- * DataStoreWrite: '/Data Store Write1'
- */
- if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) &&
- (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates:
- * ActionPort: '/Action Port'
- */
- /* BusCreator: '/Bus Creator' incorporates:
- * Constant: '/Constant1'
- * Constant: '/Constant10'
- * Constant: '/Constant11'
- * Constant: '/Constant14'
- * Constant: '/Constant2'
- * Constant: '/Constant9'
- * DataStoreWrite: '/Data Store Write7'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch0_Command_Model.POS[i] = 1U;
- Actuator_Ch0_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch0_Command_Model.MODE[i] = 0U;
- Actuator_Ch0_Command_Model.COM[i] = 3U;
- Actuator_Ch0_Command_Model.Stall_SET[i] = 1U;
- Actuator_Ch0_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Autos_SET[i] = 1U;
- Actuator_Ch0_Command_Model.Speed_SET[i] = 3U;
- Actuator_Ch0_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* MATLAB Function: '/Move to position Min' incorporates:
- * Constant: '/Constant'
- * DataStoreRead: '/Data Store Read3'
- * Sum: '/step inc'
- */
- MovetopositionMin(rtDW.LOGGER_LIN, (int8_t)(rtb_Switch + 1), &rtb_y_fb);
-
- /* Merge: '/Merge' incorporates:
- * Constant: '/Constant'
- * SignalConversion generated from: '/step'
- * Sum: '/step inc'
- */
- rtB.Merge = (int8_t)(rtb_Switch + 1);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem2' */
- } else {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates:
- * ActionPort: '/Action Port'
- */
- IfActionSubsystem3(rtb_Switch, &rtB.Merge);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem3' */
- }
-
- /* End of If: '/If1' */
- /* End of Outputs for SubSystem: '/Move to position Min' */
- break;
-
- case 5:
- /* Outputs for IfAction SubSystem: '/Check Stall Min' incorporates:
- * ActionPort: '/Action Port'
- */
- /* RelationalOperator: '/Relational Operator1' incorporates:
- * DataStoreRead: '/Data Store Read1'
- * RelationalOperator: '/Relational Operator'
- */
- for (i = 0; i < 9; i++) {
- rtb_RelationalOperator_j[i] =
- (rtDW.Actuator_Ch0_Status_Model.in_Act_Stall_Slave[i] == 1);
- }
-
- /* End of RelationalOperator: '/Relational Operator1' */
-
- /* Logic: '/Logical Operator2' incorporates:
- * RelationalOperator: '/Relational Operator'
- */
- tmp = rtb_RelationalOperator_j[0];
- for (i = 0; i < 8; i++) {
- tmp = (tmp || rtb_RelationalOperator_j[i + 1]);
- }
-
- /* RelationalOperator: '/Relational Operator' incorporates:
- * DataStoreRead: '/Data Store Read1'
- */
- for (i = 0; i < 9; i++) {
- rtb_RelationalOperator_j[i] =
- (rtDW.Actuator_Ch0_Status_Model.in_CPOS_ALL[i] == 1);
- }
-
- /* End of RelationalOperator: '/Relational Operator' */
-
- /* Logic: '/Logical Operator1' incorporates:
- * RelationalOperator: '/Relational Operator'
- */
- tmp_0 = rtb_RelationalOperator_j[0];
- for (i = 0; i < 8; i++) {
- tmp_0 = (tmp_0 || rtb_RelationalOperator_j[i + 1]);
- }
-
- /* If: '/If2' incorporates:
- * DataStoreRead: '/Data Store Read1'
- * DataStoreWrite: '/Data Store Write'
- * DataStoreWrite: '/Data Store Write1'
- * DataTypeConversion: '/Data Type Conversion'
- * DataTypeConversion: '/Data Type Conversion1'
- * Logic: '/Logical Operator'
- * Logic: '/Logical Operator1'
- * Logic: '/Logical Operator2'
- */
- if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) &&
- (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0) && (tmp || tmp_0)) {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates:
- * ActionPort: '/Action Port'
- */
- /* Merge: '/Merge' incorporates:
- * Constant: '/Constant'
- * Sum: '/step inc'
- */
- rtB.Merge = (int8_t)(rtb_Switch + 1);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem2' */
- for (i = 0; i < 9; i++) {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates:
- * ActionPort: '/Action Port'
- */
- rtb_y_ey[i] = rtDW.Actuator_Ch0_Status_Model.in_CPOS_ALL[i];
-
- /* End of Outputs for SubSystem: '/If Action Subsystem2' */
- }
-
- /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates:
- * ActionPort: '/Action Port'
- */
- /* MATLAB Function: '/MIN POSITION' incorporates:
- * DataStoreRead: '/Data Store Read3'
- */
- MINPOSITION(rtb_y_ey, rtDW.LOGGER_LIN);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem2' */
- } else {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates:
- * ActionPort: '/Action Port'
- */
- IfActionSubsystem3(rtb_Switch, &rtB.Merge);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem3' */
- }
-
- /* End of If: '/If2' */
- /* End of Outputs for SubSystem: '/Check Stall Min' */
- break;
-
- case 6:
- /* Outputs for IfAction SubSystem: '/Initial CPOS Max' incorporates:
- * ActionPort: '/Action Port'
- */
- /* If: '/If1' incorporates:
- * DataStoreRead: '/Data Store Read1'
- * DataStoreWrite: '/Data Store Write'
- * DataStoreWrite: '/Data Store Write1'
- */
- if ((rtDW.Actuator_Ch0_Status_Model.Busy == 0) &&
- (rtDW.Actuator_Ch0_Status_Model.Error_Connect == 0)) {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem2' incorporates:
- * ActionPort: '/Action Port'
- */
- /* BusCreator: '/Bus Creator' incorporates:
- * DataStoreWrite: '/Data Store Write2'
- * SignalConversion generated from: '/Bus Creator'
- * */
- for (i = 0; i < 9; i++) {
- Actuator_Ch0_Command_Model.POS[i] = 1U;
- Actuator_Ch0_Command_Model.BUS_ADR[i] = 0U;
- Actuator_Ch0_Command_Model.MODE[i] = 0U;
- Actuator_Ch0_Command_Model.COM[i] = 2U;
- Actuator_Ch0_Command_Model.Stall_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Lnoise_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Autos_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Speed_SET[i] = 0U;
- Actuator_Ch0_Command_Model.Coils_Stop_SET[i] = 0U;
- }
-
- /* End of BusCreator: '/Bus Creator' */
-
- /* MATLAB Function: '/Initial CPOS Max' incorporates:
- * Constant: '/Constant'
- * DataStoreRead: '/Data Store Read3'
- * Sum: '/step inc'
- */
- InitialCPOSMax(rtDW.LOGGER_LIN, (int8_t)(rtb_Switch + 1), &rtb_y_fb);
-
- /* Merge: '/Merge' incorporates:
- * Constant: '/Constant'
- * SignalConversion generated from: '/step'
- * Sum: '/step inc'
- */
- rtB.Merge = (int8_t)(rtb_Switch + 1);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem2' */
- } else {
- /* Outputs for IfAction SubSystem: '/If Action Subsystem3' incorporates:
- * ActionPort: '/Action Port'
- */
- IfActionSubsystem3(rtb_Switch, &rtB.Merge);
-
- /* End of Outputs for SubSystem: '/If Action Subsystem3' */
- }
-
- /* End of If: '/If1' */
- /* End of Outputs for SubSystem: '