Sfoglia il codice sorgente

[Improve][Moduralization][Module_OcppBackend / Module_OcppBackend20]

2021.10.05 / Folus Wen

Actions:
1. Model name parsing method change by library.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 3 anni fa
parent
commit
79bd94166b

+ 3 - 3
EVSE/Modularization/Makefile

@@ -72,17 +72,17 @@ WebServiceLib:
 
 Ocppph:
 	rm -f OcppBackendPH;
-	$(CC) -D $(TLS_EXPIRED) -D $(Project) -D__USE_XOPEN -D_GNU_SOURCE ./ocppph/Module_OcppBackend.c ./ocppph/MessageHandler.c ./ocppph/JsonParser.c ./ocppph/SystemLogMessage.c ./ocppph/hashmap.c ./ocppph/common.c -I ../Projects -I ../GPL/libwebsockets-2.2.2-stable/release/include -I ../GPL/json-c-json-c-0.13.1-20180305/release/include -L ../GPL/libwebsockets-2.2.2-stable/release/lib -L ../GPL/openssl-1.0.2g/release/lib -L ../GPL/json-c-json-c-0.13.1-20180305/release/lib -lwebsockets -luuid -lpthread -lc -lsqlite3 -ljson-c -o OcppBackendPH
+	$(CC) -D $(TLS_EXPIRED) -D $(Project) -D__USE_XOPEN -D_GNU_SOURCE ./ocppph/Module_OcppBackend.c ./ocppph/MessageHandler.c ./ocppph/JsonParser.c ./ocppph/SystemLogMessage.c ./ocppph/hashmap.c ./ocppph/common.c -I ../Projects -I ../GPL/libwebsockets-2.2.2-stable/release/include -I ../GPL/json-c-json-c-0.13.1-20180305/release/include -include ./Module_RatedCurrent.h  -L ../GPL/libwebsockets-2.2.2-stable/release/lib -L ../GPL/openssl-1.0.2g/release/lib -L ../GPL/json-c-json-c-0.13.1-20180305/release/lib -L ./ -lwebsockets -luuid -lpthread -lc -lsqlite3 -ljson-c -lModule_RatedCurrent -o OcppBackendPH
 	mv -f OcppBackendPH ../rootfs/root/
 
 Ocpp16:
 	rm -f OcppBackend;
-	$(CC) -D $(TLS_EXPIRED) -D $(Project) -D__USE_XOPEN -D_GNU_SOURCE ./ocppfiles/Module_OcppBackend.c ./ocppfiles/MessageHandler.c ./ocppfiles/JsonParser.c ./ocppfiles/SystemLogMessage.c ./ocppfiles/hashmap.c ./ocppfiles/common.c -I ../Projects -I ../GPL/libwebsockets-2.2.2-stable/release/include -I ../GPL/json-c-json-c-0.13.1-20180305/release/include -L ../GPL/libwebsockets-2.2.2-stable/release/lib -L ../GPL/openssl-1.0.2g/release/lib -L ../GPL/json-c-json-c-0.13.1-20180305/release/lib -lwebsockets -luuid -lpthread -lc -lsqlite3 -ljson-c -o OcppBackend
+	$(CC) -D $(TLS_EXPIRED) -D $(Project) -D__USE_XOPEN -D_GNU_SOURCE ./ocppfiles/Module_OcppBackend.c ./ocppfiles/MessageHandler.c ./ocppfiles/JsonParser.c ./ocppfiles/SystemLogMessage.c ./ocppfiles/hashmap.c ./ocppfiles/common.c -I ../Projects -I ../GPL/libwebsockets-2.2.2-stable/release/include -I ../GPL/json-c-json-c-0.13.1-20180305/release/include -include ./Module_RatedCurrent.h -L ../GPL/libwebsockets-2.2.2-stable/release/lib -L ../GPL/openssl-1.0.2g/release/lib -L ../GPL/json-c-json-c-0.13.1-20180305/release/lib -L ./ -lwebsockets -luuid -lpthread -lc -lsqlite3 -ljson-c -lModule_RatedCurrent -o OcppBackend
 	mv -f OcppBackend ../rootfs/root/
 
 Ocpp20:
 	rm -f OcppBackend20;
-	$(CC) -D $(TLS_EXPIRED) -D $(Project) -D__USE_XOPEN -D_GNU_SOURCE ./ocpp20/Module_OcppBackend20.c ./ocpp20/MessageHandler.c ./ocpp20/JsonParser.c ./ocpp20/SystemLogMessage.c ./ocpp20/hashmap.c ./ocpp20/common.c -I ../Projects -I ../GPL/libwebsockets-2.2.2-stable/release/include -I ../GPL/json-c-json-c-0.13.1-20180305/release/include -L ../GPL/libwebsockets-2.2.2-stable/release/lib -L ../GPL/openssl-1.0.2g/release/lib -L ../GPL/json-c-json-c-0.13.1-20180305/release/lib -lwebsockets -luuid -lpthread -lc -lsqlite3 -ljson-c -o OcppBackend20
+	$(CC) -D $(TLS_EXPIRED) -D $(Project) -D__USE_XOPEN -D_GNU_SOURCE ./ocpp20/Module_OcppBackend20.c ./ocpp20/MessageHandler.c ./ocpp20/JsonParser.c ./ocpp20/SystemLogMessage.c ./ocpp20/hashmap.c ./ocpp20/common.c -I ../Projects -I ../GPL/libwebsockets-2.2.2-stable/release/include -I ../GPL/json-c-json-c-0.13.1-20180305/release/include -include ./Module_RatedCurrent.h  -L ../GPL/libwebsockets-2.2.2-stable/release/lib -L ../GPL/openssl-1.0.2g/release/lib -L ../GPL/json-c-json-c-0.13.1-20180305/release/lib -L ./ -lwebsockets -luuid -lpthread -lc -lsqlite3 -ljson-c -lModule_RatedCurrent -o OcppBackend20
 	mv -f OcppBackend20 ../rootfs/root/
 
 

+ 82 - 95
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -6005,6 +6005,9 @@ int InitShareMemory()
 
 int ProcessShareMemory()
 {
+	int result = PASS;
+	ParsingRatedCur modelnameInfo={0};
+
 	if(InitShareMemory() == FAIL)
 	{
 		DEBUG_ERROR("InitShareMemory NG\n");
@@ -6013,10 +6016,86 @@ int ProcessShareMemory()
 		{
 			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
 		}
-		sleep(5);
-		return FAIL;
+
+		result = FAIL;
 	}
-	return PASS;
+
+	if(RatedCurrentParsing((char*)ShmSysConfigAndInfo->SysConfig.ModelName, &modelnameInfo) != -1)
+	{
+	 	if((ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') &&
+	 	   ((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
+		    (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
+			(ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O'))
+		   ) // 'D' means DC
+		{
+			// DO series
+			for(int gun_index=0; gun_index<GENERAL_GUN_QUANTITY ; gun_index++)
+			{
+				SystemInitial += 1;
+				gunTotalNumber += 1;
+				gunType[gun_index] = GUN_TYPE_DO;
+
+ 				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
+ 				{
+ 					case Gun_Type_Chademo:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet CHAdeMO\n", gun_index);
+ 						break;
+ 					case Gun_Type_CCS_2:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet CCS\n", gun_index);
+						break;
+ 					case Gun_Type_GB:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet GBT\n", gun_index);
+						break;
+ 					case Gun_Type_AC:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet AC\n", gun_index);
+						break;
+ 					default:
+ 						DEBUG_WARN("Gun-%02d type: Cabinet unknown\n", gun_index);
+ 						break;
+ 				}
+			}
+		}
+		else
+		{
+ 			for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+ 			{
+				SystemInitial += 1;
+				gunTotalNumber += 1;
+
+ 				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
+ 				{
+ 					case Gun_Type_Chademo:
+ 						gunType[gun_index] = GUN_TYPE_CHAdeMO;
+ 						DEBUG_INFO("Gun-%02d type: CHAdeMO\n", gun_index);
+ 						break;
+ 					case Gun_Type_CCS_2:
+ 						gunType[gun_index] = GUN_TYPE_CCS;
+ 						DEBUG_INFO("Gun-%02d type: CCS\n", gun_index);
+						break;
+ 					case Gun_Type_GB:
+ 						gunType[gun_index] = GUN_TYPE_GBT;
+ 						DEBUG_INFO("Gun-%02d type: GBT\n", gun_index);
+						break;
+ 					case Gun_Type_AC:
+ 						gunType[gun_index] = GUN_TYPE_AC;
+ 						DEBUG_INFO("Gun-%02d type: AC\n", gun_index);
+						break;
+ 					default:
+ 						DEBUG_WARN("Gun-%02d type: Unknown\n", gun_index);
+ 						break;
+ 				}
+ 			}
+		}
+	}
+	else
+	{
+		DEBUG_ERROR("Model name parsing fail.\n");
+		result = FAIL;
+	}
+
+	if(result != PASS)sleep(5);
+
+	return result;
 }
 
 //---------------------common routine---------------------------//
@@ -18378,7 +18457,6 @@ void refreshProcDogTimer()
 
 void InitialSystemValue(void)
 {
-	int connectorIndex = 0;
 	gunTotalNumber=0;
 	SystemInitial = 0;
 	localversion=0;
@@ -18408,97 +18486,6 @@ void InitialSystemValue(void)
 	memset(AcPreviousConnectorPlugIn, 0, ARRAY_SIZE(AcPreviousConnectorPlugIn));
 	memset(gunType, 0, ARRAY_SIZE(gunType));
 
-	if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') // 'D' means DC
-	{
- 		if((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
-		   (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
-		   (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O'))
-		{
-			// DO series
-			for(int index=0; index<GENERAL_GUN_QUANTITY ; index++)
-			{
-				SystemInitial = SystemInitial + 1;
-				gunTotalNumber = gunTotalNumber + 1;
-				gunType[connectorIndex] = GUN_TYPE_DO;
-				connectorIndex = connectorIndex + 1;
-			}
-		}
-		else
-		{
-			// DM, DW, DS series
-			//check connector / socket type (index: 8, 9, 10)
-			for(int index=7; index <10 ; index++)
-			{
-				if(index != 8)
-				{
-					// DC Connector
-					if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'J'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_CHAdeMO;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'D') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'E') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'F') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'U') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'T') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'V'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_CCS;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'G'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_GBT;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'O'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_DO;
-						connectorIndex = connectorIndex + 1;
-					}
-				}
-				else
-				{
-					// AC Connector
-					if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] > '0') && (ShmSysConfigAndInfo->SysConfig.ModelName[index] <= '9'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_AC;
-						connectorIndex = connectorIndex + 1;
-					}
-				}
-			}
-		}
-
-		//DEBUG_INFO("DC ...\n");
-	}
-	else if (ShmSysConfigAndInfo->SysConfig.ModelName[0]=='A') //'A' means AC
-	{
-		//check connector / socket type (index: 8, 9, 10)
-		for(int index=7; index <10 ; index++)
-		{
-			if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] > '0') && (ShmSysConfigAndInfo->SysConfig.ModelName[index] <= '9'))
-			{
-				SystemInitial = SystemInitial + 1;
-				gunTotalNumber = gunTotalNumber + 1;
-				gunType[connectorIndex] = GUN_TYPE_AC;
-				connectorIndex = connectorIndex + 1;
-
-				//DEBUG_INFO("AC: %d, %c\n", index, ShmSysConfigAndInfo->SysConfig.ModelName[index]);
-			}
-		}
-	}
-
 	//Status &&  ConnectorPlugIn Setting
 	for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 	{

+ 83 - 96
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -3838,6 +3838,9 @@ int InitShareMemory()
 
 int ProcessShareMemory()
 {
+	int result = PASS;
+	ParsingRatedCur modelnameInfo={0};
+
 	if(InitShareMemory() == FAIL)
 	{
 		DEBUG_ERROR("InitShareMemory NG\n");
@@ -3846,10 +3849,87 @@ int ProcessShareMemory()
 		{
 			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
 		}
-		sleep(5);
-		return FAIL;
+
+		result = FAIL;
+	}
+
+	// Model name parsing
+	if(RatedCurrentParsing((char*)ShmSysConfigAndInfo->SysConfig.ModelName, &modelnameInfo) != -1)
+	{
+	 	if((ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') &&
+	 	   ((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
+		    (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
+			(ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O'))
+		   ) // 'D' means DC
+		{
+			// DO series
+			for(int gun_index=0; gun_index<GENERAL_GUN_QUANTITY ; gun_index++)
+			{
+				SystemInitial += 1;
+				gunTotalNumber += 1;
+				gunType[gun_index] = GUN_TYPE_DO;
+
+ 				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
+ 				{
+ 					case Gun_Type_Chademo:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet CHAdeMO\n", gun_index);
+ 						break;
+ 					case Gun_Type_CCS_2:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet CCS\n", gun_index);
+						break;
+ 					case Gun_Type_GB:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet GBT\n", gun_index);
+						break;
+ 					case Gun_Type_AC:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet AC\n", gun_index);
+						break;
+ 					default:
+ 						DEBUG_WARN("Gun-%02d type: Cabinet unknown\n", gun_index);
+ 						break;
+ 				}
+			}
+		}
+		else
+		{
+ 			for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+ 			{
+				SystemInitial += 1;
+				gunTotalNumber += 1;
+
+ 				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
+ 				{
+ 					case Gun_Type_Chademo:
+ 						gunType[gun_index] = GUN_TYPE_CHAdeMO;
+ 						DEBUG_INFO("Gun-%02d type: CHAdeMO\n", gun_index);
+ 						break;
+ 					case Gun_Type_CCS_2:
+ 						gunType[gun_index] = GUN_TYPE_CCS;
+ 						DEBUG_INFO("Gun-%02d type: CCS\n", gun_index);
+						break;
+ 					case Gun_Type_GB:
+ 						gunType[gun_index] = GUN_TYPE_GBT;
+ 						DEBUG_INFO("Gun-%02d type: GBT\n", gun_index);
+						break;
+ 					case Gun_Type_AC:
+ 						gunType[gun_index] = GUN_TYPE_AC;
+ 						DEBUG_INFO("Gun-%02d type: AC\n", gun_index);
+						break;
+ 					default:
+ 						DEBUG_WARN("Gun-%02d type: Unknown\n", gun_index);
+ 						break;
+ 				}
+ 			}
+		}
 	}
-	return PASS;
+	else
+	{
+		DEBUG_ERROR("Model name parsing fail.\n");
+		result = FAIL;
+	}
+
+	if(result != PASS)sleep(5);
+
+	return result;
 }
 
 void CheckSystemValue(void)
@@ -19241,8 +19321,6 @@ void refreshProcDogTimer()
 
 void InitialSystemValue(void)
 {
-	int connectorIndex = 0;
-	//int valueASCII = 0;
 	server_cycle_Status = atoi((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MinimumStatusDuration].ItemData);
 	gunTotalNumber=0;
 	SystemInitial = 0;
@@ -19272,97 +19350,6 @@ void InitialSystemValue(void)
 	memset(AcPreviousConnectorPlugIn, 0, ARRAY_SIZE(AcPreviousConnectorPlugIn));
 	memset(gunType, 0, ARRAY_SIZE(gunType));
 
- 	if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') // 'D' means DC
-	{
- 		if((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
-		   (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
-		   (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O'))
- 		{
- 			// DO series
- 			for(int index=0; index<GENERAL_GUN_QUANTITY ; index++)
- 			{
-				SystemInitial = SystemInitial + 1;
-				gunTotalNumber = gunTotalNumber + 1;
-				gunType[connectorIndex] = GUN_TYPE_DO;
-				connectorIndex = connectorIndex + 1;
- 			}
- 		}
- 		else
- 		{
- 			// DM, DW, DS series
- 			//check connector / socket type (index: 8, 9, 10)
-			for(int index=7; index <10 ; index++)
-			{
-				if(index != 8)
-				{
-					// DC Connector
-					if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'J'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_CHAdeMO;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'D') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'E') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'F') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'U') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'T') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'V'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_CCS;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'G'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_GBT;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'O'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_DO;
-						connectorIndex = connectorIndex + 1;
-					}
-				}
-				else
-				{
-					// AC Connector
-					if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] > '0') && (ShmSysConfigAndInfo->SysConfig.ModelName[index] <= '9'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_AC;
-						connectorIndex = connectorIndex + 1;
-					}
-				}
-			}
- 		}
-
-		//DEBUG_INFO("DC ...\n");
-	}
-	else if (ShmSysConfigAndInfo->SysConfig.ModelName[0]=='A') //'A' means AC
-	{
-		//check connector / socket type (index: 8, 9, 10)
-		for(int index=7; index <10 ; index++)
-		{
-			if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] > '0') && (ShmSysConfigAndInfo->SysConfig.ModelName[index] <= '9'))
-			{
-				SystemInitial = SystemInitial + 1;
-				gunTotalNumber = gunTotalNumber + 1;
-				gunType[connectorIndex] = GUN_TYPE_AC;
-				connectorIndex = connectorIndex + 1;
-
-				//DEBUG_INFO("AC: %d, %c\n", index, ShmSysConfigAndInfo->SysConfig.ModelName[index]);
-			}
-		}
-	}
-
 	//Status &&  ConnectorPlugIn Setting
 	for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 	{

+ 83 - 96
EVSE/Modularization/ocppph/MessageHandler.c

@@ -3555,6 +3555,9 @@ int InitShareMemory()
 
 int ProcessShareMemory()
 {
+	int result = PASS;
+	ParsingRatedCur modelnameInfo={0};
+
 	if(InitShareMemory() == FAIL)
 	{
 		DEBUG_ERROR("InitShareMemory NG\n");
@@ -3563,10 +3566,87 @@ int ProcessShareMemory()
 		{
 			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
 		}
-		sleep(5);
-		return FAIL;
+
+		result = FAIL;
+	}
+
+	// Model name parsing
+	if(RatedCurrentParsing((char*)ShmSysConfigAndInfo->SysConfig.ModelName, &modelnameInfo) != -1)
+	{
+	 	if((ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') &&
+	 	   ((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
+		    (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
+			(ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O'))
+		   ) // 'D' means DC
+		{
+			// DO series
+			for(int gun_index=0; gun_index<GENERAL_GUN_QUANTITY ; gun_index++)
+			{
+				SystemInitial += 1;
+				gunTotalNumber += 1;
+				gunType[gun_index] = GUN_TYPE_DO;
+
+ 				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
+ 				{
+ 					case Gun_Type_Chademo:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet CHAdeMO\n", gun_index);
+ 						break;
+ 					case Gun_Type_CCS_2:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet CCS\n", gun_index);
+						break;
+ 					case Gun_Type_GB:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet GBT\n", gun_index);
+						break;
+ 					case Gun_Type_AC:
+ 						DEBUG_INFO("Gun-%02d type: Cabinet AC\n", gun_index);
+						break;
+ 					default:
+ 						DEBUG_WARN("Gun-%02d type: Cabinet unknown\n", gun_index);
+ 						break;
+ 				}
+			}
+		}
+		else
+		{
+ 			for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+ 			{
+				SystemInitial += 1;
+				gunTotalNumber += 1;
+
+ 				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
+ 				{
+ 					case Gun_Type_Chademo:
+ 						gunType[gun_index] = GUN_TYPE_CHAdeMO;
+ 						DEBUG_INFO("Gun-%02d type: CHAdeMO\n", gun_index);
+ 						break;
+ 					case Gun_Type_CCS_2:
+ 						gunType[gun_index] = GUN_TYPE_CCS;
+ 						DEBUG_INFO("Gun-%02d type: CCS\n", gun_index);
+						break;
+ 					case Gun_Type_GB:
+ 						gunType[gun_index] = GUN_TYPE_GBT;
+ 						DEBUG_INFO("Gun-%02d type: GBT\n", gun_index);
+						break;
+ 					case Gun_Type_AC:
+ 						gunType[gun_index] = GUN_TYPE_AC;
+ 						DEBUG_INFO("Gun-%02d type: AC\n", gun_index);
+						break;
+ 					default:
+ 						DEBUG_WARN("Gun-%02d type: Unknown\n", gun_index);
+ 						break;
+ 				}
+ 			}
+		}
 	}
-	return PASS;
+	else
+	{
+		DEBUG_ERROR("Model name parsing fail.\n");
+		result = FAIL;
+	}
+
+	if(result != PASS)sleep(5);
+
+	return result;
 }
 
 void CheckSystemValue(void)
@@ -18771,8 +18851,6 @@ void refreshProcDogTimer()
 
 void InitialSystemValue(void)
 {
-	int connectorIndex = 0;
-	//int valueASCII = 0;
 	server_cycle_Status = atoi((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MinimumStatusDuration].ItemData);
 	gunTotalNumber=0;
 	SystemInitial = 0;
@@ -18802,97 +18880,6 @@ void InitialSystemValue(void)
 	memset(AcPreviousConnectorPlugIn, 0, ARRAY_SIZE(AcPreviousConnectorPlugIn));
 	memset(gunType, 0, ARRAY_SIZE(gunType));
 
- 	if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') // 'D' means DC
-	{
- 		if((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
-		   (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
-		   (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O'))
- 		{
- 			// DO series
- 			for(int index=0; index<GENERAL_GUN_QUANTITY ; index++)
- 			{
-				SystemInitial = SystemInitial + 1;
-				gunTotalNumber = gunTotalNumber + 1;
-				gunType[connectorIndex] = GUN_TYPE_DO;
-				connectorIndex = connectorIndex + 1;
- 			}
- 		}
- 		else
- 		{
- 			// DM, DW, DS series
- 			//check connector / socket type (index: 8, 9, 10)
-			for(int index=7; index <10 ; index++)
-			{
-				if(index != 8)
-				{
-					// DC Connector
-					if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'J'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_CHAdeMO;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'D') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'E') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'F') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'U') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'T') ||
-							 (ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'V'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_CCS;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'G'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_GBT;
-						connectorIndex = connectorIndex + 1;
-					}
-					else if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] == 'O'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_DO;
-						connectorIndex = connectorIndex + 1;
-					}
-				}
-				else
-				{
-					// AC Connector
-					if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] > '0') && (ShmSysConfigAndInfo->SysConfig.ModelName[index] <= '9'))
-					{
-						SystemInitial = SystemInitial + 1;
-						gunTotalNumber = gunTotalNumber + 1;
-						gunType[connectorIndex] = GUN_TYPE_AC;
-						connectorIndex = connectorIndex + 1;
-					}
-				}
-			}
- 		}
-
-		//DEBUG_INFO("DC ...\n");
-	}
-	else if (ShmSysConfigAndInfo->SysConfig.ModelName[0]=='A') //'A' means AC
-	{
-		//check connector / socket type (index: 8, 9, 10)
-		for(int index=7; index <10 ; index++)
-		{
-			if ((ShmSysConfigAndInfo->SysConfig.ModelName[index] > '0') && (ShmSysConfigAndInfo->SysConfig.ModelName[index] <= '9'))
-			{
-				SystemInitial = SystemInitial + 1;
-				gunTotalNumber = gunTotalNumber + 1;
-				gunType[connectorIndex] = GUN_TYPE_AC;
-				connectorIndex = connectorIndex + 1;
-
-				//DEBUG_INFO("AC: %d, %c\n", index, ShmSysConfigAndInfo->SysConfig.ModelName[index]);
-			}
-		}
-	}
-
 	//Status &&  ConnectorPlugIn Setting
 	for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 	{