Ver Fonte

支持欠压动态设置

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui há 3 anos atrás
pai
commit
12056ca6b5

+ 4 - 4
Applications/app/nv_storage.c

@@ -185,9 +185,9 @@ void nv_storage_init(void) {
 	nv_read_motor_params();
 	nv_read_motor_params();
 	nv_read_foc_params();
 	nv_read_foc_params();
 	sys_debug("encoder_off = %f\n", m_params.offset);
 	sys_debug("encoder_off = %f\n", m_params.offset);
-	nv_default_motor_params();
-	nv_default_foc_params();
-	nv_save_foc_params();
-	nv_save_motor_params();
+	//nv_default_motor_params();
+	//nv_default_foc_params();
+	//nv_save_foc_params();
+	//nv_save_motor_params();
 }
 }
 
 

+ 1 - 1
Applications/bsp/board_mc_v1.h

@@ -9,7 +9,7 @@
 #define CONFIG_MOS_MAX_VOL 145.0F
 #define CONFIG_MOS_MAX_VOL 145.0F
 #define CONFIG_MAX_DC_VOL 120.0F
 #define CONFIG_MAX_DC_VOL 120.0F
 #define CONFIG_RATED_DC_VOL (96.0f)   /* 母线最大电压 V*/
 #define CONFIG_RATED_DC_VOL (96.0f)   /* 母线最大电压 V*/
-#define CONFIG_MIN_DC_VOL   (25.0f)
+#define CONFIG_MIN_DC_VOL   (36.0f)
 
 
 #define CONFIG_MAX_VBUS_CURRENT 200.0f
 #define CONFIG_MAX_VBUS_CURRENT 200.0f
 #define CONFIG_MAX_MOT_RPM      9000.0f
 #define CONFIG_MAX_MOT_RPM      9000.0f

+ 6 - 2
Applications/foc/limit.c

@@ -16,10 +16,14 @@ static limter_t mos_temp_lim[] = { //mos过温限流,限制相电流
 	{.enter_pointer = 120, .exit_pointer = 20, .limit_value = 0},
 	{.enter_pointer = 120, .exit_pointer = 20, .limit_value = 0},
 };  
 };  
 static limter_t vol_under_lim[] = { //欠压限流,限制母线
 static limter_t vol_under_lim[] = { //欠压限流,限制母线
-	{.enter_pointer = 40, .exit_pointer = 44, .limit_value = 20},
-	{.enter_pointer = 44, .exit_pointer = 46, .limit_value = 40},
+	{.enter_pointer = 40, .exit_pointer = 48, .limit_value = 10},
 };
 };
 
 
+void limter_set_under_voltage(s16 und_vol) {
+	vol_under_lim[0].enter_pointer = und_vol;
+	vol_under_lim[0].exit_pointer = und_vol + 8;
+}
+
 static u16 _temp_limiter(s16 temp, limter_t *lim) {
 static u16 _temp_limiter(s16 temp, limter_t *lim) {
 	if (!lim->is_limit) {
 	if (!lim->is_limit) {
 		if (temp < lim->enter_pointer) {
 		if (temp < lim->enter_pointer) {

+ 1 - 0
Applications/foc/limit.h

@@ -13,6 +13,7 @@ typedef struct {
 
 
 u16 phase_current_temp_high_limit(void);
 u16 phase_current_temp_high_limit(void);
 u16 vbus_current_vol_lower_limit(void);
 u16 vbus_current_vol_lower_limit(void);
+void limter_set_under_voltage(s16 und_vol);
 
 
 #endif /* _Limit_H__ */
 #endif /* _Limit_H__ */
 
 

+ 2 - 0
Applications/foc/motor/motor.c

@@ -19,6 +19,7 @@
 #include "foc/core/torque.h"
 #include "foc/core/torque.h"
 #include "app/nv_storage.h"
 #include "app/nv_storage.h"
 #include "foc/core/torque.h"
 #include "foc/core/torque.h"
+#include "foc/limit.h"
 
 
 static bool mc_is_hwbrake(void);
 static bool mc_is_hwbrake(void);
 static void _pwm_brake_timer_handler(shark_timer_t *);
 static void _pwm_brake_timer_handler(shark_timer_t *);
@@ -69,6 +70,7 @@ void mc_init(void) {
 	PMSM_FOC_CoreInit();
 	PMSM_FOC_CoreInit();
 	eCtrl_init(CONFIG_ACC_TIME, CONFIG_DEC_TIME);
 	eCtrl_init(CONFIG_ACC_TIME, CONFIG_DEC_TIME);
 	mc_brk_gpio_init();
 	mc_brk_gpio_init();
+	limter_set_under_voltage(nv_get_foc_params()->s_minDCVol);
 	MC_Check_MosVbusThrottle();
 	MC_Check_MosVbusThrottle();
 	sched_timer_enable(CONFIG_SPD_CTRL_US);
 	sched_timer_enable(CONFIG_SPD_CTRL_US);
 	shark_task_create(_self_check_task, NULL);
 	shark_task_create(_self_check_task, NULL);