From 52eec13c1e9eccd63e649ff04854c0e654810610 Mon Sep 17 00:00:00 2001 From: cfif Date: Tue, 28 Jul 2026 13:50:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=A1=D0=9E=D0=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HVAC_model.c | 136 ++++++++++++++++++++++++++++++++++++++++++- HVAC_model.h | 6 +- HVAC_model_data.c | 4 +- HVAC_model_private.h | 4 +- HVAC_model_types.h | 4 +- Model_Task.c | 67 +++++++++++++++------ Model_Task.h | 2 + 7 files changed, 195 insertions(+), 28 deletions(-) diff --git a/HVAC_model.c b/HVAC_model.c index 1cc91d1..f49753d 100644 --- a/HVAC_model.c +++ b/HVAC_model.c @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.1446 + * Model version : 1.1448 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Mon Jul 27 16:34:24 2026 + * C/C++ source code generated on : Mon Jul 27 17:25:25 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M @@ -30214,6 +30214,18 @@ void HVAC_model_step(void) * EnablePort: '/Enable' */ if (rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwDL_Req > 0) { + /* Switch: '/Switch' incorporates: + * Constant: '/no LED' + * DataStoreWrite: '/Data Store Write1' + */ + if (rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwDL_Req > 3) { + rtDW.DRS_SFL = 0U; + } else { + rtDW.DRS_SFL = rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwDL_Req; + } + + /* End of Switch: '/Switch' */ + /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ @@ -30226,6 +30238,18 @@ void HVAC_model_step(void) * EnablePort: '/Enable' */ if (rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwDR_Req > 0) { + /* Switch: '/Switch' incorporates: + * Constant: '/no LED' + * DataStoreWrite: '/Data Store Write1' + */ + if (rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwDR_Req > 3) { + rtDW.DRS_SFR = 0U; + } else { + rtDW.DRS_SFR = rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwDR_Req; + } + + /* End of Switch: '/Switch' */ + /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ @@ -30255,6 +30279,18 @@ void HVAC_model_step(void) * EnablePort: '/Enable' */ if (rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwFPL_Req > 0) { + /* Switch: '/Switch' incorporates: + * Constant: '/no LED' + * DataStoreWrite: '/Data Store Write23' + */ + if (rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwFPL_Req > 3) { + rtDW.DRS_CFL = 0U; + } else { + rtDW.DRS_CFL = rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwFPL_Req; + } + + /* End of Switch: '/Switch' */ + /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ @@ -30267,6 +30303,18 @@ void HVAC_model_step(void) * EnablePort: '/Enable' */ if (rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwFPR_Req > 0) { + /* Switch: '/Switch' incorporates: + * Constant: '/no LED' + * DataStoreWrite: '/Data Store Write24' + */ + if (rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwFPR_Req > 3) { + rtDW.DRS_CFR = 0U; + } else { + rtDW.DRS_CFR = rtDW.FIU_CCU1_MODEL.FIU_DeflectorSwFPR_Req; + } + + /* End of Switch: '/Switch' */ + /* DataStoreWrite: '/Data Store Write' incorporates: * Constant: '/Constant' */ @@ -31880,6 +31928,44 @@ void HVAC_model_step(void) /* End of Outputs for SubSystem: '/Subsystem38' */ + /* Outputs for Enabled SubSystem: '/Subsystem39' incorporates: + * EnablePort: '/Enable' + */ + if (rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwRLB_Req > 0) { + /* Switch: '/Switch' incorporates: + * Constant: '/no LED' + * DataStoreWrite: '/Data Store Write1' + */ + if (rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwRLB_Req > 3) { + rtDW.DRS_SRL = 0U; + } else { + rtDW.DRS_SRL = rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwRLB_Req; + } + + /* End of Switch: '/Switch' */ + } + + /* End of Outputs for SubSystem: '/Subsystem39' */ + + /* Outputs for Enabled SubSystem: '/Subsystem40' incorporates: + * EnablePort: '/Enable' + */ + if (rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwFCL_Req > 0) { + /* Switch: '/Switch' incorporates: + * Constant: '/no LED' + * DataStoreWrite: '/Data Store Write1' + */ + if (rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwFCL_Req > 3) { + rtDW.DRS_CRL = 0U; + } else { + rtDW.DRS_CRL = rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwFCL_Req; + } + + /* End of Switch: '/Switch' */ + } + + /* End of Outputs for SubSystem: '/Subsystem40' */ + /* Outputs for Enabled SubSystem: '/Subsystem41' incorporates: * EnablePort: '/Enable' */ @@ -31897,6 +31983,44 @@ void HVAC_model_step(void) /* End of Outputs for SubSystem: '/Subsystem41' */ + /* Outputs for Enabled SubSystem: '/Subsystem42' incorporates: + * EnablePort: '/Enable' + */ + if (rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwFCR_Req > 0) { + /* Switch: '/Switch' incorporates: + * Constant: '/no LED' + * DataStoreWrite: '/Data Store Write1' + */ + if (rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwFCR_Req > 3) { + rtDW.DRS_CRR = 0U; + } else { + rtDW.DRS_CRR = rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwFCR_Req; + } + + /* End of Switch: '/Switch' */ + } + + /* End of Outputs for SubSystem: '/Subsystem42' */ + + /* Outputs for Enabled SubSystem: '/Subsystem43' incorporates: + * EnablePort: '/Enable' + */ + if (rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwRRB_Req > 0) { + /* Switch: '/Switch' incorporates: + * Constant: '/no LED' + * DataStoreWrite: '/Data Store Write1' + */ + if (rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwRRB_Req > 3) { + rtDW.DRS_SRR = 0U; + } else { + rtDW.DRS_SRR = rtDW.FIU_CCU2_MODEL.FIU_DeflectorSwRRB_Req; + } + + /* End of Switch: '/Switch' */ + } + + /* End of Outputs for SubSystem: '/Subsystem43' */ + /* Outputs for Enabled SubSystem: '/Subsystem44' incorporates: * EnablePort: '/Enable' */ @@ -32466,6 +32590,11 @@ void HVAC_model_step(void) */ rtDW.DRS_SRR = rtDW.CCU_STAT2_WAKEUP_MODEL.CCU_DeflectorSwRRB_Stat; + /* DataStoreWrite: '/Data Store Write42' incorporates: + * DataStoreRead: '/Data Store Read2' + */ + rtDW.CCU_Rest = rtDW.CCU_STAT3_WAKEUP_MODEL.CCU_RestMode2_Stat; + /* DataStoreWrite: '/Data Store Write20' incorporates: * DataStoreRead: '/Data Store Read3' */ @@ -32755,6 +32884,7 @@ void HVAC_model_step(void) * BusCreator: '/Bus Creator12' * DataStoreRead: '/Data Store Read75' * DataStoreRead: '/Data Store Read76' + * DataStoreRead: '/Data Store Read79' */ rtY.CCU_Stat3_model.CCU_AromaCartridgeCapacity_Stat_ro = rtDW.Aroma_CartridgeCapacity; @@ -32763,7 +32893,7 @@ void HVAC_model_step(void) rtY.CCU_Stat3_model.CCU_AromaFaultReason_Stat = 0U; rtY.CCU_Stat3_model.CCU_RLfootBlowDis_Stat = 0U; rtY.CCU_Stat3_model.CCU_RRfootBlowDis_Stat = 0U; - rtY.CCU_Stat3_model.CCU_RestMode2_Stat = 0U; + rtY.CCU_Stat3_model.CCU_RestMode2_Stat = rtDW.CCU_Rest; CCU_Errors_Model.CCU_IncarTempErrF_Stat = (uint8_t)(rtb_err || rtb_LogicalOperator6); CCU_Errors_Model.CCU_IncarTempErrR_Stat = (uint8_t)(rtb_LogicalOperator3 || diff --git a/HVAC_model.h b/HVAC_model.h index ad1eb33..5844e91 100644 --- a/HVAC_model.h +++ b/HVAC_model.h @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.1446 + * Model version : 1.1448 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Mon Jul 27 16:34:24 2026 + * C/C++ source code generated on : Mon Jul 27 17:25:25 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M @@ -248,6 +248,7 @@ typedef struct { dbg_Drs_t_Bus dbg_Drs_t_model; /* '/Data Store Memory285' */ LIN4_ERROR_Bus LIN4_ERROR_model; /* '/Data Store Memory329' */ dbg_LIN_Ionizer_Stat_t_Bus dbg_LIN_Ionizer_Stat_t_model;/* '/Data Store Memory336' */ + CmdCAN_CCU_STAT3_WakeUp_Bus CCU_STAT3_WAKEUP_MODEL;/* '/Data Store Memory340' */ dbgCAN_dbg_Act0_Bus dbgCAN_dbg_Act0_model;/* '/Data Store Memory79' */ dbgCAN_dbg_Act1_Bus dbgCAN_dbg_Act1_model;/* '/Data Store Memory80' */ dbgCAN_dbg_Act2_Bus dbgCAN_dbg_Act2_model;/* '/Data Store Memory81' */ @@ -518,6 +519,7 @@ typedef struct { uint8_t CCU_IonizationErr_Stat; /* '/Data Store Memory328' */ uint8_t CCU_DeflectorSwErrR_Stat; /* '/Data Store Memory330' */ uint8_t CCU_DeflectorSwErrF_Stat; /* '/Data Store Memory331' */ + uint8_t CCU_Rest; /* '/Data Store Memory334' */ uint8_t CCU_Ionization; /* '/Data Store Memory335' */ uint8_t sleep_model; /* '/Data Store Memory338' */ uint8_t Blower_logic_FL; /* '/Data Store Memory37' */ diff --git a/HVAC_model_data.c b/HVAC_model_data.c index 887f198..08e7c6d 100644 --- a/HVAC_model_data.c +++ b/HVAC_model_data.c @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.1446 + * Model version : 1.1448 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Mon Jul 27 16:34:24 2026 + * C/C++ source code generated on : Mon Jul 27 17:25:25 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M diff --git a/HVAC_model_private.h b/HVAC_model_private.h index 0fe7a9b..573f450 100644 --- a/HVAC_model_private.h +++ b/HVAC_model_private.h @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.1446 + * Model version : 1.1448 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Mon Jul 27 16:34:24 2026 + * C/C++ source code generated on : Mon Jul 27 17:25:25 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M diff --git a/HVAC_model_types.h b/HVAC_model_types.h index 4f9ea9b..1f9399f 100644 --- a/HVAC_model_types.h +++ b/HVAC_model_types.h @@ -3,9 +3,9 @@ * * Code generated for Simulink model 'HVAC_model'. * - * Model version : 1.1446 + * Model version : 1.1448 * Simulink Coder version : 24.1 (R2024a) 19-Nov-2023 - * C/C++ source code generated on : Mon Jul 27 16:34:24 2026 + * C/C++ source code generated on : Mon Jul 27 17:25:25 2026 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex-M diff --git a/Model_Task.c b/Model_Task.c index 7702e62..985115d 100644 --- a/Model_Task.c +++ b/Model_Task.c @@ -62,8 +62,6 @@ void ModelTask_Init( tLoggerInterface *logger ) { - HVAC_model_initialize(); - env->linTaskActuator1 = linTaskActuator1; env->linTaskActuator2 = linTaskActuator2; env->linTaskActuator3 = linTaskActuator3; @@ -90,7 +88,6 @@ void ModelTask_Init( InitThreadAtrStatic(&env->thread.attr, "ModelTask", env->thread.controlBlock, env->thread.stack, osPriorityNormal); env->thread.id = 0; - HVAC_model_initialize(); } static bool setActuatorBusy(tModelTask *env) { @@ -276,20 +273,38 @@ static bool setActuatorBusy(tModelTask *env) { return false; } -__attribute__((section(".nchache_save_data"))) volatile CCU_Stat1_t CCU_STAT1_MODEL_SAVE; -__attribute__((section(".nchache_save_data"))) volatile CCU_Stat2_t CCU_STAT2_MODEL_SAVE; -__attribute__((section(".nchache_save_data"))) volatile CCU_Stat3_t CCU_STAT3_MODEL_SAVE; -__attribute__((section(".nchache_save_data"))) volatile CCU_Msg1_t CCU_MSG1_MODEL_SAVE; +__attribute__((section(".save_data"))) volatile CmdCAN_CCU_STAT1_Bus CCU_STAT1_MODEL_SAVE; +__attribute__((section(".save_data"))) volatile CmdCAN_CCU_STAT2_Bus CCU_STAT2_MODEL_SAVE; +__attribute__((section(".save_data"))) volatile CmdCAN_CCU_STAT3_Bus CCU_STAT3_MODEL_SAVE; +__attribute__((section(".save_data"))) volatile CCU_Msg1_Bus CCU_MSG1_MODEL_SAVE; + + +void InitWakeupModel(tModelTask *env) { + + HVAC_model_initialize(); + + if (RGM_SRS_WAKEUP_MASK == (RGM->SRS & RGM_SRS_WAKEUP_MASK)) { + LoggerInfoStatic(LOGGER, LOG_SIGN, "Wake up from standby") + rtDW.sleep_model = 1; + } else { + + memset((void *) &CCU_STAT1_MODEL_SAVE, 0, sizeof(env->ccu_candb_tx.CCU_Stat1)); + memset((void *) &CCU_STAT2_MODEL_SAVE, 0, sizeof(env->ccu_candb_tx.CCU_Stat2)); + memset((void *) &CCU_STAT3_MODEL_SAVE, 0, sizeof(env->ccu_candb_tx.CCU_Stat3)); + memset((void *) &CCU_MSG1_MODEL_SAVE, 0, sizeof(env->ccu_candb_tx.CCU_Msg1)); + + LoggerInfoStatic(LOGGER, LOG_SIGN, "Cold boot (power-on reset)") + + + rtDW.sleep_model = 0; + } +} + #define SLEEP_TIME 3000 static _Noreturn void ModelTask_Thread(tModelTask *env) { - memset((void *) &CCU_STAT1_MODEL_SAVE, 0, sizeof(env->ccu_candb_tx.CCU_Stat1)); - memset((void *) &CCU_STAT2_MODEL_SAVE, 0, sizeof(env->ccu_candb_tx.CCU_Stat2)); - memset((void *) &CCU_STAT3_MODEL_SAVE, 0, sizeof(env->ccu_candb_tx.CCU_Stat3)); - memset((void *) &CCU_MSG1_MODEL_SAVE, 0, sizeof(env->ccu_candb_tx.CCU_Msg1)); - for (;;) { if (GPIO_ReadPins((uint8_t) PORT_E, PORT_PIN_16)) { @@ -338,14 +353,31 @@ static _Noreturn void ModelTask_Thread(tModelTask *env) { } model_Status_EMS_For_Model_input.EMS_Chiller_Req = rtDW.CCUCAN_EMS_HVC_REQ_MSG_MODEL.EMS_eCompChiller_Req; + + + bool isT15 = rtDW.CCUCAN_BCM_VEH_STATE_model.BCM_T15_Stat; //конец--------------------------------------------------CAN------------------------------------------------------------ +//начало-------------------------------------------------SlEEP---------------------------------------------------------- + + memcpy((void *) &rtDW.CCU_STAT1_WAKEUP_MODEL, (void *) &CCU_STAT1_MODEL_SAVE, sizeof(CmdCAN_CCU_STAT1_WakeUp_Bus)); + memcpy((void *) &rtDW.CCU_STAT2_WAKEUP_MODEL, (void *) &CCU_STAT2_MODEL_SAVE, sizeof(CmdCAN_CCU_STAT2_WakeUp_Bus)); + memcpy((void *) &rtDW.CCU_STAT3_WAKEUP_MODEL, (void *) &CCU_STAT3_MODEL_SAVE, sizeof(CmdCAN_CCU_STAT3_WakeUp_Bus)); + memcpy((void *) &rtDW.CCU_Msg1_WakeUp_model, (void *) &CCU_MSG1_MODEL_SAVE, sizeof(CCU_Msg1_WakeUp_Bus)); + + +//конец--------------------------------------------------SLEEP---------------------------------------------------------- + Lin4_Output_Get_From_Model(env->lin4TaskSensor); Lin5_Output_Get_From_Model(env->lin5TaskSensor); + HVAC_model_step(); + + rtDW.sleep_model = 0; + Lin5_Input_Set_From_Model(env->lin5TaskSensor); CanUdsOutput_Get_Model(env->canUds); @@ -493,11 +525,12 @@ static _Noreturn void ModelTask_Thread(tModelTask *env) { //конец--------------------------------------------------PWM------------------------------------------------------------ //начало-------------------------------------------------SlEEP---------------------------------------------------------- - - memcpy((void *) &CCU_STAT1_MODEL_SAVE, &rtY.CCU_Stat1_model, sizeof(env->ccu_candb_tx.CCU_Stat1)); - memcpy((void *) &CCU_STAT2_MODEL_SAVE, &rtY.CCU_Stat2_model, sizeof(env->ccu_candb_tx.CCU_Stat2)); - memcpy((void *) &CCU_MSG1_MODEL_SAVE, &rtY.CCU_Msg1_model, sizeof(env->ccu_candb_tx.CCU_Msg1)); - + if (isT15) { + memcpy((void *) &CCU_STAT1_MODEL_SAVE, &rtY.CCU_Stat1_model, sizeof(CmdCAN_CCU_STAT1_Bus)); + memcpy((void *) &CCU_STAT2_MODEL_SAVE, &rtY.CCU_Stat2_model, sizeof(CmdCAN_CCU_STAT2_Bus)); + memcpy((void *) &CCU_STAT3_MODEL_SAVE, &rtY.CCU_Stat3_model, sizeof(CmdCAN_CCU_STAT3_Bus)); + memcpy((void *) &CCU_MSG1_MODEL_SAVE, &rtY.CCU_Msg1_model, sizeof(CCU_Msg1_Bus)); + } //конец--------------------------------------------------SLEEP---------------------------------------------------------- //начало--------------------------------------------------CAN----------------------------------------------------------- diff --git a/Model_Task.h b/Model_Task.h index 3ba232e..0224a51 100644 --- a/Model_Task.h +++ b/Model_Task.h @@ -105,4 +105,6 @@ void ModelTask_StartThread(tModelTask *env); void ModelTask_StopThread(tModelTask *env); +void InitWakeupModel(tModelTask *env); + #endif //HVAC_M7_MODEL_TASK_H