Эх сурвалжийг харах

update log&change both mos open when current >= 5A

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 жил өмнө
parent
commit
48a035ab2d

+ 7 - 12
Application/app/sox/soc.c

@@ -43,13 +43,13 @@ void soc_init(void){
 #define TOHA(x) (float)(x/3600.0f)
 
 void soc_log(void){
-	soc_debug("C now: %.2f\n", TOHA(_soc.coulomb_now));
-	soc_debug("C min: %.2f\n", TOHA(_soc.coulomb_min));
-	soc_debug("C max: %.2f\n", TOHA(_soc.coulomb_max));
-	soc_debug("C char: %.2f\n", TOHA(_soc.charger_coulomb));
-	soc_debug("C dischar: %.2f\n", TOHA(_soc.dischrger_coulomb));
-	soc_debug("C pre char: %.2f\n", TOHA(_soc.pre_discharger_coulomb));
-	soc_debug("C pre dischar: %.2f\n", TOHA(_soc.pre_charger_coulomb));
+	soc_debug("C now: %.4f\n", TOHA(_soc.coulomb_now));
+	soc_debug("C min: %.4f\n", TOHA(_soc.coulomb_min));
+	soc_debug("C max: %.4f\n", TOHA(_soc.coulomb_max));
+	soc_debug("C char: %.4f\n", TOHA(_soc.charger_coulomb));
+	soc_debug("C dischar: %.4f\n", TOHA(_soc.dischrger_coulomb));
+	soc_debug("C pre char: %.4f\n", TOHA(_soc.pre_discharger_coulomb));
+	soc_debug("C pre dischar: %.4f\n", TOHA(_soc.pre_charger_coulomb));
 	soc_debug("C tol: %.2f\n", _soc.total_coulomb);
 	soc_debug("C energy: %f\n", _soc.energy);
 	soc_debug("C delta time %f,%f\n", max_soc_delta_time, soc_delta_time);
@@ -213,14 +213,9 @@ void soc_update(void){
 		chargering = 0;
 		soc_warning("changed to dischargering, current = %d\n", measure_value()->load_current);
 	}
-	double current = measure_value()->load_current / 1000.0f; //A
-	double delta_q = current * _delta_time();
 
 	soc_update_by_current_and_time(measure_value()->load_current, _delta_time());
-
-
 	soc_update_charger_remain_time();
-	
 }
 
 soc_t *get_soc(void){

+ 1 - 1
Application/app/sox/state.c

@@ -336,7 +336,7 @@ static void check_charging(){
    we must judage the current: if current is large than 10A(-10A), 
    we must open the closed mos to avoid the closed mos to be destroyed
 */
-#define MIN_CURRENT_FOR_BOTH_MOS_OPEN (10 * 1000)
+#define MIN_CURRENT_FOR_BOTH_MOS_OPEN (5 * 1000)
 static int _min_current_for_both_mos_count = 0;
 static void _check_mos_stat(void){
 	if (abs(measure_value()->load_current) >= MIN_CURRENT_FOR_BOTH_MOS_OPEN){