瀏覽代碼

2021.10.28 / Tim Ling
Actions:
1. Add model AX, DQ, DK and DX.
2. Add power 80KW and 160KW.
3. Add gun type C, W, B, H and A.
4. Add power parameter to defaultRatedCurrent().

Files:
1. Module_RatedCurrent.c
2. Module_RatedCurrent.h

8187 3 年之前
父節點
當前提交
956c296b1d
共有 2 個文件被更改,包括 120 次插入46 次删除
  1. 92 31
      EVSE/Modularization/Module_RatedCurrent.c
  2. 28 15
      EVSE/Modularization/Module_RatedCurrent.h

+ 92 - 31
EVSE/Modularization/Module_RatedCurrent.c

@@ -25,6 +25,7 @@ static SymStruct modelTable[] = {
     { "AC", MODEL_AC },
     { "AW", MODEL_AW },
     { "AP", MODEL_AP },
+	{ "AX", MODEL_AX },
     { "DW", MODEL_DW },
     { "DS", MODEL_DS },
     { "DM", MODEL_DM },
@@ -32,6 +33,10 @@ static SymStruct modelTable[] = {
     //{ "DM", MODEL_DM },
     { "DD", MODEL_DD },
     { "DO", MODEL_DO },
+	{ "DQ", MODEL_DQ },
+	{ "DK", MODEL_DK },
+	{ "DX", MODEL_DX },
+
 };
 
 static SymStruct regulationTable[] = {
@@ -54,9 +59,11 @@ static SymStruct regulationTable[] = {
 static SymStruct powerTable[] = {
     {"30", POWER_30W},
     {"60", POWER_60W},
+	{"80", POWER_80W},
     {"90", POWER_90W},
     {"12", POWER_120W},
     {"15", POWER_150W},
+	{"16", POWER_160W},
     {"18", POWER_180W},
     {"24", POWER_240W},
     {"36", POWER_360W},
@@ -87,6 +94,11 @@ static SymStruct gunTypeTable[] = {
     {"N", GUN_TYPE_N},
     {"P", GUN_TYPE_P},
     {"R", GUN_TYPE_R},
+	{"C", GUN_TYPE_C},
+	{"W", GUN_TYPE_W},
+	{"B", GUN_TYPE_B},
+	{"H", GUN_TYPE_H},
+	{"A", GUN_TYPE_A},
 };
 
 //------------------------------------------------------------------------------
@@ -147,41 +159,79 @@ static int keyfromstring(char *key, SymStruct *table, int tableCount)
 }
 
 //------------------------------------------------------------------------------
-static uint16_t defaultRatedCurrent(uint32_t gunType)
+static uint16_t defaultRatedCurrent(uint32_t gunType, int powerKey)
 {
+	uint16_t ret = RC_0A;
+
+	if(powerKey == BADKEY)
+		powerKey = POWER_30W;
+
     switch (gunType) {
     case GUN_TYPE_J:
-        return RC_125A;
+    	if(powerKey == POWER_30W)
+    		ret = RC_60A;
+    	else if(powerKey >= POWER_60W)
+    		ret =  RC_120A;
         break;
 
     case GUN_TYPE_U:
     case GUN_TYPE_E:
+    	if(powerKey == POWER_30W)
+    		ret =  RC_60A;
+		else if(powerKey == POWER_60W)
+			ret =  RC_120A;
+		else if(powerKey > POWER_60W)
+			ret =  RC_200A;
+		break;
+
+    case GUN_TYPE_G:
+	case GUN_TYPE_B:
+		if(powerKey == POWER_30W)
+			ret =  RC_60A;
+		else if(powerKey == POWER_60W)
+			ret =  RC_120A;
+		else if(powerKey > POWER_60W)
+			ret =  RC_250A;
+		break;
+
+	case GUN_TYPE_M:
+	case GUN_TYPE_N:
+		if(powerKey == POWER_30W)
+			ret =  RC_80A;
+		else if(powerKey == POWER_60W)
+			ret =  RC_120A;
+		else if(powerKey > POWER_60W)
+			ret =  RC_200A;
+		break;
+
     case GUN_TYPE_K:
-        return RC_200A;
+    	ret = RC_200A;
         break;
 
     case GUN_TYPE_V:
     case GUN_TYPE_F:
     case GUN_TYPE_P:
     case GUN_TYPE_R:
-        return RC_500A;
-        break;
-
-    case GUN_TYPE_G:
-        return RC_250A;
+    	ret = RC_500A;
         break;
 
     case GUN_TYPE_T:
     case GUN_TYPE_D:
-        return RC_300A;
+    	ret = RC_300A;
         break;
 
-    case GUN_TYPE_M:
-    case GUN_TYPE_N:
-        return RC_80A;
-        break;
+    case GUN_TYPE_H:
+    	ret = RC_500A;
+    	break;
+
+    case GUN_TYPE_A:
+    	ret = RC_400A;
+    	break;
 
     case GUN_TYPE_0:
+    	ret = RC_0A;
+		break;
+
     case GUN_TYPE_1:
     case GUN_TYPE_2:
     case GUN_TYPE_3:
@@ -195,6 +245,8 @@ static uint16_t defaultRatedCurrent(uint32_t gunType)
         return RC_0A;
         break;
     }
+
+    return ret;
 }
 
 static uint16_t exchangeRatingCur(uint32_t key)
@@ -206,25 +258,24 @@ static uint16_t exchangeRatingCur(uint32_t key)
 
     case DW_CE_30_E:
     case DM_CE_30_E:
-        return RC_60A; //rating current 60A
 
-    //65A U
+    //60A U
     case DW_UL_30_U:
     case DM_UL_30_U:
 
     case DW_CNS_30_U:
     case DM_CNS_30_U:
-        return RC_65A;
 
-    //80A J
+    //60A J
     case DW_UL_30_J:
     case DM_UL_30_J:
     case DW_CNS_30_J:
     case DM_CNS_30_J:
 
-    //80A G
+    //60A G
     case DM_CNS_30_G:
     case DS_UL_30_G:
+    	return RC_60A; //rating current 60A
 
     //80A M
     case DW_CE_30_M:
@@ -237,7 +288,7 @@ static uint16_t exchangeRatingCur(uint32_t key)
     case DM_CNS_30_N:
         return RC_80A; //rating current 80A
 
-    //125A J
+    //120A J
     case DS_CE_60_J:
     case DS_CE_90_J:
     case DS_CE_120_J:
@@ -256,14 +307,14 @@ static uint16_t exchangeRatingCur(uint32_t key)
     case DS_CNS_150_J:
     case DS_CNS_180_J:
 
-    //125A U
+    //120A U
     case DS_UL_60_U:
 
     case DS_CNS_60_U:
 
-    //125A E
+    //120A E
     case DS_CE_60_E:
-        return RC_125A; //rating current 125A
+    	return RC_120A; //rating current 120A
 
     //200A U
     case DD_CE_180_U:
@@ -434,6 +485,9 @@ static void exchangeGunTypeAndVolValue(uint8_t key, GunTypeAndVolInfo *gunAndVol
         break;
 
     case GUN_TYPE_G:// : GBT DC
+    case GUN_TYPE_B:// : GBT YG PT1000
+    case GUN_TYPE_H:// : WOER GBT 500A
+    case GUN_TYPE_A:// : WOER GBT 400A
         pGunAndVol->GunType = Gun_Type_GB;
         pGunAndVol->GunVoltage = VOL_GBT;
         break;
@@ -449,6 +503,9 @@ static int exchangePowerValue(uint8_t key)
     case POWER_60W:
         return 600;
 
+    case POWER_80W:
+        return 800;
+
     case POWER_90W:
         return 900;
 
@@ -458,6 +515,9 @@ static int exchangePowerValue(uint8_t key)
     case POWER_150W:
         return 1500;
 
+    case POWER_160W:
+        return 1600;
+
     case POWER_180W:
         return 1800;
 
@@ -474,7 +534,8 @@ static int exchangePowerValue(uint8_t key)
         return 7200;
 
     default:
-        return 600;
+    	log_error("Power is not defined, return 30kw\r\n");
+        return 300;
         break;
     }
 }
@@ -491,16 +552,16 @@ int RatedCurrentParsing(char *pModuleName, void *pDestStruct)
     uint8_t gunTypeIndex = 0;
 
     uint8_t modelKey = 0;
-    uint8_t reguKey = 0;
-    uint8_t powerKey = 0;
-    uint8_t gunTypeKey = 0;
+    int reguKey = 0;
+    int powerKey = 0;
+    int gunTypeKey = 0;
     uint16_t ratingCurVal = 0;
     int i = 0;
     uint32_t ret = 0;
-    char model[2] = {'\0'};
-    char regulation[1] = {'\0'};
-    char power[2] = {'\0'};
-    char gunType[1] = {'\0'};
+    char model[3] = {'\0'};
+    char regulation[2] = {'\0'};
+    char power[3] = {'\0'};
+    char gunType[2] = {'\0'};
     ParsingRatedCur *pParsingInfo = NULL;
     RateCurInfo *pGunRateCurInfo = NULL;
     GunTypeAndVolInfo fGunAndVol = {0};
@@ -550,7 +611,7 @@ int RatedCurrentParsing(char *pModuleName, void *pDestStruct)
         ret = ((modelKey << 24) | (reguKey << 16) | (powerKey << 8) | gunTypeKey);
         ratingCurVal = exchangeRatingCur(ret);
         if (ratingCurVal == RC_0A) {
-            ratingCurVal = defaultRatedCurrent(gunTypeKey);
+            ratingCurVal = defaultRatedCurrent(gunTypeKey, powerKey);
         }
 
         memset((uint8_t *)&fGunAndVol, 0, sizeof(GunTypeAndVolInfo));

+ 28 - 15
EVSE/Modularization/Module_RatedCurrent.h

@@ -13,13 +13,17 @@
 #define MODEL_AC                                (0x01) //Ac EVse Cordset
 #define MODEL_AW                                (0x02) //Ac EVse Wallmount
 #define MODEL_AP                                (0x03) //Ac EVse Pedestal
-#define MODEL_DW                                (0x04) //Dc EVse Wallmount
-#define MODEL_DS                                (0x05) //Dc EVse Standalone
-#define MODEL_DM                                (0x06) //Dc EVse Moveable (Battery equipped)
-#define MODEL_DR                                (0x07) //Dc EVse Power Rack (without cabinet)
-//#define MODEL_DM                                (0x08) //Dc EVse Moveable (移動)
-#define MODEL_DD                                (0x09) //Dc EVse Dispenser
-#define MODEL_DO                                (0x0A) //Dc EVse Output power cabinet
+#define MODEL_AX								(0x04) //Ac EVSE Wallmount excellent
+#define MODEL_DW                                (0x05) //Dc EVse Wallmount
+#define MODEL_DS                                (0x06) //Dc EVse Standalone
+#define MODEL_DM                                (0x07) //Dc EVse Moveable (Battery equipped)
+#define MODEL_DR                                (0x08) //Dc EVse Power Rack (without cabinet)
+//#define MODEL_DM                                (0x09) //Dc EVse Moveable (移動)
+#define MODEL_DD                                (0x0A) //Dc EVse Dispenser
+#define MODEL_DO                                (0x0B) //Dc EVse Output power cabinet
+#define MODEL_DQ								(0x0C) //DC EVSE Infy 30KW GB
+#define MODEL_DK								(0x0D) //DC EVSE Power rack
+#define MODEL_DX								(0x0E) //DC EVSE Output Communication Box (Dispenser)
 
 //------------------------------------------------------------------------------
 // regulation key
@@ -44,14 +48,16 @@
 //------------------------------------------------------------------------------
 #define POWER_30W                               (0x01)
 #define POWER_60W                               (0x02)
-#define POWER_90W                               (0x03)
-#define POWER_120W                              (0x04)
-#define POWER_150W                              (0x05)
-#define POWER_180W                              (0x06)
-#define POWER_240W                              (0x07)
-#define POWER_360W                              (0x08)
-#define POWER_480W                              (0x09)
-#define POWER_720W                              (0x0A)
+#define POWER_80W                               (0x03)
+#define POWER_90W                               (0x04)
+#define POWER_120W                              (0x05)
+#define POWER_150W                              (0x06)
+#define POWER_160W                              (0x07)
+#define POWER_180W                              (0x08)
+#define POWER_240W                              (0x09)
+#define POWER_360W                              (0x0A)
+#define POWER_480W                              (0x0B)
+#define POWER_720W                              (0x0C)
 
 //------------------------------------------------------------------------------
 // gun type key
@@ -78,6 +84,11 @@
 #define GUN_TYPE_N                              (0x13) //CCS1 80A
 #define GUN_TYPE_P                              (0x14) //Phoenix CCS2 500A 水冷
 #define GUN_TYPE_R                              (0x15) //Phoenix CCS1 500A 水冷
+#define GUN_TYPE_C                              (0x16) //Reserved for ChaoJi
+#define GUN_TYPE_W                              (0x17) //Reserved for Wireless
+#define GUN_TYPE_B                              (0x18) //GBT YG PT1000
+#define GUN_TYPE_H                              (0x19) //WOER GBT 500A
+#define GUN_TYPE_A                              (0x1A) //WOER GBT 400A
 
 //------------------------------------------------------------------------------
 // rating current parameters
@@ -86,10 +97,12 @@
 #define RC_60A                                  (600)
 #define RC_65A                                  (650)
 #define RC_80A                                  (800)
+#define RC_120A                                 (1200)
 #define RC_125A                                 (1250)
 #define RC_200A                                 (2000)
 #define RC_250A                                 (2500)
 #define RC_300A                                 (3000)
+#define RC_400A                                 (4000)
 #define RC_500A                                 (5000)
 
 //------------------------------------------------------------------------------