BMS_Defines.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. //##############################################################################
  2. //
  3. // FILE: BMS_Defines.h
  4. //
  5. // TITLE: Global Defines
  6. //
  7. //
  8. //##############################################################################
  9. //
  10. //==============================================================================
  11. // Change History:
  12. //==============================================================================
  13. // Datum: | Name | Version:| Change / Cause: | No
  14. //------------------------------------------------------------------------------
  15. // | | | | 002
  16. //------------------------------------------------------------------------------
  17. // | | | | 001
  18. //------------------------------------------------------------------------------
  19. // 05.07.13 | VR | 1.0 | New Build | 000
  20. //==============================================================================
  21. //==============================================================================
  22. // Comment Change / Cause:
  23. //==============================================================================
  24. // Change: 003 // 003
  25. //----------------------
  26. //
  27. //
  28. //==============================================================================
  29. // Change: 002 // 002
  30. //----------------------
  31. //
  32. //
  33. //==============================================================================
  34. // Change: 001 // 001
  35. //----------------------
  36. //
  37. //
  38. //==============================================================================
  39. #ifndef __BMS_DEFINES_H__
  40. #define __BMS_DEFINES_H__
  41. // **** general ******
  42. #define TRUE 1
  43. #define FALSE 0
  44. // ***** CAN0 FSM **********
  45. #define CAN0_NR_OF_TELEGRAMS 8
  46. #define CAN0_NR_OF_SLAVES 6
  47. #define CAN0_TIMEOUT_MS 4
  48. #define CAN0_RASTER_MS 10
  49. #define CAN0_COMM_CYCLE_MS 250
  50. #define CAN0_MAX_NR_OF_SLAVES 16
  51. #define CAN0_MAX_NR_OF_TIMEOUTS 3
  52. #define CAN0_MAX_NR_OF_FAILED_COM 4
  53. #define CAN0_ALL_TELEGRAMS_REC 0xff
  54. #define BMS_ERROR_STACK_SIZE 32
  55. // ***** CAN1 *************
  56. #define CAN1_NR_OF_WAIT_CYCLES 6
  57. #define CAN1_TX_TIMEOUT 3
  58. #define BMS_SOC_NR_OF_CHARGE_AREAS 6
  59. #define BMS_SOC_NR_OF_DISCARGE_AREAS 6
  60. #define BMS_SOC_NR_OF_REST_AREAS 6
  61. #define BMS_SOC_NR_OF_RI_POINTS 2
  62. #define BMS_SOC_MIN_CURRENT_MA 100 // 100mA minimal Charge or discharge current, prevents discharge due to long phases of non doing
  63. #define BMS_MAX_CURRENT_INCONSITENCY_MA 1000 // maximum difference between current measurend by UI and Inverter = 1000mA
  64. // ***** CAN= Modes *********
  65. #define BMS_NIGHT_MODE_SOC 0.45// Threshold for going into night mode
  66. #define BMS_WINTER_MODE_SOC 0.4// Threshold for going into winter mode
  67. #define BMS_WINTER_MODE_TIMEOUT 10000// Time before TURNOFF in Winter mode
  68. #define BMS_WINTER_MODE_RECOVER_PWR 20// minimum power from inverter to start recovering from Winter Mode
  69. // startup FRAM States
  70. #define BMS_STARTUP_FIRST_RUN 0x0001
  71. #define BMS_STARTUP_WINTER_MODE 0x0002
  72. #define BMS_STARTUP_ERROR_MODE_1 0x0004
  73. #define BMS_STARTUP_ERROR_MODE_2 0x0008
  74. #define BMS_STARTUP_ERROR_MODE_3 0x0010
  75. #define BMS_STARTUP_UPGRADE_SYSTEM 0x0020
  76. #define BMS_STARTUP_TEST_MODE 0x0040 // has to be removed in final version
  77. // FRAM ADDRESS
  78. #define BMS_STARTUP_MODE_ADDR 0x20
  79. #define BMS_STARTUP_SOC 0x22
  80. #define BMS_SLAVE_CAN_ID_VALID 0x24 // uint16_t Slave_Can_Id_valid => 2 Byte => till 0x26 occupied
  81. #define BMS_SLAVE_ANZ 0x26 // uint16_t Slave_Anz => 2 Byte => till 0x28 occupied
  82. #define BMS_SERNR 0x28 // uint8_t SerNr[17][8] => 136 Byte => till 0xB0 occupied
  83. #define BMS_SLAVE_CAN_ID_END 0xB0
  84. //#define BMS_ERROR_BUFFER1_OFFSET 0x200;
  85. //#define BMS_ERROR_BUFFER2_OFFSET 0x300;
  86. //#define BMS_ERROR_BUFFER3_OFFSET 0x400;
  87. //+ **** BMS TX Value IDs *****
  88. #define CAN1_TX_MAX_BATTERY_CHARGE_CURRENT_ID 0x1E5FCA70
  89. #define CAN1_TX_MAX_BATTERY_CHARGE_VOLTAGE_ID 0x6E491B50
  90. #define CAN1_TX_MAX_BATTERY_DISCHARGE_CURRENT_ID 0xDF0A735C
  91. #define CAN1_TX_MIN_BATTERY_DISCHARGE_VOLTAGE_ID 0xB0EBE75A
  92. #define CAN1_TX_BATTERY_CURRENT_ID 0x21961B58
  93. #define CAN1_TX_BATTERY_VOLTAGE_ID 0x65EED11B
  94. #define CAN1_TX_BATTERY_SOC_TARGET_ID 0x8B9FF008
  95. #define CAN1_TX_BATTERY_SOC_ID 0x959930BF
  96. #define CAN1_TX_BATTERY_CAPACITY 0xB57B59BD
  97. #define CAN1_TX_REQUESTED_VALUE_ID_ID 0x69AA598A
  98. #define CAN1_TX_BATTERY_TEMPERATURE 0x902AFAFB
  99. #define CAN1_TX_BATTERY_SOH 0x381B8BF9
  100. #define CAN1_TX_BATTERY_STATUS 0x71765BD8
  101. #define CAN1_TX_CELL_STATUS 0xD143A391
  102. #define CAN1_TX_BATTERY_MODE 0x11111111
  103. #define CAN1_TX_BATTERY_STATUS_EXTRA 0x0DE3D20D
  104. // ***** BMS RX VALUE IDS
  105. #define CAN1_RX_ACTUAL_AC_POWER_ID 0xDB2D69AE
  106. #define CAN1_RX_PHASE_L1_VOLTAGE 0xCF053085
  107. #define CAN1_RX_PHASE_L2_VOLTAGE 0x54B4684E
  108. #define CAN1_RX_PHASE_L3_VOLTAGE 0x2545E22D
  109. #define CAN1_RX_DC_INPUT_A_VOLTAGE 0xB298395D
  110. #define CAN1_RX_DC_INPUT_B_VOLTAGE 0x5BB8075A
  111. #define CAN1_RX_ISLAND_MODE 0x3623D82A
  112. #define CAN1_RX_DC_INPUT_A_POWER 0xDB11855B
  113. #define CAN1_RX_DC_INPUT_B_POWER 0x0CB5D21B
  114. #define CAN1_RX_TOTAL_DC_PWR 0xE31F8B17
  115. #define CAN1_RX_BATTERY_CURRENT 0x0AFDD6CF
  116. #define CAN1_RX_BATTERY_VOLTAGE 0x97E3A6F2
  117. #define CAN1_NR_OF_REQUEST_TELEGRAMS 4
  118. // ***** SLAVE OPERATION MODE
  119. #define BMS_SLAVE_STAND_BY 0x1
  120. #define BMS_SLAVE_CAL_Test 0x2
  121. #define BMS_SLAVE_RUN 0x4
  122. #define BMS_SLAVE_ERROR 0x8
  123. #define BMS_SLAVE_RESET 0x10
  124. #define BMS_SLAVE_DATA_OK 0x0
  125. #define BMS_SALVE_DATA_ERROR_ALIVE_CNT 0x1
  126. #define BMS_SLAVE_DATA_ERROR_ALIVE_TIMEOUT 0x2
  127. #define BMS_SLAVE_DATA_ERROR_VOLTAGE_LIMIT 0x4
  128. #define BMS_SLAVE_DATA_ERROR_TEMP_LIMIT 0x8
  129. #define BMS_SLAVE_DATA_ERROR_HEAT_SINK_LIMIT 0x10
  130. #define BMS_SLAVE_DATA_ERROR_BOARD_ELECTRONIC 0x20
  131. #define BMS_SLAVE_DATA_ERROR_OVER_VOLTAGE 0x40
  132. #define BMS_SLAVE_DATA_ERROR_UNDER_VOLTAGE 0x80
  133. // ******** BMS Error Stack *********** //
  134. #define BMS_ERROR_STACK_DATA_OK 0
  135. #define BMS_ERROR_STACK_SLAVE_OVER_VOLTAGE 0x001
  136. #define BMS_ERROR_STACK_SLAVE_UNDER_VOLTAGE 0x002
  137. #define BMS_ERROR_STACK_SLAVE_OVER_TEMP_CHARGE 0x004
  138. #define BMS_ERROR_STACK_SLAVE_UNDER_TEMP_CHARGE 0x008
  139. #define BMS_ERROR_STACK_SLAVE_OVER_TEMP_DISCHARGE 0x010
  140. #define BMS_ERROR_STACK_SLAVE_UNDER_TEMP_DISCHARGE 0x020
  141. #define BMS_ERROR_STACK_SLAVE_TEMP_DIFFERENCE 0x040
  142. #define BMS_ERROR_STACK_SLAVE_TEMP_BOARD 0x080
  143. #define BMS_ERROR_STACK_SLAVE_SPI_ERROR 0x100
  144. #define BMS_ERROR_STACK_SLAVE_LTC_TIMING 0x200
  145. #define BMS_ERROR_STACK_SLAVE_LTC_SELF_TEST 0x400
  146. #define BMS_ERROR_STACK_SLAVE_CAN_ERROR 0x800
  147. #define BMS_ERROR_STACK_UI_OK 0
  148. #define BMS_ERROR_STACK_UI_CAN_ERROR 0x01
  149. #define BMS_ERROR_STACK_UI_OVER_CURRENT 0x02
  150. #define BMS_ERROR_STACK_UI_CURRENT_INCONSIST 0x04
  151. #define BMS_ERROR_STACK_UI_VOLTAGE_INCONSIST 0x08
  152. #define BMS_ERROR_STACK_UI_OVER_VOLTAGE 0x10
  153. #define BMS_ERROR_STACK_UI_SUPPLY_VOLTAGE 0x20
  154. #define BMS_ERROR_STACK_UI_OFFSET_ERROR 0x40
  155. #define BMS_ERROR_STACK_UI_RELAY_OPEN 0x80
  156. #define BMS_ERROR_STACK_MASTER_OK 0
  157. #define BMS_ERROR_STACK_MASTER_VCC_12V 0x001
  158. #define BMS_ERROR_STACK_MASTER_VCC_3V3 0x002
  159. #define BMS_ERROR_STACK_MASTER_UMIN_1 0x004
  160. #define BMS_ERROR_STACK_MASTER_UMIN_2 0x008
  161. #define BMS_ERROR_STACK_MASTER_UMIN_3 0x010
  162. #define BMS_ERROR_STACK_MASTER_UMAX_1 0x020
  163. #define BMS_ERROR_STACK_MASTER_UMAX_2 0x040
  164. #define BMS_ERROR_STACK_MASTER_UMAX_SYSTEM 0x080
  165. #define BMS_ERROR_STACK_MASTER_VOLTAGE_INCONSIT 0x100
  166. #define BMS_ERROR_STACK_MASTER_EXTERN_CAN_ERROR 0x200
  167. #define BMS_ERROR_STACK_MASTER_FLASH 0x400
  168. #define BMS_ERROR_STACK_MASTER_I_MAX_DISCHARGE_OP 0x800
  169. #define BMS_ERROR_STACK_MASTER_I_MAX_CHARGE_OP 0x1000
  170. #define BMS_ERROR_STACK_MASTER_UMAX_3 0x2000
  171. #define BMS_ERROR_STACK_MASTER_INVERTER_CONNECT_SHORT_CIRCUIT 0x4000
  172. #define BMS_ERROR_STACK_MASTER_INVERTER_CONNECT_LS_STUCK 0x8000
  173. // BMS ERROR HANDLING
  174. #define BMS_ERROR_ERROR_STACK_SIZE 32 // 32 Error Entries possible
  175. #define BMS_ERROR_BUFFER1_OFFSET 0x200;
  176. #define BMS_ERROR_BUFFER2_OFFSET 0x300;
  177. #define BMS_ERROR_BUFFER3_OFFSET 0x400;
  178. #define BMS_ERROR_CLASS_1 1
  179. #define BMS_ERROR_CLASS_2 2
  180. #define BMS_ERROR_CLASS_3 3
  181. #define BMS_ERROR_UI_ID 15
  182. #define BMS_ERROR_MASTER_ID 16
  183. #define BMS_ERROR_FSM_ES2_TIMEOUT 300000 // 30s timeout at error state 2
  184. #define BMS_ERROR_FSM_ES3_TIMEOUT 300000 // 30s min timeout at error state 3
  185. #define BMS_ERROR_RESTORE_TIMEOUT 300000 // 5 Minutes for Inverter to clear Error
  186. #define BMS_SOC_LOW_MARK 0.1
  187. #define BMS_SOC_UMIN_1_DERATE 3000
  188. #define BMS_SOC_UMIN_1 2975
  189. #define BMS_SOC_UMIN_2 2900
  190. #define BMS_SOC_UMIN_3 2800
  191. #define BMS_SOC_UMAX_1 3500
  192. #define BMS_SOC_UMAX_2 3550
  193. #define BMS_SOC_UMAX_3 3600
  194. #define BMS_ERROR_THRESHOLD_UMAX_SYSTEM 610000 // Umax System = 610V
  195. #define BMS_ERROR_THRESHOLD_T_DISCHARGE_MIN -10
  196. #define BMS_ERROR_THRESHOLD_T_DISCHARGE_MAX 60
  197. #define BMS_ERROR_THRESHOLD_T_HEATSINK_MIN -20
  198. #define BMS_ERROR_THRESHOLD_T_HEATSINK_MAX 80
  199. #define BMS_CAN_ID_INIT_RETURN_RUNNING 0
  200. #define BMS_CAN_ID_INIT_RETURN_COMPLETE 1
  201. #define BMS_CAN_ID_INIT_RETURN_ERROR 2
  202. #define BMS_CONNECT_VOLTAGE_EQUAL_MARGIN 0.05 // 5% Voltage difference is ok
  203. #define BMS_CONNECT_VOLTAGE_TEST_MARGIN_MV 10000 // 10V difference is ok
  204. // ********* ERROR STATES *****************
  205. // ****** min max operatrion borders ******
  206. #define BMS_SLAVE_MAX_TEMP 45
  207. #define BMS_SLAVE_MIN_TEMP 5
  208. #define BMS_SLAVE_MAX_CELL_VOLTAGE 3600
  209. #define BMS_SLAVE_MIN_CELL_VOLTAGE 2800
  210. #define BMS_SLAVE_MAX_CURRENT 25000
  211. #define BMS_SLAVE_BATTERY_CHARGE_THERESOLD -50
  212. #define BMS_SLAVE_MAX_BALANCE_VOLTAGE 3400
  213. #define BMS_SLAVE_MIN_BALANCE_SOC 0.8 // start balancing at 80% SoC
  214. #define BMS_SLAVE_MAX_BALANCE_HEATSINK_TEMP 45 // Balance to maximum board Temperature of 45 deg celcius
  215. // ******* SOC ESTIMATOR CONSTANTS *********
  216. #define BMS_SOC_SMOOTH_APPROACH_THRESHOLD 0.01 // one percent
  217. #define BMS_SOC_DERATE_CHARGE_THRESHOLD_SOC 0.9 // start disrating at 90% SoC
  218. #define BMS_SOC_DERATE_CHARGE_THRESHOLD_VOLTAGE 3450 // start dreating at 3450mV
  219. #define BMS_SOC_DERATE_DISCHARGE_THRESHOLD_SOC 0.1 // start disrating at 10% SoC
  220. #define BMS_SOC_DERATE_DISCHARGE_THRESHOLD_VOLTAGE 3000 // start dreating at 3000mV
  221. #define BMS_SOC_CHARGE_MAX_CURRENT BMS_SLAVE_MAX_CURRENT/1000
  222. #define BMS_SLAVE_MAX_CURRENT_A BMS_SLAVE_MAX_CURRENT/1000.0
  223. #define BMS_SOC_NR_OF_AREAS 5
  224. #define BMS_SOC_FLAG_SOC_100 0x0001
  225. #define BMS_SOC_FLAG_SOC_HIGH 0x0002
  226. #define BMS_SOC_FLAG_SOC_0 0x0004
  227. #define BMS_SOC_FLAG_SOC_LOW 0x0008
  228. #define BMS_SOC_CHARGE_SMOOTH_99 0x0001 // SoC at 99%
  229. #define BMS_SOC_CHARGE_SMOOTH_OVERSHOOT 0x0002 // Coulumb counting too fast
  230. #define BMS_SOC_CHARGE_SMOOTH_UNDERSHOOT 0x0004 // Coulumb counting too slow
  231. #define BMS_SOC_DISCHARGE_SMOOTH_01 0x0008 // SoC at 1%
  232. #define BMS_SOC_DISCHARGE_SMOOTH_OVERSHOOT 0x0010 // Coulumb counting too fast
  233. #define BMS_SOC_DISCHARGE_SMOOTH_UNDERSHOOT 0x0020 // Coulumb counting too slow
  234. // ***** FSM *******************************************************************
  235. #define EV__ERROR 0x0001
  236. #define EV__STAND_BY 0x0004
  237. #define EV__INITIALISE 0x0008
  238. #define EV__DRIVE_START_1 0x0010
  239. #define EV__DRIVE_START_2 0x0020
  240. #define EV__DRIVE_START_3 0x0040
  241. #define EV__DRIVE_START_4 0x0080
  242. #define EV__DRIVE 0x0100
  243. #define EV__DRIVE_DELAY 0x0200
  244. #define EV__SHUT_DOWN_DRIVE 0x0400
  245. #define EV__CHARGE 0x0800
  246. #define EV__CHARGE_CC 0x1000
  247. #define EV__CHARGE_CV 0x2000
  248. #define EV__CHARGE_DELAY 0x4000
  249. #define EV__SHUT_DOWN_CHARGE 0x8000
  250. // ***** Error FSM *************************************************************
  251. #define EEV__NO_ERROR 0x0000
  252. #define EEV__SHUT_DOWN_EMERGENCY 0x0001
  253. #define EEV__ALL_OFF 0x0002
  254. #define EEV__SHUT_DOWN_CHARGE 0x0004
  255. #define EEV__CHARGE_OFF 0x0008
  256. #define EEV__DEGRADATION 0x0010
  257. #define EEV__DEGRADATION_ON 0x0020
  258. // ***** MODE REQUEST 6 FEEDBACK ***********************************************
  259. #define MF__STANDBY 0x0000
  260. #define MF__DRIVE 0x0001
  261. #define MF__CHARGE 0x0002
  262. #define MF__ERROR 0x0008
  263. #define MF__END_OF_CHARGE 0X0004
  264. #define MR__STANDBY MF__STANDBY
  265. #define MR__DRIVE MF__DRIVE
  266. #define MR__CHARGE MF__CHARGE
  267. // ***** Slave *****************************************************************
  268. #define MAX_CELLS 120
  269. #define MAX_SLAVE_CELLS 24
  270. #define MAX_SLAVES MAX_CELLS / MAX_SLAVE_CELLS
  271. #define MAX_SLAVES_INDEX MAX_SLAVES -1
  272. #define LOOP_TIME 9000
  273. #define CYCLE_TIME_BALANCER 20
  274. #define CYCLE_TIME_VOLTAGE 30
  275. #define CYCLE_TIME_STATUS 100
  276. #define CYCLE_TIME_UI 100
  277. #define CYCLE_TIME_TEMPERATURE 1000
  278. #define MAX_COUNT_VOLTAGE LOOP_TIME / CYCLE_TIME_VOLTAGE
  279. #define MAX_COUNT_STATUS LOOP_TIME / CYCLE_TIME_STATUS
  280. #define MAX_COUNT_UI LOOP_TIME / CYCLE_TIME_UI
  281. #define MAX_COUNT_TEMPERATURE LOOP_TIME / CYCLE_TIME_TEMPERATURE
  282. #define MAX_COUNT_BALANCER 100
  283. #define MIN_COUNT_BALANCER 5 // dV = 12mV
  284. #define SLAVE_BALANCE_MIN_DELTA_U_MV 20 // dV_min = 10mV
  285. #define UI_VOLTAGE_FIFO_SIZE 60 // one minute of Voltage values
  286. #define UI_CURRENT_FIFO_SIZE 60 // one minute of Current values
  287. #define SOC_SMOOTH_FIFO_SIZE 10
  288. #define INVERTER_VOLTAGE_FIFO_SIZE 200 // approximatlely 1 minute of Battery voltage measured by Inverter
  289. #define INVERTER_CURRENT_FIFO_SIZE 200 // approximately 1 minute of Battery current measured by Inverter
  290. // ***** Relais ****************************************************************
  291. #define RELAIS_ON 1
  292. #define RELAIS_OFF 0
  293. #define HS_RELAIS 5
  294. #define LS_RELAIS 0
  295. #define PRE_CHARGE_RELAIS 6
  296. #define PWR_SUPPLY 8
  297. #define VBAT_RELAIS 7
  298. // **** Inverter Connect Constants ***
  299. #define UI_VOLTAGE_STABILITY_CHECK 20 // nr of voltages to be checked for stability (5 seconds)
  300. #define UI_VOLTAGE_STABILITY_MAX_DEVIATION 3 // 3V min max
  301. #define CONNECT_INVERTER_MIN_WAIT_TIME_MS 5000 // 5s minimum wartezeit
  302. #define CONNECT_INVERTER_MAX_WAIT_TIME_MS 10000 // 10s maximum waittime
  303. #define CONNECT_INVERTER_WAIT_FOR_HS_TO_CLOSE_MS 2000 // 2s for HS relay to be closed
  304. #define CONNECT_INVERTER_SHORT_CIRCUIT_TEST_VOLTAGE 100000.0 // 100000mV
  305. // ***** Cell Errors ***********************************************************
  306. #define ERROR_MAX_CELL_VOLTAGE 0x0001
  307. #define ERROR_MIN_CELL_VOLTAGE 0x0002
  308. #define ERROR_DELTA_CELL_VOLTAGE 0x0004
  309. #define ERROR_MAX_CELL_TEMPERATURE 0x0008
  310. #define ERROR_MIN_CELL_TEMPERATURE 0x0010
  311. #define ERROR_DELTA_CELL_TEMPERATURE 0x0020
  312. #define ERROR_MAX_LOAD_CELL_VOLTAGE 0x0040
  313. #define ERROR_PRE_CELL_LOW_VOLTAGE 0x0080
  314. #define ERROR_PRE_CELL_OVERHEAT 0x0100
  315. #define MAX_COUNT_MSG_VOLTAGE 0x3FFFFFFF // 5 Slaves x 6 MSG -> BitMask = 2^(30-1)
  316. #define MAX_COUNT_MSG_TEMPERATURE 0x00007FFF // 5 Slaves x 3 MSG -> BitMask = 2^(15-1)
  317. #define MAX_COUNT_MSG_STATUS 0x0000001F // 5 Slaves x 1 MSG -> BitMask = 2^( 5-1)
  318. // ***** Slave Errors **********************************************************
  319. #define ERROR_SLAVE_CAN 0x0001
  320. #define ERROR_MAX_LTC_TEMP 0x0002
  321. #define ERROR_MIN_LTC_TEMP 0x0004
  322. #define ERROR_MAX_HEATSINK_TEMPERATURE 0x0008
  323. #define ERROR_SLAVE_PEC 0x0010
  324. #define ERROR_SLAVE_SELFTEST 0x0020
  325. // ***** UI Errors *************************************************************
  326. #define ERROR_MAX_UI_VOLTAGE 0x0001
  327. #define ERROR_MIN_UI_VOLTAGE 0x0002
  328. #define ERROR_MAX_UI_CURRENT 0x0004
  329. #define ERROR_MIN_UI_CURRENT 0x0008
  330. #define ERROR_UI_PEC_NOK 0x0010
  331. #define ERROR_VOLTAGE_FRAME_LOST 0x0020
  332. #define ERROR_STATUS_FRAME_LOST 0x0040
  333. #define ERROR_TEMPERATURE_FRAME_LOST 0x0080
  334. #define ERROR_UI_FRAME_LOST 0x0100
  335. #define ERROR_ISO_GENERAL 0x0200
  336. #define ERROR_ISO_BAD 0x0400
  337. #define ERROR_ISO_LOW 0x0800
  338. // ***** Slave Boarders ********************************************************
  339. #define MAX_CELL_VOLTAGE 4201
  340. #define MAX_CELL_VOLTAGE_TEST MAX_CELL_VOLTAGE + 50
  341. #define PRE_CELL_LOW_VOLTAGE 3100
  342. #define MIN_CELL_VOLTAGE 2999
  343. #define MIN_CELL_VOLTAGE_TEST MIN_CELL_VOLTAGE - 50
  344. #define DELTA_CELL_VOLTAGE 500
  345. #define DELTA_CELL_VOLTAGE_TEST DELTA_CELL_VOLTAGE + 50
  346. #define MAX_LOAD_CELL_VOLTAGE 4150
  347. #define MIN_LOAD_CELL_CURRENT 400 // 4A
  348. #define MAX_SOC 144000000 // 40Ah (x3600sec x 10(=>mA))
  349. #define MAX_UI_VOLTAGE 5040
  350. #define MAX_UI_VOLTAGE_TEST MAX_UI_VOLTAGE + 10
  351. #define MIN_UI_VOLTAGE 3600
  352. #define MIN_UI_VOLTAGE_TEST MIN_UI_VOLTAGE - 10
  353. #define MAX_UI_DRIVE_CURRENT 12000
  354. #define MIN_UI_LOAD_CURRENT -4000
  355. #define MAX_CELL_TEMPERATURE 60
  356. #define MAX_CELL_TEMPERATURE_TEST MAX_CELL_TEMPERATURE + 1
  357. #define PRE_CELL_OVERHEAT 50
  358. #define MIN_CELL_TEMPERATURE -30
  359. #define MIN_CELL_TEMPERATURE_TEST MIN_CELL_TEMPERATURE - 1
  360. #define DELTA_CELL_TEMPERATURE 5
  361. #define DELTA_CELL_TEMPERATURE_TEST DELTA_CELL_TEMPERATURE + 1
  362. #define MAX_HEATSINK_TEMPERATURE 70
  363. #define MAX_HEATSINK_TEMPERATURE_TEST MAX_HEATSINK_TEMPERATURE + 1
  364. #define MIN_ISO_R 20 // kOhm
  365. #define MIN_ISO_R_TEST MIN_ISO_R - 1 // kOhm
  366. #define MAX_AVE 4
  367. #define MAX_AVE_SHIFT 2 // >> 2 = / 4
  368. #define MAX_PRECHARGE_VOLTAGE 50 // 5V
  369. #define MIN_SHUTDOWN_VOLTAGE 600 // 60V
  370. #define RELAIS_SETTLING_TIME 19 // 19ms
  371. #define START_RETRY_DELAY 60000 // 1min
  372. #define STOP_VOLTAGE_DECLINE_DELAY 50 // 50ms
  373. #define DELAY_START 10000 // 1000ms
  374. // ***** CAN0 Telegram *********************************************************
  375. #define CAN0_VOLTAGE_TELEGRAM_SIZE 6
  376. #define CAN0_TEMPERATURE_TELEGRAM_SIZE 3
  377. #define CAN0_STATUS_TELEGRAM_SIZE 1
  378. #define CAN0_BALANCING_TELEGRAM_SIZE 1
  379. #define CAN0_UI_TELEGRAM_SIZE 1
  380. // ***** CAN1 BRUSA ************************************************************
  381. #define NLG5_MAINS_CURRENT 500 // 50A
  382. #define NLG5_OUTPUT_VOLTAGE 5000 // 500V
  383. #define NLG5_OUTPUT_CURRENT 400 // 40A
  384. #endif /* ifndef*/