1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266 |
- /*
- * Module_AlarmDetect.c
- *
- * Created on: 2020/01/15
- * Author: Eason Yang
- */
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <termios.h>
- #include <errno.h>
- #include <errno.h>
- #include <string.h>
- #include <time.h>
- #include <ctype.h>
- #include "define.h"
- #include "main.h"
- #include "Module_AlarmDetect.h"
- #define FILTER_SPEC 2
- #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
- #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
- #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
- #define Debug
- #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
- #define PASS 1
- #define FAIL 0
- #define ON 1
- #define OFF 0
- #define SPEC_OV 275
- #define SPEC_UV 160
- #define SPEC_OC (32*1.1)
- #define SPEC_OT 85
- #define HYSTERETIC_OUV 10
- #define HYSTERETIC_OT 10
- #define HYSTERETIC_OC 10
- struct{
- unsigned short int OV[3];
- unsigned short int UV[3];
- unsigned short int OC[3];
- unsigned short int OT_AMB;
- unsigned short int GMI;
- unsigned short int Short[3];
- unsigned short int Leakage;
- unsigned short int EmrgencyBTN;
- unsigned short int Relay_Welding;
- unsigned short int Relay_DrivingFault;
- unsigned short int CP_LevelFail;
- unsigned short int MCU_SelfTestFail;
- unsigned short int GetEvCCIDTimeout;
- unsigned short int Rotary_Switch;
- unsigned short int leak_module_fail;
- unsigned short int locker_fault;
- unsigned short int power_drop;
- unsigned short int meter_comm_timeout;
- unsigned short int meter_ic_comm_timeout;
- unsigned short int pilot_negative_error;
- }Alarm_Counter[3];
- void trim(char *s);
- void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
- struct SysConfigAndInfo *ShmSysConfigAndInfo;
- struct StatusCodeData *ShmStatusCodeData;
- struct OCPP16Data *ShmOCPP16Data;
- struct OCPP20Data *ShmOCPP20Data;
- struct Charger *ShmCharger;
- unsigned long previousAlarmCode[AC_QUANTITY];
- struct timespec startTime[TMR_IDX_CNT];
- int StoreLogMsg(const char *fmt, ...)
- {
- char Buf[4096+256];
- char buffer[4096];
- time_t CurrentTime;
- struct tm *tm;
- struct timeval tv;
- va_list args;
- va_start(args, fmt);
- int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
- va_end(args);
- memset(Buf,0,sizeof(Buf));
- CurrentTime = time(NULL);
- tm=localtime(&CurrentTime);
- gettimeofday(&tv, NULL); // get microseconds, 10^-6
- if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
- {
- sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
- tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
- buffer,
- tm->tm_year+1900,tm->tm_mon+1,
- ShmSysConfigAndInfo->SysConfig.ModelName,
- ShmSysConfigAndInfo->SysConfig.SerialNumber);
- }
- else
- {
- sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
- tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
- buffer,
- tm->tm_year+1900,tm->tm_mon+1);
- }
- #ifdef SystemLogMessage
- system(Buf);
- #endif
- #ifdef ConsloePrintLog
- printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
- #endif
- return rc;
- }
- int DiffTimeb(struct timeb ST, struct timeb ET)
- {
- //return milli-second
- unsigned int StartTime,StopTime;
- StartTime=(unsigned int)ST.time;
- StopTime=(unsigned int)ET.time;
- return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
- }
- void refreshStartTimer(struct timespec *timer)
- {
- clock_gettime(CLOCK_MONOTONIC, timer);
- }
- int getDiffSecNow(struct timespec timer)
- {
- struct timespec timerNow;
- clock_gettime(CLOCK_MONOTONIC, &timerNow);
- return (int)((((unsigned long)(timerNow.tv_sec - timer.tv_sec) * 1000) + ((unsigned long)((timerNow.tv_nsec / 1000000) - (timer.tv_nsec / 1000000))))/1000);
- }
- //==========================================
- // Init all share memory
- //==========================================
- int InitShareMemory()
- {
- int result = PASS;
- int MeterSMId;
- //creat ShmSysConfigAndInfo
- if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
- {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
- #endif
- result = FAIL;
- }
- else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
- #endif
- result = FAIL;
- }
- else
- {}
- //creat ShmStatusCodeData
- if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
- {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
- #endif
- result = FAIL;
- }
- else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
- #endif
- result = FAIL;
- }
- else
- {}
- //creat ShmStatusCodeData
- if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
- {
- DEBUG_ERROR("shmget ShmCharger NG\n");
- result = FAIL;
- }
- else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- DEBUG_ERROR("shmat ShmCharger NG\n");
- result = FAIL;
- }
- else
- {}
- //creat ShmOCPP16Data
- if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
- {
- DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
- result = FAIL;
- }
- else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
- result = FAIL;
- }
- else
- {}
- //creat ShmOCPP20Data
- if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), 0777)) < 0)
- {
- DEBUG_ERROR("shmget ShmOCPP20Data NG\n");
- result = FAIL;
- }
- else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- DEBUG_ERROR("shmat ShmOCPP20Data NG\n");
- result = FAIL;
- }
- else
- {}
- return result;
- }
- //==========================================
- // Common routine
- //==========================================
- void trim(char *s)
- {
- int i=0, j, k, l=0;
- while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
- i++;
- j = strlen(s)-1;
- while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
- j--;
- if(i==0 && j==strlen(s)-1) { }
- else if(i==0) s[j+1] = '\0';
- else {
- for(k=i; k<=j; k++) s[l++] = s[k];
- s[l] = '\0';
- }
- }
- void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
- {
- strncpy(dest, src + start, cnt);
- dest[cnt] = 0;
- }
- void getNowDatetime(uint8_t *data)
- {
- time_t t = time(NULL);
- struct tm tm = *localtime(&t);
- sprintf((char*)data, "%04d-%02d-%02dT%02d:%02d:%02dZ", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
- }
- int qca7000FlashCheck()
- {
- int result = FAIL;
- char buf[256];
- FILE *fp;
- system("echo 1 > /sys/class/gpio/gpio115/value");
- fp = popen("/usr/bin/plcID", "r");
- if(fp != NULL)
- {
- while(fgets(buf, sizeof(buf), fp) != NULL)
- {
- if(strlen(buf) >= 30)result = PASS;
- }
- }
- pclose(fp);
- system("echo 0 > /sys/class/gpio/gpio115/value");
- return result;
- }
- //==========================================
- // Main process
- //==========================================
- int main(void)
- {
- uint8_t isCheckQca7000[AC_QUANTITY] = {0};
- if(InitShareMemory() == FAIL)
- {
- DEBUG_ERROR("InitShareMemory NG\n");
- if(ShmStatusCodeData!=NULL)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
- }
- sleep(5);
- return FAIL;
- }
- for(;;)
- {
- for(int gun_index = 0;gun_index<AC_QUANTITY;gun_index++)
- {
- //=====================================
- // Over voltage detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L1 == ON)
- {
- if(Alarm_Counter[gun_index].OV[0] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_VOLTAGE;
- DEBUG_INFO("ALARM_L1_OVER_VOLTAGE : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].OV[0]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].OV[0] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_OVER_VOLTAGE;
- DEBUG_INFO("ALARM_L1_OVER_VOLTAGE : recover \n");
- }
- }
- Alarm_Counter[gun_index].OV[0] = 0;
- }
- if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
- {
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L2 == ON)
- {
- if(Alarm_Counter[gun_index].OV[1] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_OVER_VOLTAGE;
- DEBUG_INFO("ALARM_L2_OVER_VOLTAGE : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].OV[1]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].OV[1] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_OVER_VOLTAGE;
- DEBUG_INFO("ALARM_L2_OVER_VOLTAGE : recover \n");
- }
- }
- Alarm_Counter[gun_index].OV[1] = 0;
- }
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L3 == ON)
- {
- if(Alarm_Counter[gun_index].OV[2] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_OVER_VOLTAGE;
- DEBUG_INFO("ALARM_L3_OVER_VOLTAGE : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].OV[2]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].OV[2] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_OVER_VOLTAGE;
- DEBUG_INFO("ALARM_L3_OVER_VOLTAGE : recover \n");
- }
- }
- Alarm_Counter[gun_index].OV[2] = 0;
- }
- }
- //=====================================
- // Under voltage detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L1 == ON)
- {
- if(Alarm_Counter[gun_index].UV[0] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_UNDER_VOLTAGE;
- DEBUG_INFO("ALARM_L1_UNDER_VOLTAGE : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].UV[0]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].UV[0] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_UNDER_VOLTAGE;
- DEBUG_INFO("ALARM_L1_UNDER_VOLTAGE : recover \n");
- }
- }
- Alarm_Counter[gun_index].UV[0] = 0;
- }
- if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
- {
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L2 == ON)
- {
- if(Alarm_Counter[gun_index].UV[1] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_UNDER_VOLTAGE;
- DEBUG_INFO("ALARM_L2_UNDER_VOLTAGE : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].UV[1]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].UV[1] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_UNDER_VOLTAGE;
- DEBUG_INFO("ALARM_L2_UNDER_VOLTAGE : recover \n");
- }
- }
- Alarm_Counter[gun_index].UV[1] = 0;
- }
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L3 == ON)
- {
- if(Alarm_Counter[gun_index].UV[2] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_UNDER_VOLTAGE;
- DEBUG_INFO("ALARM_L3_UNDER_VOLTAGE : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].UV[2]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].UV[2] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_UNDER_VOLTAGE;
- DEBUG_INFO("ALARM_L3_UNDER_VOLTAGE : recover \n");
- }
- }
- Alarm_Counter[gun_index].UV[2] = 0;
- }
- }
- //=====================================
- // Over current detection
- //=====================================
- if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L1 == ON) ||
- ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0] > (ShmCharger->gun_info[gun_index].targetCurrent<=20?(ShmCharger->gun_info[gun_index].targetCurrent+2):((int)(ShmCharger->gun_info[gun_index].targetCurrent*((ShmSysConfigAndInfo->SysConfig.ModelName[3]=='E') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='T') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='Z')?1.25:1.1)))))) )
- {
- if(Alarm_Counter[gun_index].OC[0] > 500)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == OFF)
- {
- refreshStartTimer(&startTime[ALARM_TMR_IDX_OCP_L1]);
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_CURRENT;
- DEBUG_INFO("ALARM_L1_OVER_CURRENT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].OC[0]++;
- }
- }
- else if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L1 != ON) &&
- ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) ? (getDiffSecNow(startTime[ALARM_TMR_IDX_OCP_L1]) >= 60) : TRUE) &&
- (ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0] <= (ShmCharger->gun_info[gun_index].targetCurrent<=20?(ShmCharger->gun_info[gun_index].targetCurrent):((int)((ShmCharger->gun_info[gun_index].targetCurrent*((ShmSysConfigAndInfo->SysConfig.ModelName[3]=='E') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='T') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='Z')?1.25:1.1))-2)))))
- {
- if(Alarm_Counter[gun_index].OC[0] > 500)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_OVER_CURRENT;
- DEBUG_INFO("ALARM_L1_OVER_CURRENT : recover \n");
- }
- }
- Alarm_Counter[gun_index].OC[0] = 0;
- }
- if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
- {
- if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L2 == ON) ||
- ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0] > (ShmCharger->gun_info[gun_index].targetCurrent<=20?(ShmCharger->gun_info[gun_index].targetCurrent+2):((int)(ShmCharger->gun_info[gun_index].targetCurrent*((ShmSysConfigAndInfo->SysConfig.ModelName[3]=='E') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='T') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='Z')?1.25:1.1)))))) )
- {
- if(Alarm_Counter[gun_index].OC[1] > 500)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 == OFF)
- {
- refreshStartTimer(&startTime[ALARM_TMR_IDX_OCP_L2]);
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_OVER_CURRENT;
- DEBUG_INFO("ALARM_L2_OVER_CURRENT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].OC[1]++;
- }
- }
- else if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L2 != ON) &&
- ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) ? (getDiffSecNow(startTime[ALARM_TMR_IDX_OCP_L2]) >= 60) : TRUE) &&
- (ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0] <= (ShmCharger->gun_info[gun_index].targetCurrent<=20?(ShmCharger->gun_info[gun_index].targetCurrent):((int)((ShmCharger->gun_info[gun_index].targetCurrent*((ShmSysConfigAndInfo->SysConfig.ModelName[3]=='E') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='T') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='Z')?1.25:1.1))-2)))))
- {
- if(Alarm_Counter[gun_index].OC[1] > 500)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_OVER_CURRENT;
- DEBUG_INFO("ALARM_L2_OVER_CURRENT : recover \n");
- }
- }
- Alarm_Counter[gun_index].OC[1] = 0;
- }
- if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L3 == ON) ||
- ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0] > (ShmCharger->gun_info[gun_index].targetCurrent<=20?(ShmCharger->gun_info[gun_index].targetCurrent+2):((int)(ShmCharger->gun_info[gun_index].targetCurrent*((ShmSysConfigAndInfo->SysConfig.ModelName[3]=='E') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='T') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='Z')?1.25:1.1)))))) )
- {
- if(Alarm_Counter[gun_index].OC[2] > 500)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 == OFF)
- {
- refreshStartTimer(&startTime[ALARM_TMR_IDX_OCP_L3]);
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_OVER_CURRENT;
- DEBUG_INFO("ALARM_L3_OVER_CURRENT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].OC[2]++;
- }
- }
- else if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L3 != ON) &&
- ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) ? (getDiffSecNow(startTime[ALARM_TMR_IDX_OCP_L3]) >= 60) : TRUE) &&
- (ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0] <= (ShmCharger->gun_info[gun_index].targetCurrent<=20?(ShmCharger->gun_info[gun_index].targetCurrent):((int)((ShmCharger->gun_info[gun_index].targetCurrent*((ShmSysConfigAndInfo->SysConfig.ModelName[3]=='E') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='T') || (ShmSysConfigAndInfo->SysConfig.ModelName[3]=='Z')?1.25:1.1))-2)))))
- {
- if(Alarm_Counter[gun_index].OC[2] > 500)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_OVER_CURRENT;
- DEBUG_INFO("ALARM_L3_OVER_CURRENT : recover \n");
- }
- }
- Alarm_Counter[gun_index].OC[2] = 0;
- }
- }
- //=====================================
- // Over temperature detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP == ON)
- {
- if(Alarm_Counter[gun_index].OT_AMB > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_TEMPERATURE;
- DEBUG_INFO("ALARM_OVER_TEMPERATURE : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].OT_AMB++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].OT_AMB > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_TEMPERATURE;
- DEBUG_INFO("ALARM_OVER_TEMPERATURE : recover \n");
- }
- }
- Alarm_Counter[gun_index].OT_AMB = 0;
- }
- //=====================================
- // Ground fault detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault == ON)
- {
- if(Alarm_Counter[gun_index].GMI > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcGroundfaultFail == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcGroundfaultFail = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_GROUND_FAIL;
- DEBUG_INFO("ALARM_GROUND_FAIL : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].GMI++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].GMI > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcGroundfaultFail == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcGroundfaultFail = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_GROUND_FAIL;
- DEBUG_INFO("ALARM_GROUND_FAIL : recover \n");
- }
- }
- Alarm_Counter[gun_index].GMI = 0;
- }
- //=====================================
- // CP level fail detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault == ON)
- {
- if(Alarm_Counter[gun_index].CP_LevelFail > FILTER_SPEC)
- {
- if(ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault == OFF)
- {
- ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CP_ERROR;
- DEBUG_INFO("ALARM_CP_ERROR : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].CP_LevelFail++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].CP_LevelFail > FILTER_SPEC)
- {
- if(ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault == ON)
- {
- ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CP_ERROR;
- DEBUG_INFO("ALARM_CP_ERROR : recover \n");
- }
- }
- Alarm_Counter[gun_index].CP_LevelFail= 0;
- }
- //=====================================
- // Current AC/DC leak detection
- //=====================================
- if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak == ON) ||
- (ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak == ON))
- {
- if(Alarm_Counter[gun_index].Leakage > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip = ON;
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak == ON)
- {
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CURRENT_LEAK_AC;
- ShmCharger->gun_info[gun_index].otherAlarmCode.isACLeakage = ON;
- DEBUG_INFO("ALARM_CURRENT_LEAK_AC : alarm \n");
- }
- else if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak == ON)
- {
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CURRENT_LEAK_DC;
- ShmCharger->gun_info[gun_index].otherAlarmCode.isDcLeakage = ON;
- DEBUG_INFO("ALARM_CURRENT_LEAK_DC : alarm \n");
- }
- }
- }
- else
- {
- Alarm_Counter[gun_index].Leakage++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].Leakage > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip = OFF;
- if(ShmCharger->gun_info[gun_index].otherAlarmCode.isACLeakage == ON)
- {
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CURRENT_LEAK_AC;
- ShmCharger->gun_info[gun_index].otherAlarmCode.isACLeakage = OFF;
- DEBUG_INFO("ALARM_CURRENT_LEAK_AC : recover \n");
- }
- else if(ShmCharger->gun_info[gun_index].otherAlarmCode.isDcLeakage == ON)
- {
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CURRENT_LEAK_DC;
- ShmCharger->gun_info[gun_index].otherAlarmCode.isDcLeakage = OFF;
- DEBUG_INFO("ALARM_CURRENT_LEAK_DC : recover \n");
- }
- }
- }
- Alarm_Counter[gun_index].Leakage = 0;
- }
- //=====================================
- // MCU self test fail detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail == ON)
- {
- if(Alarm_Counter[gun_index].MCU_SelfTestFail > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.McuSelftestFail == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.McuSelftestFail = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_MCU_TESTFAIL;
- DEBUG_INFO("ALARM_MCU_TESTFAIL : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].MCU_SelfTestFail++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].MCU_SelfTestFail > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.McuSelftestFail == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.McuSelftestFail = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_MCU_TESTFAIL;
- DEBUG_INFO("ALARM_MCU_TESTFAIL : recover \n");
- }
- }
- Alarm_Counter[gun_index].MCU_SelfTestFail = 0;
- }
- //=====================================
- // Emergency stop detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop == ON)
- {
- if(Alarm_Counter[gun_index].EmrgencyBTN > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_EMERGENCY_STOP;
- DEBUG_INFO("ALARM_EMERGENCY_STOP : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].EmrgencyBTN++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].EmrgencyBTN > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_EMERGENCY_STOP;
- DEBUG_INFO("ALARM_EMERGENCY_STOP : recover \n");
- }
- }
- Alarm_Counter[gun_index].EmrgencyBTN = 0;
- }
- //=====================================
- // Relay welding detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding == ON)
- {
- if(Alarm_Counter[gun_index].Relay_Welding > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding == OFF)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_RELAY_WELDING;
- DEBUG_INFO("ALARM_RELAY_STATUS : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].Relay_Welding++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].Relay_Welding > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding == ON)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_RELAY_WELDING;
- DEBUG_INFO("ALARM_RELAY_STATUS : recover \n");
- }
- }
- Alarm_Counter[gun_index].Relay_Welding = 0;
- }
- //=====================================
- // Relay driving fault detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault == ON)
- {
- if(Alarm_Counter[gun_index].Relay_DrivingFault > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault == OFF)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_RELAY_DRIVE_FAULT;
- DEBUG_INFO("ALARM_RELAY_DRIVE_FAULT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].Relay_DrivingFault++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].Relay_DrivingFault > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault == ON)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_RELAY_DRIVE_FAULT;
- DEBUG_INFO("ALARM_RELAY_DRIVE_FAULT : recover \n");
- }
- }
- Alarm_Counter[gun_index].Relay_DrivingFault = 0;
- }
- //=====================================
- // Current short detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L1 == ON)
- {
- if(Alarm_Counter[gun_index].Short[0] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_CIRCUIT_SHORT;
- DEBUG_INFO("ALARM_L1_CIRCUIT_SHORT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].Short[0]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].Short[0] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_CIRCUIT_SHORT;
- DEBUG_INFO("ALARM_L1_CIRCUIT_SHORT : recover \n");
- }
- }
- Alarm_Counter[gun_index].Short[0] = 0;
- }
-
- if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
- {
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L2 == ON)
- {
- if(Alarm_Counter[gun_index].Short[1] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_CIRCUIT_SHORT;
- DEBUG_INFO("ALARM_L2_CIRCUIT_SHORT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].Short[1]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].Short[1] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_CIRCUIT_SHORT;
- DEBUG_INFO("ALARM_L2_CIRCUIT_SHORT : recover \n");
- }
- }
- Alarm_Counter[gun_index].Short[1] = 0;
- }
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L3 == ON)
- {
- if(Alarm_Counter[gun_index].Short[2] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_CIRCUIT_SHORT;
- DEBUG_INFO("ALARM_L3_CIRCUIT_SHORT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].Short[2]++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].Short[2] > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_CIRCUIT_SHORT;
- DEBUG_INFO("ALARM_L3_CIRCUIT_SHORT : recover \n");
- }
- }
- Alarm_Counter[gun_index].Short[2] = 0;
- }
- }
- //=====================================
- // Rotatory switch detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.rotate_switch_fault == ON)
- {
- if(Alarm_Counter[gun_index].Rotary_Switch > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.RotarySwitchFault == OFF)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.RotarySwitchFault = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_ROTATORY_SWITCH_FAULT;
- DEBUG_INFO("ALARM_ROTATORY_SWITCH_FAULT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].Rotary_Switch += 1;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].Rotary_Switch > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.RotarySwitchFault == ON)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.RotarySwitchFault = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_ROTATORY_SWITCH_FAULT;
- DEBUG_INFO("ALARM_ROTATORY_SWITCH_FAULT : recover \n");
- }
- }
- Alarm_Counter[gun_index].Rotary_Switch = 0;
- }
- //=====================================
- // Leakage module detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail == ON)
- {
- if(Alarm_Counter[gun_index].leak_module_fail > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.RcdSelfTestFail == OFF)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.RcdSelfTestFail = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_LEAK_MODULE_FAIL;
- DEBUG_INFO("ALARM_LEAK_MODULE_FAIL : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].leak_module_fail += 1;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].leak_module_fail > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.RcdSelfTestFail == ON)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.RcdSelfTestFail = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_LEAK_MODULE_FAIL;
- DEBUG_INFO("ALARM_LEAK_MODULE_FAIL : recover \n");
- }
- }
- Alarm_Counter[gun_index].leak_module_fail = 0;
- }
- //=====================================
- // Locker detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault == ON)
- {
- if(Alarm_Counter[gun_index].locker_fault > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcConnectorLockFail == OFF)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.AcConnectorLockFail = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_LOCKER_FAULT;
- DEBUG_INFO("ALARM_LOCKER_FAULT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].locker_fault += 1;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].locker_fault > FILTER_SPEC)
- {
- if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcConnectorLockFail == ON)
- {
- ShmStatusCodeData->FaultCode.FaultEvents.bits.AcConnectorLockFail = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_LOCKER_FAULT;
- DEBUG_INFO("ALARM_LOCKER_FAULT : recover \n");
- }
- }
- Alarm_Counter[gun_index].locker_fault = 0;
- }
- //=====================================
- // Power drop detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop == ON)
- {
- if(Alarm_Counter[gun_index].power_drop > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_POWER_DROP;
- DEBUG_INFO("ALARM_POWER_DROP : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].power_drop += 1;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].power_drop > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_POWER_DROP;
- DEBUG_INFO("ALARM_POWER_DROP : recover \n");
- }
- }
- Alarm_Counter[gun_index].power_drop = 0;
- }
- //=====================================
- // Meter communication timeout detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_comm_timeout == ON)
- {
- if(Alarm_Counter[gun_index].meter_comm_timeout > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.Meter1CommTimeout == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.Meter1CommTimeout = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_METER_TIMEOUT;
- DEBUG_INFO("ALARM_METER_TIMEOUT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].meter_comm_timeout += 1;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].meter_comm_timeout > FILTER_SPEC)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.Meter1CommTimeout == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.Meter1CommTimeout = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_METER_TIMEOUT;
- DEBUG_INFO("ALARM_METER_TIMEOUT : recover \n");
- }
- }
- Alarm_Counter[gun_index].meter_comm_timeout = 0;
- }
- //=====================================
- // Meter ic communication timeout detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_ic_comm_timeout == ON)
- {
- if(Alarm_Counter[gun_index].meter_ic_comm_timeout > FILTER_SPEC)
- {
- 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
- {
- Alarm_Counter[gun_index].meter_ic_comm_timeout += 1;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].meter_ic_comm_timeout > FILTER_SPEC)
- {
- 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");
- }
- }
- Alarm_Counter[gun_index].meter_ic_comm_timeout = 0;
- }
- //=====================================
- // Pilot negative error detection
- //=====================================
- if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.pilot_negative_error == ON)
- {
- if(Alarm_Counter[gun_index].pilot_negative_error > FILTER_SPEC)
- {
- 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
- {
- Alarm_Counter[gun_index].pilot_negative_error += 1;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].pilot_negative_error > FILTER_SPEC)
- {
- 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");
- }
- }
- Alarm_Counter[gun_index].pilot_negative_error = 0;
- }
- //=====================================
- // QCA7000 flash content check
- //=====================================
- if((((gun_index == 0) && (ShmSysConfigAndInfo->SysConfig.ModelName[9] == '7')) ||
- ((gun_index == 1) && (ShmSysConfigAndInfo->SysConfig.ModelName[8] == '7')) ||
- ((gun_index == 2) && (ShmSysConfigAndInfo->SysConfig.ModelName[7] == '7'))) && !isCheckQca7000[gun_index])
- {
- if(qca7000FlashCheck() == FAIL)
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CCSboardStestFail == OFF)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CCSboardStestFail = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_QCA_FLASH_FAIL;
- DEBUG_INFO("ALARM_QCA_FLASH_FAIL : alarm \n");
- }
- }
- else
- {
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CCSboardStestFail == ON)
- {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CCSboardStestFail = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_QCA_FLASH_FAIL;
- DEBUG_INFO("ALARM_QCA_FLASH_FAIL : recover \n");
- }
- }
- isCheckQca7000[gun_index] = TRUE;
- }
- //=====================================
- // EVCCID get timeout
- //=====================================
- if(ShmCharger->gun_info[gun_index].isGetEvCCIDTimeout == ON)
- {
- if(Alarm_Counter[gun_index].GetEvCCIDTimeout > FILTER_SPEC)
- {
- if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail== OFF)
- {
- ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = ON;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_GET_EVCCID_TIMEOUT;
- DEBUG_INFO("ALARM_GET_EVCCID_TIMEOUT : alarm \n");
- }
- }
- else
- {
- Alarm_Counter[gun_index].GetEvCCIDTimeout++;
- }
- }
- else
- {
- if(Alarm_Counter[gun_index].GetEvCCIDTimeout > FILTER_SPEC)
- {
- if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail == ON)
- {
- ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = OFF;
- ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_GET_EVCCID_TIMEOUT;
- DEBUG_INFO("ALARM_GET_EVCCID_TIMEOUT : recover \n");
- }
- }
- Alarm_Counter[gun_index].GetEvCCIDTimeout = 0;
- }
- //=====================================
- // OCPP error code message
- //=====================================
- if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
- {
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE) ||
- (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE) ||
- (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE))
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OverVoltage");
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012200");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012201");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012202");
- }
- else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE) ||
- (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE) ||
- (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE))
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "UnderVoltage");
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012203");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012204");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012205");
- }
- else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT) ||
- (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT) ||
- (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT))
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OverCurrentFailure");
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012216");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012299");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012300");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_TEMPERATURE)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "HighTemperature");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012223");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "GroundFailure");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012256");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_ERROR)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "023703");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "CpError");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_AC)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012233");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "ACLeakage");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_DC)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012233");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "DCLeakage");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_MCU_TESTFAIL)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012257");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "McuTestFail");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012251");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "EmergencyStop");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_WELDING)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011009");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "RelayWelding");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LEAK_MODULE_FAIL)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011004");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "LeakageModuleFail");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LOCKER_FAULT)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "ConnectorLockFailure");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011027");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_POWER_DROP)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012212");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputDrop == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012213");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputDrop == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012214");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "PowerDrop");
- }
- else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT) ||
- (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT) ||
- (ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT))
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012262");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012301");
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 == ON)
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012302");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "CircuitShort");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_ROTATORY_SWITCH_FAULT)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011036");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "RotatorySwitchFault");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_DRIVE_FAULT)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011010");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "RelayDriveFault");
- }
- else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_TIMEOUT)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- 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 if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CCSboardStestFail)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012284");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "QCA Self test Failed");
- }
- else if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail)
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "023701");
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "CCS EV communication Fail");
- }
- else
- {
- sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "NoError");
- memset(ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode, 0x00, ARRAY_SIZE(ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode));
- memset(ShmOCPP16Data->StatusNotification[gun_index].Info, 0x00, ARRAY_SIZE(ShmOCPP16Data->StatusNotification[gun_index].Info));
- }
- }
- else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
- {
- uint8_t idxEvent = 0;
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L1_OVER_VOLTAGE))
- {
- 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_L1_OVER_VOLTAGE)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012200");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L1 input OVP");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
- 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_L1_OVER_VOLTAGE)
- previousAlarmCode[gun_index] |= ALARM_L1_OVER_VOLTAGE;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L1_OVER_VOLTAGE;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L2_OVER_VOLTAGE))
- {
- 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_L2_OVER_VOLTAGE)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012201");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L2 input OVP");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
- 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_L2_OVER_VOLTAGE)
- previousAlarmCode[gun_index] |= ALARM_L2_OVER_VOLTAGE;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L2_OVER_VOLTAGE;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L3_OVER_VOLTAGE))
- {
- 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_L3_OVER_VOLTAGE)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012202");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L3 input OVP");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
- 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_L3_OVER_VOLTAGE)
- previousAlarmCode[gun_index] |= ALARM_L3_OVER_VOLTAGE;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L3_OVER_VOLTAGE;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L1_UNDER_VOLTAGE))
- {
- 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_L1_UNDER_VOLTAGE)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012203");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L1 input UVP");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
- 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_L1_UNDER_VOLTAGE)
- previousAlarmCode[gun_index] |= ALARM_L1_UNDER_VOLTAGE;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L1_UNDER_VOLTAGE;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L2_UNDER_VOLTAGE))
- {
- 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_L2_UNDER_VOLTAGE)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012204");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L2 input UVP");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
- 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_L2_UNDER_VOLTAGE)
- previousAlarmCode[gun_index] |= ALARM_L2_UNDER_VOLTAGE;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L2_UNDER_VOLTAGE;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L3_UNDER_VOLTAGE))
- {
- 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_L3_UNDER_VOLTAGE)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012205");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L3 input UVP");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
- 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_L3_UNDER_VOLTAGE)
- previousAlarmCode[gun_index] |= ALARM_L3_UNDER_VOLTAGE;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L3_UNDER_VOLTAGE;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT) != (previousAlarmCode[gun_index] & ALARM_L1_OVER_CURRENT))
- {
- 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_L1_OVER_CURRENT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012216");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System AC output OCP L1");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
- 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_L1_OVER_CURRENT)
- previousAlarmCode[gun_index] |= ALARM_L1_OVER_CURRENT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L1_OVER_CURRENT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT) != (previousAlarmCode[gun_index] & ALARM_L2_OVER_CURRENT))
- {
- 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_L2_OVER_CURRENT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012299");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System AC output OCP L2");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
- 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_L2_OVER_CURRENT)
- previousAlarmCode[gun_index] |= ALARM_L2_OVER_CURRENT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L2_OVER_CURRENT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT) != (previousAlarmCode[gun_index] & ALARM_L3_OVER_CURRENT))
- {
- 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_L3_OVER_CURRENT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012300");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System AC output OCP L3");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
- 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_L3_OVER_CURRENT)
- previousAlarmCode[gun_index] |= ALARM_L3_OVER_CURRENT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L3_OVER_CURRENT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_TEMPERATURE) != (previousAlarmCode[gun_index] & ALARM_OVER_TEMPERATURE))
- {
- 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_OVER_TEMPERATURE)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_TEMPERATURE)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012223");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System ambient/inlet OTP");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Temperature");
- 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_OVER_TEMPERATURE)
- previousAlarmCode[gun_index] |= ALARM_OVER_TEMPERATURE;
- else
- previousAlarmCode[gun_index] &= ~ALARM_OVER_TEMPERATURE;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL) != (previousAlarmCode[gun_index] & ALARM_GROUND_FAIL))
- {
- 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_GROUND_FAIL)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012256");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "AC Ground Fault");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Ground(PE)");
- 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_GROUND_FAIL)
- previousAlarmCode[gun_index] |= ALARM_GROUND_FAIL;
- else
- previousAlarmCode[gun_index] &= ~ALARM_GROUND_FAIL;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_ERROR) != (previousAlarmCode[gun_index] & ALARM_CP_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_ERROR)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_ERROR)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "023703");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "pilot fault");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Control pilot");
- 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_ERROR)
- previousAlarmCode[gun_index] |= ALARM_CP_ERROR;
- else
- previousAlarmCode[gun_index] &= ~ALARM_CP_ERROR;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_AC) != (previousAlarmCode[gun_index] & ALARM_CURRENT_LEAK_AC))
- {
- 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_CURRENT_LEAK_AC)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_AC)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012233");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "RCD/CCID trip");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "CCID");
- 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_CURRENT_LEAK_AC)
- previousAlarmCode[gun_index] |= ALARM_CURRENT_LEAK_AC;
- else
- previousAlarmCode[gun_index] &= ~ALARM_CURRENT_LEAK_AC;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_DC) != (previousAlarmCode[gun_index] & ALARM_CURRENT_LEAK_DC))
- {
- 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_CURRENT_LEAK_DC)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_DC)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012233");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "RCD/CCID trip");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "CCID");
- 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_CURRENT_LEAK_DC)
- previousAlarmCode[gun_index] |= ALARM_CURRENT_LEAK_DC;
- else
- previousAlarmCode[gun_index] &= ~ALARM_CURRENT_LEAK_DC;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_MCU_TESTFAIL) != (previousAlarmCode[gun_index] & ALARM_MCU_TESTFAIL))
- {
- 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_MCU_TESTFAIL)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_MCU_TESTFAIL)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012257");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "MCU self-test Fault");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "MCU");
- 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_MCU_TESTFAIL)
- previousAlarmCode[gun_index] |= ALARM_MCU_TESTFAIL;
- else
- previousAlarmCode[gun_index] &= ~ALARM_MCU_TESTFAIL;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP) != (previousAlarmCode[gun_index] & ALARM_EMERGENCY_STOP))
- {
- 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_EMERGENCY_STOP)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012251");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Emergency stop");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Button");
- 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_EMERGENCY_STOP)
- previousAlarmCode[gun_index] |= ALARM_EMERGENCY_STOP;
- else
- previousAlarmCode[gun_index] &= ~ALARM_EMERGENCY_STOP;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_WELDING) != (previousAlarmCode[gun_index] & ALARM_RELAY_WELDING))
- {
- 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_RELAY_WELDING)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_WELDING)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011009");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "AC output relay welding");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Relay");
- 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_RELAY_WELDING)
- previousAlarmCode[gun_index] |= ALARM_RELAY_WELDING;
- else
- previousAlarmCode[gun_index] &= ~ALARM_RELAY_WELDING;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LEAK_MODULE_FAIL) != (previousAlarmCode[gun_index] & ALARM_LEAK_MODULE_FAIL))
- {
- 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_LEAK_MODULE_FAIL)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LEAK_MODULE_FAIL)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011004");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "RCD/CCID self-test fail");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "CCID");
- 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_LEAK_MODULE_FAIL)
- previousAlarmCode[gun_index] |= ALARM_LEAK_MODULE_FAIL;
- else
- previousAlarmCode[gun_index] &= ~ALARM_LEAK_MODULE_FAIL;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LOCKER_FAULT) != (previousAlarmCode[gun_index] & ALARM_LOCKER_FAULT))
- {
- 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_LOCKER_FAULT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LOCKER_FAULT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011027");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "AC connector lock fail");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Locker");
- 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_LOCKER_FAULT)
- previousAlarmCode[gun_index] |= ALARM_LOCKER_FAULT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_LOCKER_FAULT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_POWER_DROP) != (previousAlarmCode[gun_index] & ALARM_POWER_DROP))
- {
- 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_POWER_DROP)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_POWER_DROP)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop == ON)
- {
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012212");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L1 input drop");
- }
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputDrop == ON)
- {
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012213");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L2 input drop");
- }
- else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputDrop == ON)
- {
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012214");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L3 input drop");
- }
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
- 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_POWER_DROP)
- previousAlarmCode[gun_index] |= ALARM_POWER_DROP;
- else
- previousAlarmCode[gun_index] &= ~ALARM_POWER_DROP;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT) != (previousAlarmCode[gun_index] & ALARM_L1_CIRCUIT_SHORT))
- {
- 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_L1_CIRCUIT_SHORT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012262");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Circuit Short L1");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
- 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_L1_CIRCUIT_SHORT)
- previousAlarmCode[gun_index] |= ALARM_L1_CIRCUIT_SHORT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L1_CIRCUIT_SHORT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT) != (previousAlarmCode[gun_index] & ALARM_L2_CIRCUIT_SHORT))
- {
- 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_L2_CIRCUIT_SHORT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012301");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Circuit Short L2");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
- 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_L2_CIRCUIT_SHORT)
- previousAlarmCode[gun_index] |= ALARM_L2_CIRCUIT_SHORT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L2_CIRCUIT_SHORT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT) != (previousAlarmCode[gun_index] & ALARM_L3_CIRCUIT_SHORT))
- {
- 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_L3_CIRCUIT_SHORT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012302");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Circuit Short L3");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
- 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_L3_CIRCUIT_SHORT)
- previousAlarmCode[gun_index] |= ALARM_L3_CIRCUIT_SHORT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_L3_CIRCUIT_SHORT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_ROTATORY_SWITCH_FAULT) != (previousAlarmCode[gun_index] & ALARM_ROTATORY_SWITCH_FAULT))
- {
- 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_ROTATORY_SWITCH_FAULT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_ROTATORY_SWITCH_FAULT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011036");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Rotary switch fault");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Rotary switch");
- 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_ROTATORY_SWITCH_FAULT)
- previousAlarmCode[gun_index] |= ALARM_ROTATORY_SWITCH_FAULT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_ROTATORY_SWITCH_FAULT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_DRIVE_FAULT) != (previousAlarmCode[gun_index] & ALARM_RELAY_DRIVE_FAULT))
- {
- 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_RELAY_DRIVE_FAULT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_DRIVE_FAULT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011010");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "AC output relay driving fault");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Relay");
- 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_RELAY_DRIVE_FAULT)
- previousAlarmCode[gun_index] |= ALARM_RELAY_DRIVE_FAULT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_RELAY_DRIVE_FAULT;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_TIMEOUT) != (previousAlarmCode[gun_index] & ALARM_METER_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_TIMEOUT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_TIMEOUT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012305");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Meter 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_TIMEOUT)
- previousAlarmCode[gun_index] |= ALARM_METER_TIMEOUT;
- else
- 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((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_QCA_FLASH_FAIL) != (previousAlarmCode[gun_index] & ALARM_QCA_FLASH_FAIL))
- {
- 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, "012284");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "QCA Self test Failed");
- 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_QCA_FLASH_FAIL)
- previousAlarmCode[gun_index] |= ALARM_QCA_FLASH_FAIL;
- else
- previousAlarmCode[gun_index] &= ~ALARM_QCA_FLASH_FAIL;
- }
- if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GET_EVCCID_TIMEOUT) != (previousAlarmCode[gun_index] & ALARM_GET_EVCCID_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_GET_EVCCID_TIMEOUT)?"true":"false"));
- ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GET_EVCCID_TIMEOUT)?OFF:ON);
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "023701");
- sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "CCS EV communication Fail");
- 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_GET_EVCCID_TIMEOUT)
- previousAlarmCode[gun_index] |= ALARM_GET_EVCCID_TIMEOUT;
- else
- previousAlarmCode[gun_index] &= ~ALARM_GET_EVCCID_TIMEOUT;
- }
- if(idxEvent > 0)
- ShmOCPP20Data->SpMsg.bits.NotifyEventReq = ON;
- }
- //=====================================
- // Latch alarm recover in state A
- //=====================================
- if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 1))
- {
- /*
- TODO: Recover latch alarm here
- */
- }
- //=====================================
- // Latch alarm recover in state B1 and B2
- //=====================================
- if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 2) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 3))
- {
- /*
- TODO: Recover latch alarm here
- */
- }
- //=====================================
- // Latch alarm recover in state C
- //=====================================
- if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 4))
- {
- /*
- TODO: Recover latch alarm here
- */
- }
-
- ShmCharger->gun_info[gun_index].acCcsInfo.CSUAlarmStatusCode = ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode;
- }
- usleep(100000);
- }
- return FAIL;
- }
|