浏览代码

测功机简单外特性获取

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 3 年之前
父节点
当前提交
ee89cbef19
共有 1 个文件被更改,包括 10 次插入11 次删除
  1. 10 11
      Applications/foc/motor/motor_param.c

+ 10 - 11
Applications/foc/motor/motor_param.c

@@ -4,14 +4,13 @@
 
 #if CONFIG_MOT_TYPE==MOTOR_BLUESHARK_ZD_100
 static motor_map_t mot_map[] = {
-	{1500, 200},
-	{2500, 130},
-	{3000, 110},
-	{3500, 100},
-	{4000, 90},
-	{4500, 80},
-	{5000, 70},
-	{5500, 60},
+	{4500, 200},
+	{4740, 170},
+	{5050, 125},
+	{5400, 85},
+	{5740, 85},//5
+	{6050, 90},//10
+	{6430, 107},//16
 };
 #endif
 
@@ -22,12 +21,12 @@ s16 get_max_torque_for_rpm(s16 rpm) {
 	}
 	for (int i = 1; i < ARRAY_SIZE(mot_map); i++) {
 		if (rpm <= mot_map[i].rpm) { //线性插值
-			float max_trq = mot_map[i-1].torque;
+			float trq1 = mot_map[i-1].torque;
 			float min_rpm = mot_map[i-1].rpm;
-			float min_trq = mot_map[i].torque;
+			float trq2 = mot_map[i].torque;
 			float max_rpm = mot_map[i].rpm;
 
-			return (s16)f_map(rpm, min_rpm, max_rpm, min_trq, max_trq);
+			return (s16)f_map(rpm, min_rpm, max_rpm, min(trq1, trq2), MAX(trq1, trq2));
 		}
 	}
 	return mot_map[ARRAY_SIZE(mot_map)-1].torque;