Parcourir la source

2021-10-05 / Eason Yang
Action:
1. Added : meter_ic_comm_time alarm code detection into alarm task.
2. Added : pilot_negative_error alarm code detection into alarm task.
3. Added : pilot_negative_error bit into Internal communcation task.

File:
1. As follow as commit history

Firmware version: D0.55.XX.XXXX.XX

8009 il y a 3 ans
Parent
commit
9b3c71d37f

+ 105 - 1
EVSE/Projects/AW-CCS/Apps/Module_AlarmDetect.c

@@ -1008,7 +1008,7 @@ int main(void)
 			//=====================================
 			// Meter communication timeout detection
 			//=====================================
-			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_comm_timeout)
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_comm_timeout == ON)
 			{
 				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout == OFF)
 				{
@@ -1027,6 +1027,50 @@ int main(void)
 				}
 			}
 
+			//=====================================
+			// Meter ic communication timeout detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_ic_comm_timeout == ON)
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterIcCommTimeout == OFF)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterIcCommTimeout = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_METER_IC_TIMEOUT;
+					DEBUG_INFO("ALARM_METER_IC_TIMEOUT : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterIcCommTimeout == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterIcCommTimeout = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_METER_IC_TIMEOUT;
+					DEBUG_INFO("ALARM_METER_IC_TIMEOUT : recover \n");
+				}
+			}
+
+			//=====================================
+			// Pilot negative error detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.pilot_negative_error == ON)
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PilotNegativeError == OFF)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PilotNegativeError = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CP_NEG_ERROR;
+					DEBUG_INFO("ALARM_PILOT_NEGATIVE_ERROR : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PilotNegativeError == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PilotNegativeError = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CP_NEG_ERROR;
+					DEBUG_INFO("ALARM_PILOT_NEGATIVE_ERROR : recover \n");
+				}
+			}
+
 			//=====================================
 			// OCPP error code message
 			//=====================================
@@ -1184,6 +1228,18 @@ int main(void)
 					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012305");
 					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "MeterCommunicationTimeout");
 				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012344");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "MeterIcCommunicationTimeout");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012345");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "PilotNegativeError");
+				}
 				else
 				{
 					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "NoError");
@@ -1881,6 +1937,54 @@ int main(void)
 						previousAlarmCode[gun_index] &= ~ALARM_METER_TIMEOUT;
 				}
 
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT) != (previousAlarmCode[gun_index] & ALARM_METER_IC_TIMEOUT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+					
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012344");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Meter ic communication timeout");
+					
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Meter");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+					
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+					
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT)
+						previousAlarmCode[gun_index] |= ALARM_METER_IC_TIMEOUT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_METER_IC_TIMEOUT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR) != (previousAlarmCode[gun_index] & ALARM_CP_NEG_ERROR))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+					
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012345");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Pilot negative error");
+					
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "PCBA");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+					
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+					
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR)
+						previousAlarmCode[gun_index] |= ALARM_CP_NEG_ERROR;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_CP_NEG_ERROR;
+				}
+
 				if(idxEvent > 0)
 					ShmOCPP20Data->SpMsg.bits.NotifyEventReq = ON;
 			}

+ 2 - 0
EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c

@@ -847,6 +847,7 @@ unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_
 			}
 			Ret_Buf->bits.meter_comm_timeout = (((rx[9]>>4)&0x01)?1:0);
 			Ret_Buf->bits.meter_ic_comm_timeout = (((rx[9]>>5)&0x01)?1:0);
+			Ret_Buf->bits.pilot_negative_error = (((rx[9]>>6)&0x01)?1:0);
 
 			result = PASS;
 		}
@@ -2343,6 +2344,7 @@ int main(void)
 							DEBUG_INFO("MCU-%d get relay_drive_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
 							DEBUG_INFO("MCU-%d get meter_comm_timeout : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_comm_timeout);
 							DEBUG_INFO("MCU-%d get meter_ic_comm_timeout : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_ic_comm_timeout);
+							DEBUG_INFO("MCU-%d get pilot_negative_error : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.pilot_negative_error);
 							DEBUG_INFO("MCU-%d get InputAlarmCode : %x\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
 						}
 

+ 2 - 0
EVSE/Projects/AW-CCS/Apps/main.h

@@ -77,6 +77,7 @@
 #define ALARM_L3_CIRCUIT_SHORT                  0x08000000
 #define ALARM_METER_TIMEOUT						0x10000000
 #define ALARM_METER_IC_TIMEOUT					0x20000000
+#define ALARM_CP_NEG_ERROR 						0x40000000
 
 //=================================
 //CCS related define
@@ -426,6 +427,7 @@ typedef struct AC_PRIMARY_MCU_ALARM
 			unsigned long short_circuit_L3:1;
 			unsigned long meter_comm_timeout:1;
 			unsigned long meter_ic_comm_timeout:1;
+			unsigned long pilot_negative_error:1;
 		}bits;
 	};
 }Ac_Primary_Mcu_Alarm;

BIN
EVSE/Projects/AW-CCS/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/AW-CCS/Images/ramdisk.gz