Browse Source

Projekt stand nach letztem treffen

simon bischof 7 years ago
parent
commit
bc1ccb3c5b

+ 4 - 1
BMS Master/Project_Headers/BMS_Defines.h

@@ -179,6 +179,7 @@
 #define BMS_ERROR_STACK_UI_OVER_VOLTAGE					0x10
 #define BMS_ERROR_STACK_UI_SUPPLY_VOLTAGE				0x20
 #define BMS_ERROR_STACK_UI_OFFSET_ERROR					0x40
+#define BMS_ERROR_STACK_UI_RELAY_OPEN					0x80
 
 #define BMS_ERROR_STACK_MASTER_OK						0
 #define BMS_ERROR_STACK_MASTER_VCC_12V					0x001
@@ -197,6 +198,7 @@
 #define BMS_ERROR_STACK_MASTER_UMAX_3					0x2000
 
 
+
 // BMS ERROR HANDLING
 
 #define BMS_ERROR_ERROR_STACK_SIZE				32		// 32 Error Entries possible
@@ -217,7 +219,8 @@
 #define BMS_ERROR_RESTORE_TIMEOUT				300000 // 5 Minutes for Inverter to clear Error
 
 #define BMS_SOC_LOW_MARK						0.1
-#define BMS_SOC_UMIN_1							3000
+#define BMS_SOC_UMIN_1_DERATE					3000
+#define BMS_SOC_UMIN_1							2975
 #define BMS_SOC_UMIN_2							2900
 #define BMS_SOC_UMIN_3 							2800
 #define BMS_SOC_UMAX_1							3500

+ 1 - 0
BMS Master/Project_Headers/BMS_Master.h

@@ -222,6 +222,7 @@ extern CAN_MAILBOX CAN_Rx_RCT_INVERTER;
 	
 	uint32_t initSoCFifo(MASTER_CAN0_STRUCT_t* s); 
 	uint32_t pushSoCFiFo(MASTER_SOC_ESTIMATOR_t* est);
+	uint32_t BMS_Set_Error_UI_Relais(MASTER_CAN0_STRUCT_t* s) ;
 
 	
 

+ 2 - 1
BMS Master/Project_Headers/BMS_SoC_estimator.h

@@ -20,8 +20,9 @@ int32_t bms_SoC_init_estimator(MASTER_SOC_ESTIMATOR_t* cell_SoC, uint16_t voltag
 uint32_t bms_SoC_running_fsm(MASTER_SOC_ESTIMATOR_t* est, int16_t I_batt, uint16_t U_batt_max,uint16_t U_batt_min, int8_t temp_min, int8_t temp_max);
 float bms_SoC_get_norm(float value);
 float bms_calc_charge_derating(float SoC);
+float bms_calc_discharge_Umin1(uint16_t Umin);
 float bms_calc_discharge_derating(float SoC);
-uint32_t bms_set_derating(MASTER_SOC_ESTIMATOR_t* est, int8_t minTemp, int8_t maxTemp);
+uint32_t bms_set_derating(MASTER_SOC_ESTIMATOR_t* est, int8_t minTemp, int8_t maxTemp, uint16_t Umin); 
 float bms_calc_charge_temp_derating(int8_t Temp) ;
 float bms_calc_discharge_temp_derating(int8_t Temp);
 float linear_interpolate(int8_t x1,int8_t x2,int8_t x,float y1,float y2);

+ 3 - 0
BMS Master/Project_Headers/BMS_Typedefs.h

@@ -851,6 +851,9 @@ typedef struct {
 	float I_max_discharge_SoC	;
 	float I_max_charge_derate;
 	float I_max_discharge_derate; 
+	float test_SoC;
+	float I_max_discharge_SoC_test;
+	float test_SoC_actual;
 }MASTER_OVER_CURRENT_LIMITS_t;
 
 

+ 102 - 102
BMS Master/ReferencedRSESystems.xml

@@ -1,103 +1,103 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- This file stores a copy of all RSE Systems referenced by the project 
-so the systems can be automatically recreated when the project is imported in a new workspace. 
-This file is automatically generated and updated by the Eclipse IDE.-->
-<APSC_Memento>
-<host>
-<properties>
-<property key="hidden.applicator.com.freescale.debugger.applicator.launchconfiguration.lc.BMS Master FLASH.proj.BMS Master" value="com.freescale.debugger.applicator.launchconfiguration.lc.BMS Master FLASH.proj.BMS Master"/>
-<property key="host.address" value=""/>
-<property key="host.defaultEncoding" value=""/>
-<property key="host.defaultUser" value="le8041"/>
-<property key="host.description" value=""/>
-<property key="host.name" value="Flash_debug"/>
-<property key="host.promptable" value="false"/>
-<property key="host.type" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware"/>
-<property key="propertySet.[OptionalPropertySet].enableConnectorServicesPropertyPage" value="false"/>
-<property key="propertySet.[OptionalPropertySet].enableGenericHostPropertyPage" value="false"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.CW_SHADOWED_PREF.Embedded Initialization.simulator" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.PhysicalConnectionAttributeBase" value="com.pemicro.mcu.debug.connections.pne.eppc."/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.SimulatorConnectionAttributeBase" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.CommandLineArgs" value="eppc_icd "/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.ConfigFile" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.Library" value="eppc_pne_gdi"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ALTERNATIVE_ALGORITHM_CHECKBOX" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ALTERNATIVE_ALGORITHM_PATH" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_AUTO_SYNC" value="1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_CURRENT_ALGORITHM_INDEX" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ENABLE_FLASH_PROGRAMMING_DIALOG" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ERASE_PROGRAM_WITHOUT_ASKING" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_PowerDownDelay" value="250"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_PowerUpDelay" value="250"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_currentvoltage" value="255"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_poweroffonexit" value="1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_CYCLONE" value="3"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_FX" value="4"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_NORMAL" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_OSJTAG" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_Multilink_PowerDownDelay" value="250"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_Multilink_PowerUpDelay" value="1000"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PORT" value="21"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PORT_NAME_STRING" value="PE5655057"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_RESET_DELAY" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_IP" value="127.0.0.1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_IP_ENABLED" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_NETWORKCARD" value="127.0.0.1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_NETWORKCARD_ENABLED" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_USE_CYCLONEPRO_RELAYS" value="1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_interface_selection" value="1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.UUID" value="5ceeed42-818d-4b19-a220-3600a3bfcb96"/>
-<property key="propertySet.[cw.dbg.conn].rseSystemId" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system.140207081647+0100.1"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryConnectionOn" value="false"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryTimeout" value="20"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryWithTimeoutOn" value="false"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].TerminateConnectionOn" value="false"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].retryPromptUserActionOn" value="true"/>
-<property key="propertySet.[cw.dbg.ct].Connection Type" value="com.pemicro.mcu.debug.connections.pne.eppc"/>
-<property key="propertySet.[cw.dbg.main].templateId" value="None"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.HostID" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.170203142503+0100"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1486128577361"/>
-</properties>
-</host>
-<host>
-<properties>
-<property key="host.address" value=""/>
-<property key="host.defaultEncoding" value=""/>
-<property key="host.defaultUser" value="mb0005"/>
-<property key="host.description" value=""/>
-<property key="host.name" value="Test_FLASH_PnE U-MultiLink Target"/>
-<property key="host.promptable" value="false"/>
-<property key="host.type" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system"/>
-<property key="propertySet.[OptionalPropertySet].enableConnectorServicesPropertyPage" value="false"/>
-<property key="propertySet.[OptionalPropertySet].enableGenericHostPropertyPage" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.initPath" value="${ProjDirPath}/Project_Settings/Debugger/MPC5646C_VLE.tcl"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.memConfigPath" value="${ProjDirPath}/Project_Settings/Debugger/MPC5646C.mem"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.runOutOfReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.useInitFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.useMemoryConfigFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.1.e200z0h.runOutOfReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.useInitFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.useMemoryConfigFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].enableHSSTIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].enableNetworkIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].enableSerialIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].enableStopTransferIOModelConfig" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].ethernetController" value="UEC1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].executeReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkDebuggerAddress" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkGateway" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkMACAddress" value="**-**-**-**-**-**"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkNetMask" value="255.255.255.255"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkTargetAddress" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkUDPPort" value="1234"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].noIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].targetIsPalladium" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkGateway" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkMACAddress" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkUDPPort" value="false"/>
-<property key="propertySet.[cw.dbg.main].systemType" value="com.freescale.cw.system.eppc.MPC56xxB.MPC5646C"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.HostID" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system.140207081647+0100.1"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1391757409961"/>
-</properties>
-</host>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This file stores a copy of all RSE Systems referenced by the project 
+so the systems can be automatically recreated when the project is imported in a new workspace. 
+This file is automatically generated and updated by the Eclipse IDE.-->
+<APSC_Memento>
+<host>
+<properties>
+<property key="hidden.applicator.com.freescale.debugger.applicator.launchconfiguration.lc.BMS Master FLASH.proj.BMS Master" value="com.freescale.debugger.applicator.launchconfiguration.lc.BMS Master FLASH.proj.BMS Master"/>
+<property key="host.address" value=""/>
+<property key="host.defaultEncoding" value=""/>
+<property key="host.defaultUser" value="le8041"/>
+<property key="host.description" value=""/>
+<property key="host.name" value="Multi_Link"/>
+<property key="host.promptable" value="false"/>
+<property key="host.type" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware"/>
+<property key="propertySet.[OptionalPropertySet].enableConnectorServicesPropertyPage" value="false"/>
+<property key="propertySet.[OptionalPropertySet].enableGenericHostPropertyPage" value="false"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.CW_SHADOWED_PREF.Embedded Initialization.simulator" value=""/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.PhysicalConnectionAttributeBase" value="com.pemicro.mcu.debug.connections.pne.eppc."/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.SimulatorConnectionAttributeBase" value=""/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.CommandLineArgs" value="eppc_icd "/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.ConfigFile" value=""/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.Library" value="eppc_pne_gdi"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ALTERNATIVE_ALGORITHM_CHECKBOX" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ALTERNATIVE_ALGORITHM_PATH" value=""/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_AUTO_SYNC" value="1"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_CURRENT_ALGORITHM_INDEX" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ENABLE_FLASH_PROGRAMMING_DIALOG" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ERASE_PROGRAM_WITHOUT_ASKING" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_PowerDownDelay" value="250"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_PowerUpDelay" value="250"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_currentvoltage" value="255"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_poweroffonexit" value="1"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_CYCLONE" value="3"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_FX" value="4"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_NORMAL" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_OSJTAG" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_Multilink_PowerDownDelay" value="250"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_Multilink_PowerUpDelay" value="1000"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PORT" value="21"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PORT_NAME_STRING" value=""/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_RESET_DELAY" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_IP" value="127.0.0.1"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_IP_ENABLED" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_NETWORKCARD" value="127.0.0.1"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_NETWORKCARD_ENABLED" value="0"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_USE_CYCLONEPRO_RELAYS" value="1"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_interface_selection" value="1"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.UUID" value="a9cf52cc-286d-4867-8d7a-f21e6f5cfe77"/>
+<property key="propertySet.[cw.dbg.conn].rseSystemId" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system.140207081647+0100.1"/>
+<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryConnectionOn" value="false"/>
+<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryTimeout" value="20"/>
+<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryWithTimeoutOn" value="false"/>
+<property key="propertySet.[cw.dbg.ct.targetConnLost].TerminateConnectionOn" value="false"/>
+<property key="propertySet.[cw.dbg.ct.targetConnLost].retryPromptUserActionOn" value="true"/>
+<property key="propertySet.[cw.dbg.ct].Connection Type" value="com.pemicro.mcu.debug.connections.pne.eppc"/>
+<property key="propertySet.[cw.dbg.main].templateId" value="None"/>
+<property key="propertySet.[cw.ide.settingscache].hidden.HostID" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.170214120922+0100"/>
+<property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1487157334638"/>
+</properties>
+</host>
+<host>
+<properties>
+<property key="host.address" value=""/>
+<property key="host.defaultEncoding" value=""/>
+<property key="host.defaultUser" value="mb0005"/>
+<property key="host.description" value=""/>
+<property key="host.name" value="Test_FLASH_PnE U-MultiLink Target"/>
+<property key="host.promptable" value="false"/>
+<property key="host.type" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system"/>
+<property key="propertySet.[OptionalPropertySet].enableConnectorServicesPropertyPage" value="false"/>
+<property key="propertySet.[OptionalPropertySet].enableGenericHostPropertyPage" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.initPath" value="${ProjDirPath}/Project_Settings/Debugger/MPC5646C_VLE.tcl"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.memConfigPath" value="${ProjDirPath}/Project_Settings/Debugger/MPC5646C.mem"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.runOutOfReset" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.useInitFile" value="true"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.useMemoryConfigFile" value="true"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.1.e200z0h.runOutOfReset" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.useInitFile" value="true"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.useMemoryConfigFile" value="true"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].enableHSSTIOModelConfig" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].enableNetworkIOModelConfig" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].enableSerialIOModelConfig" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].enableStopTransferIOModelConfig" value="true"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].ethernetController" value="UEC1"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].executeReset" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].networkDebuggerAddress" value="127.0.0.1"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].networkGateway" value="127.0.0.1"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].networkMACAddress" value="**-**-**-**-**-**"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].networkNetMask" value="255.255.255.255"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].networkTargetAddress" value="127.0.0.1"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].networkUDPPort" value="1234"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].noIOModelConfig" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].targetIsPalladium" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkGateway" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkMACAddress" value="false"/>
+<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkUDPPort" value="false"/>
+<property key="propertySet.[cw.dbg.main].systemType" value="com.freescale.cw.system.eppc.MPC56xxB.MPC5646C"/>
+<property key="propertySet.[cw.ide.settingscache].hidden.HostID" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system.140207081647+0100.1"/>
+<property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1391757409961"/>
+</properties>
+</host>
 </APSC_Memento>

+ 2 - 2
BMS Master/Sources/BMS_CAN0_Mail_Box.c

@@ -1046,8 +1046,8 @@ uint16_t saveSlaveUI_Master_telegram(BMS_CAN0_SLAVE_t* Slave,BMS_CAN0_UI_t* UI_B
 	UI_Board->Ubatt=(Master_Rx7_buff[1] << 8 )+ Master_Rx7_buff[2];
 	UI_Board->Ibatt=(Master_Rx7_buff[3] << 8 )+ Master_Rx7_buff[4];
 	UI_Board->Errors.OffsetError=(Master_Rx7_buff[5] & 0x01 );
-	UI_Board->Errors.SupplyError=(Master_Rx7_buff[5] & 0x02 );
-	UI_Board->Errors.RelayOpen=(Master_Rx7_buff[5] & 0x04 );
+	UI_Board->Errors.SupplyError=((Master_Rx7_buff[5] & 0x02 )>> 1);
+	UI_Board->Errors.RelayOpen=((Master_Rx7_buff[5] & 0x04 )>> 2);
 	UI_Board->Checksum=Master_Rx7_buff[7];	
 	return TRUE;
 }

+ 42 - 42
BMS Master/Sources/BMS_Cell_Config.c

@@ -267,27 +267,27 @@ void initCellConfig(BMS_SLAVE_CONFIGURATION_t* cellConfig) {
 	cellConfig->tempSensConnectionState[0]=	TEMP_SENSOR_CONNECTED;
 	cellConfig->tempSensConnectionState[1]=	TEMP_SENSOR_CONNECTED;
 	cellConfig->tempSensConnectionState[2]=	TEMP_SENSOR_CONNECTED;
-	cellConfig->tempSensConnectionState[3]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[4]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[5]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[6]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[7]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[8]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[9]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[10]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[11]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[12]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[13]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[14]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[15]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[16]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[17]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[18]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[19]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[20]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[21]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[22]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[23]=TEMP_SENSOR_NOT_CONNECTED;
+	cellConfig->tempSensConnectionState[3]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[4]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[5]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[6]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[7]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[8]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[9]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[10]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[11]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[12]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[13]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[14]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[15]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[16]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[17]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[18]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[19]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[20]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[21]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[22]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[23]=TEMP_SENSOR_CONNECTED;
 	
 	// Slave 5
 	cellConfig++;
@@ -322,27 +322,27 @@ void initCellConfig(BMS_SLAVE_CONFIGURATION_t* cellConfig) {
 	cellConfig->tempSensConnectionState[0]=	TEMP_SENSOR_CONNECTED;
 	cellConfig->tempSensConnectionState[1]=	TEMP_SENSOR_CONNECTED;
 	cellConfig->tempSensConnectionState[2]=	TEMP_SENSOR_CONNECTED;
-	cellConfig->tempSensConnectionState[3]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[4]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[5]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[6]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[7]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[8]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[9]=	TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[10]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[11]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[12]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[13]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[14]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[15]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[16]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[17]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[18]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[19]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[20]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[21]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[22]=TEMP_SENSOR_NOT_CONNECTED;
-	cellConfig->tempSensConnectionState[23]=TEMP_SENSOR_NOT_CONNECTED;
+	cellConfig->tempSensConnectionState[3]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[4]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[5]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[6]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[7]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[8]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[9]=	TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[10]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[11]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[12]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[13]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[14]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[15]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[16]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[17]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[18]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[19]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[20]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[21]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[22]=TEMP_SENSOR_CONNECTED;
+	cellConfig->tempSensConnectionState[23]=TEMP_SENSOR_CONNECTED;
 	
 	// Slave 6
 	cellConfig++;

+ 4 - 0
BMS Master/Sources/BMS_Master.c

@@ -416,6 +416,7 @@ uint8_t check_UI_data(BMS_CAN0_SLAVE_t* Slave, BMS_CAN0_SLAVE_t* tempSlave,BMS_C
 	
 	ui->Ubatt=tempUI->Ubatt;
 	ui->Ibatt=tempUI->Ibatt;
+	ui->Errors=tempUI->Errors;
 	ui->Checksum=tempUI->Checksum;
 	return BMS_SLAVE_DATA_OK;
 }
@@ -942,6 +943,9 @@ uint16_t Master_CAN0_fsm(MASTER_CAN0_STRUCT_t* s,uint64_t time) {
 				
 
 				
+				if(s->UI_Board.Errors.RelayOpen==TRUE) {
+					BMS_Set_Error_UI_Relais(s) ;
+				}
 				// Check for "Soft" Errors and set Error states
 				
 

+ 21 - 2
BMS Master/Sources/BMS_Set_Error_States.c

@@ -241,10 +241,14 @@ uint32_t BMS_Set_Error_Check_derating(MASTER_CAN0_STRUCT_t* s) {
 	s->currentLimits.I_max_charge_temp_min = BMS_Set_Error_generate_Fcn(temp_charge_x,temp_charge_y,5,minTemp)*25*1000;
 	s->currentLimits.I_max_charge_SoC      = BMS_Set_Error_generate_Fcn(SoC_charge_x,SoC_charge_y,5,SoC)*1000 *1.1 ;
 	
+	// at derating use most current SOC
 	s->currentLimits.I_max_discharge_temp_max 	= BMS_Set_Error_generate_Fcn(temp_discharge_x,temp_discharge_y,4,maxTemp)*25*1000;
 	s->currentLimits.I_max_discharge_temp_min 	= BMS_Set_Error_generate_Fcn(temp_discharge_x,temp_discharge_y,4,minTemp)*25*1000;
-	s->currentLimits.I_max_discharge_SoC		= BMS_Set_Error_generate_Fcn(SoC_discharge_x,SoC_discharge_y,5,SoC)*1000 *1.1 ;	
-
+	s->currentLimits.I_max_discharge_SoC		= BMS_Set_Error_generate_Fcn(SoC_discharge_x,SoC_discharge_y,5,s->SoC_estimator.SoC_percentage_smooth)*1000 *1.1 ;	
+	s->currentLimits.I_max_discharge_SoC_test=BMS_Set_Error_generate_Fcn(SoC_discharge_x,SoC_discharge_y,5,s->SoC_estimator.SoC_percentage_smooth)*1000 ;
+	s->currentLimits.test_SoC = SoC;
+	s->currentLimits.test_SoC_actual=s->SoC_estimator.SoC_percentage_smooth;
+	
 	if(Current < -100) {
 		// Battery is charged
 		
@@ -351,6 +355,21 @@ uint32_t BMS_Set_Error_Check_derating(MASTER_CAN0_STRUCT_t* s) {
 	return TRUE;
 }
 
+/*
+ * @brief check if UI has opend relays
+ */
+uint32_t BMS_Set_Error_UI_Relais(MASTER_CAN0_STRUCT_t* s) {
+	ErrorStackPushUiError(s,BMS_ERROR_STACK_UI_RELAY_OPEN,BMS_ERROR_CLASS_2);
+	// Kill Relays
+	SwitchRelais( LS_RELAIS, 0);
+	SwitchRelais( PRE_CHARGE_RELAIS, 0);
+	SwitchRelais( HS_RELAIS, 0);
+	s->relayState.HS_closed=FALSE;
+	s->relayState.LS_closed=FALSE;
+	s->relayState.PRECHARGE_closed=FALSE;
+	
+	return TRUE;
+}
 uint32_t BMS_Set_Error_CAN1_Timeout(MASTER_CAN0_STRUCT_t* s) {
 	// CAN 1 Timeout Has occured
 	ErrorStackPushMasterError(s,BMS_ERROR_STACK_MASTER_EXTERN_CAN_ERROR,BMS_ERROR_CLASS_1);

+ 25 - 4
BMS Master/Sources/BMS_SoC_estimator.c

@@ -269,6 +269,7 @@ uint32_t bms_SoC_running_fsm(MASTER_SOC_ESTIMATOR_t* est, int16_t I_batt, uint16
 			// set Flag to prevent SOC from falling in case of relaxation
 			est->flags=BMS_SOC_FLAG_SOC_100;
 			est->state=BMS_SOC_READY;
+			pushSoCFiFo(est); 
 			return 0;
 		break;
 		case BMS_SOC_CHARGE_WAIT_FOR_RELAXATION:
@@ -316,6 +317,7 @@ uint32_t bms_SoC_running_fsm(MASTER_SOC_ESTIMATOR_t* est, int16_t I_batt, uint16
 				est->ChargeSmoothFlags=0;
 				est->SoC_percentage_smooth=est->SoC_percentage ;
 				est->state=BMS_SOC_READY;  
+				pushSoCFiFo(est); 
 				return 0;							   ; 
 			}
 			else if(est->SoC_percentage > 0.99 && est->flags != BMS_SOC_FLAG_SOC_100) {
@@ -392,8 +394,9 @@ uint32_t bms_SoC_running_fsm(MASTER_SOC_ESTIMATOR_t* est, int16_t I_batt, uint16
 		break;	
 		case BMS_SOC_CHARGE_DERATE:
 			// derate SoC depending on the SoC and temperature
-			bms_set_derating(est, temp_min, temp_max);
+			bms_set_derating(est, temp_min, temp_max,U_batt_min);
 			est->state=BMS_SOC_READY;
+			pushSoCFiFo(est); 
 			return 0;	
 		break;
 		case BMS_SOC_DISCHARGE:
@@ -508,7 +511,8 @@ uint32_t bms_SoC_running_fsm(MASTER_SOC_ESTIMATOR_t* est, int16_t I_batt, uint16
 			if(est->flags == BMS_SOC_FLAG_SOC_0) {
 				est->ChargeSmoothFlags=0;
 				est->SoC_percentage_smooth=est->SoC_percentage ;
-				est->state=BMS_SOC_READY;  
+				est->state=BMS_SOC_READY;
+				pushSoCFiFo(est); 
 				return 0;							   ; 
 			}
 			else if(est->SoC_percentage <= 0.01 && est->flags != BMS_SOC_FLAG_SOC_0) {
@@ -585,13 +589,16 @@ uint32_t bms_SoC_running_fsm(MASTER_SOC_ESTIMATOR_t* est, int16_t I_batt, uint16
 		break;			
 		case BMS_SOC_DISCHARGE_DERATE:
 			// derate SoC depending on the SoC and temperature
-			bms_set_derating(est, temp_min, temp_max);
+			bms_set_derating(est, temp_min, temp_max,U_batt_min);
 			est->state=BMS_SOC_READY; 
+			pushSoCFiFo(est); 
 			return 0;
 		break;
 		case BMS_SOC_REST:
 			// no charging or discharging => do nothing
+			bms_set_derating(est, temp_min, temp_max,U_batt_min);
 			est->state=BMS_SOC_READY;
+			pushSoCFiFo(est); 
 			return 0;
 		break;
 		case BMS_SOC_READY:
@@ -644,7 +651,7 @@ float bms_SoC_get_norm(float value) {
 /*
  * @brief set Derating
  */
-uint32_t bms_set_derating(MASTER_SOC_ESTIMATOR_t* est, int8_t minTemp, int8_t maxTemp) {
+uint32_t bms_set_derating(MASTER_SOC_ESTIMATOR_t* est, int8_t minTemp, int8_t maxTemp, uint16_t Umin) {
 	float derating_charge_temp_high;
 	float derating_charge_temp_low;
 	float derating_charge_SoC;
@@ -653,6 +660,7 @@ uint32_t bms_set_derating(MASTER_SOC_ESTIMATOR_t* est, int8_t minTemp, int8_t ma
 	float derating_discharge_temp_high;
 	float derating_discharge_temp_low;
 	float derating_discharge_SoC;
+	float derating_discharge_Umin1;
 
 	// charging
 	derating_charge_SoC=bms_calc_charge_derating(est->SoC_percentage_smooth);
@@ -677,6 +685,7 @@ uint32_t bms_set_derating(MASTER_SOC_ESTIMATOR_t* est, int8_t minTemp, int8_t ma
 	derating_discharge_SoC= bms_calc_discharge_derating(est->SoC_percentage_smooth);
 	derating_discharge_temp_high = bms_calc_discharge_temp_derating(maxTemp);
 	derating_discharge_temp_low = bms_calc_discharge_temp_derating(minTemp);
+	derating_discharge_Umin1 = bms_calc_discharge_Umin1(Umin);
 	
 	// lowest current is choosen to be set as max charge current
 	
@@ -690,6 +699,9 @@ uint32_t bms_set_derating(MASTER_SOC_ESTIMATOR_t* est, int8_t minTemp, int8_t ma
 	if(output_derate > derating_discharge_SoC ) {
 		output_derate = derating_discharge_SoC;
 	}
+	if(output_derate >= derating_discharge_Umin1) {
+		output_derate =derating_discharge_Umin1;
+	}
 	
 	est->MaxBatteryDischargeCurrent=output_derate;
 	
@@ -721,6 +733,15 @@ float bms_calc_charge_derating(float SoC) {
 	
 }
 
+float bms_calc_discharge_Umin1(uint16_t Umin) {
+	if(Umin < BMS_SOC_UMIN_1_DERATE) {
+		return 0.0;
+	}
+	else {
+		return 25.0;
+	}
+}
+
 float bms_calc_discharge_derating(float SoC) {
 	float delta_I=0;
 	float I_C_10=2.5;	// Current at C tens

+ 1 - 1
BMS Master/Sources/main.c

@@ -164,7 +164,7 @@ void main(void)
 	while(BMS_Can_ID_init_fsm (&CAN0_fsm_state) == BMS_CAN_ID_INIT_RETURN_RUNNING ) {
 		// wait
 	}
-	write_fram_clear_startup_state(&CAN0_fsm_state); 
+	//write_fram_clear_startup_state(&CAN0_fsm_state); 
 	write_fram_clear_error_buffer(&CAN0_fsm_state); 
 	//write_fram_set_SoC(0.03);