Browse Source

V3版本故障诊断增加

CHENJIE-PC\QiXiang_CHENJIE 3 years ago
parent
commit
3ad0548204
88 changed files with 1629 additions and 5992 deletions
  1. 2 22
      ARMCC/Makefile
  2. 2 2
      inc/AppConfig.h
  3. 1 3
      inc/AppFunc.h
  4. 9 9
      inc/AppSignal.h
  5. 0 75
      inc/BCU.h
  6. 0 94
      inc/EmbeddedCoder_inc/BCU.h
  7. 90 96
      inc/EmbeddedCoder_inc/BCUCal.h
  8. 92 168
      inc/EmbeddedCoder_inc/BCUDisp.h
  9. 0 73
      inc/EmbeddedCoder_inc/BCU_private.h
  10. 0 30
      inc/EmbeddedCoder_inc/BCU_types.h
  11. 0 24
      inc/EmbeddedCoder_inc/BINARYSEARCH_U16.h
  12. 0 24
      inc/EmbeddedCoder_inc/INTERPOLATE_U16_U16.h
  13. 0 24
      inc/EmbeddedCoder_inc/LookUp_U16_U16.h
  14. 0 241
      inc/EmbeddedCoder_inc/RTE_Device.h
  15. 89 279
      inc/EmbeddedCoder_inc/SFM.h
  16. 0 89
      inc/EmbeddedCoder_inc/SFM_private.h
  17. 0 30
      inc/EmbeddedCoder_inc/SFM_types.h
  18. 6 0
      inc/EmbeddedCoder_inc/TMS.h
  19. 0 23
      inc/EmbeddedCoder_inc/div_nde_s32_floor.h
  20. 0 24
      inc/EmbeddedCoder_inc/div_nzp_repeat_u32.h
  21. 0 24
      inc/EmbeddedCoder_inc/div_nzp_repeat_u32_ceiling.h
  22. 0 24
      inc/EmbeddedCoder_inc/div_repeat_s16s32_floor.h
  23. 0 24
      inc/EmbeddedCoder_inc/div_repeat_s32_floor.h
  24. 0 24
      inc/EmbeddedCoder_inc/div_repeat_u32.h
  25. 0 23
      inc/EmbeddedCoder_inc/div_s32_floor.h
  26. 0 23
      inc/EmbeddedCoder_inc/div_su32.h
  27. 0 23
      inc/EmbeddedCoder_inc/div_uus32_sat.h
  28. 0 24
      inc/EmbeddedCoder_inc/look1_binlxpw.h
  29. 0 23
      inc/EmbeddedCoder_inc/mul_s32_hiSR.h
  30. 0 23
      inc/EmbeddedCoder_inc/mul_s32_loSR.h
  31. 0 23
      inc/EmbeddedCoder_inc/mul_s32_loSR_sat.h
  32. 0 23
      inc/EmbeddedCoder_inc/mul_s32_sat.h
  33. 0 23
      inc/EmbeddedCoder_inc/mul_s32_sr32_ceil.h
  34. 0 23
      inc/EmbeddedCoder_inc/mul_ssu32_sat.h
  35. 0 23
      inc/EmbeddedCoder_inc/mul_u32_hiSR.h
  36. 0 23
      inc/EmbeddedCoder_inc/mul_u32_hiSR_near.h
  37. 0 23
      inc/EmbeddedCoder_inc/mul_us32_sat.h
  38. 0 24
      inc/EmbeddedCoder_inc/mul_wide_s32.h
  39. 0 24
      inc/EmbeddedCoder_inc/mul_wide_su32.h
  40. 0 24
      inc/EmbeddedCoder_inc/mul_wide_u32.h
  41. 0 28
      inc/EmbeddedCoder_inc/rtGetInf.h
  42. 0 26
      inc/EmbeddedCoder_inc/rtGetNaN.h
  43. 0 54
      inc/EmbeddedCoder_inc/rt_nonfinite.h
  44. 0 23
      inc/EmbeddedCoder_inc/rt_powd_snf.h
  45. 0 44
      inc/EmbeddedCoder_inc/zero_crossing_types.h
  46. 34 215
      src/AppFunc.c
  47. 1 3
      src/AppSignal.c
  48. 4 21
      src/AppTaskControl.c
  49. 2 2
      src/AppTaskTcp.c
  50. 43 4
      src/AppTaskUart.c
  51. 45 52
      src/BCU.c
  52. 94 98
      src/EmbeddedCoder_src/BCUCal.c
  53. 94 171
      src/EmbeddedCoder_src/BCUDisp.c
  54. 0 50
      src/EmbeddedCoder_src/BINARYSEARCH_U16.c
  55. 1 1
      src/EmbeddedCoder_src/BLC.c
  56. 0 65
      src/EmbeddedCoder_src/INTERPOLATE_U16_U16.c
  57. 0 31
      src/EmbeddedCoder_src/LookUp_U16_U16.c
  58. 942 2093
      src/EmbeddedCoder_src/SFM.c
  59. 1 2
      src/EmbeddedCoder_src/SOC.c
  60. 2 2
      src/EmbeddedCoder_src/SOH.c
  61. 1 1
      src/EmbeddedCoder_src/SPM.c
  62. 74 0
      src/EmbeddedCoder_src/TMS.c
  63. 0 24
      src/EmbeddedCoder_src/div_nde_s32_floor.c
  64. 0 39
      src/EmbeddedCoder_src/div_nzp_repeat_u32.c
  65. 0 43
      src/EmbeddedCoder_src/div_nzp_repeat_u32_ceiling.c
  66. 0 47
      src/EmbeddedCoder_src/div_repeat_s16s32_floor.c
  67. 0 47
      src/EmbeddedCoder_src/div_repeat_s32_floor.c
  68. 0 45
      src/EmbeddedCoder_src/div_repeat_u32.c
  69. 0 50
      src/EmbeddedCoder_src/div_s32_floor.c
  70. 0 32
      src/EmbeddedCoder_src/div_su32.c
  71. 0 35
      src/EmbeddedCoder_src/div_uus32_sat.c
  72. 0 75
      src/EmbeddedCoder_src/look1_binlxpw.c
  73. 0 27
      src/EmbeddedCoder_src/mul_s32_hiSR.c
  74. 0 28
      src/EmbeddedCoder_src/mul_s32_loSR.c
  75. 0 39
      src/EmbeddedCoder_src/mul_s32_loSR_sat.c
  76. 0 37
      src/EmbeddedCoder_src/mul_s32_sat.c
  77. 0 27
      src/EmbeddedCoder_src/mul_s32_sr32_ceil.c
  78. 0 37
      src/EmbeddedCoder_src/mul_ssu32_sat.c
  79. 0 27
      src/EmbeddedCoder_src/mul_u32_hiSR.c
  80. 0 27
      src/EmbeddedCoder_src/mul_u32_hiSR_near.c
  81. 0 35
      src/EmbeddedCoder_src/mul_us32_sat.c
  82. 0 64
      src/EmbeddedCoder_src/mul_wide_s32.c
  83. 0 63
      src/EmbeddedCoder_src/mul_wide_su32.c
  84. 0 52
      src/EmbeddedCoder_src/mul_wide_u32.c
  85. 0 92
      src/EmbeddedCoder_src/rtGetInf.c
  86. 0 58
      src/EmbeddedCoder_src/rtGetNaN.c
  87. 0 90
      src/EmbeddedCoder_src/rt_nonfinite.c
  88. 0 68
      src/EmbeddedCoder_src/rt_powd_snf.c

+ 2 - 22
ARMCC/Makefile

@@ -26,36 +26,16 @@ obj-y             += PLAT/project/$(TARGET)/apps/qx_app/src/app.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/AppTaskCan.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/AppTaskGps.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/BCU.o \
+						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/TMS.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/SFM.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/SPM.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/SOH.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/SOC.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/BLC.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/div_nde_s32_floor.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/look1_is16lu16n16tu16_binlcase.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/look1_iu16lu16n16tu16_binlcase.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/LookUp_U16_U16.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_s32_loSR_sat.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_s32_sat.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_ssu32_sat.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_us32_sat.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_wide_s32.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_wide_u32.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_wide_su32.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/look1_binlxpw.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/INTERPOLATE_U16_U16.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_u32_hiSR.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/div_repeat_s16s32_floor.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/BINARYSEARCH_U16.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/div_nzp_repeat_u32.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/div_nzp_repeat_u32_ceiling.o \
 						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/BCUCal.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/BCUDisp.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/div_su32.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_s32_hiSR.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/div_uus32_sat.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/div_repeat_u32.o \
-						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/mul_u32_hiSR_near.o
+						PLAT/project/$(TARGET)/apps/qx_app/src/EmbeddedCoder_src/BCUDisp.o 
 include $(TOP)/PLAT/tools/scripts/Makefile.rules 
 #enable wdt
 CFLAGS += -DWDT_FEATURE_ENABLE=1

+ 2 - 2
inc/AppConfig.h

@@ -12,7 +12,7 @@
 #define BMS_INFO                    (3)                 //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺4830,2-2表示美顺6060 2-3表示美顺7250
 #define DATA_MODULE_TYPE            (1)                 //1表示NB模块,2表示4G cat1
 #define EOLSTATE                    (1)                 //1表示下线检测跳过,使用默认值,0表示使用下线检测
-#define DEFAULT_SN                  "RLTEST00000000002" //默认上传的SN编码
+#define DEFAULT_SN                  "RRRRRR0000000003" //默认上传的SN编码
 #define	APPSWVERSION		        0x0300000A          //数据模块软件版本号
 
 #define TCP_ADD                     "iotp.fast-fun.cn"  //数据上传的地址
@@ -30,7 +30,7 @@
 #define BMS_OTHER_TEMP              2
 #define WORK_TIME               5
 #define SLEEP_TIME              60
-
+#define ErrorNumLength          20
 #define BATT_IDLE_SYM           0x00    //静置
 #define BATT_CHARGE_SYM 		0x02    //充电
 #define BATT_DISCHARGE_SYM      0x01    //放电

+ 1 - 3
inc/AppFunc.h

@@ -61,6 +61,4 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId);
 static UINT8 bcc_chk_fota(UINT8* data, UINT8 length);
 static UINT8 Fota_crc_chk(UINT8* data,UINT8 length);
 
-
-void PutErrorBufferArray(UINT16 *ErrorBufferArray,UINT16 ErrorTemp);
-void FaultDetectFunc(UINT16 *ErrorBufferArray);
+void ErrorNumHandleFunc(void);

+ 9 - 9
inc/AppSignal.h

@@ -13,6 +13,7 @@
 #include "queue.h"
 #include "bsp_custom.h"
 #include "lwip_config_ec6160h00.h"
+#include "BCUDisp.h"
 //declear the bool vars
 extern volatile BOOL NB_Fota_update_flag;
 extern volatile BOOL BMS_Fota_update_flag;
@@ -48,7 +49,6 @@ extern UINT8	reservedSignal5;
 extern UINT8	reservedSignal6;
 extern UINT8	reservedSignal7;
 extern UINT8	reservedSignal8;
-
 extern UINT8    Lockstatus;
 extern UINT8    TcpErrorcount;
 extern UINT8    TCPWorkState;
@@ -58,7 +58,7 @@ extern UINT8 	UDSSwitch;
 extern UINT8 	UDSSwitch ;
 extern UINT8 	PosFlag ;     
 extern UINT8    UartRecvFlag ;
-extern UINT8   UartErrorFlag ;
+extern UINT8    UartErrorFlag ;
 extern UINT8    UartCmdRecvFlag;
 extern UINT8	UDSService[2];           //uds 服务
 extern UINT8	UDSSubService[2];       // uds 子服务
@@ -66,10 +66,10 @@ extern UINT8	UDSSubServiceActionCode[2];  // uds 子服务状态
 extern UINT8    GpsFlag;
 extern UINT8    BuzzerControl;
 extern UINT8    BattWorkStateDelay;
-extern UINT8   HeatForceControl;  
-extern UINT8   PadInterrupt ;
-extern UINT8   chargerConnectState;
-extern UINT8   BMSupdatestatus;
+extern UINT8    HeatForceControl;  
+extern UINT8    PadInterrupt ;
+extern UINT8    chargerConnectState;
+extern UINT8    BMSupdatestatus;
 
 //declear the UINT16 vars
 extern UINT16	battCellU[28];
@@ -79,8 +79,8 @@ extern UINT16   avrgCellVol;
 extern UINT16	battPackVol;
 extern UINT16	battI;
 extern UINT16	nbHwVersion;
-extern UINT16   ErrorNum[5];
-extern UINT16  updateDifferDataPackageCounter;
+extern UINT16   ErrorNum[ErrorNumLength];
+extern UINT16   updateDifferDataPackageCounter;
 
 
 //declear the UINT32 vars
@@ -89,7 +89,7 @@ extern UINT32	battProtectState;
 extern UINT32	nbSwVersion ;
 extern UINT32	battBalanceoInfo;
 extern UINT32   Battdesigncap;
-extern UINT32  PowerVoltage;
+extern UINT32   PowerVoltage;
 extern volatile UINT32  TimeCounter;
 
 

+ 0 - 75
inc/BCU.h

@@ -1,37 +1,7 @@
-/*
- * File: BCU.h
- *
- * Code generated for Simulink model 'BCU'.
- *
- * Model version                  : 1.33
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:19:09 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTW_HEADER_BCU_h_
-#define RTW_HEADER_BCU_h_
-#ifndef BCU_COMMON_INCLUDES_
-#define BCU_COMMON_INCLUDES_
 #include "rtwtypes.h"
-#include "zero_crossing_types.h"
 #include "AppSignal.h"
-
-#endif                                 /* BCU_COMMON_INCLUDES_ */
-
-#include "BCU_types.h"
-
-/* Child system includes */
-#define SFM_MDLREF_HIDE_CHILD_
 #include "SFM.h"
-#define SPM_MDLREF_HIDE_CHILD_
 #include "SPM.h"
-
-/* Includes for objects with custom storage classes. */
 #include "BCUCal.h"
 #include "BCUDisp.h"
 #define PROC_BCU_TASK_STACK_SIZE           (2048)
@@ -43,52 +13,7 @@ typedef enum
     PROCESS_STATE_SLEEP
 }process_Bcu;
 
-/* Macros for accessing real-time model data structure */
-#ifndef rtmGetErrorStatus
-#define rtmGetErrorStatus(rtm)         ((rtm)->errorStatus)
-#endif
-
-#ifndef rtmSetErrorStatus
-#define rtmSetErrorStatus(rtm, val)    ((rtm)->errorStatus = (val))
-#endif
-
-#ifndef rtmGetErrorStatusPointer
-#define rtmGetErrorStatusPointer(rtm)  ((const char_T **)(&((rtm)->errorStatus)))
-#endif
-
-/* Real-time Model Data Structure */
-struct tag_RTM_BCU_T {
-  const char_T *errorStatus;
-};
-
-/* Model entry point functions */
 extern void BCU_Init(void);
 extern void BCU(void);
 extern void BCUEEDataSave(void);
 
-/* Real-time Model object */
-extern RT_MODEL_BCU_T *const BCU_M;
-
-/*-
- * The generated code includes comments that allow you to trace directly
- * back to the appropriate location in the model.  The basic format
- * is <system>/block_name, where system is the system number (uniquely
- * assigned by Simulink) and block_name is the name of the block.
- *
- * Use the MATLAB hilite_system command to trace the generated code back
- * to the model.  For example,
- *
- * hilite_system('<S3>')    - opens system 3
- * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
- *
- * Here is the system hierarchy for this model
- *
- * '<Root>' : 'BCU'
- */
-#endif                                 /* RTW_HEADER_BCU_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 94
inc/EmbeddedCoder_inc/BCU.h

@@ -1,94 +0,0 @@
-/*
- * File: BCU.h
- *
- * Code generated for Simulink model 'BCU'.
- *
- * Model version                  : 1.33
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:19:09 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTW_HEADER_BCU_h_
-#define RTW_HEADER_BCU_h_
-#ifndef BCU_COMMON_INCLUDES_
-#define BCU_COMMON_INCLUDES_
-#include "rtwtypes.h"
-#include "zero_crossing_types.h"
-#include "AppSignal.h"
-
-#endif                                 /* BCU_COMMON_INCLUDES_ */
-
-#include "BCU_types.h"
-
-/* Child system includes */
-#define SFM_MDLREF_HIDE_CHILD_
-#include "SFM.h"
-#define SPM_MDLREF_HIDE_CHILD_
-#include "SPM.h"
-
-/* Includes for objects with custom storage classes. */
-#include "BCUCal.h"
-#include "BCUDisp.h"
-#define PROC_BCU_TASK_STACK_SIZE           (2048)
-typedef enum
-{
-    PROCESS_STATE_INIT = 0,
-    PROCESS_STATE_IDLE,
-    PROCESS_STATE_WORK,
-    PROCESS_STATE_SLEEP
-}process_Bcu;
-
-/* Macros for accessing real-time model data structure */
-#ifndef rtmGetErrorStatus
-#define rtmGetErrorStatus(rtm)         ((rtm)->errorStatus)
-#endif
-
-#ifndef rtmSetErrorStatus
-#define rtmSetErrorStatus(rtm, val)    ((rtm)->errorStatus = (val))
-#endif
-
-#ifndef rtmGetErrorStatusPointer
-#define rtmGetErrorStatusPointer(rtm)  ((const char_T **)(&((rtm)->errorStatus)))
-#endif
-
-/* Real-time Model Data Structure */
-struct tag_RTM_BCU_T {
-  const char_T *errorStatus;
-};
-
-/* Model entry point functions */
-extern void BCU_Init(void);
-extern void BCU(void);
-extern void BCUEEDataSave(void);
-
-/* Real-time Model object */
-extern RT_MODEL_BCU_T *const BCU_M;
-
-/*-
- * The generated code includes comments that allow you to trace directly
- * back to the appropriate location in the model.  The basic format
- * is <system>/block_name, where system is the system number (uniquely
- * assigned by Simulink) and block_name is the name of the block.
- *
- * Use the MATLAB hilite_system command to trace the generated code back
- * to the model.  For example,
- *
- * hilite_system('<S3>')    - opens system 3
- * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
- *
- * Here is the system hierarchy for this model
- *
- * '<Root>' : 'BCU'
- */
-#endif                                 /* RTW_HEADER_BCU_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 90 - 96
inc/EmbeddedCoder_inc/BCUCal.h

@@ -1,100 +1,94 @@
-/*
- * File: BCUCal.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
 
-#ifndef RTW_HEADER_BCUCal_h_
-#define RTW_HEADER_BCUCal_h_
 #include "rtwtypes.h"
 
-/* Const memory section */
-/* Exported data declaration */
-/* Declaration for custom storage class: Const */
-extern const uint16_T blcc_R_esr;
-extern const int16_T blcc_T_close;
-extern const int16_T blcc_T_open;
-extern const uint16_T blcc_V_low;
-extern const uint16_T cmnc_Q_ratedCp;
-extern const uint16_T cmnc_num_cellUNumMax;
+extern const uint16_T blcc_R_esr;                          /* 鍧囪 鐢甸樆 */
+extern const uint16_T blcc_T_close;                         /* 鍧囪 鏆傚仠娓╁害锛� */
+extern const uint16_T blcc_T_open;                          /* 鍧囪 鏆傚仠鎭㈠�娓╁害锛� */
+extern const uint16_T blcc_V_low;                            /* 鍧囪 寮€鍚�數鍘嬮槇鍊� */
+
+extern const uint16_T cmnc_Q_ratedCp;                       /* 鐢垫睜瀹归噺锛� */
+extern const uint16_T cmnc_num_cellUNum;                     /* 鐢靛帇閲囨牱鐐瑰疄闄呬釜鏁帮紱 */
+extern const uint16_T cmnc_num_modTNum;                       /* 娓╁害閲囨牱鐐瑰疄闄呬釜鏁帮紱 */
+extern const uint16_T cmnc_tm_parkTime;                    /* 闈欑疆鏃堕棿闃堝€硷紱 */
+extern const uint16_T cmnm_F_polar[13]; /* 鐢垫睜鏀剧數鍙傛暟鐨凜鏁扮粍锛� */
+extern const uint16_T cmnm_R_ohm[13];       /* 鐢垫睜鏀剧數鍙傛暟鐨凴o鏁扮粍锛� */
+extern const uint16_T cmnm_R_polar[13];       /* 鐢垫睜鏀剧數鍙傛暟鐨凴p鏁扮粍锛� */
+extern const uint16_T cmnm_V_ocv[13];       /* 鐢垫睜鏀剧數鍙傛暟鐨凮CV鏁扮粍锛� */
+extern const uint16_T cmnm_pct_soc[13];                         /* 鐢垫睜鏀剧數鍙傛暟鐨凷OC鏁扮粍锛� */
+  
+extern const int16_T sfmc_I_chrgCurrOverThr;                 /* 鍏呯數鐢垫祦闃堝€� */
+extern const int16_T sfmc_I_disChrgCurrOverThr;              /* 鏀剧數鐢垫祦闃堝€� */
+extern const int16_T sfmc_T_ACPlugTOverThrFlt1;              /* 鎱㈠厖鎻掑ご娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_ACPlugTOverThrFlt2;              /* 鎱㈠厖鎻掑ご娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_ACPlugTOverThrRec1;              /* 鎱㈠厖鎻掑ご娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_ACPlugTOverThrRec2;              /* 鎱㈠厖鎻掑ご娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_DCPlugTOverThrFlt1;              /* 蹇�厖鎻掑ご娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_DCPlugTOverThrFlt2;              /* 蹇�厖鎻掑ご娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_DCPlugTOverThrRec1;              /* 蹇�厖鎻掑ご娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_DCPlugTOverThrRec2;              /* 蹇�厖鎻掑ご娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_chrgModTLowThrFlt1;             /* 鍏呯數妯$粍娓╁害杩囦綆1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_T_chrgModTLowThrFlt2;             /* 鍏呯數妯$粍娓╁害杩囦綆2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_T_chrgModTLowThrRec1;             /* 鍏呯數妯$粍娓╁害杩囦綆1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_chrgModTLowThrRec2;             /* 鍏呯數妯$粍娓╁害杩囦綆2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_chrgModTOverThrFlt1;            /* 鍏呯數妯$粍娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_T_chrgModTOverThrFlt2;           /* 鍏呯數妯$粍娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_T_chrgModTOverThrRec1;            /* 鍏呯數妯$粍娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_chrgModTOverThrRec2;            /* 鍏呯數妯$粍娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_chrgMosTOverThrFlt1;             /* 鍏呯數Mos娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_chrgMosTOverThrFlt2;             /* 鍏呯數Mos娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_chrgMosTOverThrRec1;             /* 鍏呯數Mos娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_chrgMosTOverThrRec2;             /* 鍏呯數Mos娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_disChrgModTLowThrFlt1;          /* 鏀剧數妯$粍娓╁害杩囦綆1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_T_disChrgModTLowThrFlt2;          /* 鏀剧數妯$粍娓╁害杩囦綆2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_T_disChrgModTLowThrRec1;          /* 鏀剧數妯$粍娓╁害杩囦綆1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_disChrgModTLowThrRec2;          /* 鏀剧數妯$粍娓╁害杩囦綆2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_disChrgModTOverThrFlt1;         /* 鏀剧數妯$粍娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_T_disChrgModTOverThrFlt2;        /* 鏀剧數妯$粍娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_T_disChrgModTOverThrRec1;         /* 鏀剧數妯$粍娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_disChrgModTOverThrRec2;         /* 鏀剧數妯$粍娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_heatPanTOverThrFlt1;             /* 鍔犵儹鏉挎俯搴﹁繃楂�1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_heatPanTOverThrFlt2;             /* 鍔犵儹鏉挎俯搴﹁繃楂�2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_heatPanTOverThrRec1;             /* 鍔犵儹鏉挎俯搴﹁繃楂�1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_heatPanTOverThrRec2;             /* 鍔犵儹鏉挎俯搴﹁繃楂�2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_modTDiffThrFlt1;                  /* 妯$粍娓╁樊杩囧ぇ1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_modTDiffThrFlt2;                  /* 妯$粍娓╁樊杩囧ぇ2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const int16_T sfmc_T_modTDiffThrRec1;                  /* 妯$粍娓╁樊杩囧ぇ1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const int16_T sfmc_T_modTDiffThrRec2;                  /* 妯$粍娓╁樊杩囧ぇ2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_V_battULowThrFlt1;               /* 鎬诲帇娆犲帇1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_V_battULowThrFlt2;               /* 鎬诲帇娆犲帇2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_V_battULowThrRec1;               /* 鎬诲帇娆犲帇1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_V_battULowThrRec2;               /* 鎬诲帇娆犲帇2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_V_battUOverThrFlt1;              /* 鎬诲帇杩囧帇1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_V_battUOverThrFlt2;              /* 鎬诲帇杩囧帇2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_V_battUOverThrRec1;              /* 鎬诲帇杩囧帇1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_V_battUOverThrRec2;              /* 鎬诲帇杩囧帇2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_V_cellULowThrFlt1;        /* 鍗曚綋鐢靛帇娆犲帇1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_V_cellULowThrFlt2;              /* 鍗曚綋鐢靛帇娆犲帇2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_V_cellULowThrRec1;              /* 鍗曚綋鐢靛帇娆犲帇1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_V_cellULowThrRec2;              /* 鍗曚綋鐢靛帇娆犲帇2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_V_cellUOverThrFlt1;             /* 鍗曚綋鐢靛帇杩囧帇1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_V_cellUOverThrFlt2;             /* 鍗曚綋鐢靛帇杩囧帇2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_V_cellUOverThrRec1;             /* 鍗曚綋鐢靛帇杩囧帇1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_V_cellUOverThrRec2;             /* 鍗曚綋鐢靛帇杩囧帇2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_flg_cellUDiffThrFlt1;            /* 鍘嬪樊杩囧ぇ1绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_flg_cellUDiffThrFlt2;            /* 鍘嬪樊杩囧ぇ2绾ф晠闅滆瘖鏂�槇鍊� */
+extern const uint16_T sfmc_flg_cellUDiffThrRec1;            /* 鍘嬪樊杩囧ぇ1绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_flg_cellUDiffThrRec2;            /* 鍘嬪樊杩囧ぇ2绾ф晠闅滄仮澶嶉槇鍊� */
+extern const uint16_T sfmc_T_disChrgMosTOverThrFlt1;
+extern const uint16_T sfmc_T_disChrgMosTOverThrRec1;
+extern const uint16_T sfmc_T_disChrgMosTOverThrFlt2;
+extern const uint16_T sfmc_T_disChrgMosTOverThrRec2;
+
+
+extern const uint16_T socc_V_chrgFulV;                     /* 鍏呮弧鐢电殑鎴�嚦鐢靛帇锛� */
+extern const uint16_T socc_pct_battSocLow;                    /* SOC涓嬮檺鍊硷紱 */
+extern const uint16_T socc_pct_battSocUp;                  /* SOC涓婇檺鍊硷紱 */
+extern const int16_T socm_I_chrgCor[4];   /* 鍏呯數CCV瀵瑰簲鐨勭數娴佹暟鎹�紱 */
+extern const int16_T socm_I_disChrgCor[3]; /* 鏀剧數CCV瀵瑰簲鐨勭數娴佹暟鎹�紱 */
+extern const uint16_T socm_V_chrgCor[4];/* 鍏呯數CCV瀵瑰簲鐨勭數鍘嬶紱 */
+extern const uint16_T socm_V_disChrgCor[3]; /* 鏀剧數CCV瀵瑰簲鐨勭數鍘嬶紱 */
+
+extern const uint16_T tmsc_T_openThr;                         /* 鐑��鐞嗗紑鍚�俯搴︼紱 */
+extern const uint16_T tmsc_T_closeMinThr;                     /* 鐑��鐞嗗叧闂�俯搴︼紙鏈€浣庢ā缁勶級锛� */
+extern const uint16_T tmsc_T_closeMaxThr;                     /* 鐑��鐞嗗紑鍚�俯搴︼紙鏈€楂樻ā缁勶級锛� */
 
-/* 额定容量; */
-extern const uint8_T cmnc_num_cellUNum;
-
-/* 电压采样点个数; */
-extern const uint8_T cmnc_num_modTNum;
-
-/* 温度采样点个数; */
-extern const uint16_T cmnc_tm_parkTime;
-
-/* 静置时间阈值; */
-extern const uint16_T cmnm_F_polar[13];
-
-/* 放电OCV-SOC的SOC数组; */
-extern const uint16_T cmnm_R_ohm[13];
-
-/* 放电OCV-SOC的SOC数组; */
-extern const uint16_T cmnm_R_polar[13];
-
-/* 放电OCV-SOC的SOC数组; */
-extern const uint16_T cmnm_V_ocv[13];
-
-/* 放电OCV-SOC的OCV数组; */
-extern const uint16_T cmnm_pct_soc[13];
-
-/* 放电OCV-SOC的SOC数组; */
-extern const uint16_T sfmc_flg_cellUDiffThr2;
-extern const uint16_T sfmc_flg_cellUDiffThr1;
-
-extern const int16_T sfmc_I_chrgCurrOverThr;
-extern const int16_T sfmc_I_dischrgCurrOverThr;
-extern const int16_T sfmc_T_modTDiffThr1;
-extern const int16_T sfmc_T_modTDiffThr2;
-extern const int16_T sfmc_T_modTMaxThr1;
-extern const int16_T sfmc_T_modTMaxThr2;
-extern const int16_T sfmc_T_modTMinThr1;
-extern const int16_T sfmc_T_modTMinThr2;
-extern const uint16_T sfmc_V_battUMaxThr1;
-extern const uint16_T sfmc_V_battUMaxThr2;
-extern const uint16_T sfmc_V_battUMinThr1;
-extern const uint16_T sfmc_V_battUMinThr2;
-extern const uint16_T sfmc_V_cellUMaxThr1;
-extern const uint16_T sfmc_V_cellUMaxThr2;
-extern const uint16_T sfmc_V_cellUMinThr1;
-extern const uint16_T sfmc_V_cellUMinThr2;
-extern const uint8_T sfmc_num_fltNumMax;
-
-/* 温度采样点个数; */
-extern const uint16_T sfmd_flg_cellUDiffThr2;
-extern const uint16_T socc_V_chrgFulV;
-
-/* 充满电的截至电压; */
-extern const uint16_T socc_pct_battSocLow;
-
-/* SOC下限值; */
-extern const uint16_T socc_pct_battSocUp;
-
-/* SOC上限值; */
-extern const int16_T socm_I_chrgCor[4];
-
-/* 充电CCV对应的电流数据; */
-extern const int16_T socm_I_disChrgCor[3];
-
-/* 放电CCV对应的电流数据; */
-extern const uint16_T socm_V_chrgCor[4];
-
-/* 充电CCV对应的电压; */
-extern const uint16_T socm_V_disChrgCor[3];
-
-/* 放电CCV对应的电压; */
-#endif                                 /* RTW_HEADER_BCUCal_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 92 - 168
inc/EmbeddedCoder_inc/BCUDisp.h

@@ -1,172 +1,96 @@
-/*
- * File: BCUDisp.h
- *
- * Code generated for Simulink model 'SPM'.
- *
- * Model version                  : 1.30
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:47:59 2021
- */
 
-#ifndef RTW_HEADER_BCUDisp_h_
-#define RTW_HEADER_BCUDisp_h_
 #include "rtwtypes.h"
 
-/* Exported data declaration */
-/* Declaration for custom storage class: ExportToFile */
-extern uint16_T socd_pct_estSoc;
-extern uint16_T FltCodeArr[20];
+extern uint8_T tmsd_st_heatAct;                          /*鐑��鐞嗚�姹傜姸鎬侊紱 */
 extern uint16_T appv_V_cellU[28];
-
-extern uint16_T blcn_Q_impleCp[28];
-extern uint16_T blcv_Q_reqCpEi[28];
-
-/* 均衡需求容量 读取量(数组); */
-extern uint16_T blcv_Q_reqCpEo[28];
-
-/* 均衡需求容量 写入量(数组); */
-extern uint32_T blcv_Q_totalCpEi[28];
-
-/* 累计均衡容量 读取量(数组); */
-extern uint32_T blcv_Q_totalCpEo[28];
-
-/* 累计均衡容量 写入量(数组); */
-extern boolean_T blcv_flg_excute[28];
-extern uint8_T cand_Nr_cellNr;
-extern uint16_T cand_Q_cellCap;
-extern uint16_T cand_V_chrgStartStat;
-extern uint16_T cand_Q_reqCp;
-extern uint32_T cand_Q_totalCp;
-
-/* 均衡执行请求标志位 (数组) */
-extern int16_T ihd_I_curr;
-
-/* 电池包电流; */
-extern uint16_T ihd_L_urtRecv;
-
-/* urt返回信号长度 */
-extern uint16_T ihd_P_gas;
-
-/* 气体浓度 */
-extern int16_T ihd_T_bdtemp;
-
-/* 板子温度 */
-extern int16_T ihd_T_modTMax;
-
-/* 模组温度最大 */
-extern int16_T ihd_T_modTMin;
-
-/* 模组温度最小 */
-extern uint16_T ihd_V_cellUAvrg;
-
-/* 电池单体电压平均; */
-extern uint16_T ihd_V_cellUMax;
-
-/* 电池单体电压最大; */
-extern uint16_T ihd_V_cellUMin;
-
-/* 电池单体电压最小; */
-extern boolean_T ihd_flg_currFlt;
-
-/* 电流传感器故障 */
-extern uint8_T ihd_st_workStat;
-
-/* 电池工作状态; */
-extern uint16_T ihd_tm_parkTime;
-
-/* 驻车时间; */
-extern int16_T ihv_T_modT[6];
-
-/* 模组温度(数组) */
-extern uint16_T ihv_V_cellU[28];
-
-/* 电池单体电压(数组); */
-extern int16_T sfmd_I_curr;
-extern uint8_T sfmd_N_fltLevel;
-extern int16_T sfmd_T_modTMax;
-extern int16_T sfmd_T_modTMin;
-extern uint16_T sfmd_V_cellUAvrg;
-extern uint16_T sfmd_V_cellUMax;
-extern uint16_T sfmd_V_cellUMin;
-extern boolean_T ihd_flg_chrgMosClosFlt;
-
-/* 充电电Mos失效 */
-extern boolean_T sfmd_flg_currFlt;
-extern boolean_T ihd_flg_dischrgMosClosFlt;
-
-/* 放电Mos失效 */
-extern boolean_T sfmd_flg_volFlt;
-extern uint16_T sfmd_idx_fltCode;
-extern uint16_T sfmd_num_fltNum;
-extern uint8_T sfmd_st_fltAct;
-extern int16_T sfmv_T_modT[6];
-extern uint16_T sfmv_V_cellU[28];
-extern boolean_T sfmv_flg_TFlt;
-extern boolean_T socd_flg_EEsave;
-extern uint16_T socd_pct_ahSoc;
-
-/* 安时SOC; */
-extern uint16_T socd_pct_battSoc;
-
-/* 电池真实SOC; */
-extern uint16_T socd_pct_battSocEi;
-
-/* 电池真实SOC 读取量; */
-extern uint16_T socd_pct_battSocEo;
-
-/* 电池真实SOC 写入量; */
-extern uint16_T socd_pct_bcuSoc;
-
-/* 电池显示SOC; */
-extern uint16_T socd_pct_bcuSocEi;
-
-/* 电池显示SOC读取量; */
-extern uint16_T socd_pct_bcuSocEo;
-
-/* 电池显示SOC写入量; */
-extern uint16_T socd_pct_ekfSoc;
-
-/* EKFSOC; */
-extern uint16_T sohd_Q_chrgEi;
-
-/* 充入容量读取量; */
-extern uint16_T sohd_Q_chrgEo;
-
-/* 充入容量写入量; */
-extern boolean_T sohd_flg_chrgEndEi;
-
-/* 充电结束标志位读取量; */
-extern boolean_T sohd_flg_chrgEndEo;
-
-/* 充电结束标志位写入量; */
-extern uint16_T sohd_pct_bcuSoh;
-
-/* 电池SOH; */
-extern uint16_T sohd_tm_chrgStartStatEi;
-
-/* 充电前静置时间读取量; */
-extern uint16_T sohd_tm_chrgStartStatEo;
-
-/* 充电前静置时间写入量; */
-extern uint16_T sohv_Q_cellCap[28];
-extern uint16_T sohv_Q_cellCapArrEi[28];
-extern uint16_T sohv_Q_cellCapArrEo[28];
-extern uint16_T sohv_Q_packCapArrEi[10];
-
-/* 10次整包容量(数组)读取量; */
-extern uint16_T sohv_Q_packCapArrEo[10];
-
-/* 10次整包容量(数组)写入量; */
-extern uint16_T sohv_V_chrgStartStatEi[28];
-
-/* 充电开始时刻的单体电压(数组)读取量; */
-extern uint16_T sohv_V_chrgStartStatEo[28];
-
-/* 充电开始时刻的单体电压(数组)写入量; */
-#endif                                 /* RTW_HEADER_BCUDisp_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */
+extern boolean_T ihd_flg_HVILFlt;
+extern uint16_T blcv_Q_reqCpEi[28];                      /*鍧囪 闇€姹傚�閲� 璇诲彇閲忥紙鏁扮粍锛夛紱 */
+extern uint16_T blcv_Q_reqCpEo[28];                      /*鍧囪 闇€姹傚�閲� 鍐欏叆閲忥紙鏁扮粍锛夛紱 */
+extern uint32_T blcv_Q_totalCpEi[28];                    /*绱��鍧囪 瀹归噺 璇诲彇閲忥紙鏁扮粍锛夛紱 */
+extern uint32_T blcv_Q_totalCpEo[28];                    /*绱��鍧囪 瀹归噺 鍐欏叆閲忥紙鏁扮粍锛夛紱 */
+extern boolean_T blcv_flg_excute[28];                    /*鍧囪 鎵ц�璇锋眰鏍囧織浣� 锛堟暟缁勶級 */
+
+extern uint8_T ihd_st_authFaild; 
+extern int16_T ihd_I_curr;                               /*鐢垫睜鍖呯數娴侊紱 */
+extern uint8_T ihd_st_chrgConnect;                       /*鍏呯數鍣ㄨ繛鎺ョ姸鎬侊紱 */
+extern uint16_T ihd_P_gas;                               /*姘斾綋娴撳害 */
+extern uint16_T ihd_T_ACPlugT;                           /*鎱㈠厖鎻掑ご娓╁害 +40 */
+extern uint16_T ihd_T_DCPlugT;                           /*蹇�厖鎻掑ご娓╁害+40 */
+extern uint16_T ihd_T_bdtemp;                            /*鏉垮瓙娓╁害 */
+extern uint16_T ihd_T_heatPanT1;                         /*鍔犵儹鏉挎俯搴�1+40 */
+extern uint16_T ihd_T_heatPanT2;                         /*鍔犵儹鏉挎俯搴�2 +40 */
+extern uint16_T ihd_T_mosT;                              /*Mos娓╁害+40 */
+extern boolean_T ihd_flg_EESaveFlt;                      /*EE瀛樺偍鏁呴殰 */
+extern boolean_T ihd_flg_battULowFlt;                    /*淇濇姢鏉夸笂浼犵殑鎬诲帇娆犲帇鏁呴殰锛� */
+extern boolean_T ihd_flg_battUOverFlt;                   /*淇濇姢鏉夸笂浼犵殑鎬诲帇杩囧帇鏁呴殰锛� */
+extern boolean_T ihd_flg_cellULowFlt;                    /*淇濇姢鏉夸笂浼犵殑鍗曚綋娆犲帇鏁呴殰锛� */
+extern boolean_T ihd_flg_cellUOverFlt;                   /*淇濇姢鏉夸笂浼犵殑鍗曚綋杩囧帇鏁呴殰锛� */
+extern boolean_T ihd_flg_chrgCurrOverFlt;                /*淇濇姢鏉夸笂浼犵殑鍏呯數杩囨祦鏁呴殰锛� */
+extern boolean_T ihd_flg_chrgModTLowFlt;                 /*淇濇姢鏉夸笂浼犵殑鍏呯數妯$粍娓╁害杩囦綆鏁呴殰锛� */
+extern boolean_T ihd_flg_chrgModTOverFlt;                /*淇濇姢鏉夸笂浼犵殑鍏呯數妯$粍娓╁害杩囬珮鏁呴殰锛� */
+extern boolean_T ihd_flg_chrgMosClosFlt;                 /*鍏呯數Mos澶辨晥 */
+extern boolean_T ihd_flg_chrgMosTOverFlt;                /*淇濇姢鏉夸笂浼犵殑鍏呯數Mos娓╁害杩囬珮鏁呴殰锛� */
+extern boolean_T ihd_flg_currOpenFlt;                    /*淇濇姢鏉夸笂浼犵殑鐢垫祦寮€璺�晠闅� */
+extern boolean_T ihd_flg_disChrgCurrOverFlt;             /*淇濇姢鏉夸笂浼犵殑鏀剧數杩囨祦鏁呴殰锛� */
+extern boolean_T ihd_flg_disChrgModTLowFlt;              /*淇濇姢鏉夸笂浼犵殑鏀剧數妯$粍娓╁害杩囦綆鏁呴殰锛� */
+extern boolean_T ihd_flg_disChrgModTOverFlt;             /*淇濇姢鏉夸笂浼犵殑鏀剧數妯$粍娓╁害杩囬珮鏁呴殰锛� */
+extern boolean_T ihd_flg_disChrgMosClosFlt;              /*鏀剧數Mos澶辨晥 */
+extern boolean_T ihd_flg_disChrgMosTOverFlt;             /*淇濇姢鏉夸笂浼犵殑鏀剧數Mos娓╁害杩囬珮鏁呴殰锛� */
+extern boolean_T ihd_flg_urtRecFlt;                      /*鍐呯綉閫氳�鏁呴殰 */
+extern uint16_T ihd_pct_soc;                             /*淇濇姢鏉縎OC */
+extern uint16_T ihd_pct_soh;                             /*淇濇姢鏉縎OH */
+extern uint8_T ihd_st_workStat;                          /*鐢垫睜宸ヤ綔鐘舵€� */
+extern uint16_T ihd_tm_parkTime;                         /*椹昏溅鏃堕棿锛� */
+extern uint16_T ihv_T_modT[6];                           /*妯$粍娓╁害锛堟暟缁勶級+40 */
+extern uint16_T ihv_V_cellU[28];                         /*鐢垫睜鍗曚綋鐢靛帇锛堟暟缁勶級锛� */
+
+extern int16_T sfmd_I_curr;                              /*澶勭悊鍚庢暣鍖呯數娴� */
+extern uint16_T sfmd_T_modTMax;                          /*澶勭悊鍚庢ā缁勬俯搴︽渶灏� */
+extern uint16_T sfmd_T_modTMin;                          /*澶勭悊鍚庢ā缁勬俯搴︽渶澶� */
+extern uint16_T sfmd_V_cellUAvrg;                        /*澶勭悊鍚庡崟浣撶數鍘嬪钩鍧� */
+extern uint16_T sfmd_V_cellUMax;                         /*澶勭悊鍚庡崟浣撶數鍘嬫渶澶� */
+extern uint16_T sfmd_V_cellUMin;                         /*澶勭悊鍚庡崟浣撶數鍘嬫渶灏� */
+extern boolean_T sfmd_flg_cellUDisable;                  /*鍗曚綋鐢靛帇鏈夋晥鏍囧織浣� 锛� 0涓烘湁鏁堬紱1涓烘棤鏁� */
+extern boolean_T sfmd_flg_currDisable;                   /*鐢垫祦鏈夋晥鏍囧織浣� 锛� 0涓烘湁鏁堬紱1涓烘棤鏁� */
+extern boolean_T sfmd_flg_modTDisable;                   /*妯$粍娓╁害鏈夋晥鏍囧織浣� 锛� 0涓烘湁鏁堬紱1涓烘棤鏁� */
+extern uint16_T sfmd_num_fltNum;                         /*鏁呴殰鏁伴噺 */
+extern uint8_T sfmd_st_fltAct;                           /*鏁呴殰绂佹�鎸囦护 */
+extern uint8_T sfmd_st_fltLevel;                         /*鏁呴殰绛夌骇 */
+extern uint16_T sfmv_T_modT[6];                          /*澶勭悊鍚庢ā缁勬俯搴� */
+extern uint16_T sfmv_V_cellU[28];                        /*澶勭悊鍚庡崟浣撶數鍘� */
+extern uint16_T sfmv_idx_fltCode[20];                    /*璇婃柇鏁呴殰鐮侊紙鏁扮粍锛� */
+extern uint16_T sfmd_V_battU;   
+
+extern uint16_T socd_pct_ahSoc;                          /*瀹夋椂SOC锛� */
+extern uint16_T socd_pct_estSoc;                         /*浼扮畻SOC锛�*/
+extern uint16_T socd_flg_EEsave;                         /*瀹炴椂瀛樺偍鏍囧織浣嶏紱*/
+extern uint16_T socd_pct_ekfSoc;                         /*EKFSOC锛�*/
+extern uint16_T socd_pct_battSoc;                        /*鐢垫睜鐪熷疄SOC锛� */
+extern uint16_T socd_pct_battSocEi;                      /*鐢垫睜鐪熷疄SOC 璇诲彇閲忥紱 */
+extern uint16_T socd_pct_battSocEo;                      /*鐢垫睜鐪熷疄SOC 鍐欏叆閲忥紱 */
+extern uint16_T socd_pct_bcuSoc;                         /*鐢垫睜鏄剧ずSOC锛� */
+extern uint16_T socd_pct_bcuSocEi;                       /*鐢垫睜鏄剧ずSOC璇诲彇閲忥紱 */
+extern uint16_T socd_pct_bcuSocEo;                       /*鐢垫睜鏄剧ずSOC鍐欏叆閲忥紱 */
+extern uint16_T socd_pct_bcuSoc_Delay;                   /*鐢垫睜鏄剧ずSOC寤舵椂锛� */
+
+extern uint16_T sohd_Q_chrgEi;                           /*鍏呭叆瀹归噺璇诲彇閲忥紱 */
+extern uint16_T sohd_Q_chrgEo;                           /*鍏呭叆瀹归噺鍐欏叆閲忥紱 */
+extern boolean_T sohd_flg_chrgEndEi;                     /*鍏呯數缁撴潫鏍囧織浣嶈�鍙栭噺锛� */
+extern boolean_T sohd_flg_chrgEndEo;                     /*鍏呯數缁撴潫鏍囧織浣嶅啓鍏ラ噺锛� */
+extern uint16_T sohd_pct_bcuSoh;                         /*鐢垫睜SOH锛� */
+extern uint16_T sohd_pct_bcuSoh_Delay;                   /*鐢垫睜SOH寤舵椂锛� */
+extern uint16_T sohd_tm_chrgStartStatEi;                 /*鍏呯數鍓嶉潤缃�椂闂磋�鍙栭噺锛� */
+extern uint16_T sohd_tm_chrgStartStatEo;                 /*鍏呯數鍓嶉潤缃�椂闂村啓鍏ラ噺锛� */
+extern uint16_T sohv_Q_cellCap[28];                      /*鍗曚綋瀹归噺 */
+extern uint16_T sohv_Q_cellCapArrEi[28];                 /*鍗曚綋瀹归噺锛堟暟缁勶級 璇诲彇閲� */
+extern uint16_T sohv_Q_cellCapArrEo[28];                 /*鍗曚綋瀹归噺锛堟暟缁勶級 鍐欏叆閲� */
+extern uint16_T sohv_Q_packCapArrEi[10];                 /*10娆℃暣鍖呭�閲忥紙鏁扮粍锛夎�鍙栭噺锛� */
+extern uint16_T sohv_Q_packCapArrEo[10];                 /*10娆℃暣鍖呭�閲忥紙鏁扮粍锛夊啓鍏ラ噺锛� */
+extern uint16_T sohv_V_chrgStartStatEi[28];              /*鍏呯數寮€濮嬫椂鍒荤殑鍗曚綋鐢靛帇锛堟暟缁勶級璇诲彇閲忥紱 */
+extern uint16_T sohv_V_chrgStartStatEo[28];              /*鍏呯數寮€濮嬫椂鍒荤殑鍗曚綋鐢靛帇锛堟暟缁勶級鍐欏叆閲忥紱 */
+
+extern uint16_T cand_Nr_cellNr;                          /*寰�幆鍙戦€佺殑鍗曚綋缂栧彿锛� */
+extern uint16_T cand_Q_cellCap;                          /*寰�幆鍙戦€佺殑鍗曚綋瀹归噺锛� */
+extern uint16_T cand_V_chrgStartStat;                    /*寰�幆鍙戦€佺殑鍏呯數鍓嶅崟浣撶數鍘嬶紱 */
+extern uint16_T cand_Q_reqCp;                            /*寰�幆鍙戦€佺殑鍗曚綋闇€姹傚潎琛″�閲忥紱 */
+extern uint16_T cand_Q_totalCp;                          /*寰�幆鍙戦€佺殑鍗曚綋绱��鍧囪 瀹归噺锛� */

+ 0 - 73
inc/EmbeddedCoder_inc/BCU_private.h

@@ -1,73 +0,0 @@
-/*
- * File: BCU_private.h
- *
- * Code generated for Simulink model 'BCU'.
- *
- * Model version                  : 1.33
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:19:09 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTW_HEADER_BCU_private_h_
-#define RTW_HEADER_BCU_private_h_
-#include "rtwtypes.h"
-#include "zero_crossing_types.h"
-#ifndef UCHAR_MAX
-#include <limits.h>
-#endif
-
-#if ( UCHAR_MAX != (0xFFU) ) || ( SCHAR_MAX != (0x7F) )
-#error Code was generated for compiler with different sized uchar/char. \
-Consider adjusting Test hardware word size settings on the \
-Hardware Implementation pane to match your compiler word sizes as \
-defined in limits.h of the compiler. Alternatively, you can \
-select the Test hardware is the same as production hardware option and \
-select the Enable portable word sizes option on the Code Generation > \
-Verification pane for ERT based targets, which will disable the \
-preprocessor word size checks.
-#endif
-
-#if ( USHRT_MAX != (0xFFFFU) ) || ( SHRT_MAX != (0x7FFF) )
-#error Code was generated for compiler with different sized ushort/short. \
-Consider adjusting Test hardware word size settings on the \
-Hardware Implementation pane to match your compiler word sizes as \
-defined in limits.h of the compiler. Alternatively, you can \
-select the Test hardware is the same as production hardware option and \
-select the Enable portable word sizes option on the Code Generation > \
-Verification pane for ERT based targets, which will disable the \
-preprocessor word size checks.
-#endif
-
-#if ( UINT_MAX != (0xFFFFFFFFU) ) || ( INT_MAX != (0x7FFFFFFF) )
-#error Code was generated for compiler with different sized uint/int. \
-Consider adjusting Test hardware word size settings on the \
-Hardware Implementation pane to match your compiler word sizes as \
-defined in limits.h of the compiler. Alternatively, you can \
-select the Test hardware is the same as production hardware option and \
-select the Enable portable word sizes option on the Code Generation > \
-Verification pane for ERT based targets, which will disable the \
-preprocessor word size checks.
-#endif
-
-#if ( ULONG_MAX != (0xFFFFFFFFU) ) || ( LONG_MAX != (0x7FFFFFFF) )
-#error Code was generated for compiler with different sized ulong/long. \
-Consider adjusting Test hardware word size settings on the \
-Hardware Implementation pane to match your compiler word sizes as \
-defined in limits.h of the compiler. Alternatively, you can \
-select the Test hardware is the same as production hardware option and \
-select the Enable portable word sizes option on the Code Generation > \
-Verification pane for ERT based targets, which will disable the \
-preprocessor word size checks.
-#endif
-#endif                                 /* RTW_HEADER_BCU_private_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 30
inc/EmbeddedCoder_inc/BCU_types.h

@@ -1,30 +0,0 @@
-/*
- * File: BCU_types.h
- *
- * Code generated for Simulink model 'BCU'.
- *
- * Model version                  : 1.33
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:19:09 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTW_HEADER_BCU_types_h_
-#define RTW_HEADER_BCU_types_h_
-
-/* Model Code Variants */
-
-/* Forward declaration for rtModel */
-typedef struct tag_RTM_BCU_T RT_MODEL_BCU_T;
-
-#endif                                 /* RTW_HEADER_BCU_types_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/BINARYSEARCH_U16.h

@@ -1,24 +0,0 @@
-/*
- * File: BINARYSEARCH_U16.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#ifndef RTW_HEADER_BINARYSEARCH_U16_h_
-#define RTW_HEADER_BINARYSEARCH_U16_h_
-#include "rtwtypes.h"
-
-void BINARYSEARCH_U16(uint32_T *piLeft, uint32_T *piRght, uint16_T u, const
-                      uint16_T *pData, uint32_T iHi);
-
-#endif                                 /* RTW_HEADER_BINARYSEARCH_U16_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/INTERPOLATE_U16_U16.h

@@ -1,24 +0,0 @@
-/*
- * File: INTERPOLATE_U16_U16.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#ifndef RTW_HEADER_INTERPOLATE_U16_U16_h_
-#define RTW_HEADER_INTERPOLATE_U16_U16_h_
-#include "rtwtypes.h"
-
-void INTERPOLATE_U16_U16(uint16_T *pY, uint16_T yL, uint16_T yR, uint16_T x,
-  uint16_T xL, uint16_T xR);
-
-#endif                                 /* RTW_HEADER_INTERPOLATE_U16_U16_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/LookUp_U16_U16.h

@@ -1,24 +0,0 @@
-/*
- * File: LookUp_U16_U16.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#ifndef RTW_HEADER_LookUp_U16_U16_h_
-#define RTW_HEADER_LookUp_U16_U16_h_
-#include "rtwtypes.h"
-
-void LookUp_U16_U16(uint16_T *pY, const uint16_T *pYData, uint16_T u, const
-                    uint16_T *pUData, uint32_T iHi);
-
-#endif                                 /* RTW_HEADER_LookUp_U16_U16_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 241
inc/EmbeddedCoder_inc/RTE_Device.h

@@ -1,241 +0,0 @@
-#ifndef __RTE_DEVICE_H
-#define __RTE_DEVICE_H
-
-#include "ec616.h"
-
-/*  Peripheral IO Mode Select, Must Configure First !!!
-    Note, when receiver works in DMA_MODE, interrupt is also enabled to transfer tailing bytes.
-*/
-
-#define POLLING_MODE            	0x1
-#define DMA_MODE                		0x2
-#define IRQ_MODE                		0x3
-#define UNILOG_MODE            		0x4
-
-#define RTE_UART0_TX_IO_MODE    UNILOG_MODE
-#define RTE_UART0_RX_IO_MODE    DMA_MODE
-
-#define RTE_UART1_TX_IO_MODE    POLLING_MODE
-#define RTE_UART1_RX_IO_MODE    DMA_MODE
-
-#define RTE_UART2_TX_IO_MODE    POLLING_MODE
-#define RTE_UART2_RX_IO_MODE    DMA_MODE
-
-#define RTE_SPI0_IO_MODE           POLLING_MODE
-
-#define RTE_SPI1_IO_MODE           POLLING_MODE
-
-#define I2C0_INIT_MODE               POLLING_MODE
-#define I2C1_INIT_MODE               POLLING_MODE
-
-
-// I2C0 (Inter-integrated Circuit Interface) [Driver_I2C0]
-// Configuration settings for Driver_I2C0 in component ::Drivers:I2C
-#define RTE_I2C0                        1
-
-// { PAD_PIN25},  // 0 : gpio10 / 1 : I2C0 SCL
-// { PAD_PIN26},  // 0 : gpio8  / 1 : I2C0 SDA
-#define RTE_I2C0_SCL_BIT                25
-#define RTE_I2C0_SCL_FUNC               PAD_MuxAlt1
-
-#define RTE_I2C0_SDA_BIT                26
-#define RTE_I2C0_SDA_FUNC               PAD_MuxAlt1
-
-// DMA
-//   Tx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_I2C0_DMA_TX_EN              0
-#define RTE_I2C0_DMA_TX_REQID           DMA_RequestI2C0TX
-//   Rx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_I2C0_DMA_RX_EN              0
-#define RTE_I2C0_DMA_RX_REQID           DMA_RequestI2C0RX
-
-// I2C1 (Inter-integrated Circuit Interface) [Driver_I2C1]
-// Configuration settings for Driver_I2C1 in component ::Drivers:I2C
-#define RTE_I2C1                        0
-
-// { PAD_PIN27},  // 0 : gpio17 / 1 : I2C1 SCL
-// { PAD_PIN28},  // 0 : gpio9  / 1 : I2C1 SDA
-#define RTE_I2C1_SCL_BIT                27
-#define RTE_I2C1_SCL_FUNC               PAD_MuxAlt1
-
-#define RTE_I2C1_SDA_BIT                28
-#define RTE_I2C1_SDA_FUNC               PAD_MuxAlt1
-
-// DMA
-//   Tx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_I2C1_DMA_TX_EN              1
-#define RTE_I2C1_DMA_TX_REQID           DMA_RequestI2C1TX
-//   Rx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_I2C1_DMA_RX_EN              1
-#define RTE_I2C1_DMA_RX_REQID           DMA_RequestI2C1RX
-
-
-// UART0 (Universal asynchronous receiver transmitter) [Driver_USART0]
-// Configuration settings for Driver_USART0 in component ::Drivers:USART
-#define RTE_UART0                       1
-#define RTE_UART0_CTS_PIN_EN            0
-#define RTE_UART0_RTS_PIN_EN            0
-#if 1
-// { PAD_PIN23},  // 0 : gpio14 / 1 : UART1 RXD  / 2 :SPI0_MISO /3 : UART0_RXD
-// { PAD_PIN24},  // 0 : gpio15 / 1 : UART1 TXD  / 2: SPI0_SCLK /3 : UART0_TXD
-#define RTE_UART0_RX_BIT                23
-#define RTE_UART0_RX_FUNC               PAD_MuxAlt3
-
-#define RTE_UART0_TX_BIT                24
-#define RTE_UART0_TX_FUNC               PAD_MuxAlt3
-#else
-// { PAD_PIN13},  // 0 : gpio2 / 1 : UART0 RTSn / 3 : SPI1 SSn
-// { PAD_PIN14},  // 0 : gpio3 / 1 : UART0 CTSn / 3 : SPI1 MOSI
-// { PAD_PIN15},  // 0 : gpio4 / 1 : UART0 RXD  / 3 : SPI1 MISO
-// { PAD_PIN16},  // 0 : gpio5 / 1 : UART0 TXD  / 3 : SPI1 SCLK
-#define RTE_UART0_RTS_BIT               13
-#define RTE_UART0_RTS_FUNC              PAD_MuxAlt1
-
-#define RTE_UART0_CTS_BIT               14
-#define RTE_UART0_CTS_FUNC              PAD_MuxAlt1
-
-#define RTE_UART0_RX_BIT                15
-#define RTE_UART0_RX_FUNC               PAD_MuxAlt1
-
-#define RTE_UART0_TX_BIT                16
-#define RTE_UART0_TX_FUNC               PAD_MuxAlt1
-#endif
-
-// DMA
-//  Tx
-//    Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_UART0_DMA_TX_REQID          DMA_RequestUSART0TX
-//  Rx
-//    Channel    <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_UART0_DMA_RX_REQID          DMA_RequestUSART0RX
-
-// UART1 (Universal asynchronous receiver transmitter) [Driver_USART1]
-// Configuration settings for Driver_USART1 in component ::Drivers:USART
-#define RTE_UART1                       1
-#define RTE_UART1_CTS_PIN_EN            0
-#define RTE_UART1_RTS_PIN_EN            0
-// { PAD_PIN17},  // 0 : gpio6   / 3 : UART1 RTS
-// { PAD_PIN18},  // 0 : gpio7   / 3 : UART1 CTS
-// { PAD_PIN19},  // 0 : gpio13  / 3 : UART1 RXD
-// { PAD_PIN20},  // 0 : gpio12  / 3 : UART1 TXD
-#define RTE_UART1_RTS_BIT               17
-#define RTE_UART1_RTS_FUNC              PAD_MuxAlt3
-
-#define RTE_UART1_CTS_BIT               18
-#define RTE_UART1_CTS_FUNC              PAD_MuxAlt3
-
-#define RTE_UART1_RX_BIT                19
-#define RTE_UART1_RX_FUNC               PAD_MuxAlt3
-
-#define RTE_UART1_TX_BIT                20
-#define RTE_UART1_TX_FUNC               PAD_MuxAlt3
-
-// DMA
-//   Tx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_UART1_DMA_TX_REQID          DMA_RequestUSART1TX
-//   Rx
-//     Channel    <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_UART1_DMA_RX_REQID          DMA_RequestUSART1RX
-
-// UART2 (Universal asynchronous receiver transmitter) [Driver_USART2]
-// Configuration settings for Driver_USART2 in component ::Drivers:USART
-#define RTE_UART2                       1
-#define RTE_UART2_CTS_PIN_EN            0
-#define RTE_UART2_RTS_PIN_EN            0
-
-// { PAD_PIN29},  // 0 : gpio18 / 1 : UART2 RXD
-// { PAD_PIN30},  // 0 : gpio19 / 1 : UART2 TXD
-#define RTE_UART2_RX_BIT                29
-#define RTE_UART2_RX_FUNC               PAD_MuxAlt1
-
-#define RTE_UART2_TX_BIT                30
-#define RTE_UART2_TX_FUNC               PAD_MuxAlt1
-
-
-// DMA
-//   Tx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_UART2_DMA_TX_REQID          DMA_RequestUSART2TX
-//   Rx
-//     Channel    <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_UART2_DMA_RX_REQID          DMA_RequestUSART2RX
-
-// SPI0 (Serial Peripheral Interface) [Driver_SPI0]
-// Configuration settings for Driver_SPI0 in component ::Drivers:SPI
-#define RTE_SPI0                        0
-
-// { PAD_PIN21},  // 0 : gpio16 / 1 : UART1 RTS / 2 : SPI0 SSn
-// { PAD_PIN22},  // 0 : gpio11 / 1 : UART1 CTS / 2 : SPI0 MOSI
-// { PAD_PIN23},  // 0 : gpio14 / 1 : UART1 RXD / 2 : SPI0 MISO
-// { PAD_PIN24},  // 0 : gpio15 / 1 : UART1 TXD / 2 : SPI0 SCLK
-#define RTE_SPI0_SSN_BIT                21
-#define RTE_SPI0_SSN_FUNC               PAD_MuxAlt2
-
-#define RTE_SPI0_MOSI_BIT               22
-#define RTE_SPI0_MOSI_FUNC              PAD_MuxAlt2
-
-#define RTE_SPI0_MISO_BIT               23
-#define RTE_SPI0_MISO_FUNC              PAD_MuxAlt2
-
-#define RTE_SPI0_SCLK_BIT               24
-#define RTE_SPI0_SCLK_FUNC              PAD_MuxAlt2
-
-#define RTE_SPI0_SSN_GPIO_INSTANCE      1
-#define RTE_SPI0_SSN_GPIO_INDEX         0
-
-// DMA
-//   Tx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_SPI0_DMA_TX_REQID           DMA_RequestSPI0TX
-
-//   Rx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_SPI0_DMA_RX_REQID           DMA_RequestSPI0RX
-
-// SPI1 (Serial Peripheral Interface) [Driver_SPI1]
-// Configuration settings for Driver_SPI1 in component ::Drivers:SPI
-#define RTE_SPI1                        1
-
-// { PAD_PIN13},  // 0 : gpio2 / 1 : UART0 RTSn / 3 : SPI1 SSn
-// { PAD_PIN14},  // 0 : gpio3 / 1 : UART0 CTSn / 3 : SPI1 MOSI
-// { PAD_PIN15},  // 0 : gpio4 / 1 : UART0 RXD  / 3 : SPI1 MISO
-// { PAD_PIN16},  // 0 : gpio5 / 1 : UART0 TXD  / 3 : SPI1 SCLK
-#define RTE_SPI1_SSN_BIT                13
-#define RTE_SPI1_SSN_FUNC               PAD_MuxAlt3
-
-#define RTE_SPI1_MOSI_BIT               14
-#define RTE_SPI1_MOSI_FUNC              PAD_MuxAlt3
-
-#define RTE_SPI1_MISO_BIT               15
-#define RTE_SPI1_MISO_FUNC              PAD_MuxAlt3
-
-#define RTE_SPI1_SCLK_BIT               16
-#define RTE_SPI1_SCLK_FUNC              PAD_MuxAlt3
-
-#define RTE_SPI1_SSN_GPIO_INSTANCE      0
-#define RTE_SPI1_SSN_GPIO_INDEX         2
-
-// DMA
-//   Tx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_SPI1_DMA_TX_REQID           DMA_RequestSPI1TX
-
-//   Rx
-//     Channel     <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
-#define RTE_SPI1_DMA_RX_REQID           DMA_RequestSPI1RX
-
-
-// PWM0 Controller [Driver_PWM0]
-// Configuration settings for Driver_PWM0 in component ::Drivers:PWM
-#define RTE_PWM                         1
-
-#define EFUSE_INIT_MODE POLLING_MODE
-
-#define FLASH_BARE_RW_MODE 1
-
-#endif  /* __RTE_DEVICE_H */

+ 89 - 279
inc/EmbeddedCoder_inc/SFM.h

@@ -1,287 +1,97 @@
-/*
- * File: SFM.h
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.88
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Fri Sep 10 17:41:38 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTW_HEADER_SFM_h_
-#define RTW_HEADER_SFM_h_
-#ifndef SFM_COMMON_INCLUDES_
-#define SFM_COMMON_INCLUDES_
 #include "rtwtypes.h"
-#endif                                 /* SFM_COMMON_INCLUDES_ */
-
-#include "SFM_types.h"
-
-/* Includes for objects with custom storage classes. */
 #include "BCUCal.h"
 #include "BCUDisp.h"
-
-/* Block states (default storage) for system '<S27>/Subsytem' */
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  uint8_T delay_DSTATE;                /* '<S31>/delay' */
-} DW_Subsytem_SFM_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-/* Block states (default storage) for system '<S27>/Subsytem1' */
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  uint8_T delay_DSTATE;                /* '<S32>/delay' */
-} DW_Subsytem1_SFM_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-/* Block states (default storage) for system '<S28>/Subsytem' */
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  uint8_T delay_DSTATE;                /* '<S41>/delay' */
-} DW_Subsytem_SFM_d_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-/* Block states (default storage) for system '<S28>/Subsytem1' */
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  uint8_T delay_DSTATE;                /* '<S42>/delay' */
-} DW_Subsytem1_SFM_k_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-/* Block states (default storage) for system '<S28>/Subsytem6' */
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  uint8_T delay_DSTATE;                /* '<S47>/delay' */
-} DW_Subsytem6_SFM_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-/* Block states (default storage) for system '<S28>/Subsytem7' */
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  uint8_T delay_DSTATE;                /* '<S48>/delay' */
-} DW_Subsytem7_SFM_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-/* Block signals for model 'SFM' */
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  uint16_T CellU[28];                  /* '<S13>/Chart' */
-  uint16_T MinU;                       /* '<S13>/Chart' */
-  uint16_T MaxU;                       /* '<S13>/Chart' */
-  boolean_T ErrFlg[28];                /* '<S13>/Chart' */
-  boolean_T GNDFlg;                    /* '<S13>/Chart' */
-} B_SFM_c_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-/* Block states (default storage) for model 'SFM' */
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  uint16_T Time_Delay_DSTATE;          /* '<S23>/Time_Delay' */
-  uint16_T Cntl;                       /* '<S3>/FltCodeArry' */
-  uint16_T CellUArry[84];              /* '<S13>/Chart' */
-  uint8_T delay_DSTATE;                /* '<S30>/delay' */
-  uint8_T delay_DSTATE_j;              /* '<S29>/delay' */
-  uint8_T ChgNr[28];                   /* '<S13>/Chart' */
-  uint8_T RecNr[28];                   /* '<S13>/Chart' */
-  uint8_T UdelNr[28];                  /* '<S13>/Chart' */
-  boolean_T FirstFlg;                  /* '<S13>/Chart' */
-  boolean_T ErrUFlg[28];               /* '<S13>/Chart' */
-  DW_Subsytem7_SFM_T Subsytem9;        /* '<S28>/Subsytem9' */
-  DW_Subsytem6_SFM_T Subsytem8;        /* '<S28>/Subsytem8' */
-  DW_Subsytem7_SFM_T Subsytem7;        /* '<S28>/Subsytem7' */
-  DW_Subsytem6_SFM_T Subsytem6;        /* '<S28>/Subsytem6' */
-  DW_Subsytem_SFM_d_T Subsytem5_l;     /* '<S28>/Subsytem5' */
-  DW_Subsytem_SFM_d_T Subsytem4_p;     /* '<S28>/Subsytem4' */
-  DW_Subsytem1_SFM_k_T Subsytem3_b;    /* '<S28>/Subsytem3' */
-  DW_Subsytem_SFM_d_T Subsytem2_p;     /* '<S28>/Subsytem2' */
-  DW_Subsytem1_SFM_k_T Subsytem1_n;    /* '<S28>/Subsytem1' */
-  DW_Subsytem_SFM_d_T Subsytem_j0;     /* '<S28>/Subsytem' */
-  DW_Subsytem_SFM_T Subsytem5;         /* '<S27>/Subsytem5' */
-  DW_Subsytem_SFM_T Subsytem4;         /* '<S27>/Subsytem4' */
-  DW_Subsytem1_SFM_T Subsytem3;        /* '<S27>/Subsytem3' */
-  DW_Subsytem_SFM_T Subsytem2;         /* '<S27>/Subsytem2' */
-  DW_Subsytem1_SFM_T Subsytem1_e;      /* '<S27>/Subsytem1' */
-  DW_Subsytem_SFM_T Subsytem_j;        /* '<S27>/Subsytem' */
-} DW_SFM_f_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-/* Real-time Model Data Structure */
-struct tag_RTM_SFM_T {
-  const char_T **errorStatus;
-};
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-typedef struct {
-  RT_MODEL_SFM_T rtm;
-} MdlrefDW_SFM_T;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
+extern boolean_T FirstRun_SFM;
 
 extern void SFM_Init(void);
 extern void SFM(void);
 
-/* Model reference registration function */
-extern void SFM_initialize(const char_T **rt_errorStatus);
-
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-extern void SFM_Subsytem_Init(DW_Subsytem_SFM_T *localDW);
-extern boolean_T SFM_Subsytem(uint8_T rtu_Enable, boolean_T rtu_Precondition,
-  int16_T rtu_inputs, int16_T rtu_threshold, uint8_T rtu_CtrN, DW_Subsytem_SFM_T
-  *localDW);
-extern void SFM_Subsytem1_Init(DW_Subsytem1_SFM_T *localDW);
-extern boolean_T SFM_Subsytem1(uint8_T rtu_Enable, boolean_T rtu_Precondition,
-  int16_T rtu_InputS, int16_T rtu_threshold, uint8_T rtu_CtrN,
-  DW_Subsytem1_SFM_T *localDW);
-extern boolean_T SFM_Subsystem5(boolean_T rtu_In1, boolean_T rtu_In2);
-extern void SFM_Subsytem_b_Init(DW_Subsytem_SFM_d_T *localDW);
-extern boolean_T SFM_Subsytem_j(uint8_T rtu_Enable, boolean_T rtu_Precondition,
-  uint16_T rtu_inputs, uint16_T rtu_threshold, uint8_T rtu_CtrN,
-  DW_Subsytem_SFM_d_T *localDW);
-extern void SFM_Subsytem1_f_Init(DW_Subsytem1_SFM_k_T *localDW);
-extern boolean_T SFM_Subsytem1_n(uint8_T rtu_Enable, boolean_T rtu_Precondition,
-  uint16_T rtu_InputS, uint16_T rtu_threshold, uint8_T rtu_CtrN,
-  DW_Subsytem1_SFM_k_T *localDW);
-extern void SFM_Subsytem6_Init(DW_Subsytem6_SFM_T *localDW);
-extern boolean_T SFM_Subsytem6(uint8_T rtu_Enable, boolean_T rtu_Precondition,
-  uint32_T rtu_inputs, uint16_T rtu_threshold, uint8_T rtu_CtrN,
-  DW_Subsytem6_SFM_T *localDW);
-extern void SFM_Subsytem7_Init(DW_Subsytem7_SFM_T *localDW);
-extern boolean_T SFM_Subsytem7(uint8_T rtu_Enable, boolean_T rtu_Precondition,
-  uint32_T rtu_InputS, uint16_T rtu_threshold, uint8_T rtu_CtrN,
-  DW_Subsytem7_SFM_T *localDW);
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-extern MdlrefDW_SFM_T SFM_MdlrefDW;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-#ifndef SFM_MDLREF_HIDE_CHILD_
-
-/* Block signals (default storage) */
-extern B_SFM_c_T SFM_B;
-
-/* Block states (default storage) */
-extern DW_SFM_f_T SFM_DW;
-
-#endif                                 /*SFM_MDLREF_HIDE_CHILD_*/
-
-/*-
- * These blocks were eliminated from the model due to optimizations:
- *
- * Block '<S3>/Bitwise Operator' : Unused code path elimination
- * Block '<S3>/Constant82' : Unused code path elimination
- * Block '<S3>/Constant83' : Unused code path elimination
- * Block '<S3>/Display' : Unused code path elimination
- * Block '<S3>/Display1' : Unused code path elimination
- * Block '<S3>/Display3' : Unused code path elimination
- * Block '<S3>/Display7' : Unused code path elimination
- * Block '<S17>/Signal Conversion' : Unused code path elimination
- * Block '<S28>/Display' : Unused code path elimination
- * Block '<S28>/Display1' : Unused code path elimination
- * Block '<S28>/Display2' : Unused code path elimination
- */
-
-/*-
- * The generated code includes comments that allow you to trace directly
- * back to the appropriate location in the model.  The basic format
- * is <system>/block_name, where system is the system number (uniquely
- * assigned by Simulink) and block_name is the name of the block.
- *
- * Use the MATLAB hilite_system command to trace the generated code back
- * to the model.  For example,
- *
- * hilite_system('<S3>')    - opens system 3
- * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
- *
- * Here is the system hierarchy for this model
- *
- * '<Root>' : 'SFM'
- * '<S1>'   : 'SFM/SFM'
- * '<S2>'   : 'SFM/SFM/Fault Data'
- * '<S3>'   : 'SFM/SFM/Fault report'
- * '<S4>'   : 'SFM/SFM/diagnosis'
- * '<S5>'   : 'SFM/SFM/Fault report/FltCodeArry'
- * '<S6>'   : 'SFM/SFM/diagnosis/ thermal runaway diagnosis'
- * '<S7>'   : 'SFM/SFM/diagnosis/Acquisition signal diagnosis'
- * '<S8>'   : 'SFM/SFM/diagnosis/Algt diagnosis'
- * '<S9>'   : 'SFM/SFM/diagnosis/Communication diagnosis'
- * '<S10>'  : 'SFM/SFM/diagnosis/Relay diagnosis'
- * '<S11>'  : 'SFM/SFM/diagnosis/Threshold diagnosis'
- * '<S12>'  : 'SFM/SFM/diagnosis/high voltage diagnosis'
- * '<S13>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/BattU'
- * '<S14>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/I'
- * '<S15>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/Subsystem'
- * '<S16>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/else'
- * '<S17>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/gas'
- * '<S18>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/BattU/Chart'
- * '<S19>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/Subsystem/ModMax1'
- * '<S20>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/Subsystem/ModMin1'
- * '<S21>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/Subsystem/ModMax1/ArrMin'
- * '<S22>'  : 'SFM/SFM/diagnosis/Acquisition signal diagnosis/Subsystem/ModMin1/ArrMin'
- * '<S23>'  : 'SFM/SFM/diagnosis/Communication diagnosis/keep juged'
- * '<S24>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ current Threshold diagnosis'
- * '<S25>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ else Threshold diagnosis'
- * '<S26>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ gas Threshold diagnosis'
- * '<S27>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ temperature Threshold diagnosis'
- * '<S28>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis'
- * '<S29>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ current Threshold diagnosis/Subsytem'
- * '<S30>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ current Threshold diagnosis/Subsytem1'
- * '<S31>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ temperature Threshold diagnosis/Subsytem'
- * '<S32>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ temperature Threshold diagnosis/Subsytem1'
- * '<S33>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ temperature Threshold diagnosis/Subsytem2'
- * '<S34>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ temperature Threshold diagnosis/Subsytem3'
- * '<S35>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ temperature Threshold diagnosis/Subsytem4'
- * '<S36>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/ temperature Threshold diagnosis/Subsytem5'
- * '<S37>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsystem5'
- * '<S38>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsystem6'
- * '<S39>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsystem7'
- * '<S40>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsystem8'
- * '<S41>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem'
- * '<S42>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem1'
- * '<S43>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem2'
- * '<S44>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem3'
- * '<S45>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem4'
- * '<S46>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem5'
- * '<S47>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem6'
- * '<S48>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem7'
- * '<S49>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem8'
- * '<S50>'  : 'SFM/SFM/diagnosis/Threshold diagnosis/voltage Threshold diagnosis/Subsytem9'
- */
-#endif                                 /* RTW_HEADER_SFM_h_ */
+typedef struct {
+    uint8_T fltNum81;
+    uint8_T recNum81;
+    uint8_T fltNum82;
+    uint8_T recNum82;
+    uint8_T fltNum83;
+    uint8_T recNum83;
+    uint8_T fltNum84;
+    uint8_T recNum84;
+    uint8_T fltNum85;
+    uint8_T recNum85;
+    uint8_T fltNum86;
+    uint8_T recNum86;
+    uint8_T fltNum87;
+    uint8_T recNum87;
+    uint8_T fltNum88;
+    uint8_T recNum88;
+    uint8_T fltNum89;
+    uint8_T recNum89;
+    uint8_T fltNum90;
+    uint8_T recNum90;
+    uint8_T fltNum97;
+    uint8_T recNum97;
+    uint8_T fltNum98;
+    uint8_T recNum98;
+	uint8_T fltNum99;
+    uint8_T recNum99;
+    uint8_T fltNum100;
+    uint8_T recNum100;
+    uint8_T fltNum101;
+    uint8_T recNum101;
+    uint8_T fltNum102;
+    uint8_T recNum102;
+    uint8_T fltNum103;
+    uint8_T recNum103;
+    uint8_T fltNum104;
+    uint8_T recNum104;
+    uint8_T fltNum105;
+    uint8_T recNum105;
+    uint8_T fltNum106;
+    uint8_T recNum106;
+    uint8_T fltNum107;
+    uint8_T recNum107;
+    uint8_T fltNum108;
+    uint8_T recNum108;
+    uint8_T fltNum109;
+    uint8_T recNum109;
+    uint8_T fltNum110;
+    uint8_T recNum110;
+    uint8_T fltNum111;
+    uint8_T recNum111;
+    uint8_T fltNum112;
+    uint8_T recNum112;
+    uint8_T fltNum113;
+    uint8_T recNum113;
+    uint8_T fltNum114;
+    uint8_T recNum114;
+    uint8_T fltNum115_1;
+    uint8_T recNum115_1;
+    uint8_T fltNum115_2;
+    uint8_T recNum115_2;
+    uint8_T fltNum116_1;
+    uint8_T recNum116_1;
+    uint8_T fltNum116_2;
+    uint8_T recNum116_2;
+    uint8_T fltNum131;
+    uint8_T recNum131;
+    uint8_T fltNum132;
+    uint8_T recNum132;
+}DiagThrstruct;
 
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */
+typedef struct {
+    uint8_T N151;
+    uint8_T N152;
+    uint8_T N153;
+    uint8_T N154;
+    uint8_T N155;
+    uint8_T N156;
+    uint8_T N157;
+    uint8_T N158;
+    uint8_T N159;
+    uint8_T N160;
+    uint8_T N161;
+    uint8_T N162;
+}DiagMisstruct;
+
+extern boolean_T DiagThrSystem1(boolean_T Enable, boolean_T precondition, uint16_T Input,uint16_T fltThr,uint16_T recThr,uint16_T fltNumThr,uint16_T recNumThr,uint8_T *fltNum,uint8_T *recNum,boolean_T *fitFlg);
+extern boolean_T DiagThrSystem2(boolean_T Enable, boolean_T precondition, uint16_T Input,uint16_T fltThr,uint16_T recThr,uint16_T fltNumThr,uint16_T recNumThr,uint8_T *fltNum,uint8_T *recNum,boolean_T *fitFlg);
+extern boolean_T MisMatich(boolean_T x, boolean_T y, uint8_T *N);

+ 0 - 89
inc/EmbeddedCoder_inc/SFM_private.h

@@ -1,89 +0,0 @@
-/*
- * File: SFM_private.h
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.73
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:18:17 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTW_HEADER_SFM_private_h_
-#define RTW_HEADER_SFM_private_h_
-#include "rtwtypes.h"
-#ifndef UCHAR_MAX
-#include <limits.h>
-#endif
-
-#if ( UCHAR_MAX != (0xFFU) ) || ( SCHAR_MAX != (0x7F) )
-#error Code was generated for compiler with different sized uchar/char. \
-Consider adjusting Test hardware word size settings on the \
-Hardware Implementation pane to match your compiler word sizes as \
-defined in limits.h of the compiler. Alternatively, you can \
-select the Test hardware is the same as production hardware option and \
-select the Enable portable word sizes option on the Code Generation > \
-Verification pane for ERT based targets, which will disable the \
-preprocessor word size checks.
-#endif
-
-#if ( USHRT_MAX != (0xFFFFU) ) || ( SHRT_MAX != (0x7FFF) )
-#error Code was generated for compiler with different sized ushort/short. \
-Consider adjusting Test hardware word size settings on the \
-Hardware Implementation pane to match your compiler word sizes as \
-defined in limits.h of the compiler. Alternatively, you can \
-select the Test hardware is the same as production hardware option and \
-select the Enable portable word sizes option on the Code Generation > \
-Verification pane for ERT based targets, which will disable the \
-preprocessor word size checks.
-#endif
-
-#if ( UINT_MAX != (0xFFFFFFFFU) ) || ( INT_MAX != (0x7FFFFFFF) )
-#error Code was generated for compiler with different sized uint/int. \
-Consider adjusting Test hardware word size settings on the \
-Hardware Implementation pane to match your compiler word sizes as \
-defined in limits.h of the compiler. Alternatively, you can \
-select the Test hardware is the same as production hardware option and \
-select the Enable portable word sizes option on the Code Generation > \
-Verification pane for ERT based targets, which will disable the \
-preprocessor word size checks.
-#endif
-
-#if ( ULONG_MAX != (0xFFFFFFFFU) ) || ( LONG_MAX != (0x7FFFFFFF) )
-#error Code was generated for compiler with different sized ulong/long. \
-Consider adjusting Test hardware word size settings on the \
-Hardware Implementation pane to match your compiler word sizes as \
-defined in limits.h of the compiler. Alternatively, you can \
-select the Test hardware is the same as production hardware option and \
-select the Enable portable word sizes option on the Code Generation > \
-Verification pane for ERT based targets, which will disable the \
-preprocessor word size checks.
-#endif
-
-/* Macros for accessing real-time model data structure */
-#ifndef rtmGetErrorStatus
-#define rtmGetErrorStatus(rtm)         (*((rtm)->errorStatus))
-#endif
-
-#ifndef rtmSetErrorStatus
-#define rtmSetErrorStatus(rtm, val)    (*((rtm)->errorStatus) = (val))
-#endif
-
-#ifndef rtmGetErrorStatusPointer
-#define rtmGetErrorStatusPointer(rtm)  (rtm)->errorStatus
-#endif
-
-#ifndef rtmSetErrorStatusPointer
-#define rtmSetErrorStatusPointer(rtm, val) ((rtm)->errorStatus = (val))
-#endif
-#endif                                 /* RTW_HEADER_SFM_private_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 30
inc/EmbeddedCoder_inc/SFM_types.h

@@ -1,30 +0,0 @@
-/*
- * File: SFM_types.h
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.73
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:18:17 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTW_HEADER_SFM_types_h_
-#define RTW_HEADER_SFM_types_h_
-
-/* Model Code Variants */
-
-/* Forward declaration for rtModel */
-typedef struct tag_RTM_SFM_T RT_MODEL_SFM_T;
-
-#endif                                 /* RTW_HEADER_SFM_types_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 6 - 0
inc/EmbeddedCoder_inc/TMS.h

@@ -0,0 +1,6 @@
+#include "rtwtypes.h"
+#include "BCUCal.h"
+#include "BCUDisp.h"
+extern boolean_T FirstRun_TMS;
+extern void TMS_Init(void);
+extern void TMS(void);

+ 0 - 23
inc/EmbeddedCoder_inc/div_nde_s32_floor.h

@@ -1,23 +0,0 @@
-/*
- * File: div_nde_s32_floor.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#ifndef RTW_HEADER_div_nde_s32_floor_h_
-#define RTW_HEADER_div_nde_s32_floor_h_
-#include "rtwtypes.h"
-
-extern int32_T div_nde_s32_floor(int32_T numerator, int32_T denominator);
-
-#endif                                 /* RTW_HEADER_div_nde_s32_floor_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/div_nzp_repeat_u32.h

@@ -1,24 +0,0 @@
-/*
- * File: div_nzp_repeat_u32.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#ifndef RTW_HEADER_div_nzp_repeat_u32_h_
-#define RTW_HEADER_div_nzp_repeat_u32_h_
-#include "rtwtypes.h"
-
-extern uint32_T div_nzp_repeat_u32(uint32_T numerator, uint32_T denominator,
-  uint32_T nRepeatSub);
-
-#endif                                 /* RTW_HEADER_div_nzp_repeat_u32_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/div_nzp_repeat_u32_ceiling.h

@@ -1,24 +0,0 @@
-/*
- * File: div_nzp_repeat_u32_ceiling.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#ifndef RTW_HEADER_div_nzp_repeat_u32_ceiling_h_
-#define RTW_HEADER_div_nzp_repeat_u32_ceiling_h_
-#include "rtwtypes.h"
-
-extern uint32_T div_nzp_repeat_u32_ceiling(uint32_T numerator, uint32_T
-  denominator, uint32_T nRepeatSub);
-
-#endif                            /* RTW_HEADER_div_nzp_repeat_u32_ceiling_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/div_repeat_s16s32_floor.h

@@ -1,24 +0,0 @@
-/*
- * File: div_repeat_s16s32_floor.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#ifndef RTW_HEADER_div_repeat_s16s32_floor_h_
-#define RTW_HEADER_div_repeat_s16s32_floor_h_
-#include "rtwtypes.h"
-
-extern int16_T div_repeat_s16s32_floor(int32_T numerator, int32_T denominator,
-  uint32_T nRepeatSub);
-
-#endif                               /* RTW_HEADER_div_repeat_s16s32_floor_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/div_repeat_s32_floor.h

@@ -1,24 +0,0 @@
-/*
- * File: div_repeat_s32_floor.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.52
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Tue Sep 14 16:42:25 2021
- */
-
-#ifndef RTW_HEADER_div_repeat_s32_floor_h_
-#define RTW_HEADER_div_repeat_s32_floor_h_
-#include "rtwtypes.h"
-
-extern int32_T div_repeat_s32_floor(int32_T numerator, int32_T denominator,
-  uint32_T nRepeatSub);
-
-#endif                                 /* RTW_HEADER_div_repeat_s32_floor_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/div_repeat_u32.h

@@ -1,24 +0,0 @@
-/*
- * File: div_repeat_u32.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#ifndef RTW_HEADER_div_repeat_u32_h_
-#define RTW_HEADER_div_repeat_u32_h_
-#include "rtwtypes.h"
-
-extern uint32_T div_repeat_u32(uint32_T numerator, uint32_T denominator,
-  uint32_T nRepeatSub);
-
-#endif                                 /* RTW_HEADER_div_repeat_u32_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/div_s32_floor.h

@@ -1,23 +0,0 @@
-/*
- * File: div_s32_floor.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.52
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Tue Sep 14 16:42:25 2021
- */
-
-#ifndef RTW_HEADER_div_s32_floor_h_
-#define RTW_HEADER_div_s32_floor_h_
-#include "rtwtypes.h"
-
-extern int32_T div_s32_floor(int32_T numerator, int32_T denominator);
-
-#endif                                 /* RTW_HEADER_div_s32_floor_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/div_su32.h

@@ -1,23 +0,0 @@
-/*
- * File: div_su32.h
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#ifndef RTW_HEADER_div_su32_h_
-#define RTW_HEADER_div_su32_h_
-#include "rtwtypes.h"
-
-extern int32_T div_su32(uint32_T numerator, uint32_T denominator);
-
-#endif                                 /* RTW_HEADER_div_su32_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/div_uus32_sat.h

@@ -1,23 +0,0 @@
-/*
- * File: div_uus32_sat.h
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.71
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:17:31 2021
- */
-
-#ifndef RTW_HEADER_div_uus32_sat_h_
-#define RTW_HEADER_div_uus32_sat_h_
-#include "rtwtypes.h"
-
-extern uint32_T div_uus32_sat(uint32_T numerator, int32_T denominator);
-
-#endif                                 /* RTW_HEADER_div_uus32_sat_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/look1_binlxpw.h

@@ -1,24 +0,0 @@
-/*
- * File: look1_binlxpw.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#ifndef RTW_HEADER_look1_binlxpw_h_
-#define RTW_HEADER_look1_binlxpw_h_
-#include "rtwtypes.h"
-
-extern real_T look1_binlxpw(real_T u0, const real_T bp0[], const real_T table[],
-  uint32_T maxIndex);
-
-#endif                                 /* RTW_HEADER_look1_binlxpw_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_s32_hiSR.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_s32_hiSR.h
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.71
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:17:31 2021
- */
-
-#ifndef RTW_HEADER_mul_s32_hiSR_h_
-#define RTW_HEADER_mul_s32_hiSR_h_
-#include "rtwtypes.h"
-
-extern int32_T mul_s32_hiSR(int32_T a, int32_T b, uint32_T aShift);
-
-#endif                                 /* RTW_HEADER_mul_s32_hiSR_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_s32_loSR.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_s32_loSR.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.52
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Tue Sep 14 16:42:25 2021
- */
-
-#ifndef RTW_HEADER_mul_s32_loSR_h_
-#define RTW_HEADER_mul_s32_loSR_h_
-#include "rtwtypes.h"
-
-extern int32_T mul_s32_loSR(int32_T a, int32_T b, uint32_T aShift);
-
-#endif                                 /* RTW_HEADER_mul_s32_loSR_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_s32_loSR_sat.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_s32_loSR_sat.h
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#ifndef RTW_HEADER_mul_s32_loSR_sat_h_
-#define RTW_HEADER_mul_s32_loSR_sat_h_
-#include "rtwtypes.h"
-
-extern int32_T mul_s32_loSR_sat(int32_T a, int32_T b, uint32_T aShift);
-
-#endif                                 /* RTW_HEADER_mul_s32_loSR_sat_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_s32_sat.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_s32_sat.h
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#ifndef RTW_HEADER_mul_s32_sat_h_
-#define RTW_HEADER_mul_s32_sat_h_
-#include "rtwtypes.h"
-
-extern int32_T mul_s32_sat(int32_T a, int32_T b);
-
-#endif                                 /* RTW_HEADER_mul_s32_sat_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_s32_sr32_ceil.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_s32_sr32_ceil.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.52
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Tue Sep 14 16:42:25 2021
- */
-
-#ifndef RTW_HEADER_mul_s32_sr32_ceil_h_
-#define RTW_HEADER_mul_s32_sr32_ceil_h_
-#include "rtwtypes.h"
-
-extern int32_T mul_s32_sr32_ceil(int32_T a, int32_T b);
-
-#endif                                 /* RTW_HEADER_mul_s32_sr32_ceil_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_ssu32_sat.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_ssu32_sat.h
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#ifndef RTW_HEADER_mul_ssu32_sat_h_
-#define RTW_HEADER_mul_ssu32_sat_h_
-#include "rtwtypes.h"
-
-extern int32_T mul_ssu32_sat(int32_T a, uint32_T b);
-
-#endif                                 /* RTW_HEADER_mul_ssu32_sat_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_u32_hiSR.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_u32_hiSR.h
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#ifndef RTW_HEADER_mul_u32_hiSR_h_
-#define RTW_HEADER_mul_u32_hiSR_h_
-#include "rtwtypes.h"
-
-extern uint32_T mul_u32_hiSR(uint32_T a, uint32_T b, uint32_T aShift);
-
-#endif                                 /* RTW_HEADER_mul_u32_hiSR_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_u32_hiSR_near.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_u32_hiSR_near.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#ifndef RTW_HEADER_mul_u32_hiSR_near_h_
-#define RTW_HEADER_mul_u32_hiSR_near_h_
-#include "rtwtypes.h"
-
-extern uint32_T mul_u32_hiSR_near(uint32_T a, uint32_T b, uint32_T aShift);
-
-#endif                                 /* RTW_HEADER_mul_u32_hiSR_near_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/mul_us32_sat.h

@@ -1,23 +0,0 @@
-/*
- * File: mul_us32_sat.h
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#ifndef RTW_HEADER_mul_us32_sat_h_
-#define RTW_HEADER_mul_us32_sat_h_
-#include "rtwtypes.h"
-
-extern uint32_T mul_us32_sat(int32_T a, int32_T b);
-
-#endif                                 /* RTW_HEADER_mul_us32_sat_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/mul_wide_s32.h

@@ -1,24 +0,0 @@
-/*
- * File: mul_wide_s32.h
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.71
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:17:31 2021
- */
-
-#ifndef RTW_HEADER_mul_wide_s32_h_
-#define RTW_HEADER_mul_wide_s32_h_
-#include "rtwtypes.h"
-
-extern void mul_wide_s32(int32_T in0, int32_T in1, uint32_T *ptrOutBitsHi,
-  uint32_T *ptrOutBitsLo);
-
-#endif                                 /* RTW_HEADER_mul_wide_s32_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/mul_wide_su32.h

@@ -1,24 +0,0 @@
-/*
- * File: mul_wide_su32.h
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#ifndef RTW_HEADER_mul_wide_su32_h_
-#define RTW_HEADER_mul_wide_su32_h_
-#include "rtwtypes.h"
-
-extern void mul_wide_su32(int32_T in0, uint32_T in1, uint32_T *ptrOutBitsHi,
-  uint32_T *ptrOutBitsLo);
-
-#endif                                 /* RTW_HEADER_mul_wide_su32_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 24
inc/EmbeddedCoder_inc/mul_wide_u32.h

@@ -1,24 +0,0 @@
-/*
- * File: mul_wide_u32.h
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#ifndef RTW_HEADER_mul_wide_u32_h_
-#define RTW_HEADER_mul_wide_u32_h_
-#include "rtwtypes.h"
-
-extern void mul_wide_u32(uint32_T in0, uint32_T in1, uint32_T *ptrOutBitsHi,
-  uint32_T *ptrOutBitsLo);
-
-#endif                                 /* RTW_HEADER_mul_wide_u32_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 28
inc/EmbeddedCoder_inc/rtGetInf.h

@@ -1,28 +0,0 @@
-/*
- * File: rtGetInf.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#ifndef RTW_HEADER_rtGetInf_h_
-#define RTW_HEADER_rtGetInf_h_
-#include <stddef.h>
-#include "rtwtypes.h"
-#include "rt_nonfinite.h"
-
-extern real_T rtGetInf(void);
-extern real32_T rtGetInfF(void);
-extern real_T rtGetMinusInf(void);
-extern real32_T rtGetMinusInfF(void);
-
-#endif                                 /* RTW_HEADER_rtGetInf_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 26
inc/EmbeddedCoder_inc/rtGetNaN.h

@@ -1,26 +0,0 @@
-/*
- * File: rtGetNaN.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#ifndef RTW_HEADER_rtGetNaN_h_
-#define RTW_HEADER_rtGetNaN_h_
-#include <stddef.h>
-#include "rtwtypes.h"
-#include "rt_nonfinite.h"
-
-extern real_T rtGetNaN(void);
-extern real32_T rtGetNaNF(void);
-
-#endif                                 /* RTW_HEADER_rtGetNaN_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 54
inc/EmbeddedCoder_inc/rt_nonfinite.h

@@ -1,54 +0,0 @@
-/*
- * File: rt_nonfinite.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#ifndef RTW_HEADER_rt_nonfinite_h_
-#define RTW_HEADER_rt_nonfinite_h_
-#include <stddef.h>
-#include "rtwtypes.h"
-
-extern real_T rtInf;
-extern real_T rtMinusInf;
-extern real_T rtNaN;
-extern real32_T rtInfF;
-extern real32_T rtMinusInfF;
-extern real32_T rtNaNF;
-extern void rt_InitInfAndNaN(size_t realSize);
-extern boolean_T rtIsInf(real_T value);
-extern boolean_T rtIsInfF(real32_T value);
-extern boolean_T rtIsNaN(real_T value);
-extern boolean_T rtIsNaNF(real32_T value);
-typedef struct {
-  struct {
-    uint32_T wordH;
-    uint32_T wordL;
-  } words;
-} BigEndianIEEEDouble;
-
-typedef struct {
-  struct {
-    uint32_T wordL;
-    uint32_T wordH;
-  } words;
-} LittleEndianIEEEDouble;
-
-typedef struct {
-  union {
-    real32_T wordLreal;
-    uint32_T wordLuint;
-  } wordL;
-} IEEESingle;
-
-#endif                                 /* RTW_HEADER_rt_nonfinite_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 23
inc/EmbeddedCoder_inc/rt_powd_snf.h

@@ -1,23 +0,0 @@
-/*
- * File: rt_powd_snf.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#ifndef RTW_HEADER_rt_powd_snf_h_
-#define RTW_HEADER_rt_powd_snf_h_
-#include "rtwtypes.h"
-
-extern real_T rt_powd_snf(real_T u0, real_T u1);
-
-#endif                                 /* RTW_HEADER_rt_powd_snf_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 44
inc/EmbeddedCoder_inc/zero_crossing_types.h

@@ -1,44 +0,0 @@
-/*
- * File: zero_crossing_types.h
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#ifndef ZERO_CROSSING_TYPES_H
-#define ZERO_CROSSING_TYPES_H
-#include "rtwtypes.h"
-
-/* Trigger directions: falling, either, and rising */
-typedef enum {
-  FALLING_ZERO_CROSSING = -1,
-  ANY_ZERO_CROSSING = 0,
-  RISING_ZERO_CROSSING = 1
-} ZCDirection;
-
-/* Previous state of a trigger signal */
-typedef uint8_T ZCSigState;
-
-/* Initial value of a trigger zero crossing signal */
-#define UNINITIALIZED_ZCSIG            0x03U
-#define NEG_ZCSIG                      0x02U
-#define POS_ZCSIG                      0x01U
-#define ZERO_ZCSIG                     0x00U
-
-/* Current state of a trigger signal */
-typedef enum {
-  FALLING_ZCEVENT = -1,
-  NO_ZCEVENT = 0,
-  RISING_ZCEVENT = 1
-} ZCEventType;
-
-#endif                                 /* ZERO_CROSSING_TYPES_H */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 34 - 215
src/AppFunc.c

@@ -9,229 +9,48 @@
 #include "AppFunc.h"
 #include "numeric.h"
 #include "hal_module_adapter.h"
-void FaultDetectFunc(UINT16 *ErrorBufferArray)
+void ErrorNumHandleFunc(void)
 {
-	static UINT16 HeatErrorCounter = 0;
-	static UINT16 CollecErrorCounter = 0;
-	static UINT16 VbatErrorCounter = 0;
-	UINT16 ErrorNumTemp = 0;
-	UINT8 ret;
-	if(battWarningState!=0)
+	UINT16 ErrorArrayBuffer[20] = {0};
+	MEMCPY(ErrorArrayBuffer,sfmv_idx_fltCode,sfmd_num_fltNum*2);
+	BOOL isSorted;
+	UINT16 temp = 0;
+	for(UINT8 i=0; i<sfmd_num_fltNum; i++)
 	{
-		ret = ((battWarningState) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 7;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在电芯过放告警故障!!\n";单体电压过低
-		}
-		ret = ((battWarningState >> 1) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 10;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在总电压过放告警故障!!\n";总电压过低
-		}
-		ret = ((battWarningState >> 2) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 8;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在电芯过压告警故障!!\n";
-		}
-		ret = ((battWarningState >> 3) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 11;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在总电压过压告警故障!!\n";
-		}
-		ret = ((battWarningState >> 4) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 12;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在放电过流告警故障!!\n";
-		}
-		ret = ((battWarningState >> 5) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 13;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在充电过流告警故障!!\n";
-		}
-		ret = ((battWarningState >> 6) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 2;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在放电过温告警故障!!\n";
-		}
-		ret = ((battWarningState >> 7) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 2;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在充电过温告警故障!!\n";
-		}
-		ret = ((battWarningState >> 8) & 0x01) == 1 ;
-		if (ret)
-		{
-			//str += "ERROR:存在环境高温告警故障!!\n";
-		}
-		ret = ((battWarningState >> 9) & 0x01) == 1 ;
-		if (ret)
-		{
-			//str += "ERROR:存在环境低温告警故障!!\n";
-		}
-		ret = ((battWarningState >> 10) & 0x01) == 1 ;
-		if (ret)
+		isSorted = TRUE;  //假设剩下的元素已经排序好了
+		for(UINT8 j=0; j<sfmd_num_fltNum-i; j++)
 		{
-			ErrorNumTemp = 27;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在battSOC低告警故障!!\n";
-		}
-		ret = ((battWarningState >> 11) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 3;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在MOS高温告警故障!!\n";
-		}
-		ret = ((battWarningState >> 16) & 0x01) == 1;
-		if (ret)
-		{
-			ErrorNumTemp = 18;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在温度采集失效/传感器故障!!\n";
-		}
-		ret = ((battWarningState >> 17) & 0x01) == 1;
-		if (ret)
-		{
-			ErrorNumTemp = 19;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在电压采集失效/断线故障!!\n";
-		}
-		ret = ((battWarningState >> 18) & 0x01) == 1;
-		if (ret)
-		{
-			ErrorNumTemp = 17;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在放电MOS失效故障!!\n";
-		}
-		ret = ((battWarningState >> 19) & 0x01) == 1;
-		if (ret)
-		{
-			ErrorNumTemp = 16;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在充电MOS失效故障!!\n";
-		}
-		ret = ((battWarningState >> 20) & 0x01) == 1;
-		if (ret)
-		{
-			ErrorNumTemp = 22;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在电芯不均衡告警!!\n";
-		}
-		ret = ((battWarningState >> 22) & 0x01) == 1;
-		if (ret)
-		{
-			ErrorNumTemp = 1;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在放电低温告警故障!!\n";
-		}
-		ret = ((battWarningState >> 23) & 0x01) == 1 ;
-		if (ret)
-		{
-			ErrorNumTemp = 1;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-			//str += "ERROR:存在充电低温告警故障!!\n";
-		}
-	}
-
-	if(UartErrorFlag==1)//内网通信故障
-	{
-		ErrorNumTemp = 33;
-		PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-	}
-	if((AvgBattTemp>=45+40)&&(battHeatEnableState==0x00)&&(MOSTemp>=70+40))//温度的判定需要加40摄氏度,如果模组最高>=45度,模组最低>=45度,mos温度>=70度,并且加热关闭,持续超过10s,则断开继电器,锁定放电mos
-	{
-		HeatErrorCounter++;
-		if(HeatErrorCounter>100)
-		{
-			AppDataInfo.ErrorMsg = 20;
-			AppDataInfo.appDataModify = TRUE;
-			AppDataInfo.RelayControl  =  TRUE;
-			AppDataInfo.BattForceLock = TRUE;
-		}
-	}
-	else
-	{
-		HeatErrorCounter = 0;
-	}
-	if (AppDataInfo.ErrorMsg !=0)
-	{
-		ErrorNumTemp = 20;
-		PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-	}
-
-	if(PowerVoltage<9*1000||PowerVoltage>90*1000)
-	{
-		VbatErrorCounter++;
-		if(VbatErrorCounter>=100)
-		{
-			ErrorNumTemp = 37;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-		}
-	}
-	else
-	{
-		VbatErrorCounter = 0;
-	}
-	if(fastChargeTemp==0||normalChargeTemp==0||heatTemp1==0||heatTemp2==0)
-	{
-		CollecErrorCounter++;
-		if(CollecErrorCounter>100)
-		{
-			ErrorNumTemp = 18;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
+			if(ErrorArrayBuffer[j] < ErrorArrayBuffer[j+1])
+			{
+				temp = ErrorArrayBuffer[j];
+				ErrorArrayBuffer[j] = ErrorArrayBuffer[j+1];
+				ErrorArrayBuffer[j+1] = temp;
+				isSorted = FALSE;  //一旦需要交换数组元素,就说明剩下的元素没有排序好
+			}
 		}
+		if(isSorted) break; //如果没有发生交换,说明剩下的元素已经排序好了
 	}
-	else 
-	{	CollecErrorCounter = 0;
-		if(fastChargeTemp>(50+40)||normalChargeTemp>(50+40))
-		{
-			ErrorNumTemp = 4;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-		}
-		if(heatTemp1>(50+40)||heatTemp2>(50+40))
+	 #ifdef USING_PRINTF1
+	 	for(UINT8 i=0; i<sfmd_num_fltNum; i++)
 		{
-			ErrorNumTemp = 5;
-			PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
+			printf("%d,%d  ",ErrorArrayBuffer[i],sfmv_idx_fltCode[i]);
 		}
-	}
-	if((maxCellTemp-minCellTemp)>20)
-	{
-		ErrorNumTemp = 6;
-		PutErrorBufferArray(ErrorBufferArray,ErrorNumTemp);
-	}
-	return;
-}
-void PutErrorBufferArray(UINT16 *ErrorBufferArray,UINT16 ErrorTemp)//临时函数处理
-{	
-	for(UINT8 i=0;i<20;i++)
+		printf("[%d]Num=%d,level=%d,act=%d\n",__LINE__,sfmd_num_fltNum,sfmd_st_fltLevel,sfmd_st_fltAct);
+		printf("[%d]sn=%s,add=%x\n,sn-1=%x,sn-2=%x,sn-3=%x,sn-4=%x,sn-5=%x",__LINE__,AppNVMData.battSN,&(AppNVMData.battSN[0]),*(AppNVMData.battSN-1),
+		*(AppNVMData.battSN-2),*(AppNVMData.battSN-3),*(AppNVMData.battSN-4),*(AppNVMData.battSN-5));
+	#endif
+	if(osOK==osMutexAcquire(Error_Mutex, 1))
 	{
-		if(*(ErrorBufferArray+i)==0)
-		{
-			*(ErrorBufferArray+i) = ErrorTemp;
-			return;
-		}
-		else
+		for(UINT8 index=0;index<20;index++)
 		{
-			continue;
+			if(ErrorArrayBuffer[index]!=0)
+			{
+				PutErrorNum((UINT16 *)ErrorNum,ErrorNumLength,(ErrorArrayBuffer[index]%10000U)); 
+
+			}
 		}
 	}
-	return;
+	osMutexRelease(Error_Mutex);
 }
 void ExpiryTimeCal(UINT8 *StartTimeArray,UINT16 rentalDays,UINT8 *ExpiryTimeArray)
 {
@@ -587,7 +406,7 @@ BOOL BattHeaterSwitch(UINT8* heaterSwitch,UINT8 HeatForceControl)
 	{
 		if(currentSwitchState==0)  //当前状态为关闭,判断是否应该开启
 		{
-			if((chargerConnectState == 1 && minCellTemp<5+40 && minCellTemp>=-29+40 && maxCellTemp<25+40)||(chargerConnectState==0 && minCellTemp<5+40 && minCellTemp>=-29+40 && battSOC>=10 && (((battProtectState>> 21)&0x01) == 0)))//温度偏移为40 
+			if(tmsd_st_heatAct==1) 
 			{
 				*heaterSwitch = 1;
 				isNeedtoSwitch = true;
@@ -595,7 +414,7 @@ BOOL BattHeaterSwitch(UINT8* heaterSwitch,UINT8 HeatForceControl)
 		}
 		else        //当前状态为开启,判断是否应该关闭
 		{
-			if((minCellTemp>=10+40 || maxCellTemp>=30+40)||(chargerConnectState == 0 && minCellTemp<5+40 && minCellTemp>=-29+40 && battSOC<5))
+			if(tmsd_st_heatAct==0)
 			{
 				*heaterSwitch = 0;
 				isNeedtoSwitch= true;
@@ -722,7 +541,7 @@ void LEDDisplay(void)
 				if((((battWarningState >> 10) & 0x01) == 0x01) &&  ((battWarningState & 0xFFFFFBFF) == 0x00))
 					return;
 			}
-			if(battWarningState != 0)			//电池存在故障
+			if(getbit(sfmd_st_fltAct,2)== 1)			//电池存在故障
 			{
 				if(ErrorLightTimer<(UINT8)(LEDFlashPeriod*DutyRatio)) 
 				{	

+ 1 - 3
src/AppSignal.c

@@ -17,7 +17,6 @@ volatile BOOL CanInterruptFlag = FALSE;
 UINT32 ErrFlg = FALSE;
 BOOL downloadReady = FALSE;   
 
-
 /**declear the uint8 vars**/
 UINT8   AvgBattTemp = 0;
 UINT8	battCellTemp[8] = {0};       //Battery temperature 电池温度数值
@@ -46,7 +45,6 @@ UINT8	reservedSignal5 = 0xFF;         //can信息保留信号5
 UINT8	reservedSignal6 = 0xFF;         //can信息保留信号6
 UINT8	reservedSignal7 = 0xFF;         //can信息保留信号7
 UINT8	reservedSignal8 = 0xFF;         //can信息保留信号8
-
 UINT8   Lockstatus = 0;             //Interlock status 高压互锁状态
 UINT8   TcpErrorcount=0;            //Error count TCP联网错误计数
 UINT8   TCPWorkState = 0;           //Tcp工作状态,0-表示发送,1-表示应答,2-表示监听以及心跳发送
@@ -76,7 +74,7 @@ UINT16  avrgCellVol = 0xFFFF;   //平均单体电压
 UINT16	battPackVol = 0xFFFF;   //电池总压
 UINT16	battI = 0xFFFF;         //电池总电流
 UINT16	nbHwVersion = 0xFFFF;   //数据模块硬件状态
-UINT16  ErrorNum[5]={0};        //Error array,故障数组
+UINT16  ErrorNum[ErrorNumLength]={0};        //Error array,故障数组
 UINT16  updateDifferDataPackageCounter = 0;  //差分包升级计数器
 
 

+ 4 - 21
src/AppTaskControl.c

@@ -29,7 +29,6 @@ static void ControlTask(void* arg)
     UINT32 CurrentTime = 0;
     UINT8 AdcOrder = 1;
     UINT8 RingTimes = 0;
-    UINT16 ErrorBufferArray[20] = {0};
     while (true)
     {
         switch(gProcess_Control_Task)
@@ -67,7 +66,7 @@ static void ControlTask(void* arg)
                             clrbit(UartCmdRecvFlag,0);
                         }
                     }
-                    else if(BuzzerControl==TRUE && TimeCounter%10==0)
+                    else if(BuzzerControl==TRUE||getbit(sfmd_st_fltAct,2)==1)
                     {
                         relayControlFunc(0.4);
                     }
@@ -91,30 +90,14 @@ static void ControlTask(void* arg)
                     PROC_CONTROL_STATE_SWITCH(PROCESS_CONTROL_STATE_SLEEP);
                     break;
                 }
-
-                //临时故障诊断函数
-                memset(ErrorBufferArray,0x00,20);
-                FaultDetectFunc(ErrorBufferArray);
-                if(osOK==osMutexAcquire(Error_Mutex, 1))
-                {
-                    for(UINT8 index=0;index<20;index++)
-                    {
-                        if(ErrorBufferArray[index]!=0)
-                        {
-                            #ifdef USING_PRINTF1
-                                printf("ErrorBufferArray-%d  \t",ErrorBufferArray[index]);
-                            #endif	
-                            PutErrorNum((UINT16 *)ErrorNum,sizeof(ErrorNum),ErrorBufferArray[index]); 
-                        }
-                    }
-                }
-                osMutexRelease(Error_Mutex);
+                //临时故障诊断函数--改为模型诊断
+                ErrorNumHandleFunc();
                 break;
             }
             case PROCESS_CONTROL_STATE_SLEEP:
             {
                 osDelay(100);
-                if(TimeCounter%(10*60)==0)
+                if(TimeCounter%(10*600)==0)
                 {
                     GetAdcValue(AdcOrder);
                     AdcOrder++;

+ 2 - 2
src/AppTaskTcp.c

@@ -322,10 +322,10 @@ static void TcpDataInfoAssembleSend()
         *(SendBuffer + 35 ) = UTC8TimeTcp.minute & 0xFF;			//mins-36
         *(SendBuffer + 36 ) = UTC8TimeTcp.second & 0xFF;			//sec-37
         *(SendBuffer + 37 ) = csq;                                  //信号强度-38
-        *(SendBuffer + 38 ) = 0x00;                                 //故障等级-39
+        *(SendBuffer + 38 ) = sfmd_st_fltLevel;                     //故障等级-39
         if(osOK==osMutexAcquire(Error_Mutex, 100))
         {
-            ErrorTemp = GetErrorNum((UINT16 *)ErrorNum,sizeof(ErrorNum));
+            ErrorTemp = GetErrorNum((UINT16 *)ErrorNum,ErrorNumLength);
         }
         else
         {

+ 43 - 4
src/AppTaskUart.c

@@ -64,6 +64,17 @@ static void UartTask(void* arg)
 					EncryptFlag = Uart_Encrypt_Send();
 					EncryptCount++;
 				}
+				#ifdef USING_PRINTF
+					printf("EncryptFlag:%d\n",EncryptFlag);
+				#endif
+				// if(EncryptFlag==0x01)
+				// {
+				// 	ihd_st_authFaild = 0;
+				// }
+				// else
+				// {
+				// 	ihd_st_authFaild = 1;
+				// }
                 PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_IDLE);
                 break;
             }
@@ -269,28 +280,48 @@ void Uart_Cmd_Control(QueueHandle_t UartWriteCmdHandle,UartBuffer UartAnswerData
 		UartWriteData.Data[1] = HeatSwitch&0xFF;
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
-	if(battWorkState ==0x00 && AppDataInfo.BattLock==TRUE && ((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01)!=0x00)//try to lock lock the discharge 
+	if((getbit(sfmd_st_fltAct,6)==1)&&(((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x02)!=0x00))//try to lock lock the charge 
+	{
+		#ifdef USING_PRINTF1
+			printf("[%d]try to lock charge \n",__LINE__);
+		#endif
+		UartWriteData.WriteCmd = 0x01;
+		UartWriteData.Data[0] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2]);
+		UartWriteData.Data[1] = 0x00|((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01);
+		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,0);
+	}
+	else if((getbit(sfmd_st_fltAct,6)==0)&&(((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x02)!=0x02))//try to unlock lock the charge 
+	{
+		#ifdef USING_PRINTF1
+			printf("[%d]try to unlock charge \n",__LINE__);
+		#endif
+		UartWriteData.WriteCmd = 0x01;
+		UartWriteData.Data[0] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2]);
+		UartWriteData.Data[1] = 0x02|((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01);
+		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,0);
+	}
+	if(battWorkState ==0x00 && (AppDataInfo.BattLock==TRUE||getbit(sfmd_st_fltAct,5)==1) && ((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01)!=0x00)//try to lock lock the discharge 
 	{
 		UartWriteData.WriteCmd = 0x01;
 		UartWriteData.Data[0] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2]);
 		UartWriteData.Data[1] = 0x02;
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
-	else if (battWorkState ==0x00 && AppDataInfo.BattLock==FALSE && ((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01)!=0x01 ) // try to unlock
+	else if (battWorkState ==0x00 && (AppDataInfo.BattLock==FALSE&&getbit(sfmd_st_fltAct,5)==0) && ((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01)!=0x01 ) // try to unlock
 	{
 		UartWriteData.WriteCmd = 0x01;
 		UartWriteData.Data[0] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2]);
 		UartWriteData.Data[1] = 0x03;
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
-	if(AppDataInfo.RelayControl==TRUE && getbit((UartAnswerData.data[(0x09+AppDataInfo.BattCellCount+AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]),0)==0x00)//继电器断开
+	if((AppDataInfo.RelayControl==TRUE||getbit(sfmd_st_fltAct,3)==1) && getbit((UartAnswerData.data[(0x09+AppDataInfo.BattCellCount+AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]),0)==0x00)//继电器断开
 	{
 		UartWriteData.WriteCmd = 0x04;
 		UartWriteData.Data[0] = 0x80;
 		UartWriteData.Data[1] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]);
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
-	else if(AppDataInfo.RelayControl==FALSE && getbit((UartAnswerData.data[(0x09+AppDataInfo.BattCellCount+AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]),0)==0x01)//继电器闭合
+	else if((AppDataInfo.RelayControl==FALSE&&getbit(sfmd_st_fltAct,3)==0) && getbit((UartAnswerData.data[(0x09+AppDataInfo.BattCellCount+AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]),0)==0x01)//继电器闭合
 	{
 		UartWriteData.WriteCmd = 0x04;
 		UartWriteData.Data[0] = 0x00;
@@ -368,6 +399,14 @@ UINT8 Uart_Encrypt_Send()
 	UartEncryptBuffer[15] = CRC_chk_buffer;
 	UartEncryptBuffer[16] = CRC_chk_buffer>>8;
 	UartAppTrasmit(UartEncryptBuffer,17,(UINT8 *)&UartDecryptBuffer,5,1000);
+	#ifdef USING_PRINTF1
+        printf("UartDecryptBuffer:\n");
+		for (UINT8 i = 0; i < 5; i++)
+		{
+			printf("%x ",UartDecryptBuffer[i]);
+		}
+		printf("\n\n\n");
+    #endif
 	return UartDecryptBuffer[2];
 }
 static UINT16 crc_chk(UINT8* data, UINT8 length)

+ 45 - 52
src/BCU.c

@@ -1,17 +1,3 @@
-/*
- * File: BCU.c
- *
- * Code generated for Simulink model 'BCU'.
- *
- * Model version                  : 1.33
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:19:09 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
 
 #include "BCU.h"
 
@@ -20,17 +6,13 @@ static UINT8                gProcess_Bcu_TaskStack[PROC_BCU_TASK_STACK_SIZE];
 static osThreadId_t         BcuTaskId = NULL;
 static process_Bcu 		    gProcess_Bcu_Task;
 #define PROC_BCU_STATE_SWITCH(a)  (gProcess_Bcu_Task = a)
-/* Real-time model */
-static RT_MODEL_BCU_T BCU_M_;
-RT_MODEL_BCU_T *const BCU_M = &BCU_M_;
 
 //======================================================
 void BCU(void)
 {     
       uint16_T i;
-      static uint16_T sleep_time;
 	  UINT32 locateTimeCounter = 0;
-	  osDelay(3000);
+	  osDelay(5000);
 	  PROC_BCU_STATE_SWITCH(PROCESS_STATE_INIT);
 	  
 	  while (TRUE)
@@ -56,48 +38,63 @@ void BCU(void)
 		  //------------------------------------------------------------------------------------	  
 		  case PROCESS_STATE_WORK:
 		  { 
-		    sleep_time=0;
 			while (TRUE)
 			{
 			  	//osDelay(100);
 			  	if(locateTimeCounter != TimeCounter)
 			  	{
-					  locateTimeCounter = TimeCounter;
-					  if(BattWorkStateDelay==0&&battI==10000)
-					  {
-					    sleep_time++;
-					    if(sleep_time>100)
-					  	 {
-					  	 sleep_time=101;
+					locateTimeCounter = TimeCounter;
+					if(gProcess_app==LISTEN)
+					{
 						  PROC_BCU_STATE_SWITCH(PROCESS_STATE_SLEEP);
 						  break;
-					     }
-					  }
-					  else
-					  {
-					  	sleep_time = 0;
-					  }
+					}
 					//  printf("sleep_time:%d,BattWorkStateDelay:%d,battI:%d\n",sleep_time,BattWorkStateDelay,battI);
 					  
 					  //=============================================================================
+					  if(BattWorkStateDelay==0&&battI==10000)
+					  {    
+						  memcpy(appv_V_cellU,battCellU,sizeof(appv_V_cellU));
+					  }
 					  ihd_I_curr = (int16_T)(-(battI - 10000));
 					  memcpy(ihv_V_cellU,battCellU,sizeof(battCellU));
-					  for(i=0;i<cmnc_num_modTNum;i++)
-					  	{
-						  ihv_T_modT[i]= (int16_T) (battCellTemp[i]-40);
-
-					  	}
-
-					  ihd_st_workStat  = BattWorkStateDelay;
-					  ihd_L_urtRecv=!UartErrorFlag;
-					  ihd_flg_chrgMosClosFlt= ((battWarningState >> 19) & 0x01) == 1;
-					  ihd_flg_dischrgMosClosFlt=((battWarningState >> 18) & 0x01) == 1;
-		              ihd_flg_currFlt =((battWarningState >> 18) & 0x01) == 1;
+			
+					  for(i=0 ;i < cmnc_num_modTNum;i++)
+					  {
+						  ihv_T_modT[i] = battCellTemp[i];
+					  }
+					  
+					  ihd_T_mosT       =    MOSTemp; 
+					  ihd_T_DCPlugT    =   fastChargeTemp;
+					  ihd_T_ACPlugT    =   normalChargeTemp;
+					  ihd_T_heatPanT1  = heatTemp1;
+					  ihd_T_heatPanT2  = heatTemp2;
+                      ihd_pct_soc      =    battSOC * 10;
+					  ihd_pct_soh      =    battSOH * 10;
+                      ihd_flg_HVILFlt  =    Lockstatus;
+					  ihd_st_workStat  =    BattWorkStateDelay;
+					  ihd_flg_urtRecFlt   =    UartErrorFlag;
+					  ihd_st_chrgConnect = chargerConnectState;
+					  ihd_flg_cellULowFlt        =  ((battWarningState      ) & 0x01) == 1;
+					  ihd_flg_battULowFlt        =  ((battWarningState >> 1 ) & 0x01) == 1;
+					  ihd_flg_cellUOverFlt       =  ((battWarningState >> 2 ) & 0x01) == 1;
+					  ihd_flg_battUOverFlt       =  ((battWarningState >> 3 ) & 0x01) == 1;
+					  ihd_flg_disChrgCurrOverFlt =  ((battWarningState >> 4 ) & 0x01) == 1;
+					  ihd_flg_chrgCurrOverFlt    =  ((battWarningState >> 5 ) & 0x01) == 1;
+					  ihd_flg_disChrgModTOverFlt =  ((battWarningState >> 6 ) & 0x01) == 1;
+					  ihd_flg_chrgModTOverFlt    =  ((battWarningState >> 7 ) & 0x01) == 1;
+					  ihd_flg_chrgMosTOverFlt    =  ((battWarningState >> 11) & 0x01) == 1;
+					  ihd_flg_disChrgMosClosFlt  =  ((battWarningState >> 18) & 0x01) == 1;
+					  ihd_flg_chrgMosClosFlt     =  ((battWarningState >> 19) & 0x01) == 1;
+					  ihd_flg_disChrgModTLowFlt  =  ((battWarningState >> 22) & 0x01) == 1;
+					  ihd_flg_chrgModTLowFlt     =  ((battWarningState >> 23) & 0x01) == 1;
+		              ihd_flg_currOpenFlt      =  0;
 
 					  //=============================================================================
 					  SFM();
+					  TMS();
 					  SPM();
-
+	
 					 //==============================shi shi cun chu=======
 					  if(socd_flg_EEsave==1)
 					  {
@@ -119,12 +116,7 @@ void BCU(void)
 			  osDelay(1000);
 			  ihd_tm_parkTime++;
 			  //printf("ihd_tm_parkTime:%d\n",ihd_tm_parkTime);
-			  if(BattWorkStateDelay==0&&battI==10000)
-			  {    
-			    memcpy(appv_V_cellU,battCellU,sizeof(appv_V_cellU));
-			  }
-
-			  if(BattWorkStateDelay!=0||ihd_tm_parkTime>cmnc_tm_parkTime+10||battI!=10000)
+			  if(gProcess_app==WORK)
 			  {
 				PROC_BCU_STATE_SWITCH(PROCESS_STATE_INIT);
 				break;
@@ -145,9 +137,10 @@ void BCU(void)
 void BCU_Init(void)
 {
 
-  SFM_initialize(rtmGetErrorStatusPointer(BCU_M));
   SFM_Init();
+  TMS_Init();
   SPM_Init();
+  
 }
 
 

+ 94 - 98
src/EmbeddedCoder_src/BCUCal.c

@@ -1,107 +1,103 @@
-/*
- * File: BCUCal.c
- *
- * Code generated for Simulink model 'BCU'.
- *
- * Model version                  : 1.33
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:19:09 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
 
 #include "rtwtypes.h"
-#include "zero_crossing_types.h"
-#include "BCU_types.h"
 
-/* Exported data definition */
+const uint16_T blcc_R_esr = 1000U;                          /* 鍧囪 鐢甸樆 */
+const uint16_T blcc_T_close = 125U;                         /* 鍧囪 鏆傚仠娓╁害锛� */
+const uint16_T blcc_T_open = 100U;                          /* 鍧囪 鏆傚仠鎭㈠�娓╁害锛� */
+const uint16_T blcc_V_low = 10U;                            /* 鍧囪 寮€鍚�數鍘嬮槇鍊� */
 
-/* Const memory section */
-/* Definition for custom storage class: Const */
-const uint16_T blcc_R_esr = 1000U;
-const int16_T blcc_T_close = 85;
-const int16_T blcc_T_open = 60;
-const uint16_T blcc_V_low = 10U;
-const uint16_T cmnc_Q_ratedCp = 600U;
-const uint16_T cmnc_num_cellUNumMax =28;
-
-/* 额定容量; */
-const uint8_T cmnc_num_cellUNum = 17U;
-
-/* 电压采样点个数; */
-const uint8_T cmnc_num_modTNum = 4U;
-
-/* 温度采样点个数; */
-const uint16_T cmnc_tm_parkTime = 1800U;
-
-/* 静置时间阈值; */
+const uint16_T cmnc_Q_ratedCp = 600U;                       /* 鐢垫睜瀹归噺锛� */
+const uint16_T cmnc_num_cellUNum = 17U;                     /* 鐢靛帇閲囨牱鐐瑰疄闄呬釜鏁帮紱 */
+const uint16_T cmnc_num_modTNum = 4U;                       /* 娓╁害閲囨牱鐐瑰疄闄呬釜鏁帮紱 */
+const uint16_T cmnc_tm_parkTime = 1800U;                    /* 闈欑疆鏃堕棿闃堝€硷紱 */
 const uint16_T cmnm_F_polar[13] = { 3880U, 5062U, 4454U, 10798U, 12885U, 12990U,
-  14331U, 10754U, 9378U, 10340U, 10592U, 11946U, 11515U } ;
-
-/* 放电OCV-SOC的SOC数组; */
+  14331U, 10754U, 9378U, 10340U, 10592U, 11946U, 11515U } ; /* 鐢垫睜鏀剧數鍙傛暟鐨凜鏁扮粍锛� */
 const uint16_T cmnm_R_ohm[13] = { 2181U, 2043U, 2040U, 1927U, 1850U, 1802U,
-  1771U, 1743U, 1733U, 1728U, 1748U, 1762U, 1789U } ;
-
-/* 放电OCV-SOC的SOC数组; */
+  1771U, 1743U, 1733U, 1728U, 1748U, 1762U, 1789U } ;       /* 鐢垫睜鏀剧數鍙傛暟鐨凴o鏁扮粍锛� */
 const uint16_T cmnm_R_polar[13] = { 1837U, 1055U, 7352U, 1453U, 1181U, 1125U,
-  1205U, 1283U, 1228U, 1187U, 1104U, 1170U, 1049U } ;
-
-/* 放电OCV-SOC的SOC数组; */
-const uint16_T cmnm_V_ocv[13] =  { 3311U, 3411U, 3476U, 3553U, 3610U, 3638U, 3674U, 3758U, 3845U, 3942U, 4051U, 4106U, 4175U } ;
-
-/* 放电OCV-SOC的OCV数组; */
-const uint16_T cmnm_pct_soc[13] = {  0U,   50U,   100U,  200U,  300U, 400U,  500U,   600U,  700U,  800U,  900U,  950U, 1000U } ;
-
-/* 放电OCV-SOC的SOC数组; */
-const uint16_T sfmc_flg_cellUDiffThr2=300;
-const uint16_T sfmc_flg_cellUDiffThr1=200;
-const int16_T sfmc_I_chrgCurrOverThr = 400;
-const int16_T sfmc_I_dischrgCurrOverThr = -600;
-const int16_T sfmc_T_modTDiffThr1 = 20;
-const int16_T sfmc_T_modTDiffThr2 = 15;
-const int16_T sfmc_T_modTMaxThr1 = 57;
-const int16_T sfmc_T_modTMaxThr2 = 60;
-const int16_T sfmc_T_modTMinThr1 = -10;
-const int16_T sfmc_T_modTMinThr2 = -20;
-const uint16_T sfmc_V_battUMaxThr1 = 722U;
-const uint16_T sfmc_V_battUMaxThr2 = 731U;
-const uint16_T sfmc_V_battUMinThr1 = 425U;
-const uint16_T sfmc_V_battUMinThr2 = 340U;
-const uint16_T sfmc_V_cellUMaxThr1 = 4250U;
-const uint16_T sfmc_V_cellUMaxThr2 = 4300U;
-const uint16_T sfmc_V_cellUMinThr1 = 2700U;
-const uint16_T sfmc_V_cellUMinThr2 = 2500U;
-const uint8_T sfmc_num_fltNumMax = 20U;
-
-/* 温度采样点个数; */
-const uint16_T sfmd_flg_cellUDiffThr2 = 200U;
-const uint16_T socc_V_chrgFulV = 4200U;
-
-/* 充满电的截至电压; */
-const uint16_T socc_pct_battSocLow = 0U;
-
-/* SOC下限值; */
-const uint16_T socc_pct_battSocUp = 1000U;
-
-/* SOC上限值; */
-const int16_T socm_I_chrgCor[4] = { 50, 100, 200, 400 } ;
-
-/* 充电CCV对应的电流数据; */
-const int16_T socm_I_disChrgCor[3] = { -400, -200, -100 } ;
-
-/* 放电CCV对应的电流数据; */
-const uint16_T socm_V_chrgCor[4] = { 4125U, 4128U, 4132U, 4137U } ;
-
-/* 充电CCV对应的电压; */
-const uint16_T socm_V_disChrgCor[3] = { 3100U, 3270U, 3380U } ;
+  1205U, 1283U, 1228U, 1187U, 1104U, 1170U, 1049U } ;       /* 鐢垫睜鏀剧數鍙傛暟鐨凴p鏁扮粍锛� */
+const uint16_T cmnm_V_ocv[13] = { 3311U, 3411U, 3476U, 3553U, 3610U, 3638U,
+  3674U, 3758U, 3845U, 3942U, 4051U, 4106U, 4175U } ;       /* 鐢垫睜鏀剧數鍙傛暟鐨凮CV鏁扮粍锛� */
+const uint16_T cmnm_pct_soc[13] = { 0U, 50U, 100U, 200U, 300U, 400U, 500U, 600U,
+  700U, 800U, 900U, 950U, 1000U } ;                         /* 鐢垫睜鏀剧數鍙傛暟鐨凷OC鏁扮粍锛� */
+  
+const uint16_T sfmc_I_chrgCurrOverThr = 600;                 /* 鍏呯數鐢垫祦闃堝€� */
+const uint16_T sfmc_I_disChrgCurrOverThr = 600;              /* 鏀剧數鐢垫祦闃堝€� */
+const uint16_T sfmc_T_ACPlugTOverThrFlt1 = 120;              /* 鎱㈠厖鎻掑ご娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_ACPlugTOverThrFlt2 = 125;              /* 鎱㈠厖鎻掑ご娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_ACPlugTOverThrRec1 = 110;              /* 鎱㈠厖鎻掑ご娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_ACPlugTOverThrRec2 = 110;              /* 鎱㈠厖鎻掑ご娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_DCPlugTOverThrFlt1 = 120;              /* 蹇�厖鎻掑ご娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_DCPlugTOverThrFlt2 = 125;              /* 蹇�厖鎻掑ご娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_DCPlugTOverThrRec1 = 110;              /* 蹇�厖鎻掑ご娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_DCPlugTOverThrRec2 = 110;              /* 蹇�厖鎻掑ご娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_chrgModTLowThrFlt1 = 42U;             /* 鍏呯數妯$粍娓╁害杩囦綆1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_chrgModTLowThrFlt2 = 40U;             /* 鍏呯數妯$粍娓╁害杩囦綆2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_chrgModTLowThrRec1 = 45U;             /* 鍏呯數妯$粍娓╁害杩囦綆1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_chrgModTLowThrRec2 = 45U;             /* 鍏呯數妯$粍娓╁害杩囦綆2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_chrgModTOverThrFlt1 = 97U;            /* 鍏呯數妯$粍娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_chrgModTOverThrFlt2 = 100U;           /* 鍏呯數妯$粍娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_chrgModTOverThrRec1 = 90U;            /* 鍏呯數妯$粍娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_chrgModTOverThrRec2 = 90U;            /* 鍏呯數妯$粍娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_chrgMosTOverThrFlt1 = 120;             /* 鍏呯數Mos娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_chrgMosTOverThrFlt2 = 125;             /* 鍏呯數Mos娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_chrgMosTOverThrRec1 = 110;             /* 鍏呯數Mos娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_chrgMosTOverThrRec2 = 110;             /* 鍏呯數Mos娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+
+const uint16_T sfmc_T_disChrgModTLowThrFlt1 = 25U;          /* 鏀剧數妯$粍娓╁害杩囦綆1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_disChrgModTLowThrFlt2 = 20U;          /* 鏀剧數妯$粍娓╁害杩囦綆2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_disChrgModTLowThrRec1 = 30U;          /* 鏀剧數妯$粍娓╁害杩囦綆1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_disChrgModTLowThrRec2 = 30U;          /* 鏀剧數妯$粍娓╁害杩囦綆2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_disChrgModTOverThrFlt1 = 97U;         /* 鏀剧數妯$粍娓╁害杩囬珮1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_disChrgModTOverThrFlt2 = 100U;        /* 鏀剧數妯$粍娓╁害杩囬珮2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_disChrgModTOverThrRec1 = 90U;         /* 鏀剧數妯$粍娓╁害杩囬珮1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_disChrgModTOverThrRec2 = 90U;         /* 鏀剧數妯$粍娓╁害杩囬珮2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_disChrgMosTOverThrFlt1 = 120U;
+const uint16_T sfmc_T_disChrgMosTOverThrRec1 = 110U;
+const uint16_T sfmc_T_disChrgMosTOverThrFlt2 = 125U;
+const uint16_T sfmc_T_disChrgMosTOverThrRec2 = 110U;
+
+const uint16_T sfmc_T_heatPanTOverThrFlt1 = 125;             /* 鍔犵儹鏉挎俯搴﹁繃楂�1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_heatPanTOverThrFlt2 = 130;             /* 鍔犵儹鏉挎俯搴﹁繃楂�2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_heatPanTOverThrRec1 = 120;             /* 鍔犵儹鏉挎俯搴﹁繃楂�1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_heatPanTOverThrRec2 = 120;             /* 鍔犵儹鏉挎俯搴﹁繃楂�2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_modTDiffThrFlt1 = 20;                  /* 妯$粍娓╁樊杩囧ぇ1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_modTDiffThrFlt2 = 25;                  /* 妯$粍娓╁樊杩囧ぇ2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_T_modTDiffThrRec1 = 15;                  /* 妯$粍娓╁樊杩囧ぇ1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_T_modTDiffThrRec2 = 15;                  /* 妯$粍娓╁樊杩囧ぇ2绾ф晠闅滄仮澶嶉槇鍊� */
+
+const uint16_T sfmc_V_battULowThrFlt1 = 590U;               /* 鎬诲帇娆犲帇1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_V_battULowThrFlt2 = 580U;               /* 鎬诲帇娆犲帇2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_V_battULowThrRec1 = 600U;               /* 鎬诲帇娆犲帇1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_V_battULowThrRec2 = 600U;               /* 鎬诲帇娆犲帇2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_V_battUOverThrFlt1 = 850U;              /* 鎬诲帇杩囧帇1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_V_battUOverThrFlt2 = 860U;              /* 鎬诲帇杩囧帇2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_V_battUOverThrRec1 = 840U;              /* 鎬诲帇杩囧帇1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_V_battUOverThrRec2 = 840U;              /* 鎬诲帇杩囧帇2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_V_cellULowThrFlt1 = 2950U;              /* 鍗曚綋鐢靛帇娆犲帇1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_V_cellULowThrFlt2 = 2900U;              /* 鍗曚綋鐢靛帇娆犲帇2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_V_cellULowThrRec1 = 3000U;              /* 鍗曚綋鐢靛帇娆犲帇1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_V_cellULowThrRec2 = 3000U;              /* 鍗曚綋鐢靛帇娆犲帇2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_V_cellUOverThrFlt1 = 4250U;             /* 鍗曚綋鐢靛帇杩囧帇1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_V_cellUOverThrFlt2 = 4300U;             /* 鍗曚綋鐢靛帇杩囧帇2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_V_cellUOverThrRec1 = 4200U;             /* 鍗曚綋鐢靛帇杩囧帇1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_V_cellUOverThrRec2 = 4200U;             /* 鍗曚綋鐢靛帇杩囧帇2绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_flg_cellUDiffThrFlt1 = 250U;            /* 鍘嬪樊杩囧ぇ1绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_flg_cellUDiffThrFlt2 = 300U;            /* 鍘嬪樊杩囧ぇ2绾ф晠闅滆瘖鏂�槇鍊� */
+const uint16_T sfmc_flg_cellUDiffThrRec1 = 250U;            /* 鍘嬪樊杩囧ぇ1绾ф晠闅滄仮澶嶉槇鍊� */
+const uint16_T sfmc_flg_cellUDiffThrRec2 = 250U;            /* 鍘嬪樊杩囧ぇ2绾ф晠闅滄仮澶嶉槇鍊� */
+
+
+const uint16_T socc_V_chrgFulV = 4200U;                     /* 鍏呮弧鐢电殑鎴�嚦鐢靛帇锛� */
+const uint16_T socc_pct_battSocLow = 0U;                    /* SOC涓嬮檺鍊硷紱 */
+const uint16_T socc_pct_battSocUp = 1000U;                  /* SOC涓婇檺鍊硷紱 */
+const int16_T socm_I_chrgCor[4] = { 50, 100, 200, 400 } ;   /* 鍏呯數CCV瀵瑰簲鐨勭數娴佹暟鎹�紱 */
+const int16_T socm_I_disChrgCor[3] = { -400, -200, -100 } ; /* 鏀剧數CCV瀵瑰簲鐨勭數娴佹暟鎹�紱 */
+const uint16_T socm_V_chrgCor[4] = { 4125U, 4128U, 4132U, 4137U } ;/* 鍏呯數CCV瀵瑰簲鐨勭數鍘嬶紱 */
+const uint16_T socm_V_disChrgCor[3] = { 3100U, 3270U, 3380U } ; /* 鏀剧數CCV瀵瑰簲鐨勭數鍘嬶紱 */
+
+const uint16_T tmsc_T_openThr = 45U;                         /* 鐑��鐞嗗紑鍚�俯搴︼紱 */
+const uint16_T tmsc_T_closeMinThr = 50U;                     /* 鐑��鐞嗗叧闂�俯搴︼紙鏈€浣庢ā缁勶級锛� */
+const uint16_T tmsc_T_closeMaxThr = 70U;                     /* 鐑��鐞嗗紑鍚�俯搴︼紙鏈€楂樻ā缁勶級锛� */
 
-/* 放电CCV对应的电压; */
 
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 94 - 171
src/EmbeddedCoder_src/BCUDisp.c

@@ -1,174 +1,97 @@
-/*
- * File: BCUDisp.c
- *
- * Code generated for Simulink model 'BCU'.
- *
- * Model version                  : 1.33
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 18:19:09 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
 
-#include "rtwtypes.h"
-#include "zero_crossing_types.h"
-#include "BCU_types.h"
-
-/* Exported data definition */
+#include "BCUDisp.h"
 
+uint8_T tmsd_st_heatAct;                          /*鐑��鐞嗚�姹傜姸鎬侊紱 */
 uint16_T appv_V_cellU[28];
-uint16_T  socd_pct_estSoc;
-uint16_T  socd_pct_estSoc;
-boolean_T socd_flg_EEsave;
-uint16_T  socd_pct_ekfSoc;
-uint16_T  blcn_Q_impleCp[28];
-uint8_T   cand_Nr_cellNr;
-uint16_T  cand_Q_cellCap;
-uint16_T  cand_V_chrgStartStat;
-uint16_T  cand_Q_reqCp;
-uint32_T  cand_Q_totalCp;
-
-/* Definition for custom storage class: ExportToFile */
-uint16_T blcv_Q_reqCpEi[28];
-
-/* 均衡需求容量 读取量(数组); */
-uint16_T blcv_Q_reqCpEo[28];
-
-/* 均衡需求容量 写入量(数组); */
-uint32_T blcv_Q_totalCpEi[28];
-
-/* 累计均衡容量 读取量(数组); */
-uint32_T blcv_Q_totalCpEo[28];
-
-/* 累计均衡容量 写入量(数组); */
-boolean_T blcv_flg_excute[28];
-
-/* 均衡执行请求标志位 (数组) */
-int16_T ihd_I_curr;
-
-/* 电池包电流; */
-uint16_T ihd_L_urtRecv;
-
-/* urt返回信号长度 */
-uint16_T ihd_P_gas;
-
-/* 气体浓度 */
-int16_T ihd_T_bdtemp;
-
-/* 板子温度 */
-int16_T ihd_T_modTMax;
-
-/* 模组温度最大 */
-int16_T ihd_T_modTMin;
-
-/* 模组温度最小 */
-uint16_T ihd_V_cellUAvrg;
-
-/* 电池单体电压平均; */
-uint16_T ihd_V_cellUMax;
-
-/* 电池单体电压最大; */
-uint16_T ihd_V_cellUMin;
-
-/* 电池单体电压最小; */
-boolean_T ihd_flg_currFlt;
-
-/* 电流传感器故障 */
-uint8_T ihd_st_workStat;
-
-/* 电池工作状态; */
-uint16_T ihd_tm_parkTime;
-
-/* 驻车时间; */
-int16_T ihv_T_modT[6];
-
-/* 模组温度(数组) */
-uint16_T ihv_V_cellU[28];
-boolean_T ihd_flg_chrgMosClosFlt;
-boolean_T ihd_flg_dischrgMosClosFlt;
-
-
-int16_T sfmd_I_curr;
-uint8_T sfmd_N_fltLevel;
-int16_T sfmd_T_modTMax;
-int16_T sfmd_T_modTMin;
-uint16_T sfmd_V_cellUAvrg;
-uint16_T sfmd_V_cellUMax;
-uint16_T sfmd_V_cellUMin;
-uint16_T FltCodeArr[20];
-
-boolean_T sfmd_flg_currFlt;
-
-boolean_T sfmd_flg_volFlt;
-uint16_T sfmd_idx_fltCode;
-uint16_T sfmd_num_fltNum;
-uint8_T sfmd_st_fltAct;
-int16_T sfmv_T_modT[6];
-uint16_T sfmv_V_cellU[28];
-boolean_T sfmv_flg_TFlt;
-uint16_T socd_pct_ahSoc;
-
-/* 安时SOC; */
-uint16_T socd_pct_battSoc;
-
-/* 电池真实SOC; */
-uint16_T socd_pct_battSocEi;
-
-/* 电池真实SOC 读取量; */
-uint16_T socd_pct_battSocEo;
-
-/* 电池真实SOC 写入量; */
-uint16_T socd_pct_bcuSoc;
-
-/* 电池显示SOC; */
-uint16_T socd_pct_bcuSocEi;
-
-/* 电池显示SOC读取量; */
-uint16_T socd_pct_bcuSocEo;
-
-/* 电池显示SOC写入量; */
-uint16_T sohd_Q_chrgEi;
-
-/* 充入容量读取量; */
-uint16_T sohd_Q_chrgEo;
-
-/* 充入容量写入量; */
-boolean_T sohd_flg_chrgEndEi;
-
-/* 充电结束标志位读取量; */
-boolean_T sohd_flg_chrgEndEo;
-
-/* 充电结束标志位写入量; */
-uint16_T sohd_pct_bcuSoh;
-
-/* 电池SOH; */
-uint16_T sohd_tm_chrgStartStatEi;
-
-/* 充电前静置时间读取量; */
-uint16_T sohd_tm_chrgStartStatEo;
-
-/* 充电前静置时间写入量; */
-uint16_T sohv_Q_cellCap[28];
-uint16_T sohv_Q_cellCapArrEi[28];
-uint16_T sohv_Q_cellCapArrEo[28];
-uint16_T sohv_Q_packCapArrEi[10];
-
-/* 10次整包容量(数组)读取量; */
-uint16_T sohv_Q_packCapArrEo[10];
-
-/* 10次整包容量(数组)写入量; */
-uint16_T sohv_V_chrgStartStatEi[28];
-
-/* 充电开始时刻的单体电压(数组)读取量; */
-uint16_T sohv_V_chrgStartStatEo[28];
-
-/* 充电开始时刻的单体电压(数组)写入量; */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */
+boolean_T ihd_flg_HVILFlt;
+
+uint16_T blcv_Q_reqCpEi[28];                      /*鍧囪 闇€姹傚�閲� 璇诲彇閲忥紙鏁扮粍锛夛紱 */
+uint16_T blcv_Q_reqCpEo[28];                      /*鍧囪 闇€姹傚�閲� 鍐欏叆閲忥紙鏁扮粍锛夛紱 */
+uint32_T blcv_Q_totalCpEi[28];                    /*绱��鍧囪 瀹归噺 璇诲彇閲忥紙鏁扮粍锛夛紱 */
+uint32_T blcv_Q_totalCpEo[28];                    /*绱��鍧囪 瀹归噺 鍐欏叆閲忥紙鏁扮粍锛夛紱 */
+boolean_T blcv_flg_excute[28];                    /*鍧囪 鎵ц�璇锋眰鏍囧織浣� 锛堟暟缁勶級 */
+
+uint8_T ihd_st_authFaild;                         
+int16_T ihd_I_curr;                               /*鐢垫睜鍖呯數娴侊紱 */
+uint8_T ihd_st_chrgConnect;                       /*鍏呯數鍣ㄨ繛鎺ョ姸鎬侊紱 */
+uint16_T ihd_P_gas;                               /*姘斾綋娴撳害 */
+uint16_T ihd_T_ACPlugT;                           /*鎱㈠厖鎻掑ご娓╁害 +40 */
+uint16_T ihd_T_DCPlugT;                           /*蹇�厖鎻掑ご娓╁害+40 */
+uint16_T ihd_T_bdtemp;                            /*鏉垮瓙娓╁害 */
+uint16_T ihd_T_heatPanT1;                         /*鍔犵儹鏉挎俯搴�1+40 */
+uint16_T ihd_T_heatPanT2;                         /*鍔犵儹鏉挎俯搴�2 +40 */
+uint16_T ihd_T_mosT;                              /*Mos娓╁害+40 */
+boolean_T ihd_flg_EESaveFlt;                      /*EE瀛樺偍鏁呴殰 */
+boolean_T ihd_flg_battULowFlt;                    /*淇濇姢鏉夸笂浼犵殑鎬诲帇娆犲帇鏁呴殰锛� */
+boolean_T ihd_flg_battUOverFlt;                   /*淇濇姢鏉夸笂浼犵殑鎬诲帇杩囧帇鏁呴殰锛� */
+boolean_T ihd_flg_cellULowFlt;                    /*淇濇姢鏉夸笂浼犵殑鍗曚綋娆犲帇鏁呴殰锛� */
+boolean_T ihd_flg_cellUOverFlt;                   /*淇濇姢鏉夸笂浼犵殑鍗曚綋杩囧帇鏁呴殰锛� */
+boolean_T ihd_flg_chrgCurrOverFlt;                /*淇濇姢鏉夸笂浼犵殑鍏呯數杩囨祦鏁呴殰锛� */
+boolean_T ihd_flg_chrgModTLowFlt;                 /*淇濇姢鏉夸笂浼犵殑鍏呯數妯$粍娓╁害杩囦綆鏁呴殰锛� */
+boolean_T ihd_flg_chrgModTOverFlt;                /*淇濇姢鏉夸笂浼犵殑鍏呯數妯$粍娓╁害杩囬珮鏁呴殰锛� */
+boolean_T ihd_flg_chrgMosClosFlt;                 /*鍏呯數Mos澶辨晥 */
+boolean_T ihd_flg_chrgMosTOverFlt;                /*淇濇姢鏉夸笂浼犵殑鍏呯數Mos娓╁害杩囬珮鏁呴殰锛� */
+boolean_T ihd_flg_currOpenFlt;                    /*淇濇姢鏉夸笂浼犵殑鐢垫祦寮€璺�晠闅� */
+boolean_T ihd_flg_disChrgCurrOverFlt;             /*淇濇姢鏉夸笂浼犵殑鏀剧數杩囨祦鏁呴殰锛� */
+boolean_T ihd_flg_disChrgModTLowFlt;              /*淇濇姢鏉夸笂浼犵殑鏀剧數妯$粍娓╁害杩囦綆鏁呴殰锛� */
+boolean_T ihd_flg_disChrgModTOverFlt;             /*淇濇姢鏉夸笂浼犵殑鏀剧數妯$粍娓╁害杩囬珮鏁呴殰锛� */
+boolean_T ihd_flg_disChrgMosClosFlt;              /*鏀剧數Mos澶辨晥 */
+boolean_T ihd_flg_disChrgMosTOverFlt;             /*淇濇姢鏉夸笂浼犵殑鏀剧數Mos娓╁害杩囬珮鏁呴殰锛� */
+boolean_T ihd_flg_urtRecFlt;                      /*鍐呯綉閫氳�鏁呴殰 */
+uint16_T ihd_pct_soc;                             /*淇濇姢鏉縎OC */
+uint16_T ihd_pct_soh;                             /*淇濇姢鏉縎OH */
+uint8_T ihd_st_workStat;                          /*鐢垫睜宸ヤ綔鐘舵€� */
+uint16_T ihd_tm_parkTime;                         /*椹昏溅鏃堕棿锛� */
+uint16_T ihv_T_modT[6];                           /*妯$粍娓╁害锛堟暟缁勶級+40 */
+uint16_T ihv_V_cellU[28];                         /*鐢垫睜鍗曚綋鐢靛帇锛堟暟缁勶級锛� */
+
+int16_T sfmd_I_curr;                              /*澶勭悊鍚庢暣鍖呯數娴� */
+uint16_T sfmd_T_modTMax;                          /*澶勭悊鍚庢ā缁勬俯搴︽渶灏� */
+uint16_T sfmd_T_modTMin;                          /*澶勭悊鍚庢ā缁勬俯搴︽渶澶� */
+uint16_T sfmd_V_cellUAvrg;                        /*澶勭悊鍚庡崟浣撶數鍘嬪钩鍧� */
+uint16_T sfmd_V_cellUMax;                         /*澶勭悊鍚庡崟浣撶數鍘嬫渶澶� */
+uint16_T sfmd_V_cellUMin;                         /*澶勭悊鍚庡崟浣撶數鍘嬫渶灏� */
+boolean_T sfmd_flg_cellUDisable;                  /*鍗曚綋鐢靛帇鏈夋晥鏍囧織浣� 锛� 0涓烘湁鏁堬紱1涓烘棤鏁� */
+boolean_T sfmd_flg_currDisable;                   /*鐢垫祦鏈夋晥鏍囧織浣� 锛� 0涓烘湁鏁堬紱1涓烘棤鏁� */
+boolean_T sfmd_flg_modTDisable;                   /*妯$粍娓╁害鏈夋晥鏍囧織浣� 锛� 0涓烘湁鏁堬紱1涓烘棤鏁� */
+uint16_T sfmd_num_fltNum;                         /*鏁呴殰鏁伴噺 */
+uint8_T sfmd_st_fltAct;                           /*鏁呴殰绂佹�鎸囦护 */
+uint8_T sfmd_st_fltLevel;                         /*鏁呴殰绛夌骇 */
+uint16_T sfmv_T_modT[6];                          /*澶勭悊鍚庢ā缁勬俯搴� */
+uint16_T sfmv_V_cellU[28];                        /*澶勭悊鍚庡崟浣撶數鍘� */
+uint16_T sfmv_idx_fltCode[20];                    /*璇婃柇鏁呴殰鐮侊紙鏁扮粍锛� */
+uint16_T sfmd_V_battU;  
+
+uint16_T socd_pct_ahSoc;                          /*瀹夋椂SOC锛� */
+uint16_T socd_pct_estSoc;                         /*浼扮畻SOC锛�*/
+uint16_T socd_flg_EEsave;                         /*瀹炴椂瀛樺偍鏍囧織浣嶏紱*/
+uint16_T socd_pct_ekfSoc;                         /*EKFSOC锛�*/
+uint16_T socd_pct_battSoc;                        /*鐢垫睜鐪熷疄SOC锛� */
+uint16_T socd_pct_battSocEi;                      /*鐢垫睜鐪熷疄SOC 璇诲彇閲忥紱 */
+uint16_T socd_pct_battSocEo;                      /*鐢垫睜鐪熷疄SOC 鍐欏叆閲忥紱 */
+uint16_T socd_pct_bcuSoc;                         /*鐢垫睜鏄剧ずSOC锛� */
+uint16_T socd_pct_bcuSocEi;                       /*鐢垫睜鏄剧ずSOC璇诲彇閲忥紱 */
+uint16_T socd_pct_bcuSocEo;                       /*鐢垫睜鏄剧ずSOC鍐欏叆閲忥紱 */
+uint16_T socd_pct_bcuSoc_Delay;                   /*鐢垫睜鏄剧ずSOC寤舵椂锛� */
+
+uint16_T sohd_Q_chrgEi;                           /*鍏呭叆瀹归噺璇诲彇閲忥紱 */
+uint16_T sohd_Q_chrgEo;                           /*鍏呭叆瀹归噺鍐欏叆閲忥紱 */
+boolean_T sohd_flg_chrgEndEi;                     /*鍏呯數缁撴潫鏍囧織浣嶈�鍙栭噺锛� */
+boolean_T sohd_flg_chrgEndEo;                     /*鍏呯數缁撴潫鏍囧織浣嶅啓鍏ラ噺锛� */
+uint16_T sohd_pct_bcuSoh;                         /*鐢垫睜SOH锛� */
+uint16_T sohd_pct_bcuSoh_Delay;                   /*鐢垫睜SOH寤舵椂锛� */
+uint16_T sohd_tm_chrgStartStatEi;                 /*鍏呯數鍓嶉潤缃�椂闂磋�鍙栭噺锛� */
+uint16_T sohd_tm_chrgStartStatEo;                 /*鍏呯數鍓嶉潤缃�椂闂村啓鍏ラ噺锛� */
+uint16_T sohv_Q_cellCap[28];                      /*鍗曚綋瀹归噺 */
+uint16_T sohv_Q_cellCapArrEi[28];                 /*鍗曚綋瀹归噺锛堟暟缁勶級 璇诲彇閲� */
+uint16_T sohv_Q_cellCapArrEo[28];                 /*鍗曚綋瀹归噺锛堟暟缁勶級 鍐欏叆閲� */
+uint16_T sohv_Q_packCapArrEi[10];                 /*10娆℃暣鍖呭�閲忥紙鏁扮粍锛夎�鍙栭噺锛� */
+uint16_T sohv_Q_packCapArrEo[10];                 /*10娆℃暣鍖呭�閲忥紙鏁扮粍锛夊啓鍏ラ噺锛� */
+uint16_T sohv_V_chrgStartStatEi[28];              /*鍏呯數寮€濮嬫椂鍒荤殑鍗曚綋鐢靛帇锛堟暟缁勶級璇诲彇閲忥紱 */
+uint16_T sohv_V_chrgStartStatEo[28];              /*鍏呯數寮€濮嬫椂鍒荤殑鍗曚綋鐢靛帇锛堟暟缁勶級鍐欏叆閲忥紱 */
+
+uint16_T cand_Nr_cellNr;                          /*寰�幆鍙戦€佺殑鍗曚綋缂栧彿锛� */
+uint16_T cand_Q_cellCap;                          /*寰�幆鍙戦€佺殑鍗曚綋瀹归噺锛� */
+uint16_T cand_V_chrgStartStat;                    /*寰�幆鍙戦€佺殑鍏呯數鍓嶅崟浣撶數鍘嬶紱 */
+uint16_T cand_Q_reqCp;                            /*寰�幆鍙戦€佺殑鍗曚綋闇€姹傚潎琛″�閲忥紱 */
+uint16_T cand_Q_totalCp;                          /*寰�幆鍙戦€佺殑鍗曚綋绱��鍧囪 瀹归噺锛� */

+ 0 - 50
src/EmbeddedCoder_src/BINARYSEARCH_U16.c

@@ -1,50 +0,0 @@
-/*
- * File: BINARYSEARCH_U16.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#include "rtwtypes.h"
-#include "BINARYSEARCH_U16.h"
-
-/* Lookup Binary Search Utility BINARYSEARCH_U16 */
-void BINARYSEARCH_U16(uint32_T *piLeft, uint32_T *piRght, uint16_T u, const
-                      uint16_T *pData, uint32_T iHi)
-{
-  /* Find the location of current input value in the data table. */
-  *piLeft = 0U;
-  *piRght = iHi;
-  if (u <= pData[0] ) {
-    /* Less than or equal to the smallest point in the table. */
-    *piRght = 0U;
-  } else if (u >= pData[iHi] ) {
-    /* Greater than or equal to the largest point in the table. */
-    *piLeft = iHi;
-  } else {
-    uint32_T i;
-
-    /* Do a binary search. */
-    while (( *piRght - *piLeft ) > 1U ) {
-      /* Get the average of the left and right indices using to Floor rounding. */
-      i = (*piLeft + *piRght) >> 1;
-
-      /* Move either the right index or the left index so that */
-      /*  LeftDataPoint <= CurrentValue < RightDataPoint */
-      if (u < pData[i] ) {
-        *piRght = i;
-      } else {
-        *piLeft = i;
-      }
-    }
-  }
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 1 - 1
src/EmbeddedCoder_src/BLC.c

@@ -66,7 +66,7 @@ void BLC(void)
     //=========================================================================
     if(FirstRun_BLC)
     {
-        sfmd_flg_volFlt_keep =  sfmd_flg_volFlt;
+        sfmd_flg_volFlt_keep =  sfmd_flg_cellUDisable;
     }
     blcn_flg_judge  = (ihd_tm_parkTime > cmnc_tm_parkTime)&& !sfmd_flg_volFlt_keep;
     blcn_flg_enable = ((sfmd_st_fltAct >> 7) & 0x01) != 1;

+ 0 - 65
src/EmbeddedCoder_src/INTERPOLATE_U16_U16.c

@@ -1,65 +0,0 @@
-/*
- * File: INTERPOLATE_U16_U16.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#include "rtwtypes.h"
-#include "INTERPOLATE_U16_U16.h"
-
-/* Lookup Interpolation INTERPOLATE_U16_U16 */
-void INTERPOLATE_U16_U16(uint16_T *pY, uint16_T yL, uint16_T yR, uint16_T x,
-  uint16_T xL, uint16_T xR)
-{
-  uint32_T bigProd;
-  uint16_T yDiff;
-  uint16_T xNum;
-  uint16_T xDen;
-  *pY = yL;
-
-  /* If x is not strictly between xR and xL
-   * then an interpolation calculation is not necessary x == xL
-   * or not valid.  The invalid situation is expected when the input
-   * is beyond the left or right end of the table.  The design is
-   * that yL holds the correct value for *pY
-   * in invalid situations.
-   */
-  if ((xR > xL) && (x > xL) ) {
-    xDen = xR;
-    xDen = (uint16_T)((uint32_T)xDen - (uint32_T)xL);
-    xNum = x;
-    xNum = (uint16_T)((uint32_T)xNum - (uint32_T)xL);
-    if (yR >= yL ) {
-      yDiff = yR;
-      yDiff = (uint16_T)((uint32_T)yDiff - (uint32_T)yL);
-    } else {
-      yDiff = yL;
-      yDiff = (uint16_T)((uint32_T)yDiff - (uint32_T)yR);
-    }
-
-    bigProd = (uint32_T)yDiff * (uint32_T)xNum;
-
-    {
-      uint32_T rtb_u32_tmp;
-      rtb_u32_tmp = xDen;
-      yDiff = (uint16_T)(rtb_u32_tmp == 0U ? MAX_uint32_T : bigProd /
-                         rtb_u32_tmp);
-    }
-
-    if (yR >= yL ) {
-      *pY = (uint16_T)((uint32_T)*pY + (uint32_T)yDiff);
-    } else {
-      *pY = (uint16_T)((uint32_T)*pY - (uint32_T)yDiff);
-    }
-  }
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 31
src/EmbeddedCoder_src/LookUp_U16_U16.c

@@ -1,31 +0,0 @@
-/*
- * File: LookUp_U16_U16.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#include "rtwtypes.h"
-#include "BINARYSEARCH_U16.h"
-#include "INTERPOLATE_U16_U16.h"
-#include "LookUp_U16_U16.h"
-
-/* Lookup Utility LookUp_U16_U16 */
-void LookUp_U16_U16(uint16_T *pY, const uint16_T *pYData, uint16_T u, const
-                    uint16_T *pUData, uint32_T iHi)
-{
-  uint32_T iLeft;
-  uint32_T iRght;
-  BINARYSEARCH_U16( &(iLeft), &(iRght), u, pUData, iHi);
-  INTERPOLATE_U16_U16( pY, pYData[iLeft], pYData[iRght], u, pUData[iLeft],
-                      pUData[iRght]);
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 942 - 2093
src/EmbeddedCoder_src/SFM.c

@@ -1,2145 +1,994 @@
-/*
- * File: SFM.c
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.90
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Fri Sep 10 18:11:28 2021
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: Intel->x86-64 (Windows64)
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
 #include "SFM.h"
-#include "SFM_private.h"
-#include "div_uus32_sat.h"
-#include "mul_s32_hiSR.h"
-
-MdlrefDW_SFM_T SFM_MdlrefDW;
-
-/* Block signals (default storage) */
-B_SFM_c_T SFM_B;
-
-/* Block states (default storage) */
-DW_SFM_f_T SFM_DW;
-
-/*
- * System initialize for atomic system:
- *    '<S27>/Subsytem'
- *    '<S27>/Subsytem2'
- *    '<S27>/Subsytem4'
- *    '<S27>/Subsytem5'
- */
-void SFM_Subsytem_Init(DW_Subsytem_SFM_T *localDW)
-{
-  /* InitializeConditions for UnitDelay: '<S31>/delay' */
-  localDW->delay_DSTATE = 1U;
-}
-
-/*
- * Output and update for atomic system:
- *    '<S27>/Subsytem'
- *    '<S27>/Subsytem2'
- *    '<S27>/Subsytem4'
- *    '<S27>/Subsytem5'
- */
-boolean_T SFM_Subsytem(uint8_T rtu_Enable, boolean_T rtu_Precondition, int16_T
-  rtu_inputs, int16_T rtu_threshold, uint8_T rtu_CtrN, DW_Subsytem_SFM_T
-  *localDW)
-{
-  uint8_T rtb_Saturation_h;
-
-  /* Saturate: '<S31>/Saturation' incorporates:
-   *  Constant: '<S31>/Constant1'
-   *  Sum: '<S31>/Add'
-   *  UnitDelay: '<S31>/delay'
-   */
-  if ((uint8_T)(localDW->delay_DSTATE + 1U) < 200) {
-    rtb_Saturation_h = (uint8_T)(localDW->delay_DSTATE + 1U);
-  } else {
-    rtb_Saturation_h = 200U;
-  }
-
-  /* End of Saturate: '<S31>/Saturation' */
-
-  /* Product: '<S31>/Product' incorporates:
-   *  Logic: '<S31>/Logical Operator1'
-   *  RelationalOperator: '<S31>/Relational Operator'
-   *  UnitDelay: '<S31>/delay'
-   */
-  localDW->delay_DSTATE = (uint8_T)((rtu_Enable != 0) && rtu_Precondition &&
-    (rtu_inputs >= rtu_threshold) ? (int32_T)rtb_Saturation_h : 0);
-
-  /* RelationalOperator: '<S31>/Relational Operator1' */
-  return rtb_Saturation_h > rtu_CtrN;
-}
-
-/*
- * System initialize for atomic system:
- *    '<S27>/Subsytem1'
- *    '<S27>/Subsytem3'
- */
-void SFM_Subsytem1_Init(DW_Subsytem1_SFM_T *localDW)
-{
-  /* InitializeConditions for UnitDelay: '<S32>/delay' */
-  localDW->delay_DSTATE = 1U;
-}
 
-/*
- * Output and update for atomic system:
- *    '<S27>/Subsytem1'
- *    '<S27>/Subsytem3'
- */
-boolean_T SFM_Subsytem1(uint8_T rtu_Enable, boolean_T rtu_Precondition, int16_T
-  rtu_InputS, int16_T rtu_threshold, uint8_T rtu_CtrN, DW_Subsytem1_SFM_T
-  *localDW)
-{
-  uint8_T rtb_Saturation_f;
-
-  /* Saturate: '<S32>/Saturation' incorporates:
-   *  Constant: '<S32>/Constant2'
-   *  Sum: '<S32>/Add'
-   *  UnitDelay: '<S32>/delay'
-   */
-  if ((uint8_T)(localDW->delay_DSTATE + 1U) < 200) {
-    rtb_Saturation_f = (uint8_T)(localDW->delay_DSTATE + 1U);
-  } else {
-    rtb_Saturation_f = 200U;
-  }
 
-  /* End of Saturate: '<S32>/Saturation' */
+boolean_T FirstRun_SFM;
+DiagThrstruct DiagThr;
+DiagMisstruct DiagMis;
 
-  /* Product: '<S32>/Product' incorporates:
-   *  Logic: '<S32>/Logical Operator'
-   *  RelationalOperator: '<S32>/Relational Operator'
-   *  UnitDelay: '<S32>/delay'
-   */
-  localDW->delay_DSTATE = (uint8_T)((rtu_Enable != 0) && rtu_Precondition &&
-    (rtu_InputS <= rtu_threshold) ? (int32_T)rtb_Saturation_f : 0);
 
-  /* RelationalOperator: '<S32>/Relational Operator1' */
-  return rtb_Saturation_f > rtu_CtrN;
-}
-
-/*
- * Output and update for atomic system:
- *    '<S28>/Subsystem5'
- *    '<S28>/Subsystem6'
- *    '<S28>/Subsystem7'
- *    '<S28>/Subsystem8'
- */
-boolean_T SFM_Subsystem5(boolean_T rtu_In1, boolean_T rtu_In2)
-{
-  /* Logic: '<S37>/Logical Operator' incorporates:
-   *  RelationalOperator: '<S37>/Relational Operator'
-   *  RelationalOperator: '<S37>/Relational Operator1'
-   */
-  return (!rtu_In1) && (!rtu_In2);
-}
-
-/*
- * System initialize for atomic system:
- *    '<S28>/Subsytem'
- *    '<S28>/Subsytem2'
- *    '<S28>/Subsytem4'
- *    '<S28>/Subsytem5'
- */
-void SFM_Subsytem_b_Init(DW_Subsytem_SFM_d_T *localDW)
-{
-  /* InitializeConditions for UnitDelay: '<S41>/delay' */
-  localDW->delay_DSTATE = 1U;
-}
 
-/*
- * Output and update for atomic system:
- *    '<S28>/Subsytem'
- *    '<S28>/Subsytem2'
- *    '<S28>/Subsytem4'
- *    '<S28>/Subsytem5'
- */
-boolean_T SFM_Subsytem_j(uint8_T rtu_Enable, boolean_T rtu_Precondition,
-  uint16_T rtu_inputs, uint16_T rtu_threshold, uint8_T rtu_CtrN,
-  DW_Subsytem_SFM_d_T *localDW)
-{
-  uint8_T rtb_Saturation_h;
-
-  /* Saturate: '<S41>/Saturation' incorporates:
-   *  Constant: '<S41>/Constant1'
-   *  Sum: '<S41>/Add'
-   *  UnitDelay: '<S41>/delay'
-   */
-  if ((uint8_T)(localDW->delay_DSTATE + 1U) < 200) {
-    rtb_Saturation_h = (uint8_T)(localDW->delay_DSTATE + 1U);
-  } else {
-    rtb_Saturation_h = 200U;
-  }
-
-  /* End of Saturate: '<S41>/Saturation' */
-
-  /* Product: '<S41>/Product' incorporates:
-   *  Logic: '<S41>/Logical Operator1'
-   *  RelationalOperator: '<S41>/Relational Operator'
-   *  UnitDelay: '<S41>/delay'
-   */
-  localDW->delay_DSTATE = (uint8_T)((rtu_Enable != 0) && rtu_Precondition &&
-    (rtu_inputs >= rtu_threshold) ? (int32_T)rtb_Saturation_h : 0);
-
-  /* RelationalOperator: '<S41>/Relational Operator1' */
-  return rtb_Saturation_h > rtu_CtrN;
-}
-
-/*
- * System initialize for atomic system:
- *    '<S28>/Subsytem1'
- *    '<S28>/Subsytem3'
- */
-void SFM_Subsytem1_f_Init(DW_Subsytem1_SFM_k_T *localDW)
-{
-  /* InitializeConditions for UnitDelay: '<S42>/delay' */
-  localDW->delay_DSTATE = 1U;
-}
-
-/*
- * Output and update for atomic system:
- *    '<S28>/Subsytem1'
- *    '<S28>/Subsytem3'
- */
-boolean_T SFM_Subsytem1_n(uint8_T rtu_Enable, boolean_T rtu_Precondition,
-  uint16_T rtu_InputS, uint16_T rtu_threshold, uint8_T rtu_CtrN,
-  DW_Subsytem1_SFM_k_T *localDW)
-{
-  uint8_T rtb_Saturation_i;
-
-  /* Saturate: '<S42>/Saturation' incorporates:
-   *  Constant: '<S42>/Constant2'
-   *  Sum: '<S42>/Add'
-   *  UnitDelay: '<S42>/delay'
-   */
-  if ((uint8_T)(localDW->delay_DSTATE + 1U) < 200) {
-    rtb_Saturation_i = (uint8_T)(localDW->delay_DSTATE + 1U);
-  } else {
-    rtb_Saturation_i = 200U;
-  }
-
-  /* End of Saturate: '<S42>/Saturation' */
-
-  /* Product: '<S42>/Product' incorporates:
-   *  Logic: '<S42>/Logical Operator'
-   *  RelationalOperator: '<S42>/Relational Operator'
-   *  UnitDelay: '<S42>/delay'
-   */
-  localDW->delay_DSTATE = (uint8_T)((rtu_Enable != 0) && rtu_Precondition &&
-    (rtu_InputS <= rtu_threshold) ? (int32_T)rtb_Saturation_i : 0);
-
-  /* RelationalOperator: '<S42>/Relational Operator1' */
-  return rtb_Saturation_i > rtu_CtrN;
-}
-
-/*
- * System initialize for atomic system:
- *    '<S28>/Subsytem6'
- *    '<S28>/Subsytem8'
- */
-void SFM_Subsytem6_Init(DW_Subsytem6_SFM_T *localDW)
-{
-  /* InitializeConditions for UnitDelay: '<S47>/delay' */
-  localDW->delay_DSTATE = 1U;
-}
-
-/*
- * Output and update for atomic system:
- *    '<S28>/Subsytem6'
- *    '<S28>/Subsytem8'
- */
-boolean_T SFM_Subsytem6(uint8_T rtu_Enable, boolean_T rtu_Precondition, uint32_T
-  rtu_inputs, uint16_T rtu_threshold, uint8_T rtu_CtrN, DW_Subsytem6_SFM_T
-  *localDW)
-{
-  uint8_T rtb_Saturation_h;
-
-  /* Saturate: '<S47>/Saturation' incorporates:
-   *  Constant: '<S47>/Constant1'
-   *  Sum: '<S47>/Add'
-   *  UnitDelay: '<S47>/delay'
-   */
-  if ((uint8_T)(localDW->delay_DSTATE + 1U) < 200) {
-    rtb_Saturation_h = (uint8_T)(localDW->delay_DSTATE + 1U);
-  } else {
-    rtb_Saturation_h = 200U;
-  }
-
-  /* End of Saturate: '<S47>/Saturation' */
-
-  /* Product: '<S47>/Product' incorporates:
-   *  Logic: '<S47>/Logical Operator1'
-   *  RelationalOperator: '<S47>/Relational Operator'
-   *  UnitDelay: '<S47>/delay'
-   */
-  localDW->delay_DSTATE = (uint8_T)((rtu_Enable != 0) && rtu_Precondition &&
-    (rtu_inputs >= rtu_threshold * 100U) ? (int32_T)rtb_Saturation_h : 0);
-
-  /* RelationalOperator: '<S47>/Relational Operator1' */
-  return rtb_Saturation_h > rtu_CtrN;
-}
-
-/*
- * System initialize for atomic system:
- *    '<S28>/Subsytem7'
- *    '<S28>/Subsytem9'
- */
-void SFM_Subsytem7_Init(DW_Subsytem7_SFM_T *localDW)
-{
-  /* InitializeConditions for UnitDelay: '<S48>/delay' */
-  localDW->delay_DSTATE = 1U;
-}
-
-/*
- * Output and update for atomic system:
- *    '<S28>/Subsytem7'
- *    '<S28>/Subsytem9'
- */
-boolean_T SFM_Subsytem7(uint8_T rtu_Enable, boolean_T rtu_Precondition, uint32_T
-  rtu_InputS, uint16_T rtu_threshold, uint8_T rtu_CtrN, DW_Subsytem7_SFM_T
-  *localDW)
-{
-  uint8_T rtb_Saturation_m;
-
-  /* Saturate: '<S48>/Saturation' incorporates:
-   *  Constant: '<S48>/Constant2'
-   *  Sum: '<S48>/Add'
-   *  UnitDelay: '<S48>/delay'
-   */
-  if ((uint8_T)(localDW->delay_DSTATE + 1U) < 200) {
-    rtb_Saturation_m = (uint8_T)(localDW->delay_DSTATE + 1U);
-  } else {
-    rtb_Saturation_m = 200U;
-  }
-
-  /* End of Saturate: '<S48>/Saturation' */
-
-  /* Product: '<S48>/Product' incorporates:
-   *  Logic: '<S48>/Logical Operator'
-   *  RelationalOperator: '<S48>/Relational Operator'
-   *  UnitDelay: '<S48>/delay'
-   */
-  localDW->delay_DSTATE = (uint8_T)((rtu_Enable != 0) && rtu_Precondition &&
-    (rtu_InputS <= rtu_threshold * 100U) ? (int32_T)rtb_Saturation_m : 0);
-
-  /* RelationalOperator: '<S48>/Relational Operator1' */
-  return rtb_Saturation_m > rtu_CtrN;
-}
-
-/* System initialize for referenced model: 'SFM' */
 void SFM_Init(void)
 {
-  /* InitializeConditions for UnitDelay: '<S23>/Time_Delay' */
-  SFM_DW.Time_Delay_DSTATE = 1U;
-
-  /* SystemInitialize for Chart: '<S13>/Chart' */
-  SFM_DW.FirstFlg = true;
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem' */
-  SFM_Subsytem_b_Init(&SFM_DW.Subsytem_j0);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem2' */
-  SFM_Subsytem_b_Init(&SFM_DW.Subsytem2_p);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem2' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem1' */
-  SFM_Subsytem1_f_Init(&SFM_DW.Subsytem1_n);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem1' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem3' */
-  SFM_Subsytem1_f_Init(&SFM_DW.Subsytem3_b);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem3' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem4' */
-  SFM_Subsytem_b_Init(&SFM_DW.Subsytem4_p);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem4' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem5' */
-  SFM_Subsytem_b_Init(&SFM_DW.Subsytem5_l);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem5' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem6' */
-  SFM_Subsytem6_Init(&SFM_DW.Subsytem6);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem6' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem8' */
-  SFM_Subsytem6_Init(&SFM_DW.Subsytem8);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem8' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem7' */
-  SFM_Subsytem7_Init(&SFM_DW.Subsytem7);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem7' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S28>/Subsytem9' */
-  SFM_Subsytem7_Init(&SFM_DW.Subsytem9);
-
-  /* End of SystemInitialize for SubSystem: '<S28>/Subsytem9' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S27>/Subsytem' */
-  SFM_Subsytem_Init(&SFM_DW.Subsytem_j);
-
-  /* End of SystemInitialize for SubSystem: '<S27>/Subsytem' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S27>/Subsytem2' */
-  SFM_Subsytem_Init(&SFM_DW.Subsytem2);
-
-  /* End of SystemInitialize for SubSystem: '<S27>/Subsytem2' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S27>/Subsytem1' */
-  SFM_Subsytem1_Init(&SFM_DW.Subsytem1_e);
-
-  /* End of SystemInitialize for SubSystem: '<S27>/Subsytem1' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S27>/Subsytem3' */
-  SFM_Subsytem1_Init(&SFM_DW.Subsytem3);
-
-  /* End of SystemInitialize for SubSystem: '<S27>/Subsytem3' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S27>/Subsytem4' */
-  SFM_Subsytem_Init(&SFM_DW.Subsytem4);
-
-  /* End of SystemInitialize for SubSystem: '<S27>/Subsytem4' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S27>/Subsytem5' */
-  SFM_Subsytem_Init(&SFM_DW.Subsytem5);
-
-  /* End of SystemInitialize for SubSystem: '<S27>/Subsytem5' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S24>/Subsytem' */
-  /* InitializeConditions for UnitDelay: '<S29>/delay' */
-  SFM_DW.delay_DSTATE_j = 1U;
-
-  /* End of SystemInitialize for SubSystem: '<S24>/Subsytem' */
-
-  /* SystemInitialize for Atomic SubSystem: '<S24>/Subsytem1' */
-  /* InitializeConditions for UnitDelay: '<S30>/delay' */
-  SFM_DW.delay_DSTATE = 1U;
-   uint8_T i;
-   for(i=0;i<17;i++)
-	 {
-  
-  SFM_DW.ChgNr[i]=0;
-  SFM_DW.RecNr[i]=0;
-  SFM_DW.UdelNr[i]=0;
-   }
-   SFM_DW.Cntl=0;
-
-  /* End of SystemInitialize for SubSystem: '<S24>/Subsytem1' */
+    FirstRun_SFM =true;
 }
 
-/* Output and update for referenced model: 'SFM' */
 void SFM(void)
 {
-  /* local block i/o variables */
-  uint32_T rtb_SumU;
-  real_T tmp_2;
-  int32_T i_0;
-  int32_T tmp_0;
-  int32_T tmp_1;
-  uint32_T qY;
-  uint32_T qY_0;
-  uint16_T FltCodeArrS[20];
-  uint16_T avrgU;
-  uint16_T k;
-  uint16_T rtb_Saturation;
-  uint16_T temp;
-  uint16_T tmp_3;
-  uint8_T rtb_TmpSignalConversionAtSFun_l[155];
-  uint8_T rtb_TmpSignalConversionAtSFunct[155];
-  uint8_T rtb_FltActArr[20];
-  uint8_T rtb_FltLevelArr[20];
-  uint8_T i;
-  uint8_T j;
-  boolean_T rtb_TmpSignalConversionAtSFun_a[155];
-  boolean_T rtb_RelationalOperator1;
-  boolean_T rtb_RelationalOperator1_a;
-  boolean_T rtb_RelationalOperator1_bb;
-  boolean_T rtb_RelationalOperator1_d;
-  boolean_T rtb_RelationalOperator1_di;
-  boolean_T rtb_RelationalOperator1_eg;
-  boolean_T rtb_RelationalOperator1_ep;
-  boolean_T rtb_RelationalOperator1_fg;
-  boolean_T rtb_RelationalOperator1_gr;
-  boolean_T rtb_RelationalOperator1_i;
-  boolean_T rtb_RelationalOperator1_it;
-  boolean_T rtb_RelationalOperator1_j;
-  boolean_T rtb_RelationalOperator1_l;
-  boolean_T rtb_RelationalOperator1_lf;
-  boolean_T rtb_RelationalOperator1_o;
-  boolean_T rtb_RelationalOperator1_p;
-  boolean_T rtb_RelationalOperator_et;
-  boolean_T tmp;
-
-  /* Saturate: '<S23>/Saturation' incorporates:
-   *  Constant: '<S23>/Constant'
-   *  Sum: '<S23>/Add'
-   *  UnitDelay: '<S23>/Time_Delay'
-   */
-  if ((uint16_T)(SFM_DW.Time_Delay_DSTATE + 1U) < 60000) {
-    rtb_Saturation = (uint16_T)(SFM_DW.Time_Delay_DSTATE + 1U);
-  } else {
-    rtb_Saturation = 60000U;
-  }
-
-  /* End of Saturate: '<S23>/Saturation' */
-
-  /* RelationalOperator: '<S23>/Relational Operator1' incorporates:
-   *  Constant: '<S23>/para'
-   */
-  rtb_RelationalOperator1 = (rtb_Saturation > 2);
-
-  /* Chart: '<S13>/Chart' incorporates:
-   *  Constant: '<S13>/Constant'
-   *  Constant: '<S13>/Constant1'
-   *  Inport: '<Root>/ihv_V_cellU'
-   */
-  if (!rtb_RelationalOperator1) {
-    j = 0U;
-    while ((j < 3) && SFM_DW.FirstFlg) {
-      for (i = 0U; i < cmnc_num_cellUNum; i++) {
-        SFM_DW.CellUArry[j + 3 * i] = ihv_V_cellU[i];
-      }
-
-      j++;
+    boolean_T sfmd_flg_interComFlt;
+	boolean_T sfmd_flg_authFlt;
+    boolean_T sfmd_flg_HVILFlt;
+    boolean_T sfmd_flg_chrgMosClosFlt;
+    boolean_T sfmd_flg_disChrgMosClosFlt;
+    static uint8_T  Cntl;
+    static uint16_T CellUArry[3][28];
+    static uint8_T  ErrNr[28];
+    static uint8_T  RecNr[28];
+    static boolean_T sfmv_flg_cellUOpenFlt[28];
+    static boolean_T ErrUFlg[28];
+    uint32_T  SumU ;
+    uint16_T  UNum ;
+    boolean_T sfmd_flg_volFlt;
+    boolean_T sfmd_flg_modTOpenFlt;
+    boolean_T sfmv_flg_modTOpenFlt[6];
+    boolean_T sfmd_flg_chrgMosTOpenFlt;
+    boolean_T sfmd_flg_DCPlugTOpenFlt;
+    boolean_T sfmd_flg_ACPlugTOpenFlt;
+    boolean_T sfmd_flg_heatPanT1OpenFlt;
+    boolean_T sfmd_flg_heatPanT2OpenFlt;
+    boolean_T sfmd_flg_heatPanTOpenFlt;
+    boolean_T sfmd_flg_modTRationFlt;
+    boolean_T sfmv_flg_modTRationFlt[6];
+    static uint16_T modTArr[6];
+    uint16_T Tnum;
+    uint32_T SumT;
+    boolean_T sfmd_flg_chrgMosTRationFlt;
+    boolean_T sfmd_flg_DCPlugTRationFlt;
+    boolean_T sfmd_flg_ACPlugTRationFlt;
+    boolean_T sfmd_flg_heatPanT1RationFlt;
+    boolean_T sfmd_flg_heatPanT2RationFlt;   
+    static uint16_T ihd_T_mosT_Delay;
+    static uint16_T ihd_T_DCPlugT_Delay;
+    static uint16_T ihd_T_ACPlugT_Delay;
+    static uint16_T ihd_T_heatPanT1_Delay;
+    static uint16_T ihd_T_heatPanT2_Delay;
+    boolean_T sfmd_flg_currOpenFlt;
+	uint16_T sfmd_I_currAbs;
+
+    static boolean_T sfmd_flg_cellUOverFlt2;
+    static boolean_T sfmd_flg_cellUOverFlt1;
+    static boolean_T sfmd_flg_cellULowFlt2;
+    static boolean_T sfmd_flg_cellULowFlt1;
+    static boolean_T sfmd_flg_cellUDiffFlt2;
+    static boolean_T sfmd_flg_cellUDiffFlt1;
+    static boolean_T sfmd_flg_battUOverFlt2;
+    static boolean_T sfmd_flg_battUOverFlt1;
+    static boolean_T sfmd_flg_battULowFlt2;
+	static boolean_T sfmd_flg_battULowFlt1;
+    boolean_T chrgFlg;
+    boolean_T disChrgFlg;
+    static boolean_T sfmd_flg_chrgModTOverFlt2;
+    static boolean_T sfmd_flg_chrgModTOverFlt1;
+    static boolean_T sfmd_flg_chrgModTLowFlt2;
+    static boolean_T sfmd_flg_chrgModTLowFlt1;
+    static boolean_T sfmd_flg_disChrgModTOverFlt2;
+    static boolean_T sfmd_flg_disChrgModTOverFlt1;
+    static boolean_T sfmd_flg_disChrgModTLowFlt2;
+    static boolean_T sfmd_flg_disChrgModTLowFlt1;
+    static boolean_T sfmd_flg_modTDiffFlt2;
+    static boolean_T sfmd_flg_modTDiffFlt1;
+    static boolean_T sfmd_flg_chrgMosTOverFlt2;
+    static boolean_T sfmd_flg_chrgMosTOverFlt1;
+    static boolean_T sfmd_flg_disChrgMosTOverFlt2;
+    static boolean_T sfmd_flg_disChrgMosTOverFlt1;
+    static boolean_T sfmd_flg_DCPlugTOverFlt2;
+    static boolean_T sfmd_flg_DCPlugTOverFlt1;
+    static boolean_T sfmd_flg_ACPlugTOverFlt2;
+    static boolean_T sfmd_flg_ACPlugTOverFlt1;
+    static boolean_T sfmd_flg_heatPanTOverFlt2_1;
+    static boolean_T sfmd_flg_heatPanTOverFlt2_2;
+    boolean_T sfmd_flg_heatPanTOverFlt2;
+    static boolean_T sfmd_flg_heatPanTOverFlt1_1;
+    static boolean_T sfmd_flg_heatPanTOverFlt1_2;
+    static boolean_T sfmd_flg_heatPanTOverFlt1;
+    static boolean_T sfmd_flg_chrgCurrOverFlt;
+    static boolean_T sfmd_flg_disChrgCurrOverFlt;
+    boolean_T sfmd_flg_chrgCurrOverMisFlt;
+    boolean_T sfmd_flg_disChrgCurrOverMisFlt;
+    boolean_T sfmd_flg_battULowMisFlt;
+    boolean_T sfmd_flg_battUOverMisFlt;
+    boolean_T sfmd_flg_cellULowMisFlt;
+    boolean_T sfmd_flg_cellUOverMisFlt;
+    boolean_T sfmd_flg_chrgModTOverMisFlt;
+    boolean_T sfmd_flg_chrgModTLowMisFlt;
+    boolean_T sfmd_flg_disChrgModTOverMisFlt;
+    boolean_T sfmd_flg_disChrgModTLowMisFlt;
+    boolean_T sfmd_flg_chrgMosTOverMisFlt;
+    boolean_T sfmd_flg_disChrgMosTOverMisFlt;
+    boolean_T sfmd_flg_socMisFlt;
+    boolean_T sfmd_flg_sohMisFlt;
+    boolean_T sfmd_flg_socJumpFlt;
+    boolean_T sfmd_flg_EEsaveFlt;
+    static uint16_T socd_pct_bcuSoc_Delay;
+
+    boolean_T FltFlg[200];
+    uint16_T  FltLevel[200];
+    uint8_T   FltAct[200];
+    uint16_T  FltCodeArr[20];
+    uint16_T  FltLevelArr[20];
+    uint8_T   FltActArr[20];
+    uint16_T i;
+    uint16_T j;
+    uint16_T k;
+    
+    
+    //初值
+    if(FirstRun_SFM)
+    {   
+        memset(&DiagThr,0,sizeof(DiagThr));
+        memset(&DiagMis,0,sizeof(DiagMis));
+        Cntl = 0;
+        memset(ErrNr,0,sizeof(ErrNr));
+        memset(sfmv_flg_cellUOpenFlt,0,sizeof(sfmv_flg_cellUOpenFlt));
+        memset(ErrUFlg,0,sizeof(ErrUFlg));
+        memset(RecNr,0,sizeof(RecNr));
+        sfmd_flg_cellUOverFlt2 = false;
+        sfmd_flg_cellUOverFlt1 = false;
+        sfmd_flg_cellULowFlt2 = false;
+        sfmd_flg_cellULowFlt1 = false;
+        sfmd_flg_cellUDiffFlt2 = false;
+        sfmd_flg_cellUDiffFlt1 = false;
+        sfmd_flg_battUOverFlt2 = false;
+        sfmd_flg_battUOverFlt1 = false;
+        sfmd_flg_battULowFlt2 = false;
+		sfmd_flg_battULowFlt1 = false;
+        sfmd_flg_chrgModTOverFlt2 = false;
+        sfmd_flg_chrgModTOverFlt1 = false;
+        sfmd_flg_chrgModTLowFlt2 = false;
+        sfmd_flg_chrgModTLowFlt1 = false;
+        sfmd_flg_disChrgModTOverFlt2 = false;
+        sfmd_flg_disChrgModTOverFlt1 = false;
+        sfmd_flg_disChrgModTLowFlt2 = false;
+        sfmd_flg_disChrgModTLowFlt1 = false;
+        sfmd_flg_modTDiffFlt2 = false;
+        sfmd_flg_modTDiffFlt1 = false;
+        sfmd_flg_chrgMosTOverFlt2 = false;
+        sfmd_flg_chrgMosTOverFlt1 = false;
+        sfmd_flg_disChrgMosTOverFlt2 = false;
+        sfmd_flg_disChrgMosTOverFlt1 = false;
+        sfmd_flg_DCPlugTOverFlt2 = false;
+        sfmd_flg_DCPlugTOverFlt1 = false;
+        sfmd_flg_ACPlugTOverFlt2 = false;
+        sfmd_flg_ACPlugTOverFlt1 = false;
+        sfmd_flg_heatPanTOverFlt2_1 = false;
+        sfmd_flg_heatPanTOverFlt2_2 = false;
+        sfmd_flg_heatPanTOverFlt1_1 = false;
+        sfmd_flg_heatPanTOverFlt1_2 = false;
+        sfmd_flg_chrgCurrOverFlt = false;
+        sfmd_flg_disChrgCurrOverFlt = false;       
     }
 
-    SFM_DW.FirstFlg = false;
-    for (j = 0U; j < 2; j++) {
-      for (i = 0U; i < cmnc_num_cellUNum; i++) {
-        i_0 = 3 * i + j;
-        SFM_DW.CellUArry[i_0] = SFM_DW.CellUArry[i_0 + 1];
-      }
+	//============================================================================================
+    //=========================================================================================
+    //=======================================================================================
+    //=========================================================================================
+    //1 内网通信故障    
+    if (ihd_flg_urtRecFlt)
+    {
+        sfmd_flg_interComFlt = true;
+        FirstRun_SFM =true;
     }
-
-    for (i = 0U; i < cmnc_num_cellUNum; i++) {
-      SFM_DW.CellUArry[3 * i + 2] = ihv_V_cellU[i];
+    else
+    {
+        sfmd_flg_interComFlt = false;
     }
-
-    for (i = 0U; i < cmnc_num_cellUNum - 1; i++) {
-      i_0 = 3 * i;
-      tmp_1 = (i + 1) * 3;
-      i_0 = SFM_DW.CellUArry[i_0 + 2] - SFM_DW.CellUArry[i_0];
-      tmp_1 = SFM_DW.CellUArry[tmp_1 + 2] - SFM_DW.CellUArry[tmp_1];
-      if (((real_T)i_0 * 0.001 < -0.05) && ((real_T)tmp_1 * 0.001 > 0.05)) {
-        tmp_0 = SFM_DW.ChgNr[i] + 1;
-        if (tmp_0 > 255) {
-          tmp_0 = 255;
+	//5
+    sfmd_flg_authFlt = (ihd_st_authFaild ==1) && (!sfmd_flg_interComFlt);
+	
+    //11 高压互锁故障
+    if (ihd_flg_HVILFlt)
+    {
+        sfmd_flg_HVILFlt = true;
+    }
+    else
+    {
+        sfmd_flg_HVILFlt = false;
+    }
+	
+    //22 充电Mos失效故障
+    sfmd_flg_chrgMosClosFlt = ihd_flg_chrgMosClosFlt;
+    //24 放电Mos失效故障
+    sfmd_flg_disChrgMosClosFlt = ihd_flg_disChrgMosClosFlt;
+    
+    //52 电压开路故障
+    Cntl = Cntl + 1;
+    if(!sfmd_flg_interComFlt && Cntl > 10)
+    {
+        Cntl = 0;
+        // 矩阵更新
+        for(j = 0;j < 3 && FirstRun_SFM;j++)
+        {
+            for(i = 0;i < cmnc_num_cellUNum;i++)
+            {
+                CellUArry[j][i] = ihv_V_cellU[i];
+            }
         }
-
-        SFM_DW.ChgNr[i] = (uint8_T)tmp_0;
-      } else {
-        SFM_DW.ChgNr[i] = 0U;
-      }
-
-      if ((SFM_DW.ChgNr[i] >= 2) && ((mul_s32_hiSR(i_0, 274877907, 6U) < -1) &&
-           (tmp_1 > 1000))) {
-        SFM_B.ErrFlg[i] = true;
-        SFM_DW.ErrUFlg[i] = true;
-        SFM_DW.ErrUFlg[i + 1] = true;
-      }
-
-      if (SFM_B.ErrFlg[i] && (i > 0)) {
-        for (j = 0U; j < i; j++) {
-          i_0 = i - j;
-          tmp_1 = i_0 * 3;
-          if ((real_T)(SFM_DW.CellUArry[tmp_1 + 2] - SFM_DW.CellUArry[tmp_1 + 1])
-              * 0.001 < -0.2) {
-            SFM_B.ErrFlg[i_0] = true;
-            SFM_DW.ErrUFlg[i_0] = true;
-          }
+    
+        for(j = 0;j < 2;j++)
+        {
+            for(i = 0;i < cmnc_num_cellUNum;i++)
+            {
+                CellUArry[j][i] = CellUArry[j+1][i];
+            }
+        }
+        for(i = 0;i < cmnc_num_cellUNum;i++)
+        {
+            CellUArry[j][i] = ihv_V_cellU[i];
+        }
+        // 故障判断
+        for(i = 0;i < cmnc_num_cellUNum - 1;i++)
+        {
+            if((int16_T)(CellUArry[2][i]-CellUArry[0][i])<-50 && (int16_T)(CellUArry[2][i+1]-CellUArry[0][i+1]) > 50)
+            {
+                ErrNr[i] =ErrNr[i] +1;
+            }
+            else
+            {
+                ErrNr[i] = 0;
+            }
+            if ( ErrNr[i] >= 2|| ((int16_T)(CellUArry[2][i]-CellUArry[0][i])<-1000 && (int16_T)(CellUArry[2][i+1]-CellUArry[0][i+1]) > 1000 ))
+            {
+                sfmv_flg_cellUOpenFlt[i] = true;
+                ErrUFlg[i] = true;
+                ErrUFlg[i+1] = true;
+            }
+            if(sfmv_flg_cellUOpenFlt[i] && i > 0)
+            {
+                for(k = 0;k < i;k++)
+                {
+                    if((int16_T)(CellUArry[2][i-k]-CellUArry[1][i-k]) < -200)
+                    {
+                        sfmv_flg_cellUOpenFlt[i-k] = true;
+                        ErrUFlg[i-k] = true;
+                    }
+                }
+            }
         }
-      }
     }
-
-    if ((mul_s32_hiSR(SFM_DW.CellUArry[2] - SFM_DW.CellUArry[1], 274877907, 6U) <
-         -1) && (mul_s32_hiSR(SFM_DW.CellUArry[5] - SFM_DW.CellUArry[4],
-          274877907, 6U) < -1) && (mul_s32_hiSR(SFM_DW.CellUArry[8] -
-          SFM_DW.CellUArry[7], 274877907, 6U) < -1)) {
-      SFM_B.GNDFlg = false;
-      SFM_DW.ErrUFlg[0] = true;
-      SFM_DW.ErrUFlg[1] = true;
-      SFM_DW.ErrUFlg[2] = true;
+    //
+    if(!sfmd_flg_interComFlt)
+    {
+        sfmd_V_cellUMax = 0;
+        sfmd_V_cellUMin = 10000;
+        SumU = 0;
+        UNum = 0;
+        for(i = 0;i < cmnc_num_cellUNum ;i++)
+        {
+            if(!ErrUFlg[i])
+            {
+                SumU = SumU + ihv_V_cellU[i];
+                UNum = UNum + 1;
+                if( sfmd_V_cellUMax < ihv_V_cellU[i])
+                {
+                    sfmd_V_cellUMax = ihv_V_cellU[i];
+                }
+                if( sfmd_V_cellUMin > ihv_V_cellU[i])
+                {
+                    sfmd_V_cellUMin = ihv_V_cellU[i];
+                }
+            }
+        }
+        if(sfmd_V_cellUMax - sfmd_V_cellUMin > 3000)
+        {
+            sfmd_V_cellUAvrg = (SumU - sfmd_V_cellUMax - sfmd_V_cellUMin)/(UNum - 2);
+            for(i = 0;i < cmnc_num_cellUNum ;i++)
+            {
+                if(!ErrUFlg[i] && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) > 1500)
+                {
+                    ErrUFlg[i] =true;
+                }
+                if(!ErrUFlg[i] && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) < -1500)
+                {
+                    ErrUFlg[i] =true;
+                    sfmv_flg_cellUOpenFlt[i] = true;
+                }
+            }
+        }
+        else
+        {
+            sfmd_V_cellUAvrg = SumU / UNum;
+        }
+        
+        // 恢复
+        for(i = 0;i < cmnc_num_cellUNum ;i++)
+        {
+            if(ErrUFlg[i])
+            {
+                if((int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) < 200 && (int16_T)(ihv_V_cellU[i] - sfmd_V_cellUAvrg) > -200)
+                {
+                    RecNr[i] = RecNr[i] + 1;
+                }
+                else
+                {
+                    RecNr[i] = 0;
+                }
+                if( RecNr[i] > 20)
+                {
+                    RecNr[i] = 21;
+                    sfmv_flg_cellUOpenFlt[i] = false;
+                    ErrUFlg[i] = false;
+                }
+            }
+        }
     }
-
-    i = 0U;
-    SFM_B.MinU = 10000U;
-    SFM_B.MaxU = 0U;
-    rtb_SumU = 0U;
-    j = 0U;
-    while (i < cmnc_num_cellUNum) {
-      if (!SFM_DW.ErrUFlg[i]) {
-        qY_0 = rtb_SumU + /*MW:OvSatOk*/ ihv_V_cellU[i];
-        if (qY_0 < rtb_SumU) {
-          qY_0 = MAX_uint32_T;
+    //==========
+    SumU = 0 ;
+    sfmd_flg_volFlt =false;
+    for(i = 0;i < cmnc_num_cellUNum ;i++)
+    {
+        if(ErrUFlg[i]&&!sfmd_flg_interComFlt)
+        {
+            sfmv_V_cellU[i] = sfmd_V_cellUAvrg;
         }
-
-        rtb_SumU = qY_0;
-        i_0 = j + 1;
-        if (j + 1 > 255) {
-          i_0 = 255;
+        else
+        {
+            sfmv_flg_cellUOpenFlt[i] =false;
+            sfmv_V_cellU[i] = ihv_V_cellU[i];
         }
-
-        j = (uint8_T)i_0;
-        if (ihv_V_cellU[i] > SFM_B.MaxU) {
-          SFM_B.MaxU = ihv_V_cellU[i];
+        SumU = SumU + sfmv_V_cellU[i];
+        sfmd_flg_volFlt = sfmd_flg_volFlt || sfmv_flg_cellUOpenFlt[i];
+    }
+    sfmd_V_battU = (uint16_T)(SumU * 0.01);
+    
+    
+    
+    //53 模组温度开路故障
+    sfmd_flg_modTOpenFlt =false;
+    for(i = 0;i < cmnc_num_modTNum ;i++)
+    {
+        if (!sfmd_flg_interComFlt)
+        {
+            if( ihv_T_modT[i] == 10)
+            {
+                sfmv_flg_modTOpenFlt[i] = true;
+            }
+            else
+            {
+                sfmv_flg_modTOpenFlt[i] = false;
+            }
+            sfmd_flg_modTOpenFlt = sfmd_flg_modTOpenFlt || sfmv_flg_modTOpenFlt[i];
         }
-
-        if (ihv_V_cellU[i] < SFM_B.MinU) {
-          SFM_B.MinU = ihv_V_cellU[i];
+        else
+        {
+            sfmv_flg_modTOpenFlt[i] = false;
         }
-      }
-
-      i++;
     }
-
-    if (SFM_B.MaxU - SFM_B.MinU > 3000) {
-      qY_0 = rtb_SumU - /*MW:OvSatOk*/ SFM_B.MaxU;
-      if (qY_0 > rtb_SumU) {
-        qY_0 = 0U;
-      }
-
-      qY = qY_0 - /*MW:OvSatOk*/ SFM_B.MinU;
-      if (qY > qY_0) {
-        qY = 0U;
-      }
-
-      qY_0 = div_uus32_sat(qY, j - 2);
-      if (qY_0 > 65535U) {
-        qY_0 = 65535U;
-      }
-
-      avrgU = (uint16_T)qY_0;
-      for (i = 0U; i < cmnc_num_cellUNum; i++) {
-        if (!SFM_DW.ErrUFlg[i]) {
-          tmp_2 = (real_T)(ihv_V_cellU[i] - (uint16_T)qY_0) * 0.001;
-          if ((tmp_2 > 1.5) || (tmp_2 < -1.5)) {
-            i_0 = SFM_DW.UdelNr[i] + 1;
-            if (i_0 > 255) {
-              i_0 = 255;
+    
+    //54 Mos温度开路故障
+    sfmd_flg_chrgMosTOpenFlt = (!sfmd_flg_interComFlt && ihd_T_mosT == 10);
+    
+    //56 快充插头温度开路故障
+    sfmd_flg_DCPlugTOpenFlt = (!sfmd_flg_interComFlt && ihd_T_DCPlugT == 0);
+    
+    //57 慢充插头温度开路故障
+    sfmd_flg_ACPlugTOpenFlt = (!sfmd_flg_interComFlt && ihd_T_ACPlugT == 0);
+    
+    //58 加热板#1温度开路故障
+    sfmd_flg_heatPanT1OpenFlt = (!sfmd_flg_interComFlt && ihd_T_heatPanT1 == 0);
+    
+    //59 加热板#2温度开路故障
+    sfmd_flg_heatPanT2OpenFlt = (!sfmd_flg_interComFlt && ihd_T_heatPanT2 == 0);
+    
+    //60 加热板温度全部开路故障
+    sfmd_flg_heatPanTOpenFlt = sfmd_flg_heatPanT1OpenFlt && sfmd_flg_heatPanT2OpenFlt;
+    
+    //61 模组温度合理性故障
+    sfmd_flg_modTRationFlt = false;
+    if(!sfmd_flg_interComFlt)
+    {
+        for(i = 0;i < cmnc_num_modTNum && FirstRun_SFM ;i++)
+        {
+            modTArr[i] = ihv_T_modT[i];
+        }
+        for(i = 0;i < cmnc_num_modTNum ;i++)
+        {
+            if (!sfmv_flg_modTOpenFlt[i] && (int16_T)(modTArr[i]-ihv_T_modT[i]) > 10)
+            {
+                sfmv_flg_modTRationFlt[i] = true;
             }
-
-            SFM_DW.UdelNr[i] = (uint8_T)i_0;
-          } else {
-            SFM_DW.UdelNr[i] = 0U;
-          }
-
-          if (SFM_DW.UdelNr[i] >= 2) {
-            SFM_B.ErrFlg[i] = true;
-            SFM_DW.ErrUFlg[i] = true;
-          }
+            else
+            {
+                sfmv_flg_modTRationFlt[i] = false;
+                modTArr[i] = ihv_T_modT[i];
+            }
+            sfmd_flg_modTRationFlt = sfmd_flg_modTRationFlt || sfmv_flg_modTRationFlt[i];
         }
-      }
-    } else {
-      qY_0 = j == 0U ? MAX_uint32_T : rtb_SumU / j;
-      if (qY_0 > 65535U) {
-        qY_0 = 65535U;
-      }
-
-      avrgU = (uint16_T)qY_0;
     }
-
-    for (i = 0U; i < cmnc_num_cellUNum; i++) {
-      if (SFM_DW.ErrUFlg[i]) {
-        tmp_2 = (real_T)(ihv_V_cellU[i] - avrgU) * 0.001;
-        if ((tmp_2 < 0.2) && (tmp_2 > -0.2)) {
-          i_0 = SFM_DW.RecNr[i] + 1;
-          if (i_0 > 255) {
-            i_0 = 255;
-          }
-
-          SFM_DW.RecNr[i] = (uint8_T)i_0;
-        } else {
-          SFM_DW.RecNr[i] = 0U;
+    else
+    {
+        for(i = 0;i < cmnc_num_modTNum  ;i++)
+        {
+            sfmv_flg_modTRationFlt[i] = false;
         }
-
-        if (SFM_DW.RecNr[i] >= 2) {
-          SFM_B.ErrFlg[i] = false;
-          SFM_DW.ErrUFlg[i] = false;
-          SFM_B.GNDFlg = ((i != 0) && SFM_B.GNDFlg);
+    }
+	//
+    sfmd_T_modTMax=0;
+    sfmd_T_modTMin=200;
+    Tnum=0;
+    SumT=0;
+    for(i = 0;i < cmnc_num_modTNum  ;i++)
+    {
+        if(!sfmv_flg_modTRationFlt[i] && !sfmv_flg_modTOpenFlt[i])
+        {
+            SumT = SumT + ihv_T_modT[i];
+            Tnum = Tnum + 1;
+            if (sfmd_T_modTMax <ihv_T_modT[i])
+            {
+                sfmd_T_modTMax = ihv_T_modT[i];
+            }
+            if (sfmd_T_modTMin > ihv_T_modT[i])
+            {
+                sfmd_T_modTMin = ihv_T_modT[i];
+            }
+        }
+    }
+    for(i = 0;i < cmnc_num_modTNum  ;i++)
+    {
+        if(!sfmv_flg_modTRationFlt[i] && !sfmv_flg_modTOpenFlt[i])
+        {
+            sfmv_T_modT[i] = ihv_T_modT[i];
+        }
+        else
+        {
+            sfmv_T_modT[i] = SumT/Tnum;
         }
-      }
     }
 
-    for (i = 0U; i < cmnc_num_cellUNum; i++) {
-      if (SFM_DW.ErrUFlg[i]) {
-        SFM_B.CellU[i] = avrgU;
-      } else {
-        SFM_B.CellU[i] = ihv_V_cellU[i];
-      }
+	//printf("T:%d  %d  %d  %d,Tmax:%d,Tmin:%d\n",ihv_T_modT[0],ihv_T_modT[1],ihv_T_modT[2],ihv_T_modT[3],sfmd_T_modTMax,sfmd_T_modTMin);
+    //62 充电Mos 温度合理性故障
+    sfmd_flg_chrgMosTRationFlt = !FirstRun_SFM && !sfmd_flg_interComFlt && !sfmd_flg_chrgMosTOpenFlt && ((int16_T)(ihd_T_mosT -ihd_T_mosT_Delay )<-10);
+    if (!sfmd_flg_chrgMosTRationFlt)
+    {
+        ihd_T_mosT_Delay = ihd_T_mosT;
     }
-  } else {
-    for (i_0 = 0; i_0 < 28; i_0++) {
-      SFM_B.CellU[i_0] = ihv_V_cellU[i_0];
-      SFM_B.ErrFlg[i_0] = false;
+    
+    //64 快充插头温度合理性故障
+    sfmd_flg_DCPlugTRationFlt = !FirstRun_SFM && !sfmd_flg_interComFlt && !sfmd_flg_DCPlugTOpenFlt && ((int16_T)(ihd_T_DCPlugT -ihd_T_DCPlugT_Delay) <-10);
+    if (!sfmd_flg_DCPlugTRationFlt)
+    {
+        ihd_T_DCPlugT_Delay = ihd_T_DCPlugT;
     }
-  }
-
-  i = 0U;
-  rtb_SumU = 0U;
-  while (i < cmnc_num_cellUNum) {
-    qY_0 = rtb_SumU + /*MW:OvSatOk*/ SFM_B.CellU[i];
-    if (qY_0 < rtb_SumU) {
-      qY_0 = MAX_uint32_T;
+    //65 慢插头温度合理性故障
+    sfmd_flg_ACPlugTRationFlt = !FirstRun_SFM && !sfmd_flg_interComFlt && !sfmd_flg_ACPlugTOpenFlt && ((int16_T)(ihd_T_ACPlugT -ihd_T_ACPlugT_Delay) <-10);
+    if (!sfmd_flg_ACPlugTRationFlt)
+    {
+        ihd_T_ACPlugT_Delay = ihd_T_ACPlugT;
     }
-
-    rtb_SumU = qY_0;
-    i++;
-  }
-
-  for (i_0 = 0; i_0 < 28; i_0++) {
-    /* SignalConversion generated from: '<S13>/Chart' */
-    sfmv_V_cellU[i_0] = SFM_B.CellU[i_0];
-  }
-
-
-
-
-  
-  /* Logic: '<S13>/Logical Operator1' */
-  tmp = SFM_B.ErrFlg[0];
-  for (i_0 = 0; i_0 < 27; i_0++) {
-    tmp = (tmp || SFM_B.ErrFlg[i_0 + 1]);
-  }
-
-  rtb_RelationalOperator_et = tmp;
-
-  /* Logic: '<S15>/Logical Operator' */
-  sfmv_flg_TFlt = false;
-
-  /* SignalConversion: '<S14>/Signal Conversion' incorporates:
-   *  Inport: '<Root>/ihd_flg_currFlt'
-   */
-  sfmd_flg_currFlt = ihd_flg_currFlt;
-
-  /* SignalConversion generated from: '<S13>/Chart' */
-  sfmd_V_cellUMax = SFM_B.MaxU;
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem' */
-  /* Constant: '<S28>/Constant28' incorporates:
-   *  Constant: '<S28>/Constant25'
-   *  Constant: '<S28>/Constant27'
-   *  Logic: '<S28>/Logical Operator5'
-   */
-  rtb_RelationalOperator1_ep = SFM_Subsytem_j(1, !rtb_RelationalOperator1,
-    sfmd_V_cellUMax, sfmc_V_cellUMaxThr2, 2, &SFM_DW.Subsytem_j0);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem2' */
-  /* Constant: '<S28>/Constant26' incorporates:
-   *  Constant: '<S28>/Constant23'
-   *  Constant: '<S28>/Constant24'
-   *  Logic: '<S28>/Logical Operator3'
-   */
-  rtb_RelationalOperator1_j = SFM_Subsytem_j(1, !rtb_RelationalOperator1,
-    sfmd_V_cellUMax, sfmc_V_cellUMaxThr1, 2, &SFM_DW.Subsytem2_p);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem2' */
-
-  /* SignalConversion generated from: '<S13>/Chart' */
-  sfmd_V_cellUMin = SFM_B.MinU;
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem1' */
-  /* Constant: '<S28>/Constant22' incorporates:
-   *  Constant: '<S28>/Constant20'
-   *  Constant: '<S28>/Constant21'
-   *  Logic: '<S28>/Logical Operator1'
-   */
-  rtb_RelationalOperator1_di = SFM_Subsytem1_n(1, !rtb_RelationalOperator1,
-    sfmd_V_cellUMin, sfmc_V_cellUMinThr2, 2, &SFM_DW.Subsytem1_n);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem1' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem3' */
-  /* Constant: '<S28>/Constant19' incorporates:
-   *  Constant: '<S28>/Constant10'
-   *  Constant: '<S28>/Constant18'
-   *  Logic: '<S28>/Logical Operator6'
-   */
-  rtb_RelationalOperator1_l = SFM_Subsytem1_n(1, !rtb_RelationalOperator1,
-    sfmd_V_cellUMin, sfmc_V_cellUMinThr1, 2, &SFM_DW.Subsytem3_b);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem3' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem4' */
-  /* Constant: '<S28>/Constant14' incorporates:
-   *  Constant: '<S28>/Constant12'
-   *  Constant: '<S28>/Constant13'
-   *  Logic: '<S28>/Logical Operator2'
-   *  SignalConversion generated from: '<S13>/Chart'
-   *  Sum: '<S28>/Add'
-   * */
-  rtb_RelationalOperator1_lf = SFM_Subsytem_j(1, !rtb_RelationalOperator1,
-    (uint16_T)(sfmd_V_cellUMax - sfmd_V_cellUMin), sfmc_flg_cellUDiffThr2, 2,
-    &SFM_DW.Subsytem4_p);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem4' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem5' */
-  /* Constant: '<S28>/Constant1' incorporates:
-   *  Constant: '<S28>/Constant2'
-   *  Constant: '<S28>/Constant3'
-   *  Logic: '<S28>/Logical Operator9'
-   *  SignalConversion generated from: '<S13>/Chart'
-   *  Sum: '<S28>/Add1'
-   * */
-  rtb_RelationalOperator1_eg = SFM_Subsytem_j(1, !rtb_RelationalOperator1,
-    (uint16_T)(sfmd_V_cellUMax - sfmd_V_cellUMin), sfmc_flg_cellUDiffThr1, 2,
-    &SFM_DW.Subsytem5_l);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem5' */
-
-  /* Logic: '<S13>/Logical Operator2' incorporates:
-   *  Logic: '<S13>/Logical Operator1'
-   */
-  sfmd_flg_volFlt = (tmp || rtb_RelationalOperator1);
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsystem5' */
-  rtb_RelationalOperator1_fg = SFM_Subsystem5(sfmd_flg_volFlt,
-    rtb_RelationalOperator1);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsystem5' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem6' */
-  /* Constant: '<S28>/Constant30' incorporates:
-   *  Constant: '<S28>/Constant16'
-   *  Constant: '<S28>/Constant29'
-   */
-  rtb_RelationalOperator1_fg = SFM_Subsytem6(1, rtb_RelationalOperator1_fg,
-    rtb_SumU, sfmc_V_battUMaxThr2, 2, &SFM_DW.Subsytem6);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem6' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsystem6' */
-  rtb_RelationalOperator1_o = SFM_Subsystem5(sfmd_flg_volFlt,
-    rtb_RelationalOperator1);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsystem6' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem8' */
-  /* Constant: '<S28>/Constant17' incorporates:
-   *  Constant: '<S28>/Constant11'
-   *  Constant: '<S28>/Constant15'
-   */
-  rtb_RelationalOperator1_it = SFM_Subsytem6(1, rtb_RelationalOperator1_o,
-    rtb_SumU, sfmc_V_battUMaxThr1, 2, &SFM_DW.Subsytem8);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem8' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsystem7' */
-  rtb_RelationalOperator1_o = SFM_Subsystem5(sfmd_flg_volFlt,
-    rtb_RelationalOperator1);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsystem7' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem7' */
-  /* Constant: '<S28>/Constant9' incorporates:
-   *  Constant: '<S28>/Constant7'
-   *  Constant: '<S28>/Constant8'
-   */
-  rtb_RelationalOperator1_o = SFM_Subsytem7(1, rtb_RelationalOperator1_o,
-    rtb_SumU, sfmc_V_battUMinThr2, 2, &SFM_DW.Subsytem7);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem7' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsystem8' */
-  rtb_RelationalOperator_et = SFM_Subsystem5(sfmd_flg_volFlt,
-    rtb_RelationalOperator1);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsystem8' */
-
-  /* Outputs for Atomic SubSystem: '<S28>/Subsytem9' */
-  /* Constant: '<S28>/Constant6' incorporates:
-   *  Constant: '<S28>/Constant4'
-   *  Constant: '<S28>/Constant5'
-   */
-  rtb_RelationalOperator_et = SFM_Subsytem7(1, rtb_RelationalOperator_et,
-    rtb_SumU, sfmc_V_battUMinThr1, 2, &SFM_DW.Subsytem9);
-
-  /* End of Outputs for SubSystem: '<S28>/Subsytem9' */
-
-  /* Chart: '<S19>/ArrMin' incorporates:
-   *  Constant: '<S19>/Constant'
-   *  Inport: '<Root>/ihv_T_modT'
-   */
-  i = 0U;
-  sfmd_T_modTMax = ihv_T_modT[0];
-  while (i < cmnc_num_modTNum) {
-    if (sfmd_T_modTMax < ihv_T_modT[i]) {
-      sfmd_T_modTMax = ihv_T_modT[i];
+    //66 加热板#1 温度合理性故障
+    sfmd_flg_heatPanT1RationFlt = !FirstRun_SFM && !sfmd_flg_interComFlt && !sfmd_flg_heatPanT1OpenFlt && ((int16_T)(ihd_T_heatPanT1 -ihd_T_heatPanT1_Delay) <-10);
+    if (!sfmd_flg_heatPanT1RationFlt)
+    {
+        ihd_T_heatPanT1_Delay = ihd_T_heatPanT1;
     }
-
-    i++;
-  }
-
-  /* End of Chart: '<S19>/ArrMin' */
-
-  /* Outputs for Atomic SubSystem: '<S27>/Subsytem' */
-  /* Constant: '<S27>/Constant28' incorporates:
-   *  Constant: '<S27>/Constant25'
-   *  Constant: '<S27>/Constant27'
-   *  Logic: '<S27>/Logical Operator5'
-   */
-  rtb_RelationalOperator1_p = SFM_Subsytem(1, !rtb_RelationalOperator1,
-    sfmd_T_modTMax, sfmc_T_modTMaxThr2, 2, &SFM_DW.Subsytem_j);
-
-  /* End of Outputs for SubSystem: '<S27>/Subsytem' */
-
-  /* Outputs for Atomic SubSystem: '<S27>/Subsytem2' */
-  /* Constant: '<S27>/Constant26' incorporates:
-   *  Constant: '<S27>/Constant23'
-   *  Constant: '<S27>/Constant24'
-   *  Logic: '<S27>/Logical Operator1'
-   */
-  rtb_RelationalOperator1_a = SFM_Subsytem(1, !rtb_RelationalOperator1,
-    sfmd_T_modTMax, sfmc_T_modTMaxThr1, 2, &SFM_DW.Subsytem2);
-
-  /* End of Outputs for SubSystem: '<S27>/Subsytem2' */
-
-  /* Chart: '<S20>/ArrMin' incorporates:
-   *  Constant: '<S20>/Constant'
-   *  Inport: '<Root>/ihv_T_modT'
-   */
-  i = 0U;
-  sfmd_T_modTMin = ihv_T_modT[0];
-  while (i < cmnc_num_modTNum) {
-    if (sfmd_T_modTMin > ihv_T_modT[i]) {
-      sfmd_T_modTMin = ihv_T_modT[i];
+    //67 加热板#2 温度合理性故障
+    sfmd_flg_heatPanT2RationFlt = !FirstRun_SFM && !sfmd_flg_interComFlt && !sfmd_flg_heatPanT2OpenFlt && ((int16_T)(ihd_T_heatPanT2 -ihd_T_heatPanT2_Delay) <-10);
+    if (!sfmd_flg_heatPanT2RationFlt)
+    {
+        ihd_T_heatPanT2_Delay = ihd_T_heatPanT2;
     }
-
-    i++;
-  }
-
-  /* End of Chart: '<S20>/ArrMin' */
-
-  /* Outputs for Atomic SubSystem: '<S27>/Subsytem1' */
-  /* Constant: '<S27>/Constant22' incorporates:
-   *  Constant: '<S27>/Constant20'
-   *  Constant: '<S27>/Constant21'
-   *  Logic: '<S27>/Logical Operator3'
-   */
-  rtb_RelationalOperator1_i = SFM_Subsytem1(1, !rtb_RelationalOperator1,
-    sfmd_T_modTMin, sfmc_T_modTMinThr2, 2, &SFM_DW.Subsytem1_e);
-
-  /* End of Outputs for SubSystem: '<S27>/Subsytem1' */
-
-  /* Outputs for Atomic SubSystem: '<S27>/Subsytem3' */
-  /* Constant: '<S27>/Constant19' incorporates:
-   *  Constant: '<S27>/Constant10'
-   *  Constant: '<S27>/Constant18'
-   *  Logic: '<S27>/Logical Operator7'
-   */
-  rtb_RelationalOperator1_d = SFM_Subsytem1(1, !rtb_RelationalOperator1,
-    sfmd_T_modTMin, sfmc_T_modTMinThr1, 2, &SFM_DW.Subsytem3);
-
-  /* End of Outputs for SubSystem: '<S27>/Subsytem3' */
-
-  /* Outputs for Atomic SubSystem: '<S27>/Subsytem4' */
-  /* Constant: '<S27>/Constant14' incorporates:
-   *  Constant: '<S27>/Constant12'
-   *  Constant: '<S27>/Constant13'
-   *  Logic: '<S27>/Logical Operator4'
-   *  Sum: '<S27>/Add'
-   */
-  rtb_RelationalOperator1_bb = SFM_Subsytem(1, !rtb_RelationalOperator1,
-    (int16_T)(sfmd_T_modTMax - sfmd_T_modTMin), sfmc_T_modTDiffThr2, 2,
-    &SFM_DW.Subsytem4);
-
-  /* End of Outputs for SubSystem: '<S27>/Subsytem4' */
-
-  /* Outputs for Atomic SubSystem: '<S27>/Subsytem5' */
-  /* Constant: '<S27>/Constant1' incorporates:
-   *  Constant: '<S27>/Constant2'
-   *  Constant: '<S27>/Constant3'
-   *  Logic: '<S27>/Logical Operator10'
-   *  Sum: '<S27>/Add1'
-   */
-  rtb_RelationalOperator1_gr = SFM_Subsytem(1, !rtb_RelationalOperator1,
-    (int16_T)(sfmd_T_modTMax - sfmd_T_modTMin), sfmc_T_modTDiffThr1, 2,
-    &SFM_DW.Subsytem5);
-
-  /* End of Outputs for SubSystem: '<S27>/Subsytem5' */
-
-  /* Switch: '<S14>/Switch' incorporates:
-   *  Inport: '<Root>/ihd_flg_currFlt'
-   */
-  if (ihd_flg_currFlt) {
-    /* Switch: '<S14>/Switch' incorporates:
-     *  Constant: '<S14>/Constant'
-     */
-    sfmd_I_curr = 0;
-  } else {
-    /* Switch: '<S14>/Switch' incorporates:
-     *  Inport: '<Root>/ihd_I_curr'
-     */
-    sfmd_I_curr = ihd_I_curr;
-  }
-
-  /* End of Switch: '<S14>/Switch' */
-
-  /* Outputs for Atomic SubSystem: '<S24>/Subsytem' */
-  /* Saturate: '<S29>/Saturation' incorporates:
-   *  Constant: '<S29>/Constant1'
-   *  Sum: '<S29>/Add'
-   *  UnitDelay: '<S29>/delay'
-   */
-  if ((uint8_T)(SFM_DW.delay_DSTATE_j + 1U) < 200) {
-    i = (uint8_T)(SFM_DW.delay_DSTATE_j + 1U);
-  } else {
-    i = 200U;
-  }
-
-  /* End of Saturate: '<S29>/Saturation' */
-
-  /* Product: '<S29>/Product' incorporates:
-   *  Constant: '<S24>/Constant27'
-   *  Logic: '<S24>/Logical Operator2'
-   *  Logic: '<S29>/Logical Operator1'
-   *  RelationalOperator: '<S29>/Relational Operator'
-   *  Switch: '<S14>/Switch'
-   *  UnitDelay: '<S29>/delay'
-   */
-  SFM_DW.delay_DSTATE_j = (uint8_T)((!rtb_RelationalOperator1) && (sfmd_I_curr >=
-    sfmc_I_chrgCurrOverThr) ? (int32_T)i : 0);
-
-  /* SignalConversion generated from: '<S5>/ SFunction ' incorporates:
-   *  Chart: '<S3>/FltCodeArry'
-   *  Constant: '<S24>/Constant25'
-   *  RelationalOperator: '<S29>/Relational Operator1'
-   */
-  rtb_TmpSignalConversionAtSFun_a[130] = (i > 2);
-
-  /* End of Outputs for SubSystem: '<S24>/Subsytem' */
-
-  /* Outputs for Atomic SubSystem: '<S24>/Subsytem1' */
-  /* Saturate: '<S30>/Saturation' incorporates:
-   *  Constant: '<S30>/Constant2'
-   *  Sum: '<S30>/Add'
-   *  UnitDelay: '<S30>/delay'
-   */
-  if ((uint8_T)(SFM_DW.delay_DSTATE + 1U) < 200) {
-    i = (uint8_T)(SFM_DW.delay_DSTATE + 1U);
-  } else {
-    i = 200U;
-  }
-
-  /* End of Saturate: '<S30>/Saturation' */
-
-  /* Product: '<S30>/Product' incorporates:
-   *  Constant: '<S24>/Constant10'
-   *  Logic: '<S24>/Logical Operator1'
-   *  Logic: '<S30>/Logical Operator'
-   *  RelationalOperator: '<S30>/Relational Operator'
-   *  Switch: '<S14>/Switch'
-   *  UnitDelay: '<S30>/delay'
-   */
-  SFM_DW.delay_DSTATE = (uint8_T)((!rtb_RelationalOperator1) && (sfmd_I_curr <=
-    sfmc_I_dischrgCurrOverThr) ? (int32_T)i : 0);
-
-  /* End of Outputs for SubSystem: '<S24>/Subsytem1' */
-
-  /* SignalConversion generated from: '<S5>/ SFunction ' incorporates:
-   *  Chart: '<S3>/FltCodeArry'
-   *  Constant: '<S10>/Constant1'
-   *  Constant: '<S10>/Constant10'
-   *  Constant: '<S10>/Constant12'
-   *  Constant: '<S10>/Constant13'
-   *  Constant: '<S10>/Constant14'
-   *  Constant: '<S10>/Constant15'
-   *  Constant: '<S10>/Constant16'
-   *  Constant: '<S10>/Constant17'
-   *  Constant: '<S10>/Constant18'
-   *  Constant: '<S10>/Constant19'
-   *  Constant: '<S10>/Constant2'
-   *  Constant: '<S10>/Constant20'
-   *  Constant: '<S10>/Constant21'
-   *  Constant: '<S10>/Constant22'
-   *  Constant: '<S10>/Constant23'
-   *  Constant: '<S10>/Constant24'
-   *  Constant: '<S10>/Constant25'
-   *  Constant: '<S10>/Constant26'
-   *  Constant: '<S10>/Constant27'
-   *  Constant: '<S10>/Constant28'
-   *  Constant: '<S10>/Constant29'
-   *  Constant: '<S10>/Constant3'
-   *  Constant: '<S10>/Constant4'
-   *  Constant: '<S10>/Constant5'
-   *  Constant: '<S10>/Constant6'
-   *  Constant: '<S10>/Constant7'
-   *  Constant: '<S10>/Constant8'
-   *  Constant: '<S10>/Constant9'
-   *  Constant: '<S12>/Constant'
-   *  Constant: '<S12>/Constant1'
-   *  Constant: '<S12>/Constant2'
-   *  Constant: '<S12>/Constant3'
-   *  Constant: '<S12>/Constant4'
-   *  Constant: '<S12>/Constant5'
-   *  Constant: '<S12>/Constant6'
-   *  Constant: '<S12>/Constant7'
-   *  Constant: '<S12>/Constant8'
-   *  Constant: '<S12>/Constant9'
-   *  Constant: '<S15>/Constant11'
-   *  Constant: '<S15>/Constant12'
-   *  Constant: '<S15>/Constant13'
-   *  Constant: '<S15>/Constant14'
-   *  Constant: '<S15>/Constant15'
-   *  Constant: '<S15>/Constant16'
-   *  Constant: '<S15>/Constant17'
-   *  Constant: '<S15>/Constant18'
-   *  Constant: '<S15>/Constant19'
-   *  Constant: '<S15>/Constant20'
-   *  Constant: '<S15>/Constant21'
-   *  Constant: '<S15>/Constant4'
-   *  Constant: '<S15>/Constant5'
-   *  Constant: '<S15>/Constant6'
-   *  Constant: '<S15>/Constant7'
-   *  Constant: '<S15>/Constant8'
-   *  Constant: '<S15>/Constant9'
-   *  Constant: '<S16>/Constant'
-   *  Constant: '<S16>/Constant1'
-   *  Constant: '<S16>/Constant2'
-   *  Constant: '<S16>/Constant3'
-   *  Constant: '<S16>/Constant4'
-   *  Constant: '<S16>/Constant5'
-   *  Constant: '<S16>/Constant6'
-   *  Constant: '<S16>/Constant7'
-   *  Constant: '<S17>/Constant1'
-   *  Constant: '<S24>/Constant1'
-   *  Constant: '<S24>/Constant2'
-   *  Constant: '<S24>/Constant3'
-   *  Constant: '<S24>/Constant4'
-   *  Constant: '<S24>/Constant5'
-   *  Constant: '<S24>/Constant6'
-   *  Constant: '<S24>/Constant7'
-   *  Constant: '<S24>/Constant8'
-   *  Constant: '<S24>/Constant9'
-   *  Constant: '<S25>/Constant1'
-   *  Constant: '<S25>/Constant2'
-   *  Constant: '<S25>/Constant3'
-   *  Constant: '<S25>/Constant4'
-   *  Constant: '<S25>/Constant5'
-   *  Constant: '<S25>/Constant6'
-   *  Constant: '<S25>/Constant7'
-   *  Constant: '<S25>/Constant8'
-   *  Constant: '<S25>/Constant9'
-   *  Constant: '<S26>/Constant'
-   *  Constant: '<S27>/Constant'
-   *  Constant: '<S27>/Constant11'
-   *  Constant: '<S27>/Constant15'
-   *  Constant: '<S27>/Constant16'
-   *  Constant: '<S27>/Constant17'
-   *  Constant: '<S27>/Constant29'
-   *  Constant: '<S27>/Constant30'
-   *  Constant: '<S27>/Constant31'
-   *  Constant: '<S27>/Constant32'
-   *  Constant: '<S27>/Constant33'
-   *  Constant: '<S27>/Constant34'
-   *  Constant: '<S27>/Constant35'
-   *  Constant: '<S27>/Constant36'
-   *  Constant: '<S27>/Constant37'
-   *  Constant: '<S27>/Constant38'
-   *  Constant: '<S27>/Constant39'
-   *  Constant: '<S27>/Constant4'
-   *  Constant: '<S27>/Constant40'
-   *  Constant: '<S27>/Constant41'
-   *  Constant: '<S27>/Constant5'
-   *  Constant: '<S27>/Constant6'
-   *  Constant: '<S27>/Constant7'
-   *  Constant: '<S27>/Constant8'
-   *  Constant: '<S27>/Constant9'
-   *  Constant: '<S28>/Constant'
-   *  Constant: '<S28>/Constant31'
-   *  Constant: '<S28>/Constant32'
-   *  Constant: '<S28>/Constant33'
-   *  Constant: '<S28>/Constant34'
-   *  Constant: '<S28>/Constant35'
-   *  Constant: '<S28>/Constant36'
-   *  Constant: '<S28>/Constant37'
-   *  Constant: '<S28>/Constant38'
-   *  Constant: '<S28>/Constant39'
-   *  Constant: '<S6>/Constant'
-   *  Constant: '<S8>/Constant'
-   *  Constant: '<S8>/Constant1'
-   *  Constant: '<S8>/Constant2'
-   *  Constant: '<S8>/Constant3'
-   *  Constant: '<S8>/Constant4'
-   *  Constant: '<S9>/Constant1'
-   *  Constant: '<S9>/Constant10'
-   *  Constant: '<S9>/Constant2'
-   *  Constant: '<S9>/Constant3'
-   *  Constant: '<S9>/Constant4'
-   *  Constant: '<S9>/Constant5'
-   *  Constant: '<S9>/Constant7'
-   *  Constant: '<S9>/Constant8'
-   *  Constant: '<S9>/Constant9'
-   *  Inport: '<Root>/ihd_flg_chrgMosClosFlt'
-   *  Inport: '<Root>/ihd_flg_disChrgMosClosFlt'
-   *  Logic: '<S13>/Logical Operator1'
-   *  Logic: '<S27>/Logical Operator12'
-   *  Logic: '<S27>/Logical Operator13'
-   *  Logic: '<S27>/Logical Operator2'
-   *  Logic: '<S27>/Logical Operator6'
-   *  Logic: '<S27>/Logical Operator8'
-   *  Logic: '<S27>/Logical Operator9'
-   *  Logic: '<S28>/Logical Operator'
-   *  Logic: '<S28>/Logical Operator10'
-   *  Logic: '<S28>/Logical Operator11'
-   *  Logic: '<S28>/Logical Operator12'
-   *  Logic: '<S28>/Logical Operator13'
-   *  Logic: '<S28>/Logical Operator14'
-   *  Logic: '<S28>/Logical Operator15'
-   *  Logic: '<S28>/Logical Operator4'
-   *  Logic: '<S28>/Logical Operator7'
-   *  Logic: '<S28>/Logical Operator8'
-   *  RelationalOperator: '<S30>/Relational Operator1'
-   */
-  rtb_TmpSignalConversionAtSFun_a[0] = rtb_RelationalOperator1;
-  rtb_TmpSignalConversionAtSFun_a[1] = false;
-  rtb_TmpSignalConversionAtSFun_a[2] = false;
-  rtb_TmpSignalConversionAtSFun_a[3] = false;
-  rtb_TmpSignalConversionAtSFun_a[4] = false;
-  rtb_TmpSignalConversionAtSFun_a[5] = false;
-  rtb_TmpSignalConversionAtSFun_a[6] = false;
-  rtb_TmpSignalConversionAtSFun_a[7] = false;
-  rtb_TmpSignalConversionAtSFun_a[8] = false;
-  rtb_TmpSignalConversionAtSFun_a[9] = false;
-  rtb_TmpSignalConversionAtSFun_a[10] = false;
-  rtb_TmpSignalConversionAtSFun_a[11] = false;
-  rtb_TmpSignalConversionAtSFun_a[12] = false;
-  rtb_TmpSignalConversionAtSFun_a[13] = false;
-  rtb_TmpSignalConversionAtSFun_a[14] = false;
-  rtb_TmpSignalConversionAtSFun_a[15] = false;
-  rtb_TmpSignalConversionAtSFun_a[16] = false;
-  rtb_TmpSignalConversionAtSFun_a[17] = false;
-  rtb_TmpSignalConversionAtSFun_a[18] = false;
-  rtb_TmpSignalConversionAtSFun_a[19] = false;
-  rtb_TmpSignalConversionAtSFun_a[20] = false;
-  rtb_TmpSignalConversionAtSFun_a[21] = ihd_flg_chrgMosClosFlt;
-  rtb_TmpSignalConversionAtSFun_a[22] = false;
-  rtb_TmpSignalConversionAtSFun_a[23] = ihd_flg_dischrgMosClosFlt;
-  rtb_TmpSignalConversionAtSFun_a[24] = false;
-  rtb_TmpSignalConversionAtSFun_a[25] = false;
-  rtb_TmpSignalConversionAtSFun_a[26] = false;
-  rtb_TmpSignalConversionAtSFun_a[27] = false;
-  rtb_TmpSignalConversionAtSFun_a[28] = false;
-  rtb_TmpSignalConversionAtSFun_a[29] = false;
-  rtb_TmpSignalConversionAtSFun_a[30] = false;
-  rtb_TmpSignalConversionAtSFun_a[31] = false;
-  rtb_TmpSignalConversionAtSFun_a[32] = false;
-  rtb_TmpSignalConversionAtSFun_a[33] = false;
-  rtb_TmpSignalConversionAtSFun_a[34] = false;
-  rtb_TmpSignalConversionAtSFun_a[35] = false;
-  rtb_TmpSignalConversionAtSFun_a[36] = false;
-  rtb_TmpSignalConversionAtSFun_a[37] = false;
-  rtb_TmpSignalConversionAtSFun_a[38] = false;
-  rtb_TmpSignalConversionAtSFun_a[39] = false;
-  rtb_TmpSignalConversionAtSFun_a[40] = false;
-  rtb_TmpSignalConversionAtSFun_a[41] = false;
-  rtb_TmpSignalConversionAtSFun_a[42] = false;
-  rtb_TmpSignalConversionAtSFun_a[43] = false;
-  rtb_TmpSignalConversionAtSFun_a[44] = false;
-  rtb_TmpSignalConversionAtSFun_a[45] = false;
-  rtb_TmpSignalConversionAtSFun_a[46] = false;
-  rtb_TmpSignalConversionAtSFun_a[47] = false;
-  rtb_TmpSignalConversionAtSFun_a[48] = false;
-  rtb_TmpSignalConversionAtSFun_a[49] = false;
-  rtb_TmpSignalConversionAtSFun_a[50] = false;
-  rtb_TmpSignalConversionAtSFun_a[51] = tmp;
-  rtb_TmpSignalConversionAtSFun_a[52] = sfmv_flg_TFlt;
-  rtb_TmpSignalConversionAtSFun_a[53] = false;
-  rtb_TmpSignalConversionAtSFun_a[54] = false;
-  rtb_TmpSignalConversionAtSFun_a[55] = false;
-  rtb_TmpSignalConversionAtSFun_a[56] = false;
-  rtb_TmpSignalConversionAtSFun_a[57] = false;
-  rtb_TmpSignalConversionAtSFun_a[58] = false;
-  rtb_TmpSignalConversionAtSFun_a[59] = false;
-  rtb_TmpSignalConversionAtSFun_a[60] = false;
-  rtb_TmpSignalConversionAtSFun_a[61] = false;
-  rtb_TmpSignalConversionAtSFun_a[62] = false;
-  rtb_TmpSignalConversionAtSFun_a[63] = false;
-  rtb_TmpSignalConversionAtSFun_a[64] = false;
-  rtb_TmpSignalConversionAtSFun_a[65] = false;
-  rtb_TmpSignalConversionAtSFun_a[66] = false;
-  rtb_TmpSignalConversionAtSFun_a[67] = false;
-  rtb_TmpSignalConversionAtSFun_a[68] = false;
-  rtb_TmpSignalConversionAtSFun_a[69] = false;
-  rtb_TmpSignalConversionAtSFun_a[70] = sfmd_flg_currFlt;
-  rtb_TmpSignalConversionAtSFun_a[71] = false;
-  rtb_TmpSignalConversionAtSFun_a[72] = false;
-  rtb_TmpSignalConversionAtSFun_a[73] = false;
-  rtb_TmpSignalConversionAtSFun_a[74] = false;
-  rtb_TmpSignalConversionAtSFun_a[75] = false;
-  rtb_TmpSignalConversionAtSFun_a[76] = false;
-  rtb_TmpSignalConversionAtSFun_a[77] = false;
-  rtb_TmpSignalConversionAtSFun_a[78] = false;
-  rtb_TmpSignalConversionAtSFun_a[79] = false;
-  rtb_TmpSignalConversionAtSFun_a[80] = rtb_RelationalOperator1_ep;
-  rtb_TmpSignalConversionAtSFun_a[81] = (rtb_RelationalOperator1_j &&
-    (!rtb_RelationalOperator1_ep));
-  rtb_TmpSignalConversionAtSFun_a[82] = rtb_RelationalOperator1_di;
-  rtb_TmpSignalConversionAtSFun_a[83] = (rtb_RelationalOperator1_l &&
-    (!rtb_RelationalOperator1_di));
-  rtb_TmpSignalConversionAtSFun_a[84] = rtb_RelationalOperator1_lf;
-  rtb_TmpSignalConversionAtSFun_a[85] = (rtb_RelationalOperator1_eg &&
-    (!rtb_RelationalOperator1_lf));
-  rtb_TmpSignalConversionAtSFun_a[86] = rtb_RelationalOperator1_fg;
-  rtb_TmpSignalConversionAtSFun_a[87] = (rtb_RelationalOperator1_it &&
-    (!rtb_RelationalOperator1_fg));
-  rtb_TmpSignalConversionAtSFun_a[88] = rtb_RelationalOperator1_o;
-  rtb_TmpSignalConversionAtSFun_a[89] = (rtb_RelationalOperator_et &&
-    (!rtb_RelationalOperator1_o));
-  rtb_TmpSignalConversionAtSFun_a[90] = false;
-  rtb_TmpSignalConversionAtSFun_a[91] = false;
-  rtb_TmpSignalConversionAtSFun_a[92] = false;
-  rtb_TmpSignalConversionAtSFun_a[93] = false;
-  rtb_TmpSignalConversionAtSFun_a[94] = false;
-  rtb_TmpSignalConversionAtSFun_a[95] = false;
-  rtb_TmpSignalConversionAtSFun_a[96] = false;
-  rtb_TmpSignalConversionAtSFun_a[97] = false;
-  rtb_TmpSignalConversionAtSFun_a[98] = false;
-  rtb_TmpSignalConversionAtSFun_a[99] = false;
-  rtb_TmpSignalConversionAtSFun_a[100] = rtb_RelationalOperator1_p;
-  rtb_TmpSignalConversionAtSFun_a[101] = (rtb_RelationalOperator1_a &&
-    (!rtb_RelationalOperator1_p));
-  rtb_TmpSignalConversionAtSFun_a[102] = rtb_RelationalOperator1_i;
-  rtb_TmpSignalConversionAtSFun_a[103] = (rtb_RelationalOperator1_d &&
-    (!rtb_RelationalOperator1_i));
-  rtb_TmpSignalConversionAtSFun_a[104] = rtb_RelationalOperator1_bb;
-  rtb_TmpSignalConversionAtSFun_a[105] = (rtb_RelationalOperator1_gr &&
-    (!rtb_RelationalOperator1_bb));
-  rtb_TmpSignalConversionAtSFun_a[106] = false;
-  rtb_TmpSignalConversionAtSFun_a[107] = false;
-  rtb_TmpSignalConversionAtSFun_a[108] = false;
-  rtb_TmpSignalConversionAtSFun_a[109] = false;
-  rtb_TmpSignalConversionAtSFun_a[110] = false;
-  rtb_TmpSignalConversionAtSFun_a[111] = false;
-  rtb_TmpSignalConversionAtSFun_a[112] = false;
-  rtb_TmpSignalConversionAtSFun_a[113] = false;
-  rtb_TmpSignalConversionAtSFun_a[114] = false;
-  rtb_TmpSignalConversionAtSFun_a[115] = false;
-  rtb_TmpSignalConversionAtSFun_a[116] = false;
-  rtb_TmpSignalConversionAtSFun_a[117] = false;
-  rtb_TmpSignalConversionAtSFun_a[118] = false;
-  rtb_TmpSignalConversionAtSFun_a[119] = false;
-  rtb_TmpSignalConversionAtSFun_a[120] = false;
-  rtb_TmpSignalConversionAtSFun_a[121] = false;
-  rtb_TmpSignalConversionAtSFun_a[122] = false;
-  rtb_TmpSignalConversionAtSFun_a[123] = false;
-  rtb_TmpSignalConversionAtSFun_a[124] = false;
-  rtb_TmpSignalConversionAtSFun_a[125] = false;
-  rtb_TmpSignalConversionAtSFun_a[126] = false;
-  rtb_TmpSignalConversionAtSFun_a[127] = false;
-  rtb_TmpSignalConversionAtSFun_a[128] = false;
-  rtb_TmpSignalConversionAtSFun_a[129] = false;
-
-  /* Outputs for Atomic SubSystem: '<S24>/Subsytem1' */
-  rtb_TmpSignalConversionAtSFun_a[131] = (i > 2);
-
-  /* End of Outputs for SubSystem: '<S24>/Subsytem1' */
-  rtb_TmpSignalConversionAtSFun_a[132] = false;
-  rtb_TmpSignalConversionAtSFun_a[133] = false;
-  rtb_TmpSignalConversionAtSFun_a[134] = false;
-  rtb_TmpSignalConversionAtSFun_a[135] = false;
-  rtb_TmpSignalConversionAtSFun_a[136] = false;
-  rtb_TmpSignalConversionAtSFun_a[137] = false;
-  rtb_TmpSignalConversionAtSFun_a[138] = false;
-  rtb_TmpSignalConversionAtSFun_a[139] = false;
-  rtb_TmpSignalConversionAtSFun_a[140] = false;
-  rtb_TmpSignalConversionAtSFun_a[141] = false;
-  rtb_TmpSignalConversionAtSFun_a[142] = false;
-  rtb_TmpSignalConversionAtSFun_a[143] = false;
-  rtb_TmpSignalConversionAtSFun_a[144] = false;
-  rtb_TmpSignalConversionAtSFun_a[145] = false;
-  rtb_TmpSignalConversionAtSFun_a[146] = false;
-  rtb_TmpSignalConversionAtSFun_a[147] = false;
-  rtb_TmpSignalConversionAtSFun_a[148] = false;
-  rtb_TmpSignalConversionAtSFun_a[149] = false;
-  rtb_TmpSignalConversionAtSFun_a[150] = false;
-  rtb_TmpSignalConversionAtSFun_a[151] = false;
-  rtb_TmpSignalConversionAtSFun_a[152] = false;
-  rtb_TmpSignalConversionAtSFun_a[153] = false;
-  rtb_TmpSignalConversionAtSFun_a[154] = false;
-
-  /* SignalConversion generated from: '<S5>/ SFunction ' incorporates:
-   *  Chart: '<S3>/FltCodeArry'
-   *  Constant: '<S3>/Constant1'
-   *  Constant: '<S3>/Constant10'
-   *  Constant: '<S3>/Constant100'
-   *  Constant: '<S3>/Constant101'
-   *  Constant: '<S3>/Constant102'
-   *  Constant: '<S3>/Constant103'
-   *  Constant: '<S3>/Constant104'
-   *  Constant: '<S3>/Constant105'
-   *  Constant: '<S3>/Constant106'
-   *  Constant: '<S3>/Constant107'
-   *  Constant: '<S3>/Constant108'
-   *  Constant: '<S3>/Constant109'
-   *  Constant: '<S3>/Constant11'
-   *  Constant: '<S3>/Constant110'
-   *  Constant: '<S3>/Constant111'
-   *  Constant: '<S3>/Constant112'
-   *  Constant: '<S3>/Constant113'
-   *  Constant: '<S3>/Constant114'
-   *  Constant: '<S3>/Constant115'
-   *  Constant: '<S3>/Constant116'
-   *  Constant: '<S3>/Constant117'
-   *  Constant: '<S3>/Constant118'
-   *  Constant: '<S3>/Constant119'
-   *  Constant: '<S3>/Constant12'
-   *  Constant: '<S3>/Constant120'
-   *  Constant: '<S3>/Constant121'
-   *  Constant: '<S3>/Constant122'
-   *  Constant: '<S3>/Constant123'
-   *  Constant: '<S3>/Constant124'
-   *  Constant: '<S3>/Constant125'
-   *  Constant: '<S3>/Constant126'
-   *  Constant: '<S3>/Constant127'
-   *  Constant: '<S3>/Constant128'
-   *  Constant: '<S3>/Constant129'
-   *  Constant: '<S3>/Constant13'
-   *  Constant: '<S3>/Constant130'
-   *  Constant: '<S3>/Constant131'
-   *  Constant: '<S3>/Constant132'
-   *  Constant: '<S3>/Constant133'
-   *  Constant: '<S3>/Constant134'
-   *  Constant: '<S3>/Constant135'
-   *  Constant: '<S3>/Constant136'
-   *  Constant: '<S3>/Constant137'
-   *  Constant: '<S3>/Constant138'
-   *  Constant: '<S3>/Constant139'
-   *  Constant: '<S3>/Constant14'
-   *  Constant: '<S3>/Constant140'
-   *  Constant: '<S3>/Constant141'
-   *  Constant: '<S3>/Constant142'
-   *  Constant: '<S3>/Constant143'
-   *  Constant: '<S3>/Constant144'
-   *  Constant: '<S3>/Constant145'
-   *  Constant: '<S3>/Constant146'
-   *  Constant: '<S3>/Constant147'
-   *  Constant: '<S3>/Constant148'
-   *  Constant: '<S3>/Constant149'
-   *  Constant: '<S3>/Constant15'
-   *  Constant: '<S3>/Constant150'
-   *  Constant: '<S3>/Constant151'
-   *  Constant: '<S3>/Constant152'
-   *  Constant: '<S3>/Constant153'
-   *  Constant: '<S3>/Constant154'
-   *  Constant: '<S3>/Constant155'
-   *  Constant: '<S3>/Constant157'
-   *  Constant: '<S3>/Constant158'
-   *  Constant: '<S3>/Constant159'
-   *  Constant: '<S3>/Constant16'
-   *  Constant: '<S3>/Constant160'
-   *  Constant: '<S3>/Constant17'
-   *  Constant: '<S3>/Constant18'
-   *  Constant: '<S3>/Constant19'
-   *  Constant: '<S3>/Constant20'
-   *  Constant: '<S3>/Constant21'
-   *  Constant: '<S3>/Constant22'
-   *  Constant: '<S3>/Constant23'
-   *  Constant: '<S3>/Constant24'
-   *  Constant: '<S3>/Constant25'
-   *  Constant: '<S3>/Constant26'
-   *  Constant: '<S3>/Constant27'
-   *  Constant: '<S3>/Constant28'
-   *  Constant: '<S3>/Constant29'
-   *  Constant: '<S3>/Constant30'
-   *  Constant: '<S3>/Constant31'
-   *  Constant: '<S3>/Constant32'
-   *  Constant: '<S3>/Constant33'
-   *  Constant: '<S3>/Constant34'
-   *  Constant: '<S3>/Constant35'
-   *  Constant: '<S3>/Constant36'
-   *  Constant: '<S3>/Constant37'
-   *  Constant: '<S3>/Constant38'
-   *  Constant: '<S3>/Constant39'
-   *  Constant: '<S3>/Constant4'
-   *  Constant: '<S3>/Constant40'
-   *  Constant: '<S3>/Constant41'
-   *  Constant: '<S3>/Constant42'
-   *  Constant: '<S3>/Constant43'
-   *  Constant: '<S3>/Constant44'
-   *  Constant: '<S3>/Constant45'
-   *  Constant: '<S3>/Constant46'
-   *  Constant: '<S3>/Constant47'
-   *  Constant: '<S3>/Constant48'
-   *  Constant: '<S3>/Constant49'
-   *  Constant: '<S3>/Constant5'
-   *  Constant: '<S3>/Constant50'
-   *  Constant: '<S3>/Constant51'
-   *  Constant: '<S3>/Constant52'
-   *  Constant: '<S3>/Constant53'
-   *  Constant: '<S3>/Constant54'
-   *  Constant: '<S3>/Constant55'
-   *  Constant: '<S3>/Constant56'
-   *  Constant: '<S3>/Constant57'
-   *  Constant: '<S3>/Constant58'
-   *  Constant: '<S3>/Constant59'
-   *  Constant: '<S3>/Constant6'
-   *  Constant: '<S3>/Constant60'
-   *  Constant: '<S3>/Constant61'
-   *  Constant: '<S3>/Constant62'
-   *  Constant: '<S3>/Constant63'
-   *  Constant: '<S3>/Constant64'
-   *  Constant: '<S3>/Constant65'
-   *  Constant: '<S3>/Constant66'
-   *  Constant: '<S3>/Constant67'
-   *  Constant: '<S3>/Constant68'
-   *  Constant: '<S3>/Constant69'
-   *  Constant: '<S3>/Constant7'
-   *  Constant: '<S3>/Constant70'
-   *  Constant: '<S3>/Constant71'
-   *  Constant: '<S3>/Constant72'
-   *  Constant: '<S3>/Constant73'
-   *  Constant: '<S3>/Constant74'
-   *  Constant: '<S3>/Constant75'
-   *  Constant: '<S3>/Constant76'
-   *  Constant: '<S3>/Constant77'
-   *  Constant: '<S3>/Constant78'
-   *  Constant: '<S3>/Constant79'
-   *  Constant: '<S3>/Constant8'
-   *  Constant: '<S3>/Constant80'
-   *  Constant: '<S3>/Constant81'
-   *  Constant: '<S3>/Constant84'
-   *  Constant: '<S3>/Constant85'
-   *  Constant: '<S3>/Constant86'
-   *  Constant: '<S3>/Constant87'
-   *  Constant: '<S3>/Constant88'
-   *  Constant: '<S3>/Constant89'
-   *  Constant: '<S3>/Constant9'
-   *  Constant: '<S3>/Constant90'
-   *  Constant: '<S3>/Constant91'
-   *  Constant: '<S3>/Constant92'
-   *  Constant: '<S3>/Constant93'
-   *  Constant: '<S3>/Constant94'
-   *  Constant: '<S3>/Constant95'
-   *  Constant: '<S3>/Constant96'
-   *  Constant: '<S3>/Constant97'
-   *  Constant: '<S3>/Constant98'
-   *  Constant: '<S3>/Constant99'
-   */
-  rtb_TmpSignalConversionAtSFunct[0] = 2U;
-  rtb_TmpSignalConversionAtSFunct[1] = 2U;
-  rtb_TmpSignalConversionAtSFunct[2] = 2U;
-  rtb_TmpSignalConversionAtSFunct[3] = 2U;
-  rtb_TmpSignalConversionAtSFunct[4] = 4U;
-  rtb_TmpSignalConversionAtSFunct[5] = 0U;
-  rtb_TmpSignalConversionAtSFunct[6] = 0U;
-  rtb_TmpSignalConversionAtSFunct[7] = 0U;
-  rtb_TmpSignalConversionAtSFunct[8] = 0U;
-  rtb_TmpSignalConversionAtSFunct[9] = 0U;
-  rtb_TmpSignalConversionAtSFunct[10] = 5U;
-  rtb_TmpSignalConversionAtSFunct[11] = 5U;
-  rtb_TmpSignalConversionAtSFunct[12] = 2U;
-  rtb_TmpSignalConversionAtSFunct[13] = 5U;
-  rtb_TmpSignalConversionAtSFunct[14] = 3U;
-  rtb_TmpSignalConversionAtSFunct[15] = 0U;
-  rtb_TmpSignalConversionAtSFunct[16] = 0U;
-  rtb_TmpSignalConversionAtSFunct[17] = 0U;
-  rtb_TmpSignalConversionAtSFunct[18] = 0U;
-  rtb_TmpSignalConversionAtSFunct[19] = 0U;
-  rtb_TmpSignalConversionAtSFunct[20] = 5U;
-  rtb_TmpSignalConversionAtSFunct[21] = 4U;
-  rtb_TmpSignalConversionAtSFunct[22] = 2U;
-  rtb_TmpSignalConversionAtSFunct[23] = 4U;
-  rtb_TmpSignalConversionAtSFunct[24] = 2U;
-  rtb_TmpSignalConversionAtSFunct[25] = 3U;
-  rtb_TmpSignalConversionAtSFunct[26] = 3U;
-  rtb_TmpSignalConversionAtSFunct[27] = 3U;
-  rtb_TmpSignalConversionAtSFunct[28] = 3U;
-  rtb_TmpSignalConversionAtSFunct[29] = 5U;
-  rtb_TmpSignalConversionAtSFunct[30] = 2U;
-  rtb_TmpSignalConversionAtSFunct[31] = 4U;
-  rtb_TmpSignalConversionAtSFunct[32] = 0U;
-  rtb_TmpSignalConversionAtSFunct[33] = 0U;
-  rtb_TmpSignalConversionAtSFunct[34] = 0U;
-  rtb_TmpSignalConversionAtSFunct[35] = 0U;
-  rtb_TmpSignalConversionAtSFunct[36] = 0U;
-  rtb_TmpSignalConversionAtSFunct[37] = 0U;
-  rtb_TmpSignalConversionAtSFunct[38] = 0U;
-  rtb_TmpSignalConversionAtSFunct[39] = 0U;
-  rtb_TmpSignalConversionAtSFunct[40] = 0U;
-  rtb_TmpSignalConversionAtSFunct[41] = 0U;
-  rtb_TmpSignalConversionAtSFunct[42] = 0U;
-  rtb_TmpSignalConversionAtSFunct[43] = 0U;
-  rtb_TmpSignalConversionAtSFunct[44] = 0U;
-  rtb_TmpSignalConversionAtSFunct[45] = 0U;
-  rtb_TmpSignalConversionAtSFunct[46] = 0U;
-  rtb_TmpSignalConversionAtSFunct[47] = 0U;
-  rtb_TmpSignalConversionAtSFunct[48] = 0U;
-  rtb_TmpSignalConversionAtSFunct[49] = 0U;
-  rtb_TmpSignalConversionAtSFunct[50] = 2U;
-  rtb_TmpSignalConversionAtSFunct[51] = 4U;
-  rtb_TmpSignalConversionAtSFunct[52] = 4U;
-  rtb_TmpSignalConversionAtSFunct[53] = 4U;
-  rtb_TmpSignalConversionAtSFunct[54] = 4U;
-  rtb_TmpSignalConversionAtSFunct[55] = 4U;
-  rtb_TmpSignalConversionAtSFunct[56] = 4U;
-  rtb_TmpSignalConversionAtSFunct[57] = 2U;
-  rtb_TmpSignalConversionAtSFunct[58] = 2U;
-  rtb_TmpSignalConversionAtSFunct[59] = 3U;
-  rtb_TmpSignalConversionAtSFunct[60] = 0U;
-  rtb_TmpSignalConversionAtSFunct[61] = 0U;
-  rtb_TmpSignalConversionAtSFunct[62] = 0U;
-  rtb_TmpSignalConversionAtSFunct[63] = 0U;
-  rtb_TmpSignalConversionAtSFunct[64] = 0U;
-  rtb_TmpSignalConversionAtSFunct[65] = 0U;
-  rtb_TmpSignalConversionAtSFunct[66] = 0U;
-  rtb_TmpSignalConversionAtSFunct[67] = 0U;
-  rtb_TmpSignalConversionAtSFunct[68] = 0U;
-  rtb_TmpSignalConversionAtSFunct[69] = 0U;
-  rtb_TmpSignalConversionAtSFunct[70] = 4U;
-  rtb_TmpSignalConversionAtSFunct[71] = 2U;
-  rtb_TmpSignalConversionAtSFunct[72] = 0U;
-  rtb_TmpSignalConversionAtSFunct[73] = 0U;
-  rtb_TmpSignalConversionAtSFunct[74] = 0U;
-  rtb_TmpSignalConversionAtSFunct[75] = 0U;
-  rtb_TmpSignalConversionAtSFunct[76] = 0U;
-  rtb_TmpSignalConversionAtSFunct[77] = 0U;
-  rtb_TmpSignalConversionAtSFunct[78] = 0U;
-  rtb_TmpSignalConversionAtSFunct[79] = 0U;
-  rtb_TmpSignalConversionAtSFunct[80] = 4U;
-  rtb_TmpSignalConversionAtSFunct[81] = 3U;
-  rtb_TmpSignalConversionAtSFunct[82] = 4U;
-  rtb_TmpSignalConversionAtSFunct[83] = 3U;
-  rtb_TmpSignalConversionAtSFunct[84] = 3U;
-  rtb_TmpSignalConversionAtSFunct[85] = 2U;
-  rtb_TmpSignalConversionAtSFunct[86] = 4U;
-  rtb_TmpSignalConversionAtSFunct[87] = 3U;
-  rtb_TmpSignalConversionAtSFunct[88] = 4U;
-  rtb_TmpSignalConversionAtSFunct[89] = 3U;
-  rtb_TmpSignalConversionAtSFunct[90] = 0U;
-  rtb_TmpSignalConversionAtSFunct[91] = 0U;
-  rtb_TmpSignalConversionAtSFunct[92] = 0U;
-  rtb_TmpSignalConversionAtSFunct[93] = 0U;
-  rtb_TmpSignalConversionAtSFunct[94] = 0U;
-  rtb_TmpSignalConversionAtSFunct[95] = 0U;
-  rtb_TmpSignalConversionAtSFunct[96] = 0U;
-  rtb_TmpSignalConversionAtSFunct[97] = 0U;
-  rtb_TmpSignalConversionAtSFunct[98] = 0U;
-  rtb_TmpSignalConversionAtSFunct[99] = 0U;
-  rtb_TmpSignalConversionAtSFunct[100] = 4U;
-  rtb_TmpSignalConversionAtSFunct[101] = 3U;
-  rtb_TmpSignalConversionAtSFunct[102] = 4U;
-  rtb_TmpSignalConversionAtSFunct[103] = 3U;
-  rtb_TmpSignalConversionAtSFunct[104] = 3U;
-  rtb_TmpSignalConversionAtSFunct[105] = 1U;
-  rtb_TmpSignalConversionAtSFunct[106] = 4U;
-  rtb_TmpSignalConversionAtSFunct[107] = 3U;
-  rtb_TmpSignalConversionAtSFunct[108] = 4U;
-  rtb_TmpSignalConversionAtSFunct[109] = 3U;
-  rtb_TmpSignalConversionAtSFunct[110] = 4U;
-  rtb_TmpSignalConversionAtSFunct[111] = 3U;
-  rtb_TmpSignalConversionAtSFunct[112] = 4U;
-  rtb_TmpSignalConversionAtSFunct[113] = 3U;
-  rtb_TmpSignalConversionAtSFunct[114] = 4U;
-  rtb_TmpSignalConversionAtSFunct[115] = 3U;
-  rtb_TmpSignalConversionAtSFunct[116] = 1U;
-  rtb_TmpSignalConversionAtSFunct[117] = 1U;
-  rtb_TmpSignalConversionAtSFunct[118] = 0U;
-  rtb_TmpSignalConversionAtSFunct[119] = 0U;
-  rtb_TmpSignalConversionAtSFunct[120] = 0U;
-  rtb_TmpSignalConversionAtSFunct[121] = 0U;
-  rtb_TmpSignalConversionAtSFunct[122] = 0U;
-  rtb_TmpSignalConversionAtSFunct[123] = 0U;
-  rtb_TmpSignalConversionAtSFunct[124] = 0U;
-  rtb_TmpSignalConversionAtSFunct[125] = 0U;
-  rtb_TmpSignalConversionAtSFunct[126] = 0U;
-  rtb_TmpSignalConversionAtSFunct[127] = 0U;
-  rtb_TmpSignalConversionAtSFunct[128] = 0U;
-  rtb_TmpSignalConversionAtSFunct[129] = 0U;
-  rtb_TmpSignalConversionAtSFunct[130] = 4U;
-  rtb_TmpSignalConversionAtSFunct[131] = 4U;
-  rtb_TmpSignalConversionAtSFunct[132] = 3U;
-  rtb_TmpSignalConversionAtSFunct[133] = 0U;
-  rtb_TmpSignalConversionAtSFunct[134] = 0U;
-  rtb_TmpSignalConversionAtSFunct[135] = 0U;
-  rtb_TmpSignalConversionAtSFunct[136] = 0U;
-  rtb_TmpSignalConversionAtSFunct[137] = 0U;
-  rtb_TmpSignalConversionAtSFunct[138] = 0U;
-  rtb_TmpSignalConversionAtSFunct[139] = 0U;
-  rtb_TmpSignalConversionAtSFunct[140] = 3U;
-  rtb_TmpSignalConversionAtSFunct[141] = 0U;
-  rtb_TmpSignalConversionAtSFunct[142] = 0U;
-  rtb_TmpSignalConversionAtSFunct[143] = 0U;
-  rtb_TmpSignalConversionAtSFunct[144] = 0U;
-  rtb_TmpSignalConversionAtSFunct[145] = 0U;
-  rtb_TmpSignalConversionAtSFunct[146] = 0U;
-  rtb_TmpSignalConversionAtSFunct[147] = 0U;
-  rtb_TmpSignalConversionAtSFunct[148] = 0U;
-  rtb_TmpSignalConversionAtSFunct[149] = 0U;
-  rtb_TmpSignalConversionAtSFunct[150] = 2U;
-  rtb_TmpSignalConversionAtSFunct[151] = 2U;
-  rtb_TmpSignalConversionAtSFunct[152] = 2U;
-  rtb_TmpSignalConversionAtSFunct[153] = 1U;
-  rtb_TmpSignalConversionAtSFunct[154] = 1U;
-
-  /* SignalConversion generated from: '<S5>/ SFunction ' incorporates:
-   *  Chart: '<S3>/FltCodeArry'
-   *  Constant: '<S3>/Constant156'
-   *  Constant: '<S3>/Constant161'
-   *  Constant: '<S3>/Constant162'
-   *  Constant: '<S3>/Constant163'
-   *  Constant: '<S3>/Constant164'
-   *  Constant: '<S3>/Constant165'
-   *  Constant: '<S3>/Constant166'
-   *  Constant: '<S3>/Constant167'
-   *  Constant: '<S3>/Constant168'
-   *  Constant: '<S3>/Constant169'
-   *  Constant: '<S3>/Constant170'
-   *  Constant: '<S3>/Constant171'
-   *  Constant: '<S3>/Constant172'
-   *  Constant: '<S3>/Constant173'
-   *  Constant: '<S3>/Constant174'
-   *  Constant: '<S3>/Constant175'
-   *  Constant: '<S3>/Constant176'
-   *  Constant: '<S3>/Constant177'
-   *  Constant: '<S3>/Constant178'
-   *  Constant: '<S3>/Constant179'
-   *  Constant: '<S3>/Constant180'
-   *  Constant: '<S3>/Constant181'
-   *  Constant: '<S3>/Constant182'
-   *  Constant: '<S3>/Constant183'
-   *  Constant: '<S3>/Constant184'
-   *  Constant: '<S3>/Constant185'
-   *  Constant: '<S3>/Constant186'
-   *  Constant: '<S3>/Constant187'
-   *  Constant: '<S3>/Constant188'
-   *  Constant: '<S3>/Constant189'
-   *  Constant: '<S3>/Constant190'
-   *  Constant: '<S3>/Constant191'
-   *  Constant: '<S3>/Constant192'
-   *  Constant: '<S3>/Constant193'
-   *  Constant: '<S3>/Constant194'
-   *  Constant: '<S3>/Constant195'
-   *  Constant: '<S3>/Constant196'
-   *  Constant: '<S3>/Constant197'
-   *  Constant: '<S3>/Constant198'
-   *  Constant: '<S3>/Constant199'
-   *  Constant: '<S3>/Constant200'
-   *  Constant: '<S3>/Constant201'
-   *  Constant: '<S3>/Constant202'
-   *  Constant: '<S3>/Constant203'
-   *  Constant: '<S3>/Constant204'
-   *  Constant: '<S3>/Constant205'
-   *  Constant: '<S3>/Constant206'
-   *  Constant: '<S3>/Constant207'
-   *  Constant: '<S3>/Constant208'
-   *  Constant: '<S3>/Constant209'
-   *  Constant: '<S3>/Constant210'
-   *  Constant: '<S3>/Constant211'
-   *  Constant: '<S3>/Constant212'
-   *  Constant: '<S3>/Constant213'
-   *  Constant: '<S3>/Constant214'
-   *  Constant: '<S3>/Constant215'
-   *  Constant: '<S3>/Constant216'
-   *  Constant: '<S3>/Constant217'
-   *  Constant: '<S3>/Constant218'
-   *  Constant: '<S3>/Constant219'
-   *  Constant: '<S3>/Constant220'
-   *  Constant: '<S3>/Constant221'
-   *  Constant: '<S3>/Constant222'
-   *  Constant: '<S3>/Constant223'
-   *  Constant: '<S3>/Constant224'
-   *  Constant: '<S3>/Constant225'
-   *  Constant: '<S3>/Constant226'
-   *  Constant: '<S3>/Constant227'
-   *  Constant: '<S3>/Constant228'
-   *  Constant: '<S3>/Constant229'
-   *  Constant: '<S3>/Constant230'
-   *  Constant: '<S3>/Constant231'
-   *  Constant: '<S3>/Constant232'
-   *  Constant: '<S3>/Constant233'
-   *  Constant: '<S3>/Constant234'
-   *  Constant: '<S3>/Constant235'
-   *  Constant: '<S3>/Constant236'
-   *  Constant: '<S3>/Constant237'
-   *  Constant: '<S3>/Constant238'
-   *  Constant: '<S3>/Constant239'
-   *  Constant: '<S3>/Constant240'
-   *  Constant: '<S3>/Constant241'
-   *  Constant: '<S3>/Constant242'
-   *  Constant: '<S3>/Constant243'
-   *  Constant: '<S3>/Constant244'
-   *  Constant: '<S3>/Constant245'
-   *  Constant: '<S3>/Constant246'
-   *  Constant: '<S3>/Constant247'
-   *  Constant: '<S3>/Constant248'
-   *  Constant: '<S3>/Constant249'
-   *  Constant: '<S3>/Constant250'
-   *  Constant: '<S3>/Constant251'
-   *  Constant: '<S3>/Constant252'
-   *  Constant: '<S3>/Constant253'
-   *  Constant: '<S3>/Constant254'
-   *  Constant: '<S3>/Constant255'
-   *  Constant: '<S3>/Constant256'
-   *  Constant: '<S3>/Constant257'
-   *  Constant: '<S3>/Constant258'
-   *  Constant: '<S3>/Constant259'
-   *  Constant: '<S3>/Constant260'
-   *  Constant: '<S3>/Constant261'
-   *  Constant: '<S3>/Constant262'
-   *  Constant: '<S3>/Constant263'
-   *  Constant: '<S3>/Constant264'
-   *  Constant: '<S3>/Constant265'
-   *  Constant: '<S3>/Constant266'
-   *  Constant: '<S3>/Constant267'
-   *  Constant: '<S3>/Constant268'
-   *  Constant: '<S3>/Constant269'
-   *  Constant: '<S3>/Constant270'
-   *  Constant: '<S3>/Constant271'
-   *  Constant: '<S3>/Constant272'
-   *  Constant: '<S3>/Constant273'
-   *  Constant: '<S3>/Constant274'
-   *  Constant: '<S3>/Constant275'
-   *  Constant: '<S3>/Constant276'
-   *  Constant: '<S3>/Constant277'
-   *  Constant: '<S3>/Constant278'
-   *  Constant: '<S3>/Constant279'
-   *  Constant: '<S3>/Constant280'
-   *  Constant: '<S3>/Constant281'
-   *  Constant: '<S3>/Constant282'
-   *  Constant: '<S3>/Constant283'
-   *  Constant: '<S3>/Constant284'
-   *  Constant: '<S3>/Constant285'
-   *  Constant: '<S3>/Constant286'
-   *  Constant: '<S3>/Constant287'
-   *  Constant: '<S3>/Constant288'
-   *  Constant: '<S3>/Constant289'
-   *  Constant: '<S3>/Constant290'
-   *  Constant: '<S3>/Constant291'
-   *  Constant: '<S3>/Constant292'
-   *  Constant: '<S3>/Constant293'
-   *  Constant: '<S3>/Constant294'
-   *  Constant: '<S3>/Constant295'
-   *  Constant: '<S3>/Constant296'
-   *  Constant: '<S3>/Constant297'
-   *  Constant: '<S3>/Constant298'
-   *  Constant: '<S3>/Constant299'
-   *  Constant: '<S3>/Constant300'
-   *  Constant: '<S3>/Constant301'
-   *  Constant: '<S3>/Constant302'
-   *  Constant: '<S3>/Constant303'
-   *  Constant: '<S3>/Constant304'
-   *  Constant: '<S3>/Constant305'
-   *  Constant: '<S3>/Constant306'
-   *  Constant: '<S3>/Constant307'
-   *  Constant: '<S3>/Constant308'
-   *  Constant: '<S3>/Constant309'
-   *  Constant: '<S3>/Constant310'
-   *  Constant: '<S3>/Constant311'
-   *  Constant: '<S3>/Constant312'
-   *  Constant: '<S3>/Constant313'
-   *  Constant: '<S3>/Constant314'
-   */
-  rtb_TmpSignalConversionAtSFun_l[0] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[1] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[2] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[3] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[4] = 34U;
-  rtb_TmpSignalConversionAtSFun_l[5] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[6] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[7] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[8] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[9] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[10] = 254U;
-  rtb_TmpSignalConversionAtSFun_l[11] = 254U;
-  rtb_TmpSignalConversionAtSFun_l[12] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[13] = 254U;
-  rtb_TmpSignalConversionAtSFun_l[14] = 1U;
-  rtb_TmpSignalConversionAtSFun_l[15] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[16] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[17] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[18] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[19] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[20] = 254U;
-  rtb_TmpSignalConversionAtSFun_l[21] = 106U;
-  rtb_TmpSignalConversionAtSFun_l[22] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[23] = 106U;
-  rtb_TmpSignalConversionAtSFun_l[24] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[25] = 18U;
-  rtb_TmpSignalConversionAtSFun_l[26] = 18U;
-  rtb_TmpSignalConversionAtSFun_l[27] = 18U;
-  rtb_TmpSignalConversionAtSFun_l[28] = 18U;
-  rtb_TmpSignalConversionAtSFun_l[29] = 250U;
-  rtb_TmpSignalConversionAtSFun_l[30] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[31] = 106U;
-  rtb_TmpSignalConversionAtSFun_l[32] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[33] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[34] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[35] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[36] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[37] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[38] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[39] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[40] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[41] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[42] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[43] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[44] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[45] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[46] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[47] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[48] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[49] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[50] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[51] = 234U;
-  rtb_TmpSignalConversionAtSFun_l[52] = 122U;
-  rtb_TmpSignalConversionAtSFun_l[53] = 66U;
-  rtb_TmpSignalConversionAtSFun_l[54] = 34U;
-  rtb_TmpSignalConversionAtSFun_l[55] = 66U;
-  rtb_TmpSignalConversionAtSFun_l[56] = 34U;
-  rtb_TmpSignalConversionAtSFun_l[57] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[58] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[59] = 18U;
-  rtb_TmpSignalConversionAtSFun_l[60] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[61] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[62] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[63] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[64] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[65] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[66] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[67] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[68] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[69] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[70] = 122U;
-  rtb_TmpSignalConversionAtSFun_l[71] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[72] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[73] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[74] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[75] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[76] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[77] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[78] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[79] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[80] = 66U;
-  rtb_TmpSignalConversionAtSFun_l[81] = 66U;
-  rtb_TmpSignalConversionAtSFun_l[82] = 234U;
-  rtb_TmpSignalConversionAtSFun_l[83] = 131U;
-  rtb_TmpSignalConversionAtSFun_l[84] = 3U;
-  rtb_TmpSignalConversionAtSFun_l[85] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[86] = 66U;
-  rtb_TmpSignalConversionAtSFun_l[87] = 66U;
-  rtb_TmpSignalConversionAtSFun_l[88] = 162U;
-  rtb_TmpSignalConversionAtSFun_l[89] = 131U;
-  rtb_TmpSignalConversionAtSFun_l[90] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[91] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[92] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[93] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[94] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[95] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[96] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[97] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[98] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[99] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[100] = 250U;
-  rtb_TmpSignalConversionAtSFun_l[101] = 145U;
-  rtb_TmpSignalConversionAtSFun_l[102] = 234U;
-  rtb_TmpSignalConversionAtSFun_l[103] = 3U;
-  rtb_TmpSignalConversionAtSFun_l[104] = 3U;
-  rtb_TmpSignalConversionAtSFun_l[105] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[106] = 250U;
-  rtb_TmpSignalConversionAtSFun_l[107] = 19U;
-  rtb_TmpSignalConversionAtSFun_l[108] = 250U;
-  rtb_TmpSignalConversionAtSFun_l[109] = 19U;
-  rtb_TmpSignalConversionAtSFun_l[110] = 106U;
-  rtb_TmpSignalConversionAtSFun_l[111] = 3U;
-  rtb_TmpSignalConversionAtSFun_l[112] = 106U;
-  rtb_TmpSignalConversionAtSFun_l[113] = 3U;
-  rtb_TmpSignalConversionAtSFun_l[114] = 250U;
-  rtb_TmpSignalConversionAtSFun_l[115] = 146U;
-  rtb_TmpSignalConversionAtSFun_l[116] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[117] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[118] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[119] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[120] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[121] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[122] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[123] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[124] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[125] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[126] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[127] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[128] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[129] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[130] = 66U;
-  rtb_TmpSignalConversionAtSFun_l[131] = 34U;
-  rtb_TmpSignalConversionAtSFun_l[132] = 18U;
-  rtb_TmpSignalConversionAtSFun_l[133] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[134] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[135] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[136] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[137] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[138] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[139] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[140] = 131U;
-  rtb_TmpSignalConversionAtSFun_l[141] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[142] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[143] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[144] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[145] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[146] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[147] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[148] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[149] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[150] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[151] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[152] = 2U;
-  rtb_TmpSignalConversionAtSFun_l[153] = 0U;
-  rtb_TmpSignalConversionAtSFun_l[154] = 0U;
-
-  /* Chart: '<S3>/FltCodeArry' incorporates:
-   *  Constant: '<S3>/Constant'
-   *  Constant: '<S3>/Constant266'
-   *  Constant: '<S3>/Constant315'
-   *  Constant: '<S3>/Constant317'
-   *  Constant: '<S3>/Constant53'
-   *  SignalConversion generated from: '<S5>/ SFunction '
-   */
-  avrgU = 0U;
-  sfmd_num_fltNum = 0U;
-  for (i_0 = 0; i_0 < 20; i_0++) {
-    FltCodeArr[i_0] = 0U;
-    rtb_FltLevelArr[i_0] = 0U;
-    rtb_FltActArr[i_0] = 0U;
-    FltCodeArrS[i_0] = 0U;
-  }
-
-  while (avrgU < 155) {
-    if (rtb_TmpSignalConversionAtSFun_a[avrgU] && (sfmd_num_fltNum <
-         sfmc_num_fltNumMax)) {
-      FltCodeArr[sfmd_num_fltNum] = (uint16_T)(avrgU + 1);
-      rtb_FltLevelArr[sfmd_num_fltNum] = rtb_TmpSignalConversionAtSFunct[avrgU];
-      rtb_FltActArr[sfmd_num_fltNum] = rtb_TmpSignalConversionAtSFun_l[avrgU];
-      sfmd_num_fltNum = (uint16_T)(sfmd_num_fltNum + 1);
-      if (avrgU == 51) {
-        for (k = 0U; k < cmnc_num_cellUNum; k++) {
-          if (SFM_B.ErrFlg[k]) {
-            FltCodeArr[sfmd_num_fltNum] = (uint16_T)(k + 2001);
-            rtb_FltLevelArr[sfmd_num_fltNum] = 4U;
-            rtb_FltActArr[sfmd_num_fltNum] = 234U;
-            i_0 = sfmd_num_fltNum + 1;
-            if (sfmd_num_fltNum + 1 > 65535) {
-              i_0 = 65535;
+    // 71 电流传感器故障
+    sfmd_flg_currOpenFlt = !sfmd_flg_interComFlt && (ihd_flg_currOpenFlt || ihd_I_curr < -3250);
+    if (!sfmd_flg_currOpenFlt && !sfmd_flg_interComFlt)
+    {
+        sfmd_I_curr =  ihd_I_curr;
+    }
+    else
+    {
+        sfmd_I_curr = 0;
+    }
+    
+    
+    //81 单体过压故障2级
+    sfmd_flg_cellUOverFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt,sfmd_V_cellUMax,sfmc_V_cellUOverThrFlt2,sfmc_V_cellUOverThrRec2,15,15,&DiagThr.fltNum81,&DiagThr.recNum81,&sfmd_flg_cellUOverFlt2);
+    //82 单体过压故障1级
+    sfmd_flg_cellUOverFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt,sfmd_V_cellUMax,sfmc_V_cellUOverThrFlt1,sfmc_V_cellUOverThrRec1,15,15,&DiagThr.fltNum82,&DiagThr.recNum82,&sfmd_flg_cellUOverFlt1) && !sfmd_flg_cellUOverFlt2;
+    
+    //83 单体欠压故障2级
+    sfmd_flg_cellULowFlt2 =DiagThrSystem2(1,!sfmd_flg_interComFlt,sfmd_V_cellUMin,sfmc_V_cellULowThrFlt2,sfmc_V_cellULowThrRec2,15,15,&DiagThr.fltNum83,&DiagThr.recNum83,&sfmd_flg_cellULowFlt2);
+    //84 单体欠压故障1级
+    sfmd_flg_cellULowFlt1 =DiagThrSystem2(0,!sfmd_flg_interComFlt,sfmd_V_cellUMin,sfmc_V_cellULowThrFlt1,sfmc_V_cellULowThrRec1,15,15,&DiagThr.fltNum84,&DiagThr.recNum84,&sfmd_flg_cellULowFlt1) && !sfmd_flg_cellULowFlt2;
+    
+    //85 压差过大2级
+    sfmd_flg_cellUDiffFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt,sfmd_V_cellUMax - sfmd_V_cellUMin,sfmc_flg_cellUDiffThrFlt2,sfmc_flg_cellUDiffThrRec2,15,15,&DiagThr.fltNum85,&DiagThr.recNum85,&sfmd_flg_cellUDiffFlt2);
+    //86 压差过大1级
+    sfmd_flg_cellUDiffFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt,sfmd_V_cellUMax - sfmd_V_cellUMin,sfmc_flg_cellUDiffThrFlt1,sfmc_flg_cellUDiffThrRec1,15,15,&DiagThr.fltNum86,&DiagThr.recNum86,&sfmd_flg_cellUDiffFlt1) && !sfmd_flg_cellUDiffFlt2;
+    
+    //87 总压过压2级
+    sfmd_flg_battUOverFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt,sfmd_V_battU,sfmc_V_battUOverThrFlt2,sfmc_V_battUOverThrRec2,15,15,&DiagThr.fltNum87,&DiagThr.recNum87,&sfmd_flg_battUOverFlt2);
+    //88 总压过压1级
+    sfmd_flg_battUOverFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt,sfmd_V_battU,sfmc_V_battUOverThrFlt1,sfmc_V_battUOverThrRec1,15,15,&DiagThr.fltNum88,&DiagThr.recNum88,&sfmd_flg_battUOverFlt1) && !sfmd_flg_battUOverFlt2;
+    
+    //89 总压欠压2级
+    sfmd_flg_battULowFlt2 =DiagThrSystem2(1,!sfmd_flg_interComFlt,sfmd_V_battU,sfmc_V_battULowThrFlt2,sfmc_V_battULowThrRec2,15,15,&DiagThr.fltNum89,&DiagThr.recNum89,&sfmd_flg_battULowFlt2);
+    //90 总压欠压1级
+    sfmd_flg_battULowFlt1 =DiagThrSystem2(0,!sfmd_flg_interComFlt,sfmd_V_battU,sfmc_V_battULowThrFlt1,sfmc_V_battULowThrRec1,15,15,&DiagThr.fltNum90,&DiagThr.recNum90,&sfmd_flg_battULowFlt1) && !sfmd_flg_battULowFlt2;
+
+	chrgFlg = ihd_st_workStat == 2;
+    disChrgFlg = ihd_st_workStat != 2;
+    //97 模组充电温度过高2级故障
+    sfmd_flg_chrgModTOverFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt&&chrgFlg,sfmd_T_modTMax,sfmc_T_chrgModTOverThrFlt2,sfmc_T_chrgModTOverThrRec2,25,25,&DiagThr.fltNum97,&DiagThr.recNum97,&sfmd_flg_chrgModTOverFlt2);
+    //98 模组充电温度过高1级故障
+    sfmd_flg_chrgModTOverFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt&&chrgFlg,sfmd_T_modTMax,sfmc_T_chrgModTOverThrFlt1,sfmc_T_chrgModTOverThrRec1,25,25,&DiagThr.fltNum98,&DiagThr.recNum98,&sfmd_flg_chrgModTOverFlt1) && !sfmd_flg_chrgModTOverFlt2;
+    //99 模组充电温度过低2级故障
+    sfmd_flg_chrgModTLowFlt2 =DiagThrSystem2(1,!sfmd_flg_interComFlt&&chrgFlg,sfmd_T_modTMin,sfmc_T_chrgModTLowThrFlt2,sfmc_T_chrgModTLowThrRec2,25,25,&DiagThr.fltNum99,&DiagThr.recNum99,&sfmd_flg_chrgModTLowFlt2);
+    //100 模组充电温度过低1级故障
+    sfmd_flg_chrgModTLowFlt1 =DiagThrSystem2(0,!sfmd_flg_interComFlt&&chrgFlg,sfmd_T_modTMin,sfmc_T_chrgModTLowThrFlt1,sfmc_T_chrgModTLowThrRec1,25,25,&DiagThr.fltNum100,&DiagThr.recNum100,&sfmd_flg_chrgModTLowFlt1) && !sfmd_flg_chrgModTLowFlt2;
+    
+    //101 模组放电温度过高2级故障
+    sfmd_flg_disChrgModTOverFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt&&disChrgFlg,sfmd_T_modTMax,sfmc_T_disChrgModTOverThrFlt2,sfmc_T_disChrgModTOverThrRec2,25,25,&DiagThr.fltNum101,&DiagThr.recNum101,&sfmd_flg_disChrgModTOverFlt2);
+    //102 模组放电温度过高1级故障
+    sfmd_flg_disChrgModTOverFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt&&disChrgFlg,sfmd_T_modTMax,sfmc_T_disChrgModTOverThrFlt1,sfmc_T_disChrgModTOverThrRec1,25,25,&DiagThr.fltNum102,&DiagThr.recNum102,&sfmd_flg_disChrgModTOverFlt1) && !sfmd_flg_disChrgModTOverFlt2;
+    //103 模组放电温度过低2级故障
+    sfmd_flg_disChrgModTLowFlt2 =DiagThrSystem2(1,!sfmd_flg_interComFlt&&disChrgFlg,sfmd_T_modTMin,sfmc_T_disChrgModTLowThrFlt2,sfmc_T_disChrgModTLowThrRec2,25,25,&DiagThr.fltNum103,&DiagThr.recNum103,&sfmd_flg_disChrgModTLowFlt2);
+    //104 模组放电温度过低1级故障
+    sfmd_flg_disChrgModTLowFlt1 =DiagThrSystem2(0,!sfmd_flg_interComFlt&&disChrgFlg,sfmd_T_modTMin,sfmc_T_disChrgModTLowThrFlt1,sfmc_T_disChrgModTLowThrRec1,25,25,&DiagThr.fltNum104,&DiagThr.recNum104,&sfmd_flg_disChrgModTLowFlt1) && !sfmd_flg_disChrgModTLowFlt2;
+    
+    //
+    //105 模组温差2级故障
+    sfmd_flg_modTDiffFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt,sfmd_T_modTMax - sfmd_T_modTMin,sfmc_T_modTDiffThrFlt2,sfmc_T_modTDiffThrRec2,25,25,&DiagThr.fltNum105,&DiagThr.recNum105,&sfmd_flg_modTDiffFlt2);
+    //106 模组温差1级故障
+    sfmd_flg_modTDiffFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt,sfmd_T_modTMax - sfmd_T_modTMin,sfmc_T_modTDiffThrFlt1,sfmc_T_modTDiffThrRec1,25,25,&DiagThr.fltNum106,&DiagThr.recNum106,&sfmd_flg_modTDiffFlt1) && !sfmd_flg_modTDiffFlt2;
+    
+    
+    //107 充电Mos温度过高2级故障
+    sfmd_flg_chrgMosTOverFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt && chrgFlg && sfmd_flg_chrgMosTRationFlt && sfmd_flg_chrgMosTOpenFlt,ihd_T_mosT,sfmc_T_chrgMosTOverThrFlt2,sfmc_T_chrgMosTOverThrRec2,25,25,&DiagThr.fltNum107,&DiagThr.recNum107,&sfmd_flg_chrgMosTOverFlt2);
+    //108 充电Mos温度过高1级故障
+    sfmd_flg_chrgMosTOverFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt && chrgFlg && sfmd_flg_chrgMosTRationFlt && sfmd_flg_chrgMosTOpenFlt,ihd_T_mosT,sfmc_T_chrgMosTOverThrFlt1,sfmc_T_chrgMosTOverThrRec1,25,25,&DiagThr.fltNum108,&DiagThr.recNum108,&sfmd_flg_chrgMosTOverFlt1) && !sfmd_flg_chrgMosTOverFlt2;
+    //109 放电Mos温度过高2级故障
+    sfmd_flg_disChrgMosTOverFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt && disChrgFlg && sfmd_flg_chrgMosTRationFlt && sfmd_flg_chrgMosTOpenFlt,ihd_T_mosT,sfmc_T_disChrgMosTOverThrFlt2,sfmc_T_disChrgMosTOverThrRec2,25,25,&DiagThr.fltNum109,&DiagThr.recNum109,&sfmd_flg_disChrgMosTOverFlt2);
+    //110 放电Mos温度过高1级故障
+    sfmd_flg_disChrgMosTOverFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt && disChrgFlg && sfmd_flg_chrgMosTRationFlt && sfmd_flg_chrgMosTOpenFlt,ihd_T_mosT,sfmc_T_disChrgMosTOverThrFlt1,sfmc_T_disChrgMosTOverThrRec1,25,25,&DiagThr.fltNum110,&DiagThr.recNum110,&sfmd_flg_disChrgMosTOverFlt1) && !sfmd_flg_disChrgMosTOverFlt2;
+    
+    
+    //111 快充插头温度过高2级故障
+    sfmd_flg_DCPlugTOverFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt  && sfmd_flg_DCPlugTRationFlt && sfmd_flg_DCPlugTOpenFlt,ihd_T_DCPlugT,sfmc_T_DCPlugTOverThrFlt2,sfmc_T_DCPlugTOverThrRec2,25,25,&DiagThr.fltNum111,&DiagThr.recNum111,&sfmd_flg_DCPlugTOverFlt2);
+    //112 快充插头温度过高1级故障
+    sfmd_flg_DCPlugTOverFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt  && sfmd_flg_DCPlugTRationFlt && sfmd_flg_DCPlugTOpenFlt,ihd_T_DCPlugT,sfmc_T_DCPlugTOverThrFlt1,sfmc_T_DCPlugTOverThrRec1,25,25,&DiagThr.fltNum112,&DiagThr.recNum112,&sfmd_flg_DCPlugTOverFlt1) && !sfmd_flg_DCPlugTOverFlt2;
+    //113 慢充插头温度过高2级故障
+    sfmd_flg_ACPlugTOverFlt2 =DiagThrSystem1(1,!sfmd_flg_interComFlt && sfmd_flg_ACPlugTRationFlt && sfmd_flg_ACPlugTOpenFlt,ihd_T_ACPlugT,sfmc_T_ACPlugTOverThrFlt2,sfmc_T_ACPlugTOverThrRec2,25,25,&DiagThr.fltNum113,&DiagThr.recNum113,&sfmd_flg_ACPlugTOverFlt2);
+    //114 慢充插头温度过高1级故障
+    sfmd_flg_ACPlugTOverFlt1 =DiagThrSystem1(0,!sfmd_flg_interComFlt && sfmd_flg_ACPlugTRationFlt && sfmd_flg_ACPlugTOpenFlt,ihd_T_ACPlugT,sfmc_T_ACPlugTOverThrFlt1,sfmc_T_ACPlugTOverThrRec1,25,25,&DiagThr.fltNum114,&DiagThr.recNum114,&sfmd_flg_ACPlugTOverFlt1) && !sfmd_flg_ACPlugTOverFlt2;
+    
+    //115 加热板温度过高2级故障
+    sfmd_flg_heatPanTOverFlt2_1 =DiagThrSystem1(1,!sfmd_flg_interComFlt && sfmd_flg_heatPanT1RationFlt && sfmd_flg_heatPanT1OpenFlt,ihd_T_heatPanT1,sfmc_T_heatPanTOverThrFlt2,sfmc_T_heatPanTOverThrRec2,25,25,&DiagThr.fltNum115_1,&DiagThr.recNum115_1,&sfmd_flg_heatPanTOverFlt2_1);
+    sfmd_flg_heatPanTOverFlt2_2 =DiagThrSystem1(1,!sfmd_flg_interComFlt && sfmd_flg_heatPanT2RationFlt && sfmd_flg_heatPanT2OpenFlt,ihd_T_heatPanT2,sfmc_T_heatPanTOverThrFlt2,sfmc_T_heatPanTOverThrRec2,25,25,&DiagThr.fltNum115_2,&DiagThr.recNum115_2,&sfmd_flg_heatPanTOverFlt2_2);
+    sfmd_flg_heatPanTOverFlt2 = sfmd_flg_heatPanTOverFlt2_1 || sfmd_flg_heatPanTOverFlt2_2;
+    //116 加热板温度过高1级故障
+    sfmd_flg_heatPanTOverFlt1_1 =DiagThrSystem1(0,!sfmd_flg_interComFlt && sfmd_flg_heatPanT1RationFlt && sfmd_flg_heatPanT1OpenFlt,ihd_T_heatPanT1,sfmc_T_heatPanTOverThrFlt1,sfmc_T_heatPanTOverThrRec1,25,25,&DiagThr.fltNum116_1,&DiagThr.recNum116_1,&sfmd_flg_heatPanTOverFlt1_1) && !sfmd_flg_heatPanTOverFlt2;
+    sfmd_flg_heatPanTOverFlt1_2 =DiagThrSystem1(0,!sfmd_flg_interComFlt && sfmd_flg_heatPanT2RationFlt && sfmd_flg_heatPanT2OpenFlt,ihd_T_heatPanT2,sfmc_T_heatPanTOverThrFlt1,sfmc_T_heatPanTOverThrRec1,25,25,&DiagThr.fltNum116_2,&DiagThr.recNum116_2,&sfmd_flg_heatPanTOverFlt1_2) && !sfmd_flg_heatPanTOverFlt2;
+    sfmd_flg_heatPanTOverFlt1 = sfmd_flg_heatPanTOverFlt1_1 || sfmd_flg_heatPanTOverFlt1_2;
+    
+    sfmd_I_currAbs = (uint16_T) (sfmd_I_curr > 0 ? sfmd_I_curr : -sfmd_I_curr);
+    //131 充电电流过高
+    sfmd_flg_chrgCurrOverFlt = DiagThrSystem1(1,!sfmd_flg_interComFlt && chrgFlg && !sfmd_flg_currOpenFlt,sfmd_I_currAbs,sfmc_I_chrgCurrOverThr,sfmc_I_chrgCurrOverThr,20,20,&DiagThr.fltNum131,&DiagThr.recNum131,&sfmd_flg_chrgCurrOverFlt);
+    //132 放电电流过高
+    sfmd_flg_disChrgCurrOverFlt = DiagThrSystem1(1,!sfmd_flg_interComFlt && disChrgFlg && !sfmd_flg_currOpenFlt,sfmd_I_currAbs,sfmc_I_disChrgCurrOverThr,sfmc_I_disChrgCurrOverThr,20,20,&DiagThr.fltNum132,&DiagThr.recNum132,&sfmd_flg_disChrgCurrOverFlt);
+    
+    //151 充电过流故障不匹配
+    sfmd_flg_chrgCurrOverMisFlt = MisMatich( sfmd_flg_chrgCurrOverFlt,  ihd_flg_chrgCurrOverFlt,  &DiagMis.N151);
+    //152 放电过流故障不匹配
+    sfmd_flg_disChrgCurrOverMisFlt = MisMatich( sfmd_flg_disChrgCurrOverFlt,  ihd_flg_disChrgCurrOverFlt,  &DiagMis.N152);
+    //153 总压欠压不匹配
+    sfmd_flg_battULowMisFlt = MisMatich( sfmd_flg_battULowFlt2,  ihd_flg_battULowFlt,  &DiagMis.N153);
+    //154 总压过压不匹配
+    sfmd_flg_battUOverMisFlt = MisMatich( sfmd_flg_battUOverFlt2,  ihd_flg_battUOverFlt,  &DiagMis.N154);
+    
+    //155 单体欠压故障不匹配
+    sfmd_flg_cellULowMisFlt = MisMatich( sfmd_flg_cellULowFlt2,  ihd_flg_cellULowFlt,  &DiagMis.N155);
+    //156 单体过压故障不匹配
+    sfmd_flg_cellUOverMisFlt = MisMatich( sfmd_flg_cellUOverFlt2,  ihd_flg_cellUOverFlt,  &DiagMis.N156);
+    
+    //157 充电模组过温故障不匹配
+    sfmd_flg_chrgModTOverMisFlt = MisMatich( sfmd_flg_chrgModTOverFlt2,  ihd_flg_chrgModTOverFlt,  &DiagMis.N157);
+    //158 充电模组低温故障不匹配
+    sfmd_flg_chrgModTLowMisFlt = MisMatich( sfmd_flg_chrgModTLowFlt2,  ihd_flg_chrgModTLowFlt,  &DiagMis.N158);
+    //159 放电模组过温故障不匹配
+    sfmd_flg_disChrgModTOverMisFlt = MisMatich( sfmd_flg_disChrgModTOverFlt2,  ihd_flg_disChrgModTOverFlt,  &DiagMis.N159);
+    //160 放电模组低温故障不匹配
+    sfmd_flg_disChrgModTLowMisFlt = MisMatich( sfmd_flg_disChrgModTLowFlt2,  ihd_flg_disChrgModTLowFlt,  &DiagMis.N160);
+    
+    //161 充电Mos过温故障不匹配
+    sfmd_flg_chrgMosTOverMisFlt = MisMatich( sfmd_flg_chrgMosTOverFlt2,  ihd_flg_chrgMosTOverFlt,  &DiagMis.N161);
+    //162 放电Mos过温故障不匹配
+    sfmd_flg_disChrgMosTOverMisFlt = MisMatich( sfmd_flg_disChrgMosTOverFlt2,  ihd_flg_disChrgMosTOverFlt,  &DiagMis.N162);
+    
+    
+    //163 soc不匹配
+    sfmd_flg_socMisFlt =(!sfmd_flg_interComFlt) && ( (int16_T) (socd_pct_bcuSoc -ihd_pct_soc ) > 100 || (int16_T) (socd_pct_bcuSoc -ihd_pct_soc ) <- 100);
+    //164 SOH 不匹配
+    sfmd_flg_sohMisFlt =(!sfmd_flg_interComFlt) && ( (int16_T) (sohd_pct_bcuSoh -ihd_pct_soh ) > 50  || (int16_T) (sohd_pct_bcuSoh -ihd_pct_soh ) <  -50);
+    
+    
+    //179 soc跳变
+    sfmd_flg_socJumpFlt = (int16_T) (socd_pct_bcuSoc - socd_pct_bcuSoc_Delay) >50 ||(int16_T) (socd_pct_bcuSoc - socd_pct_bcuSoc_Delay) <-50;
+    socd_pct_bcuSoc_Delay = socd_pct_bcuSoc;
+    //180 EE失效
+    sfmd_flg_EEsaveFlt = ihd_flg_EESaveFlt ;
+    
+    
+    
+    //================================================================================================================================================================
+    //================================================================================================================================================================
+    //===========故障码                                  故障等级                           禁止状态===================================================================
+    //================================================================================================================================================================
+    memset(FltFlg,0,sizeof(FltFlg));
+    memset(FltLevel,0,sizeof(FltLevel));
+    memset(FltAct,0,sizeof(FltAct));
+
+	
+    FltFlg[0] = sfmd_flg_interComFlt;                FltLevel[0] = 2;          FltAct[0] = 2;       //1 内网通讯故障
+    FltFlg[1] = 0;                                   FltLevel[1] = 2;          FltAct[1] = 2;       //2 外部通讯故障
+    FltFlg[2] = 0;                                   FltLevel[2] = 2;          FltAct[2] = 2;       //3 通讯模块故障
+    FltFlg[3] = 0;                                   FltLevel[3] = 0;          FltAct[3] = 0;       //4 通讯天线故障
+    FltFlg[4] = sfmd_flg_authFlt;                    FltLevel[4] = 4;          FltAct[4] = 34;      //5 认证失败
+    FltFlg[5] = 0;                                   FltLevel[5] = 0;          FltAct[5] = 0;       //6 预留#5
+    FltFlg[6] = 0;                                   FltLevel[6] = 0;          FltAct[6] = 0;       //7 预留#4
+    FltFlg[7] = 0;                                   FltLevel[7] = 0;          FltAct[7] = 0;       //8 预留#3
+    FltFlg[8] = 0;                                   FltLevel[8] = 0;          FltAct[8] = 0;       //9  预留#2
+    FltFlg[9] = 0;                                   FltLevel[9] = 0;          FltAct[9] = 0;       //10 预留#1
+    
+    FltFlg[10] = sfmd_flg_HVILFlt;                   FltLevel[10] = 5;        FltAct[10] = 254;     //11 高压互锁
+    FltFlg[11] = 0;                                  FltLevel[11] = 0;        FltAct[11] = 0;       //12 硬件短路保护
+    FltFlg[12] = 0;                                  FltLevel[12] = 0;        FltAct[12] = 0;       //13 绝缘模块故障
+    FltFlg[13] = 0;                                  FltLevel[13] = 0;        FltAct[13] = 0;       //4 绝缘故障
+    FltFlg[14] = 0;                                  FltLevel[14] = 0;        FltAct[14] = 0;       //15 绝缘告警
+    FltFlg[15] = 0;                                  FltLevel[15] = 0;        FltAct[15] = 0;       //16 预留5
+    FltFlg[16] = 0;                                  FltLevel[16] = 0;        FltAct[16] = 0;       //17 预留4
+    FltFlg[17] = 0;                                  FltLevel[17] = 0;        FltAct[17] = 0;       //18 预留3
+    FltFlg[18] = 0;                                  FltLevel[18] = 0;        FltAct[18] = 0;       //19 预留2
+    FltFlg[19] = 0;                                  FltLevel[19] = 0;        FltAct[19] = 0;       //20 预留1
+    
+    FltFlg[20] = 0;                                  FltLevel[20] = 0;        FltAct[20] = 0;       //21 热失控;
+    FltFlg[21] = sfmd_flg_chrgMosClosFlt;            FltLevel[21] = 4;        FltAct[21] = 106;     //22充电MOS常开故障
+    FltFlg[22] = 0;                                  FltLevel[22] = 2;        FltAct[22] = 2;       //23充电MOS常闭故障
+    FltFlg[23] = sfmd_flg_disChrgMosClosFlt;         FltLevel[23] = 4;        FltAct[23] = 106;     //24 放电Mos常开故障
+    FltFlg[24] = 0;                                  FltLevel[24] = 2;        FltAct[24] = 2;       //25 放电Mos常闭故障
+    FltFlg[25] = 0;                                  FltLevel[25] = 0;        FltAct[25] = 0;
+    FltFlg[26] = 0;                                  FltLevel[26] = 0;        FltAct[26] = 0;
+    FltFlg[27] = 0;                                  FltLevel[27] = 0;        FltAct[27] = 0;
+    FltFlg[28] = 0;                                  FltLevel[28] = 0;        FltAct[28] = 0;
+    FltFlg[29] = 0;                                  FltLevel[29] = 0;        FltAct[29] = 0;
+    FltFlg[30] = 0;                                  FltLevel[30] = 0;        FltAct[30] = 0;
+    FltFlg[31] = 0;                                  FltLevel[31] = 0;        FltAct[31] = 0;
+    FltFlg[32] = 0;                                  FltLevel[32] = 0;        FltAct[32] = 0;
+    FltFlg[33] = 0;                                  FltLevel[33] = 0;        FltAct[33] = 0;
+    FltFlg[34] = 0;                                  FltLevel[34] = 0;        FltAct[34] = 0;
+    FltFlg[35] = 0;                                  FltLevel[35] = 0;        FltAct[35] = 0;
+    FltFlg[36] = 0;                                  FltLevel[36] = 0;        FltAct[36] = 0;
+    FltFlg[37] = 0;                                  FltLevel[37] = 0;        FltAct[37] = 0;
+    FltFlg[38] = 0;                                  FltLevel[38] = 0;        FltAct[38] = 0;
+    FltFlg[39] = 0;                                  FltLevel[39] = 0;        FltAct[39] = 0;
+    FltFlg[40] = 0;                                  FltLevel[40] = 0;        FltAct[40] = 0;
+    FltFlg[41] = 0;                                  FltLevel[41] = 0;        FltAct[41] = 0;
+    FltFlg[42] = 0;                                  FltLevel[42] = 0;        FltAct[42] = 0;
+    FltFlg[43] = 0;                                  FltLevel[43] = 0;        FltAct[43] = 0;
+    FltFlg[44] = 0;                                  FltLevel[44] = 0;        FltAct[44] = 0;
+    FltFlg[45] = 0;                                  FltLevel[45] = 0;        FltAct[45] = 0;
+    FltFlg[46] = 0;                                  FltLevel[46] = 0;        FltAct[46] = 0;
+    FltFlg[47] = 0;                                  FltLevel[47] = 0;        FltAct[47] = 0;
+    FltFlg[48] = 0;                                  FltLevel[48] = 0;        FltAct[48] = 0;
+    FltFlg[49] = 0;                                  FltLevel[49] = 0;        FltAct[49] = 0;
+    FltFlg[50] = 0;                                  FltLevel[50] = 0;        FltAct[50] = 0;            //51均衡失效(合一)
+    
+    FltFlg[51] = sfmd_flg_volFlt;                    FltLevel[51] = 4;        FltAct[51] = 234;          //52电压开路故障(合一)
+    FltFlg[52] = sfmd_flg_modTOpenFlt;               FltLevel[52] = 4;        FltAct[52] = 122;          //53温度开路故障(合一)
+    FltFlg[53] = sfmd_flg_chrgMosTOpenFlt;           FltLevel[53] = 4;        FltAct[53] = 66;           //54 Mos温度开路故障
+    FltFlg[54] = 0;                                  FltLevel[54] = 4;        FltAct[54] = 66;           //55 Mos温度开路故障
+    FltFlg[55] = sfmd_flg_DCPlugTOpenFlt;            FltLevel[55] = 4;        FltAct[55] = 66;           //56 快充插头温度开路故障
+    FltFlg[56] = sfmd_flg_ACPlugTOpenFlt;            FltLevel[56] = 4;        FltAct[56] = 66;           //57  慢充插头温度开路故障
+    FltFlg[57] = sfmd_flg_heatPanT1OpenFlt;          FltLevel[57] = 2;        FltAct[57] = 2;            //58加热板#1温度开路故障
+    FltFlg[58] = sfmd_flg_heatPanT2OpenFlt;          FltLevel[58] = 2;        FltAct[58] = 2;            //59加热板#2温度开路故障
+    FltFlg[59] = sfmd_flg_heatPanTOpenFlt;           FltLevel[59] = 3;        FltAct[59] = 18;           //60加热板#1#2温度开路故障
+    FltFlg[60] = sfmd_flg_modTRationFlt;                FltLevel[60] = 0;        FltAct[60] = 0;         //61模组温度合理性故障
+    FltFlg[61] = sfmd_flg_chrgMosTRationFlt;         FltLevel[61] = 0;        FltAct[61] = 0;            //62mos温度合理性故障
+    FltFlg[62] = 0;                                  FltLevel[62] = 0;        FltAct[62] = 0;            //63mos温度合理性故障
+    FltFlg[63] = sfmd_flg_DCPlugTRationFlt;          FltLevel[63] = 0;        FltAct[63] = 0;            //64快充插头温度合理性故障
+    FltFlg[64] = sfmd_flg_ACPlugTRationFlt;          FltLevel[64] = 0;        FltAct[64] = 0;            //65慢充插头温度合理性故障
+    FltFlg[65] = sfmd_flg_heatPanT1RationFlt;        FltLevel[65] = 0;        FltAct[65] = 0;            //66加热板#1温度合理性故障
+    FltFlg[66] = sfmd_flg_heatPanT2RationFlt;        FltLevel[66] = 0;        FltAct[66] = 0;            //67加热板#2温度合理性故障
+    FltFlg[67] = 0;                                  FltLevel[67] = 0;        FltAct[67] = 0;
+    FltFlg[68] = 0;                                  FltLevel[68] = 0;        FltAct[68] = 0;
+    FltFlg[69] = 0;                                  FltLevel[69] = 0;        FltAct[69] = 0;
+    
+    FltFlg[70] = sfmd_flg_currOpenFlt;               FltLevel[70] = 0;        FltAct[70] = 0;            //71 电流传感器故障
+    FltFlg[71] = 0;                                  FltLevel[71] = 0;        FltAct[71] = 0;
+    FltFlg[72] = 0;                                  FltLevel[72] = 0;        FltAct[72] = 0;
+    FltFlg[73] = 0;                                  FltLevel[73] = 0;        FltAct[73] = 0;
+    FltFlg[74] = 0;                                  FltLevel[74] = 0;        FltAct[74] = 0;
+    FltFlg[75] = 0;                                  FltLevel[75] = 0;        FltAct[75] = 0;
+    FltFlg[76] = 0;                                  FltLevel[76] = 0;        FltAct[76] = 0;
+    FltFlg[77] = 0;                                  FltLevel[77] = 0;        FltAct[77] = 0;
+    FltFlg[78] = 0;                                  FltLevel[78] = 0;        FltAct[78] = 0;
+    FltFlg[79] = 0;                                  FltLevel[79] = 0;        FltAct[79] = 0;
+    
+    FltFlg[80] = sfmd_flg_cellUOverFlt2;             FltLevel[80] = 4;        FltAct[80] = 66;       //81单体过压2级故障
+    FltFlg[81] = sfmd_flg_cellUOverFlt1;             FltLevel[81] = 3;        FltAct[81] = 66;       //82单体过压1级故障
+    FltFlg[82] = sfmd_flg_cellULowFlt2;              FltLevel[82] = 4;        FltAct[82] = 66;       //83单体欠压2级故障
+    FltFlg[83] = sfmd_flg_cellULowFlt1;              FltLevel[83] = 3;        FltAct[83] = 66;       //84单体欠压1级故障
+    FltFlg[84] = sfmd_flg_cellUDiffFlt2;             FltLevel[84] = 4;        FltAct[84] = 66;       //85压差过大2级故障
+    FltFlg[85] = sfmd_flg_cellUDiffFlt2;             FltLevel[85] = 3;        FltAct[85] = 66;       //86压差过大1级故障
+    FltFlg[86] = sfmd_flg_battUOverFlt2;             FltLevel[86] = 4;        FltAct[86] = 66;       //87总压过压2级故障
+    FltFlg[87] = sfmd_flg_battUOverFlt1;             FltLevel[87] = 3;        FltAct[87] = 66;       //88总压过压1级故障
+    FltFlg[88] = sfmd_flg_battULowFlt2;              FltLevel[88] = 0;        FltAct[88] = 0;        //89总压欠压2级故障
+    FltFlg[89] = sfmd_flg_battULowFlt1;              FltLevel[89] = 0;        FltAct[89] = 0;        //90总压欠压1级故障
+    FltFlg[90] = 0;                                  FltLevel[90] = 0;        FltAct[90] = 0;
+    FltFlg[91] = 0;                                  FltLevel[91] = 0;        FltAct[91] = 0;
+    FltFlg[92] = 0;                                  FltLevel[92] = 0;        FltAct[92] = 0;
+    FltFlg[93] = 0;                                  FltLevel[93] = 0;        FltAct[93] = 0;
+    FltFlg[94] = 0;                                  FltLevel[94] = 0;        FltAct[94] = 0;
+    FltFlg[95] = 0;                                  FltLevel[95] = 0;        FltAct[95] = 0;
+    
+    FltFlg[96] = sfmd_flg_chrgModTOverFlt2;          FltLevel[96] = 0;        FltAct[96] = 0;        //97模组充电温度过高2级故障
+    FltFlg[97] = sfmd_flg_chrgModTOverFlt1;          FltLevel[97] = 0;        FltAct[97] = 0;        //98模组充电温度过高1级故障
+    FltFlg[98] = sfmd_flg_chrgModTLowFlt2;           FltLevel[98] = 0;        FltAct[98] = 0;        //99模组充电温度过低2级故障
+    FltFlg[99] = sfmd_flg_chrgModTLowFlt1;           FltLevel[99] = 0;        FltAct[99] = 0;        //100模组充电温度过低1级故障
+    FltFlg[100] = sfmd_flg_disChrgModTOverFlt2;      FltLevel[100] = 0;       FltAct[100] = 0;       //101模组充电温度过高2级故障
+    FltFlg[101] = sfmd_flg_disChrgModTOverFlt1;      FltLevel[101] = 0;       FltAct[101] = 0;       //102模组充电温度过高1级故障
+    FltFlg[102] = sfmd_flg_disChrgModTLowFlt2;       FltLevel[102] = 0;       FltAct[102] = 0;       //103模组充电温度过低2级故障
+    FltFlg[103] = sfmd_flg_disChrgModTLowFlt1;       FltLevel[103] = 0;       FltAct[103] = 0;       //104模组充电温度过低1级故障
+    FltFlg[104] = sfmd_flg_modTDiffFlt2;             FltLevel[104] = 0;       FltAct[104] = 19;       //105模组温差过大2级故障
+    FltFlg[105] = sfmd_flg_modTDiffFlt1;             FltLevel[105] = 0;       FltAct[105] = 0;       //106模组温差过大1级故障
+    FltFlg[106] = sfmd_flg_chrgMosTOverFlt2;         FltLevel[106] = 0;       FltAct[106] = 0;       //107 充电Mos温度过高2级故障
+    FltFlg[107] = sfmd_flg_chrgMosTOverFlt1;         FltLevel[107] = 0;       FltAct[107] = 0;       //108 充电Mos温度过高1级故障
+    FltFlg[108] = sfmd_flg_disChrgMosTOverFlt2;      FltLevel[108] = 0;       FltAct[108] = 0;       //109 放电Mos温度过高2级故障
+    FltFlg[109] = sfmd_flg_disChrgMosTOverFlt1;      FltLevel[109] = 0;       FltAct[109] = 0;       //110 放电Mos温度过高1级故障
+    FltFlg[110] = sfmd_flg_DCPlugTOverFlt2;          FltLevel[110] = 0;       FltAct[110] = 0;       //111 快充插头温度过高2级故障
+    FltFlg[111] = sfmd_flg_DCPlugTOverFlt1;          FltLevel[111] = 0;       FltAct[111] = 0;       //112 快充插头温度过高1级故障
+    FltFlg[112] = sfmd_flg_ACPlugTOverFlt1;          FltLevel[112] = 0;       FltAct[112] = 0;       //113 慢充插头温度过高2级故障
+    FltFlg[113] = sfmd_flg_ACPlugTOverFlt1;          FltLevel[113] = 0;       FltAct[113] = 0;       //114 慢充插头温度过高1级故障
+    FltFlg[114] = sfmd_flg_heatPanTOverFlt2;         FltLevel[114] = 0;       FltAct[114] = 0;       //115 加热板温度过高2级故障
+    FltFlg[115] = sfmd_flg_heatPanTOverFlt1;         FltLevel[115] = 0;       FltAct[115] = 0;       //116 加热板温度过高1级故障
+    FltFlg[116] = 0;                                 FltLevel[116] = 0;       FltAct[116] = 0;
+    FltFlg[117] = 0;                                 FltLevel[117] = 0;       FltAct[117] = 0;
+    FltFlg[118] = 0;                                 FltLevel[118] = 0;       FltAct[118] = 0;
+    FltFlg[119] = 0;                                 FltLevel[119] = 0;       FltAct[119] = 0;
+    FltFlg[120] = 0;                                 FltLevel[120] = 0;       FltAct[120] = 0;
+    FltFlg[121] = 0;                                 FltLevel[121] = 0;       FltAct[121] = 0;
+    FltFlg[122] = 0;                                 FltLevel[122] = 0;       FltAct[122] = 0;
+    FltFlg[123] = 0;                                 FltLevel[123] = 0;       FltAct[123] = 0;
+    FltFlg[124] = 0;                                 FltLevel[124] = 0;       FltAct[124] = 0;
+    FltFlg[125] = 0;                                 FltLevel[125] = 0;       FltAct[125] = 0;
+    FltFlg[126] = 0;                                 FltLevel[126] = 0;       FltAct[126] = 0;
+    FltFlg[127] = 0;                                 FltLevel[127] = 0;       FltAct[127] = 0;
+    FltFlg[128] = 0;                                 FltLevel[128] = 0;       FltAct[128] = 0;
+    FltFlg[129] = 0;                                 FltLevel[129] = 0;       FltAct[129] = 0;
+    
+    FltFlg[130] = sfmd_flg_chrgCurrOverFlt;          FltLevel[130] = 0;       FltAct[130] = 0;       //131 充电电流过高
+    FltFlg[131] = sfmd_flg_disChrgCurrOverFlt;       FltLevel[131] = 0;       FltAct[131] = 0;       //132 放电电流过高
+    FltFlg[132] = 0;                                 FltLevel[132] = 0;       FltAct[132] = 0;
+    FltFlg[133] = 0;                                 FltLevel[133] = 0;       FltAct[133] = 0;
+    FltFlg[134] = 0;                                 FltLevel[134] = 0;       FltAct[134] = 0;
+    FltFlg[135] = 0;                                 FltLevel[135] = 0;       FltAct[135] = 0;
+    FltFlg[136] = 0;                                 FltLevel[136] = 0;       FltAct[136] = 0;
+    FltFlg[137] = 0;                                 FltLevel[137] = 0;       FltAct[137] = 0;
+    FltFlg[138] = 0;                                 FltLevel[138] = 0;       FltAct[138] = 0;
+    FltFlg[139] = 0;                                 FltLevel[139] = 0;       FltAct[139] = 0;
+    FltFlg[140] = 0;                                 FltLevel[140] = 0;       FltAct[140] = 0;
+    FltFlg[141] = 0;                                 FltLevel[141] = 0;       FltAct[141] = 0;
+    FltFlg[142] = 0;                                 FltLevel[142] = 0;       FltAct[142] = 0;
+    FltFlg[143] = 0;                                 FltLevel[143] = 0;       FltAct[143] = 0;
+    FltFlg[144] = 0;                                 FltLevel[144] = 0;       FltAct[144] = 0;
+    FltFlg[145] = 0;                                 FltLevel[145] = 0;       FltAct[145] = 0;
+    FltFlg[146] = 0;                                 FltLevel[146] = 0;       FltAct[146] = 0;
+    FltFlg[147] = 0;                                 FltLevel[147] = 0;       FltAct[147] = 0;
+    FltFlg[148] = 0;                                 FltLevel[148] = 0;       FltAct[148] = 0;
+    FltFlg[149] = 0;                                 FltLevel[149] = 0;       FltAct[149] = 0;
+    
+    FltFlg[150] = sfmd_flg_chrgCurrOverMisFlt;       FltLevel[150] = 0;       FltAct[150] = 0;       //151 充电过流故障不匹配
+    FltFlg[151] = sfmd_flg_disChrgCurrOverMisFlt;    FltLevel[151] = 0;       FltAct[151] = 0;       //152 放电过流故障不匹配
+    FltFlg[152] = sfmd_flg_battULowMisFlt;           FltLevel[152] = 0;       FltAct[152] = 0;      //153 总压欠压不匹配
+    FltFlg[153] = sfmd_flg_battUOverMisFlt;          FltLevel[153] = 0;       FltAct[153] = 0;       //154 总压过压不匹配
+    FltFlg[154] = sfmd_flg_cellULowMisFlt;           FltLevel[154] = 0;       FltAct[154] = 0;       //155 单体欠压故障不匹配
+    FltFlg[155] = sfmd_flg_cellUOverMisFlt;          FltLevel[155] = 0;       FltAct[155] = 0;       //156 单体过压故障不匹配
+    FltFlg[156] = sfmd_flg_chrgModTOverMisFlt;       FltLevel[156] = 0;       FltAct[156] = 0;       //157 充电模组过温故障不匹配
+    FltFlg[157] = sfmd_flg_chrgModTLowMisFlt;        FltLevel[157] = 0;       FltAct[157] = 0;       //158 充电模组低温故障不匹配
+    FltFlg[158] = sfmd_flg_disChrgModTOverMisFlt;    FltLevel[158] = 0;       FltAct[158] = 0;       //159 放电模组过温故障不匹配
+    FltFlg[159] = sfmd_flg_disChrgModTLowMisFlt;     FltLevel[159] = 0;       FltAct[159] = 0;       //160 放电模组低温故障不匹配
+    FltFlg[160] = sfmd_flg_chrgMosTOverMisFlt;       FltLevel[160] = 0;       FltAct[160] = 0;      //161 充电Mos过温故障不匹配
+    FltFlg[161] = sfmd_flg_disChrgMosTOverMisFlt;    FltLevel[161] = 0;       FltAct[161] = 0;       //162 放电Mos过温故障不匹配
+    FltFlg[162] = sfmd_flg_socMisFlt;                FltLevel[162] = 0;       FltAct[162] = 0;      //163 soc不匹配
+    FltFlg[163] = sfmd_flg_sohMisFlt;                FltLevel[163] = 0;       FltAct[163] = 0;      //164 SOH 不匹配
+    FltFlg[164] = 0;                                 FltLevel[164] = 0;       FltAct[164] = 0;
+    FltFlg[165] = 0;                                 FltLevel[165] = 0;       FltAct[165] = 0;
+    FltFlg[166] = 0;                                 FltLevel[166] = 0;       FltAct[166] = 0;
+    FltFlg[167] = 0;                                 FltLevel[167] = 0;       FltAct[167] = 0;
+    FltFlg[168] = 0;                                 FltLevel[168] = 0;       FltAct[168] = 0;
+    FltFlg[169] = 0;                                 FltLevel[169] = 0;       FltAct[169] = 0;
+    FltFlg[170] = 0;                                 FltLevel[170] = 0;       FltAct[170] = 0;
+    FltFlg[171] = 0;                                 FltLevel[171] = 0;       FltAct[171] = 0;
+    FltFlg[172] = 0;                                 FltLevel[172] = 0;       FltAct[172] = 0;
+    FltFlg[173] = 0;                                 FltLevel[173] = 0;       FltAct[173] = 0;
+    FltFlg[174] = 0;                                 FltLevel[174] = 0;       FltAct[174] = 0;
+    FltFlg[175] = 0;                                 FltLevel[175] = 0;       FltAct[175] = 0;
+    FltFlg[176] = 0;                                 FltLevel[176] = 0;       FltAct[176] = 0;
+    FltFlg[177] = 0;                                 FltLevel[177] = 0;       FltAct[177] = 0;
+    FltFlg[178] = sfmd_flg_socJumpFlt;               FltLevel[178] = 0;       FltAct[178] = 0;       //179 soc跳变
+    FltFlg[179] = sfmd_flg_EEsaveFlt;                FltLevel[179] = 0;       FltAct[179] = 0;       //180 EE失效
+    
+    
+    //==========================================================================================================================================================
+    memset(FltCodeArr,0,sizeof(FltCodeArr));
+    memset(FltLevelArr,0,sizeof(FltLevelArr));
+    memset(FltActArr,0,sizeof(FltActArr));
+    memset(sfmv_idx_fltCode,0,sizeof(sfmv_idx_fltCode));
+    sfmd_num_fltNum = 0;
+    for(i = 0;i < 200 && sfmd_num_fltNum <20;i++)
+    {
+        if (FltFlg[i])
+        {
+            FltCodeArr[sfmd_num_fltNum] = i + 1;
+            FltLevelArr[sfmd_num_fltNum] =FltLevel[i];
+            FltActArr[sfmd_num_fltNum] =FltAct[i];
+            sfmd_num_fltNum = sfmd_num_fltNum + 1;
+            
+            if (i == 50)
+            {
+                for(j = 0; j < cmnc_num_cellUNum;j++)	
+                {
+                    
+					FltCodeArr[sfmd_num_fltNum] = 1001 + j;
+                    FltLevelArr[sfmd_num_fltNum] =FltLevel[i];
+                    FltActArr[sfmd_num_fltNum] =FltAct[i];
+                    sfmd_num_fltNum = sfmd_num_fltNum + 1;
+                }
+            }
+            if (i == 51)
+            {    
+                for(j = 0; j < cmnc_num_cellUNum;j++)
+                {
+                    if(sfmv_flg_cellUOpenFlt[j])
+                   {
+                        FltCodeArr[sfmd_num_fltNum] = 2001 + j;
+                        FltLevelArr[sfmd_num_fltNum] =FltLevel[i];
+                    	FltActArr[sfmd_num_fltNum] =FltAct[i];
+                    	sfmd_num_fltNum = sfmd_num_fltNum + 1;
+                    }
+                }
+            }
+            if (i == 52)
+            {
+                for(j = 0; j < cmnc_num_modTNum;j++)
+                {   
+                    if(sfmv_flg_modTOpenFlt[j])
+                    {
+                        
+						FltCodeArr[sfmd_num_fltNum] = 3001 + j;
+                    	FltLevelArr[sfmd_num_fltNum] =FltLevel[i];
+                   		FltActArr[sfmd_num_fltNum] =FltAct[i];
+                    	sfmd_num_fltNum = sfmd_num_fltNum + 1;
+					}
+                }
+            }
+            if (i == 60)
+            {
+                for(j = 0; j < cmnc_num_modTNum;j++)
+                {
+                    if(sfmv_flg_modTRationFlt[j])
+                    {
+                    	FltCodeArr[sfmd_num_fltNum] = 3201 + j;
+                    	FltLevelArr[sfmd_num_fltNum] =FltLevel[i];
+                    	FltActArr[sfmd_num_fltNum] =FltAct[i];
+                   	 	sfmd_num_fltNum = sfmd_num_fltNum + 1;
+                    }
+                }
             }
-
-            sfmd_num_fltNum = (uint16_T)i_0;
-          }
         }
-      }
     }
-
-    avrgU++;
-  }
-
-  for (avrgU = 0U; avrgU < sfmd_num_fltNum; avrgU++) {
-    i_0 = rtb_FltLevelArr[avrgU] * 10000 + FltCodeArr[avrgU];
-    if (i_0 > 65535) {
-      i_0 = 65535;
-    }
-
-    FltCodeArrS[avrgU] = (uint16_T)i_0;
-  }
-
-  for (avrgU = 0U; avrgU < sfmd_num_fltNum; avrgU++) {
-    for (k = 0U; k < (sfmd_num_fltNum - avrgU) - 1; k++) {
-      tmp_3 = FltCodeArrS[k + 1];
-      if (FltCodeArrS[k] < tmp_3) {
-        temp = FltCodeArrS[k];
-        FltCodeArrS[k] = tmp_3;
-        FltCodeArrS[k + 1] = temp;
-      }
+    sfmd_st_fltAct = 0;
+    sfmd_st_fltLevel =0;
+    for(i = 0; i< sfmd_num_fltNum;i++)
+    {
+        sfmv_idx_fltCode[i] = FltLevelArr[i] * 10000 + FltCodeArr[i];
+		
+        if (sfmd_st_fltLevel < FltLevelArr[i])
+        {
+            sfmd_st_fltLevel = FltLevelArr[i];
+        }
+        sfmd_st_fltAct = sfmd_st_fltAct|FltActArr[i];
     }
-  }
 
-  if ((SFM_DW.Cntl > 4) || (SFM_DW.Cntl >= sfmd_num_fltNum)) {
-    SFM_DW.Cntl = 0U;
-  }
 
-  avrgU = FltCodeArrS[SFM_DW.Cntl];
-  i_0 = SFM_DW.Cntl + 1;
-  if (SFM_DW.Cntl + 1 > 65535) {
-    i_0 = 65535;
-  }
+	
+    ///=====================================================================
+    //======================================================================
 
-  SFM_DW.Cntl = (uint16_T)i_0;
+	
+	sfmd_flg_cellUDisable = sfmd_flg_interComFlt || sfmd_flg_volFlt;
+	sfmd_flg_currDisable = sfmd_flg_interComFlt || sfmd_flg_currOpenFlt;
+	sfmd_flg_modTDisable =sfmd_flg_interComFlt ||sfmd_flg_modTOpenFlt ||sfmd_flg_modTRationFlt;
+    FirstRun_SFM = false;
 
-  /* S-Function (sfix_bitop): '<S3>/Bitwise Operator1' */
-  sfmd_st_fltAct = rtb_FltActArr[0];
+}
 
-  /* MinMax: '<S3>/MinMax' */
-  sfmd_N_fltLevel = rtb_FltLevelArr[0];
-  for (i_0 = 0; i_0 < 19; i_0++) {
-    /* S-Function (sfix_bitop): '<S3>/Bitwise Operator1' */
-    sfmd_st_fltAct = (uint8_T)(rtb_FltActArr[i_0 + 1] | sfmd_st_fltAct);
 
-    /* MinMax: '<S3>/MinMax' */
-    i = rtb_FltLevelArr[i_0 + 1];
-    if (sfmd_N_fltLevel <= i) {
-      sfmd_N_fltLevel = i;
+//===============================================================================
+boolean_T DiagThrSystem1(boolean_T Enable, boolean_T precondition, uint16_T Input,uint16_T fltThr,uint16_T recThr,uint16_T fltNumThr,uint16_T recNumThr,uint8_T *fltNum,uint8_T *recNum,boolean_T *fitFlg)
+{
+    
+    if(Enable && precondition && Input > fltThr)
+    {
+        *fltNum =(*fltNum+1 > 200 ? 200 :*fltNum+1);
     }
-  }
-
-  /* Math: '<S3>/Rem1' */
-  sfmd_idx_fltCode = (uint16_T)(avrgU % 10000);
-
-  /* Chart: '<S13>/Chart' incorporates:
-   *  Constant: '<S13>/Constant'
-   */
-  qY_0 = cmnc_num_cellUNum == 0U ? MAX_uint32_T : rtb_SumU / cmnc_num_cellUNum;
-  if (qY_0 > 65535U) {
-    qY_0 = 65535U;
-  }
-
-  /* SignalConversion generated from: '<S13>/Chart' incorporates:
-   *  Chart: '<S13>/Chart'
-   */
-  sfmd_V_cellUAvrg = (uint16_T)qY_0;
-
-  /* Product: '<S23>/Product' incorporates:
-   *  Inport: '<Root>/ihd_L_urtRecv'
-   *  RelationalOperator: '<S9>/Relational Operator'
-   *  UnitDelay: '<S23>/Time_Delay'
-   */
-  SFM_DW.Time_Delay_DSTATE = (uint16_T)(ihd_L_urtRecv == 0 ? (int32_T)
-    rtb_Saturation : 0);
-  for (i_0 = 0; i_0 < 6; i_0++) {
-    /* SignalConversion: '<S15>/Signal Conversion' incorporates:
-     *  Inport: '<Root>/ihv_T_modT'
-     */
-    sfmv_T_modT[i_0] = ihv_T_modT[i_0];
-  }
+    else
+    {
+        *fltNum = 0;
+    }
+    
+    if(Enable && precondition && Input < recThr)
+    {
+        *recNum =(*recNum+1 > 200 ? 200 :*recNum+1);
+    }
+    else
+    {
+        *recNum = 0;
+    }
+    
+    if((*fltNum > fltNumThr ||(*fitFlg && *recNum < recNumThr)) &&precondition)
+    {
+        *fitFlg = true;
+    }
+	else
+	{
+	 	*fitFlg = false;
+	}
+    return *fitFlg;
 }
-
-/* Model initialize function */
-void SFM_initialize(const char_T **rt_errorStatus)
+//=============================================================================
+boolean_T DiagThrSystem2(boolean_T Enable, boolean_T precondition, uint16_T Input,uint16_T fltThr,uint16_T recThr,uint16_T fltNumThr,uint16_T recNumThr,uint8_T *fltNum,uint8_T *recNum,boolean_T *fitFlg)
 {
-  RT_MODEL_SFM_T *const SFM_M = &(SFM_MdlrefDW.rtm);
-
-  /* Registration code */
-
-  /* initialize error status */
-  rtmSetErrorStatusPointer(SFM_M, rt_errorStatus);
+    if(Enable && precondition && Input < fltThr)
+    {
+        *fltNum =(*fltNum+1 > 200 ? 200 :*fltNum+1);
+    }
+    else
+    {
+        *fltNum = 0;
+    }
+    
+    if(Enable && precondition && Input > recThr)
+    {
+        *recNum =(*recNum+1 > 200 ? 200 :*recNum+1);
+    }
+    else
+    {
+        *recNum = 0;
+    }
+    
+    if((*fltNum > fltNumThr ||(*fitFlg && *recNum < recNumThr)) &&precondition)
+    {
+        *fitFlg = true;
+    }
+	else
+	{
+	 	*fitFlg = false;
+	}
+    return *fitFlg;
 }
 
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */
+//
+boolean_T MisMatich(boolean_T x, boolean_T y, uint8_T *N)
+{
+    boolean_T fltFlg= false;
+    if(x!=y)
+    {
+        *N=(*N + 1 > 200? 200: *N+1);
+    }
+    else
+    {
+        *N= 0;
+    }
+    if (*N > 20)
+    {
+        fltFlg =true;
+    }
+    return fltFlg;
+}

+ 1 - 2
src/EmbeddedCoder_src/SOC.c

@@ -48,7 +48,6 @@ void SOC(void)
     real_T battcurr;
     real_T UL;
     uint16_T factor;
-    uint32_T temp;
     //
     static real_T ahDelay;
     int16_T ahSoc;
@@ -686,4 +685,4 @@ void SOCfit_IfActionSubsystem2(uint16_T SOC, uint16_T SOCfit_Delay, uint16_T *SO
     {
         *SOCfit=SOC;
     }
-}
+}

+ 2 - 2
src/EmbeddedCoder_src/SOH.c

@@ -94,7 +94,7 @@ void SOH(void)
  		//=======================================================================================
         //--------------------------计算使能-------------------------------------------------------
         //=======================================================================================
-        if(ihd_tm_parkTime > cmnc_tm_parkTime && sohn_flg_chrgEndEE && sohn_Q_chrgEE > 15 && !sfmd_flg_volFlt )
+        if(ihd_tm_parkTime > cmnc_tm_parkTime && sohn_flg_chrgEndEE && sohn_Q_chrgEE > 15 && !sfmd_flg_cellUDisable && sfmd_I_curr < 10 && sfmd_I_curr > -10)
         {
             sohn_flg_countEn = true;
         }
@@ -189,7 +189,7 @@ void SOH(void)
         tmp_0 = (int16_T)(Ahincr/36000 *10);
 		
         sohd_Q_chrgEo =(tmp_0 > 0 ? (uint16_T)tmp_0 : 0);  
-        if(sfmd_flg_currFlt)
+        if(sfmd_flg_currDisable)
         {
             sfmn_flg_currFlt_keep = true;
         }

+ 1 - 1
src/EmbeddedCoder_src/SPM.c

@@ -31,7 +31,7 @@ void SPM(void)
   
   SOH();
   BLC();
-  if (ihd_L_urtRecv)
+  if (!ihd_flg_urtRecFlt)
   {
     SOC();
   }

+ 74 - 0
src/EmbeddedCoder_src/TMS.c

@@ -0,0 +1,74 @@
+#include "TMS.h"
+
+
+boolean_T FirstRun_TMS;
+void TMS_Init(void)
+{
+    FirstRun_TMS =true;
+}
+
+void TMS(void)
+{
+    static uint8_T TminLowNr;
+    static uint8_T TminOverNr;
+    static uint8_T TmaxOverNr;
+    
+    //初始值
+    if (FirstRun_TMS)
+    {
+        tmsd_st_heatAct = 0;
+        TminLowNr = 0;
+        TminOverNr = 0;
+        TmaxOverNr = 0;
+    }
+    
+    //
+    if (sfmd_T_modTMin < tmsc_T_openThr)
+    {
+        TminLowNr = ((TminLowNr + 1) > 200 ? 200 : (TminLowNr + 1));
+    }
+    else
+    {
+        TminLowNr = 0;
+    }
+    //
+    if (sfmd_T_modTMin >= tmsc_T_closeMinThr)
+    {
+        TminOverNr = ((TminOverNr + 1) > 200 ? 200 : (TminOverNr + 1));
+    }
+    else
+    {
+        TminOverNr = 0;
+    }
+    //
+    if (sfmd_T_modTMax >= tmsc_T_closeMaxThr)
+    {
+        TmaxOverNr = ((TmaxOverNr + 1) > 200 ? 200 : (TmaxOverNr + 1));
+    }
+    else
+    {
+        TmaxOverNr = 0;
+    }
+    
+    //=====================================================================
+    if (tmsd_st_heatAct == 0)
+    {
+        if((TminLowNr >= 20 && ihd_st_chrgConnect == 1)||(TminLowNr >= 20 && ihd_st_chrgConnect == 0 && socd_pct_battSoc > 100))
+        {
+            tmsd_st_heatAct = 1;
+        }
+    }
+    else
+    {
+        if(TmaxOverNr >= 20 || TminOverNr >= 20 || (ihd_st_chrgConnect == 0 && socd_pct_battSoc < 50))
+        {
+            tmsd_st_heatAct = 0;
+        }
+    }
+	if (((sfmd_st_fltAct >> 4) & 0x01) == 1)
+	{
+	    tmsd_st_heatAct = 0;
+	}
+    FirstRun_TMS = false;
+
+}

+ 0 - 24
src/EmbeddedCoder_src/div_nde_s32_floor.c

@@ -1,24 +0,0 @@
-/*
- * File: div_nde_s32_floor.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#include "rtwtypes.h"
-#include "div_nde_s32_floor.h"
-
-int32_T div_nde_s32_floor(int32_T numerator, int32_T denominator)
-{
-  return (((numerator < 0) != (denominator < 0)) && (numerator % denominator !=
-           0) ? -1 : 0) + numerator / denominator;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 39
src/EmbeddedCoder_src/div_nzp_repeat_u32.c

@@ -1,39 +0,0 @@
-/*
- * File: div_nzp_repeat_u32.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#include "rtwtypes.h"
-#include "div_nzp_repeat_u32.h"
-
-uint32_T div_nzp_repeat_u32(uint32_T numerator, uint32_T denominator, uint32_T
-  nRepeatSub)
-{
-  uint32_T iRepeatSub;
-  uint32_T quotient;
-  boolean_T numeratorExtraBit;
-  quotient = numerator / denominator;
-  numerator %= denominator;
-  for (iRepeatSub = 0U; iRepeatSub < nRepeatSub; iRepeatSub++) {
-    numeratorExtraBit = (numerator >= 2147483648U);
-    numerator <<= 1U;
-    quotient <<= 1U;
-    if (numeratorExtraBit || (numerator >= denominator)) {
-      quotient++;
-      numerator -= denominator;
-    }
-  }
-
-  return quotient;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 43
src/EmbeddedCoder_src/div_nzp_repeat_u32_ceiling.c

@@ -1,43 +0,0 @@
-/*
- * File: div_nzp_repeat_u32_ceiling.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#include "rtwtypes.h"
-#include "div_nzp_repeat_u32_ceiling.h"
-
-uint32_T div_nzp_repeat_u32_ceiling(uint32_T numerator, uint32_T denominator,
-  uint32_T nRepeatSub)
-{
-  uint32_T iRepeatSub;
-  uint32_T quotient;
-  boolean_T numeratorExtraBit;
-  quotient = numerator / denominator;
-  numerator %= denominator;
-  for (iRepeatSub = 0U; iRepeatSub < nRepeatSub; iRepeatSub++) {
-    numeratorExtraBit = (numerator >= 2147483648U);
-    numerator <<= 1U;
-    quotient <<= 1U;
-    if (numeratorExtraBit || (numerator >= denominator)) {
-      quotient++;
-      numerator -= denominator;
-    }
-  }
-
-  if (numerator > 0U) {
-    quotient++;
-  }
-
-  return quotient;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 47
src/EmbeddedCoder_src/div_repeat_s16s32_floor.c

@@ -1,47 +0,0 @@
-/*
- * File: div_repeat_s16s32_floor.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#include "rtwtypes.h"
-#include "div_nzp_repeat_u32.h"
-#include "div_nzp_repeat_u32_ceiling.h"
-#include "div_repeat_s16s32_floor.h"
-
-int16_T div_repeat_s16s32_floor(int32_T numerator, int32_T denominator, uint32_T
-  nRepeatSub)
-{
-  uint32_T absDenominator;
-  uint32_T absNumerator;
-  int16_T quotient;
-  if (denominator == 0) {
-    quotient = (int16_T)(numerator >= 0 ? 32767 : -32768);
-
-    /* Divide by zero handler */
-  } else {
-    absNumerator = numerator < 0 ? ~(uint32_T)numerator + 1U : (uint32_T)
-      numerator;
-    absDenominator = denominator < 0 ? ~(uint32_T)denominator + 1U : (uint32_T)
-      denominator;
-    if ((numerator < 0) != (denominator < 0)) {
-      quotient = (int16_T)-(int32_T)div_nzp_repeat_u32_ceiling(absNumerator,
-        absDenominator, nRepeatSub);
-    } else {
-      quotient = (int16_T)div_nzp_repeat_u32(absNumerator, absDenominator,
-        nRepeatSub);
-    }
-  }
-
-  return quotient;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 47
src/EmbeddedCoder_src/div_repeat_s32_floor.c

@@ -1,47 +0,0 @@
-/*
- * File: div_repeat_s32_floor.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.52
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Tue Sep 14 16:42:25 2021
- */
-
-#include "rtwtypes.h"
-#include "div_nzp_repeat_u32.h"
-#include "div_nzp_repeat_u32_ceiling.h"
-#include "div_repeat_s32_floor.h"
-
-int32_T div_repeat_s32_floor(int32_T numerator, int32_T denominator, uint32_T
-  nRepeatSub)
-{
-  int32_T quotient;
-  uint32_T absDenominator;
-  uint32_T absNumerator;
-  if (denominator == 0) {
-    quotient = numerator >= 0 ? MAX_int32_T : MIN_int32_T;
-
-    /* Divide by zero handler */
-  } else {
-    absNumerator = numerator < 0 ? ~(uint32_T)numerator + 1U : (uint32_T)
-      numerator;
-    absDenominator = denominator < 0 ? ~(uint32_T)denominator + 1U : (uint32_T)
-      denominator;
-    if ((numerator < 0) != (denominator < 0)) {
-      quotient = -(int32_T)div_nzp_repeat_u32_ceiling(absNumerator,
-        absDenominator, nRepeatSub);
-    } else {
-      quotient = (int32_T)div_nzp_repeat_u32(absNumerator, absDenominator,
-        nRepeatSub);
-    }
-  }
-
-  return quotient;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 45
src/EmbeddedCoder_src/div_repeat_u32.c

@@ -1,45 +0,0 @@
-/*
- * File: div_repeat_u32.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#include "rtwtypes.h"
-#include "div_repeat_u32.h"
-
-uint32_T div_repeat_u32(uint32_T numerator, uint32_T denominator, uint32_T
-  nRepeatSub)
-{
-  uint32_T iRepeatSub;
-  uint32_T quotient;
-  boolean_T numeratorExtraBit;
-  if (denominator == 0U) {
-    quotient = MAX_uint32_T;
-
-    /* Divide by zero handler */
-  } else {
-    quotient = numerator / denominator;
-    numerator %= denominator;
-    for (iRepeatSub = 0U; iRepeatSub < nRepeatSub; iRepeatSub++) {
-      numeratorExtraBit = (numerator >= 2147483648U);
-      numerator <<= 1U;
-      quotient <<= 1U;
-      if (numeratorExtraBit || (numerator >= denominator)) {
-        quotient++;
-        numerator -= denominator;
-      }
-    }
-  }
-
-  return quotient;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 50
src/EmbeddedCoder_src/div_s32_floor.c

@@ -1,50 +0,0 @@
-/*
- * File: div_s32_floor.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.52
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Tue Sep 14 16:42:25 2021
- */
-
-#include "rtwtypes.h"
-#include "div_s32_floor.h"
-
-int32_T div_s32_floor(int32_T numerator, int32_T denominator)
-{
-  int32_T quotient;
-  uint32_T absDenominator;
-  uint32_T absNumerator;
-  uint32_T tempAbsQuotient;
-  boolean_T quotientNeedsNegation;
-  if (denominator == 0) {
-    quotient = numerator >= 0 ? MAX_int32_T : MIN_int32_T;
-
-    /* Divide by zero handler */
-  } else {
-    absNumerator = numerator < 0 ? ~(uint32_T)numerator + 1U : (uint32_T)
-      numerator;
-    absDenominator = denominator < 0 ? ~(uint32_T)denominator + 1U : (uint32_T)
-      denominator;
-    quotientNeedsNegation = ((numerator < 0) != (denominator < 0));
-    tempAbsQuotient = absNumerator / absDenominator;
-    if (quotientNeedsNegation) {
-      absNumerator %= absDenominator;
-      if (absNumerator > 0U) {
-        tempAbsQuotient++;
-      }
-    }
-
-    quotient = quotientNeedsNegation ? -(int32_T)tempAbsQuotient : (int32_T)
-      tempAbsQuotient;
-  }
-
-  return quotient;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 32
src/EmbeddedCoder_src/div_su32.c

@@ -1,32 +0,0 @@
-/*
- * File: div_su32.c
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#include "rtwtypes.h"
-#include "div_su32.h"
-
-int32_T div_su32(uint32_T numerator, uint32_T denominator)
-{
-  int32_T quotient;
-  if (denominator == 0U) {
-    quotient = MAX_int32_T;
-
-    /* Divide by zero handler */
-  } else {
-    quotient = (int32_T)(numerator / denominator);
-  }
-
-  return quotient;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 35
src/EmbeddedCoder_src/div_uus32_sat.c

@@ -1,35 +0,0 @@
-/*
- * File: div_uus32_sat.c
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.71
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:17:31 2021
- */
-
-#include "rtwtypes.h"
-#include "div_uus32_sat.h"
-
-uint32_T div_uus32_sat(uint32_T numerator, int32_T denominator)
-{
-  uint32_T quotient;
-  if (denominator == 0) {
-    quotient = MAX_uint32_T;
-
-    /* Divide by zero handler */
-  } else if (denominator < 0) {
-    quotient = 0U;
-  } else {
-    quotient = numerator / (denominator < 0 ? ~(uint32_T)denominator + 1U :
-      (uint32_T)denominator);
-  }
-
-  return quotient;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 75
src/EmbeddedCoder_src/look1_binlxpw.c

@@ -1,75 +0,0 @@
-/*
- * File: look1_binlxpw.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#include "rtwtypes.h"
-#include "look1_binlxpw.h"
-
-real_T look1_binlxpw(real_T u0, const real_T bp0[], const real_T table[],
-                     uint32_T maxIndex)
-{
-  real_T frac;
-  real_T yL_0d0;
-  uint32_T bpIdx;
-  uint32_T iLeft;
-  uint32_T iRght;
-
-  /* Column-major Lookup 1-D
-     Search method: 'binary'
-     Use previous index: 'off'
-     Interpolation method: 'Linear point-slope'
-     Extrapolation method: 'Linear'
-     Use last breakpoint for index at or above upper limit: 'off'
-     Remove protection against out-of-range input in generated code: 'off'
-   */
-  /* Prelookup - Index and Fraction
-     Index Search method: 'binary'
-     Extrapolation method: 'Linear'
-     Use previous index: 'off'
-     Use last breakpoint for index at or above upper limit: 'off'
-     Remove protection against out-of-range input in generated code: 'off'
-   */
-  if (u0 <= bp0[0U]) {
-    iLeft = 0U;
-    frac = (u0 - bp0[0U]) / (bp0[1U] - bp0[0U]);
-  } else if (u0 < bp0[maxIndex]) {
-    /* Binary Search */
-    bpIdx = maxIndex >> 1U;
-    iLeft = 0U;
-    iRght = maxIndex;
-    while (iRght - iLeft > 1U) {
-      if (u0 < bp0[bpIdx]) {
-        iRght = bpIdx;
-      } else {
-        iLeft = bpIdx;
-      }
-
-      bpIdx = (iRght + iLeft) >> 1U;
-    }
-
-    frac = (u0 - bp0[iLeft]) / (bp0[iLeft + 1U] - bp0[iLeft]);
-  } else {
-    iLeft = maxIndex - 1U;
-    frac = (u0 - bp0[maxIndex - 1U]) / (bp0[maxIndex] - bp0[maxIndex - 1U]);
-  }
-
-  /* Column-major Interpolation 1-D
-     Interpolation method: 'Linear point-slope'
-     Use last breakpoint for index at or above upper limit: 'off'
-     Overflow mode: 'portable wrapping'
-   */
-  yL_0d0 = table[iLeft];
-  return (table[iLeft + 1U] - yL_0d0) * frac + yL_0d0;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 27
src/EmbeddedCoder_src/mul_s32_hiSR.c

@@ -1,27 +0,0 @@
-/*
- * File: mul_s32_hiSR.c
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.71
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:17:31 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_s32.h"
-#include "mul_s32_hiSR.h"
-
-int32_T mul_s32_hiSR(int32_T a, int32_T b, uint32_T aShift)
-{
-  uint32_T u32_chi;
-  uint32_T u32_clo;
-  mul_wide_s32(a, b, &u32_chi, &u32_clo);
-  return (int32_T)u32_chi >> aShift;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 28
src/EmbeddedCoder_src/mul_s32_loSR.c

@@ -1,28 +0,0 @@
-/*
- * File: mul_s32_loSR.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.52
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Tue Sep 14 16:42:25 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_s32.h"
-#include "mul_s32_loSR.h"
-
-int32_T mul_s32_loSR(int32_T a, int32_T b, uint32_T aShift)
-{
-  uint32_T u32_chi;
-  uint32_T u32_clo;
-  mul_wide_s32(a, b, &u32_chi, &u32_clo);
-  u32_clo = u32_chi << /*MW:OvBitwiseOk*/ (32U - aShift) | u32_clo >> aShift;
-  return (int32_T)u32_clo;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 39
src/EmbeddedCoder_src/mul_s32_loSR_sat.c

@@ -1,39 +0,0 @@
-/*
- * File: mul_s32_loSR_sat.c
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_s32.h"
-#include "mul_s32_loSR_sat.h"
-
-int32_T mul_s32_loSR_sat(int32_T a, int32_T b, uint32_T aShift)
-{
-  int32_T result;
-  uint32_T u32_chi;
-  uint32_T u32_clo;
-  mul_wide_s32(a, b, &u32_chi, &u32_clo);
-  u32_clo = u32_chi << /*MW:OvBitwiseOk*/ (32U - aShift) | u32_clo >> aShift;
-  u32_chi = (uint32_T)((int32_T)u32_chi >> aShift);
-  if (((int32_T)u32_chi > 0) || ((u32_chi == 0U) && (u32_clo >= 2147483648U))) {
-    result = MAX_int32_T;
-  } else if (((int32_T)u32_chi < -1) || (((int32_T)u32_chi == -1) && (u32_clo <
-               2147483648U))) {
-    result = MIN_int32_T;
-  } else {
-    result = (int32_T)u32_clo;
-  }
-
-  return result;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 37
src/EmbeddedCoder_src/mul_s32_sat.c

@@ -1,37 +0,0 @@
-/*
- * File: mul_s32_sat.c
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_s32.h"
-#include "mul_s32_sat.h"
-
-int32_T mul_s32_sat(int32_T a, int32_T b)
-{
-  int32_T result;
-  uint32_T u32_chi;
-  uint32_T u32_clo;
-  mul_wide_s32(a, b, &u32_chi, &u32_clo);
-  if (((int32_T)u32_chi > 0) || ((u32_chi == 0U) && (u32_clo >= 2147483648U))) {
-    result = MAX_int32_T;
-  } else if (((int32_T)u32_chi < -1) || (((int32_T)u32_chi == -1) && (u32_clo <
-               2147483648U))) {
-    result = MIN_int32_T;
-  } else {
-    result = (int32_T)u32_clo;
-  }
-
-  return result;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 27
src/EmbeddedCoder_src/mul_s32_sr32_ceil.c

@@ -1,27 +0,0 @@
-/*
- * File: mul_s32_sr32_ceil.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.52
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Tue Sep 14 16:42:25 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_s32.h"
-#include "mul_s32_sr32_ceil.h"
-
-int32_T mul_s32_sr32_ceil(int32_T a, int32_T b)
-{
-  uint32_T u32_chi;
-  uint32_T u32_clo;
-  mul_wide_s32(a, b, &u32_chi, &u32_clo);
-  return (int32_T)((u32_clo != 0U) + u32_chi);
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 37
src/EmbeddedCoder_src/mul_ssu32_sat.c

@@ -1,37 +0,0 @@
-/*
- * File: mul_ssu32_sat.c
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_su32.h"
-#include "mul_ssu32_sat.h"
-
-int32_T mul_ssu32_sat(int32_T a, uint32_T b)
-{
-  int32_T result;
-  uint32_T u32_chi;
-  uint32_T u32_clo;
-  mul_wide_su32(a, b, &u32_chi, &u32_clo);
-  if (((int32_T)u32_chi > 0) || ((u32_chi == 0U) && (u32_clo >= 2147483648U))) {
-    result = MAX_int32_T;
-  } else if (((int32_T)u32_chi < -1) || (((int32_T)u32_chi == -1) && (u32_clo <
-               2147483648U))) {
-    result = MIN_int32_T;
-  } else {
-    result = (int32_T)u32_clo;
-  }
-
-  return result;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 27
src/EmbeddedCoder_src/mul_u32_hiSR.c

@@ -1,27 +0,0 @@
-/*
- * File: mul_u32_hiSR.c
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_u32.h"
-#include "mul_u32_hiSR.h"
-
-uint32_T mul_u32_hiSR(uint32_T a, uint32_T b, uint32_T aShift)
-{
-  uint32_T u32_chi;
-  uint32_T u32_clo;
-  mul_wide_u32(a, b, &u32_chi, &u32_clo);
-  return u32_chi >> aShift;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 27
src/EmbeddedCoder_src/mul_u32_hiSR_near.c

@@ -1,27 +0,0 @@
-/*
- * File: mul_u32_hiSR_near.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.51
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:48 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_u32.h"
-#include "mul_u32_hiSR_near.h"
-
-uint32_T mul_u32_hiSR_near(uint32_T a, uint32_T b, uint32_T aShift)
-{
-  uint32_T u32_chi;
-  uint32_T u32_clo;
-  mul_wide_u32(a, b, &u32_chi, &u32_clo);
-  return ((1U << (aShift - 1U) & u32_chi) != 0U) + (u32_chi >> aShift);
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 35
src/EmbeddedCoder_src/mul_us32_sat.c

@@ -1,35 +0,0 @@
-/*
- * File: mul_us32_sat.c
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_s32.h"
-#include "mul_us32_sat.h"
-
-uint32_T mul_us32_sat(int32_T a, int32_T b)
-{
-  uint32_T result;
-  uint32_T u32_chi;
-  mul_wide_s32(a, b, &u32_chi, &result);
-  if ((int32_T)u32_chi >= 0) {
-    if (u32_chi) {
-      result = MAX_uint32_T;
-    }
-  } else {
-    result = 0U;
-  }
-
-  return result;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 64
src/EmbeddedCoder_src/mul_wide_s32.c

@@ -1,64 +0,0 @@
-/*
- * File: mul_wide_s32.c
- *
- * Code generated for Simulink model 'SFM'.
- *
- * Model version                  : 1.71
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:17:31 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_s32.h"
-
-void mul_wide_s32(int32_T in0, int32_T in1, uint32_T *ptrOutBitsHi, uint32_T
-                  *ptrOutBitsLo)
-{
-  uint32_T absIn0;
-  uint32_T absIn1;
-  uint32_T in0Hi;
-  uint32_T in0Lo;
-  uint32_T in1Hi;
-  uint32_T productHiLo;
-  uint32_T productLoHi;
-  absIn0 = in0 < 0 ? ~(uint32_T)in0 + 1U : (uint32_T)in0;
-  absIn1 = in1 < 0 ? ~(uint32_T)in1 + 1U : (uint32_T)in1;
-  in0Hi = absIn0 >> 16U;
-  in0Lo = absIn0 & 65535U;
-  in1Hi = absIn1 >> 16U;
-  absIn0 = absIn1 & 65535U;
-  productHiLo = in0Hi * absIn0;
-  productLoHi = in0Lo * in1Hi;
-  absIn0 *= in0Lo;
-  absIn1 = 0U;
-  in0Lo = (productLoHi << /*MW:OvBitwiseOk*/ 16U) + /*MW:OvCarryOk*/ absIn0;
-  if (in0Lo < absIn0) {
-    absIn1 = 1U;
-  }
-
-  absIn0 = in0Lo;
-  in0Lo += /*MW:OvCarryOk*/ productHiLo << /*MW:OvBitwiseOk*/ 16U;
-  if (in0Lo < absIn0) {
-    absIn1++;
-  }
-
-  absIn0 = (((productLoHi >> 16U) + (productHiLo >> 16U)) + in0Hi * in1Hi) +
-    absIn1;
-  if ((in0 != 0) && ((in1 != 0) && ((in0 > 0) != (in1 > 0)))) {
-    absIn0 = ~absIn0;
-    in0Lo = ~in0Lo;
-    in0Lo++;
-    if (in0Lo == 0U) {
-      absIn0++;
-    }
-  }
-
-  *ptrOutBitsHi = absIn0;
-  *ptrOutBitsLo = in0Lo;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 63
src/EmbeddedCoder_src/mul_wide_su32.c

@@ -1,63 +0,0 @@
-/*
- * File: mul_wide_su32.c
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_su32.h"
-
-void mul_wide_su32(int32_T in0, uint32_T in1, uint32_T *ptrOutBitsHi, uint32_T
-                   *ptrOutBitsLo)
-{
-  uint32_T absIn0;
-  uint32_T in0Hi;
-  uint32_T in1Hi;
-  uint32_T in1Lo;
-  uint32_T outBitsLo;
-  uint32_T productHiLo;
-  uint32_T productLoHi;
-  absIn0 = in0 < 0 ? ~(uint32_T)in0 + 1U : (uint32_T)in0;
-  in0Hi = absIn0 >> 16U;
-  absIn0 &= 65535U;
-  in1Hi = in1 >> 16U;
-  in1Lo = in1 & 65535U;
-  productHiLo = in0Hi * in1Lo;
-  productLoHi = absIn0 * in1Hi;
-  absIn0 *= in1Lo;
-  in1Lo = 0U;
-  outBitsLo = (productLoHi << /*MW:OvBitwiseOk*/ 16U) + /*MW:OvCarryOk*/ absIn0;
-  if (outBitsLo < absIn0) {
-    in1Lo = 1U;
-  }
-
-  absIn0 = outBitsLo;
-  outBitsLo += /*MW:OvCarryOk*/ productHiLo << /*MW:OvBitwiseOk*/ 16U;
-  if (outBitsLo < absIn0) {
-    in1Lo++;
-  }
-
-  absIn0 = (((productLoHi >> 16U) + (productHiLo >> 16U)) + in0Hi * in1Hi) +
-    in1Lo;
-  if ((in1 != 0U) && (in0 < 0)) {
-    absIn0 = ~absIn0;
-    outBitsLo = ~outBitsLo;
-    outBitsLo++;
-    if (outBitsLo == 0U) {
-      absIn0++;
-    }
-  }
-
-  *ptrOutBitsHi = absIn0;
-  *ptrOutBitsLo = outBitsLo;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 52
src/EmbeddedCoder_src/mul_wide_u32.c

@@ -1,52 +0,0 @@
-/*
- * File: mul_wide_u32.c
- *
- * Code generated for Simulink model 'BLC'.
- *
- * Model version                  : 1.50
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Thu Sep  9 17:18:08 2021
- */
-
-#include "rtwtypes.h"
-#include "mul_wide_u32.h"
-
-void mul_wide_u32(uint32_T in0, uint32_T in1, uint32_T *ptrOutBitsHi, uint32_T
-                  *ptrOutBitsLo)
-{
-  uint32_T in0Hi;
-  uint32_T in0Lo;
-  uint32_T in1Hi;
-  uint32_T in1Lo;
-  uint32_T outBitsLo;
-  uint32_T productHiLo;
-  uint32_T productLoHi;
-  in0Hi = in0 >> 16U;
-  in0Lo = in0 & 65535U;
-  in1Hi = in1 >> 16U;
-  in1Lo = in1 & 65535U;
-  productHiLo = in0Hi * in1Lo;
-  productLoHi = in0Lo * in1Hi;
-  in0Lo *= in1Lo;
-  in1Lo = 0U;
-  outBitsLo = (productLoHi << /*MW:OvBitwiseOk*/ 16U) + /*MW:OvCarryOk*/ in0Lo;
-  if (outBitsLo < in0Lo) {
-    in1Lo = 1U;
-  }
-
-  in0Lo = outBitsLo;
-  outBitsLo += /*MW:OvCarryOk*/ productHiLo << /*MW:OvBitwiseOk*/ 16U;
-  if (outBitsLo < in0Lo) {
-    in1Lo++;
-  }
-
-  *ptrOutBitsHi = (((productLoHi >> 16U) + (productHiLo >> 16U)) + in0Hi * in1Hi)
-    + in1Lo;
-  *ptrOutBitsLo = outBitsLo;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 92
src/EmbeddedCoder_src/rtGetInf.c

@@ -1,92 +0,0 @@
-/*
- * File: rtGetInf.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-/*
- * Abstract:
- *      Function to initialize non-finite, Inf
- */
-#include "rtGetInf.h"
-#define NumBitsPerChar                 8U
-
-/*
- * Initialize rtInf needed by the generated code.
- * Inf is initialized as non-signaling. Assumes IEEE.
- */
-real_T rtGetInf(void)
-{
-  size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
-  real_T inf = 0.0;
-  if (bitsPerReal == 32U) {
-    inf = rtGetInfF();
-  } else {
-    union {
-      LittleEndianIEEEDouble bitVal;
-      real_T fltVal;
-    } tmpVal;
-
-    tmpVal.bitVal.words.wordH = 0x7FF00000U;
-    tmpVal.bitVal.words.wordL = 0x00000000U;
-    inf = tmpVal.fltVal;
-  }
-
-  return inf;
-}
-
-/*
- * Initialize rtInfF needed by the generated code.
- * Inf is initialized as non-signaling. Assumes IEEE.
- */
-real32_T rtGetInfF(void)
-{
-  IEEESingle infF;
-  infF.wordL.wordLuint = 0x7F800000U;
-  return infF.wordL.wordLreal;
-}
-
-/*
- * Initialize rtMinusInf needed by the generated code.
- * Inf is initialized as non-signaling. Assumes IEEE.
- */
-real_T rtGetMinusInf(void)
-{
-  size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
-  real_T minf = 0.0;
-  if (bitsPerReal == 32U) {
-    minf = rtGetMinusInfF();
-  } else {
-    union {
-      LittleEndianIEEEDouble bitVal;
-      real_T fltVal;
-    } tmpVal;
-
-    tmpVal.bitVal.words.wordH = 0xFFF00000U;
-    tmpVal.bitVal.words.wordL = 0x00000000U;
-    minf = tmpVal.fltVal;
-  }
-
-  return minf;
-}
-
-/*
- * Initialize rtMinusInfF needed by the generated code.
- * Inf is initialized as non-signaling. Assumes IEEE.
- */
-real32_T rtGetMinusInfF(void)
-{
-  IEEESingle minfF;
-  minfF.wordL.wordLuint = 0xFF800000U;
-  return minfF.wordL.wordLreal;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 58
src/EmbeddedCoder_src/rtGetNaN.c

@@ -1,58 +0,0 @@
-/*
- * File: rtGetNaN.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-/*
- * Abstract:
- *      Function to initialize non-finite, NaN
- */
-#include "rtGetNaN.h"
-#define NumBitsPerChar                 8U
-
-/*
- * Initialize rtNaN needed by the generated code.
- * NaN is initialized as non-signaling. Assumes IEEE.
- */
-real_T rtGetNaN(void)
-{
-  size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
-  real_T nan = 0.0;
-  if (bitsPerReal == 32U) {
-    nan = rtGetNaNF();
-  } else {
-    union {
-      LittleEndianIEEEDouble bitVal;
-      real_T fltVal;
-    } tmpVal;
-
-    tmpVal.bitVal.words.wordH = 0xFFF80000U;
-    tmpVal.bitVal.words.wordL = 0x00000000U;
-    nan = tmpVal.fltVal;
-  }
-
-  return nan;
-}
-
-/*
- * Initialize rtNaNF needed by the generated code.
- * NaN is initialized as non-signaling. Assumes IEEE.
- */
-real32_T rtGetNaNF(void)
-{
-  IEEESingle nanF = { { 0 } };
-
-  nanF.wordL.wordLuint = 0xFFC00000U;
-  return nanF.wordL.wordLreal;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 90
src/EmbeddedCoder_src/rt_nonfinite.c

@@ -1,90 +0,0 @@
-/*
- * File: rt_nonfinite.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-/*
- * Abstract:
- *      Function to initialize non-finites,
- *      (Inf, NaN and -Inf).
- */
-#include "rt_nonfinite.h"
-#include "rtGetNaN.h"
-#include "rtGetInf.h"
-#define NumBitsPerChar                 8U
-
-real_T rtInf;
-real_T rtMinusInf;
-real_T rtNaN;
-real32_T rtInfF;
-real32_T rtMinusInfF;
-real32_T rtNaNF;
-
-/*
- * Initialize the rtInf, rtMinusInf, and rtNaN needed by the
- * generated code. NaN is initialized as non-signaling. Assumes IEEE.
- */
-void rt_InitInfAndNaN(size_t realSize)
-{
-  (void) (realSize);
-  rtNaN = rtGetNaN();
-  rtNaNF = rtGetNaNF();
-  rtInf = rtGetInf();
-  rtInfF = rtGetInfF();
-  rtMinusInf = rtGetMinusInf();
-  rtMinusInfF = rtGetMinusInfF();
-}
-
-/* Test if value is infinite */
-boolean_T rtIsInf(real_T value)
-{
-  return (boolean_T)((value==rtInf || value==rtMinusInf) ? 1U : 0U);
-}
-
-/* Test if single-precision value is infinite */
-boolean_T rtIsInfF(real32_T value)
-{
-  return (boolean_T)(((value)==rtInfF || (value)==rtMinusInfF) ? 1U : 0U);
-}
-
-/* Test if value is not a number */
-boolean_T rtIsNaN(real_T value)
-{
-  boolean_T result = (boolean_T) 0;
-  size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
-  if (bitsPerReal == 32U) {
-    result = rtIsNaNF((real32_T)value);
-  } else {
-    union {
-      LittleEndianIEEEDouble bitVal;
-      real_T fltVal;
-    } tmpVal;
-
-    tmpVal.fltVal = value;
-    result = (boolean_T)((tmpVal.bitVal.words.wordH & 0x7FF00000) == 0x7FF00000 &&
-                         ( (tmpVal.bitVal.words.wordH & 0x000FFFFF) != 0 ||
-                          (tmpVal.bitVal.words.wordL != 0) ));
-  }
-
-  return result;
-}
-
-/* Test if single-precision value is not a number */
-boolean_T rtIsNaNF(real32_T value)
-{
-  IEEESingle tmp;
-  tmp.wordL.wordLreal = value;
-  return (boolean_T)( (tmp.wordL.wordLuint & 0x7F800000) == 0x7F800000 &&
-                     (tmp.wordL.wordLuint & 0x007FFFFF) != 0 );
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */

+ 0 - 68
src/EmbeddedCoder_src/rt_powd_snf.c

@@ -1,68 +0,0 @@
-/*
- * File: rt_powd_snf.c
- *
- * Code generated for Simulink model 'SOC'.
- *
- * Model version                  : 1.15
- * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
- * C/C++ source code generated on : Wed Aug 11 09:45:09 2021
- */
-
-#include "rtwtypes.h"
-#include "rtGetNaN.h"
-#include "rt_nonfinite.h"
-#include "rtGetInf.h"
-#include <math.h>
-#include "rt_powd_snf.h"
-
-real_T rt_powd_snf(real_T u0, real_T u1)
-{
-  real_T tmp;
-  real_T tmp_0;
-  real_T y;
-  if (rtIsNaN(u0) || rtIsNaN(u1)) {
-    y = (rtNaN);
-  } else {
-    tmp = fabs(u0);
-    tmp_0 = fabs(u1);
-    if (rtIsInf(u1)) {
-      if (tmp == 1.0) {
-        y = 1.0;
-      } else if (tmp > 1.0) {
-        if (u1 > 0.0) {
-          y = (rtInf);
-        } else {
-          y = 0.0;
-        }
-      } else if (u1 > 0.0) {
-        y = 0.0;
-      } else {
-        y = (rtInf);
-      }
-    } else if (tmp_0 == 0.0) {
-      y = 1.0;
-    } else if (tmp_0 == 1.0) {
-      if (u1 > 0.0) {
-        y = u0;
-      } else {
-        y = 1.0 / u0;
-      }
-    } else if (u1 == 2.0) {
-      y = u0 * u0;
-    } else if ((u1 == 0.5) && (u0 >= 0.0)) {
-      y = sqrt(u0);
-    } else if ((u0 < 0.0) && (u1 > floor(u1))) {
-      y = (rtNaN);
-    } else {
-      y = pow(u0, u1);
-    }
-  }
-
-  return y;
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */