Przeglądaj źródła

[Improve][Modularization][Module_OcppBackend / ModuleOcppBackend20]

2021.03.10 / Folus Wen

Actions:
1. BootNotification sent out if charger connector system does not in initial mode.

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 4 lat temu
rodzic
commit
26f8531df6

+ 100 - 0
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -16538,6 +16538,106 @@ int GetInternetConn(void)
 	return ShmSysConfigAndInfo->SysInfo.InternetConn;
 }
 
+int isConnectorInitMode(int gun_index)
+{
+	int tempIndex = 0;
+	int result = TRUE;
+
+	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DCcc
+	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		{
+			tempIndex = ((gun_index==2) ? 1: 0);
+		}
+		else
+		{
+			tempIndex = gun_index;
+		}
+
+		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+		{
+			if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex))
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			} //end of the same index
+		}//end of for CHAdeMO_QUANTITY
+
+	}
+	else if(gunType[gun_index] == GUN_TYPE_CCS)
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		{
+			tempIndex = ((gun_index==2) ? 1: 0);
+		}
+		else
+		{
+			tempIndex = gun_index;
+		}
+
+		for (int index = 0; index < CCS_QUANTITY; index++)
+		{
+			if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			} //end of the same index
+		} // end of for CCS_QUANTITY
+	}
+	else if(gunType[gun_index] == GUN_TYPE_GBT)
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		{
+			tempIndex = ((gun_index==2) ? 1: 0);
+		}
+		else
+		{
+			tempIndex = gun_index;
+		}
+
+		for (int index = 0; index < GB_QUANTITY; index++)
+		{
+			if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			} //end of the same index
+		} // end of for GB_QUANTITY
+	}
+	else if(gunType[gun_index] == GUN_TYPE_DO)
+	{
+		tempIndex = gun_index;
+
+		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+		{
+			if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			} //end of the same index
+		}
+	}
+	else
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+		{
+			tempIndex = 2;
+		}
+		else
+		{
+			tempIndex = gun_index;
+		}
+
+		for (int index = 0; index < AC_QUANTITY; index++)
+		{
+			if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			}//end of the same index
+
+		}//end of for AC_QUANTITY
+	}
+
+	return result;
+}
+
 void InitialSystemValue(void)
 {
 	int connectorIndex = 0;

+ 1 - 0
EVSE/Modularization/ocpp20/MessageHandler.h

@@ -1005,6 +1005,7 @@ void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart
 void splitstring(char *src,const char *separator,char **dest,int *num);
 int GetWebSocketPingInterval(void);
 int GetInternetConn(void);
+int isConnectorInitMode(int gun_index);
 int GetServerSign(void);
 void SetServerSign(int value);
 int GetBootNotificationInterval(void);

+ 1 - 0
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -1182,6 +1182,7 @@ int main(void)
 		{
 			// Sign in
 			if((GetServerSign() == FALSE) &&
+			   (isConnectorInitMode(0) != TRUE) &&
 			   ((GetBootNotificationInterval() >= 0) && ((time((time_t*)NULL)-startTime.bootNotification)>= GetBootNotificationInterval())))
 			{
 				sendBootNotificationRequest();

+ 100 - 0
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -16595,6 +16595,106 @@ int GetInternetConn(void)
 	return ShmSysConfigAndInfo->SysInfo.InternetConn;
 }
 
+int isConnectorInitMode(int gun_index)
+{
+	int tempIndex = 0;
+	int result = TRUE;
+
+	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DCcc
+	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		{
+			tempIndex = ((gun_index==2) ? 1: 0);
+		}
+		else
+		{
+			tempIndex = gun_index;
+		}
+
+		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+		{
+			if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex))
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			} //end of the same index
+		}//end of for CHAdeMO_QUANTITY
+
+	}
+	else if(gunType[gun_index] == GUN_TYPE_CCS)
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		{
+			tempIndex = ((gun_index==2) ? 1: 0);
+		}
+		else
+		{
+			tempIndex = gun_index;
+		}
+
+		for (int index = 0; index < CCS_QUANTITY; index++)
+		{
+			if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			} //end of the same index
+		} // end of for CCS_QUANTITY
+	}
+	else if(gunType[gun_index] == GUN_TYPE_GBT)
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		{
+			tempIndex = ((gun_index==2) ? 1: 0);
+		}
+		else
+		{
+			tempIndex = gun_index;
+		}
+
+		for (int index = 0; index < GB_QUANTITY; index++)
+		{
+			if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			} //end of the same index
+		} // end of for GB_QUANTITY
+	}
+	else if(gunType[gun_index] == GUN_TYPE_DO)
+	{
+		tempIndex = gun_index;
+
+		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+		{
+			if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			} //end of the same index
+		}
+	}
+	else
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+		{
+			tempIndex = 2;
+		}
+		else
+		{
+			tempIndex = gun_index;
+		}
+
+		for (int index = 0; index < AC_QUANTITY; index++)
+		{
+			if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			{
+				result = (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus==SYS_MODE_BOOTING)?TRUE:FALSE;
+			}//end of the same index
+
+		}//end of for AC_QUANTITY
+	}
+
+	return result;
+}
+
 void InitialSystemValue(void)
 {
 	int connectorIndex = 0;

+ 1 - 0
EVSE/Modularization/ocppfiles/MessageHandler.h

@@ -551,6 +551,7 @@ void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart
 void splitstring(char *src,const char *separator,char **dest,int *num);
 int GetWebSocketPingInterval(void);
 int GetInternetConn(void);
+int isConnectorInitMode(int gun_index);
 int GetServerSign(void);
 void SetServerSign(int value);
 int GetBootNotificationInterval(void);

+ 1 - 0
EVSE/Modularization/ocppfiles/Module_OcppBackend.c

@@ -1496,6 +1496,7 @@ int main(void)
 		{
 			// Sign in
 			if((GetServerSign() == FALSE) &&
+			   (isConnectorInitMode(0) != TRUE) &&
 			   ( ((GetBootNotificationInterval() != 0)  && ((time((time_t*)NULL)-startTime.bootNotification)>= GetBootNotificationInterval())) || ((time((time_t*)NULL)-startTime.bootNotification) >= defaultWaitingTime) ) )
 			{
 				sendBootNotificationRequest();