Przeglądaj źródła

2022-03-01 / Simon Xue

Simon Xue 3 lat temu
rodzic
commit
693a68ce57
29 zmienionych plików z 170 dodań i 279 usunięć
  1. 10 4
      EVSE/Projects/DD360Tcci/Apps/CSU/RFID.c
  2. 9 3
      EVSE/Projects/DD360Tcci/Apps/CSU/main.c
  3. 2 0
      EVSE/Projects/DD360Tcci/Apps/Config.h
  4. 6 6
      EVSE/Projects/DD360Tcci/Apps/Define/define.c
  5. 70 50
      EVSE/Projects/DD360Tcci/Apps/Define/define.h
  6. 2 15
      EVSE/Projects/DD360Tcci/Apps/Makefile
  7. 7 2
      EVSE/Projects/DD360Tcci/Apps/ModuleChkSysTask/Module_ChkSysTask.c
  8. 20 11
      EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.c
  9. 1 1
      EVSE/Projects/DD360Tcci/Apps/ModuleInternalComm/RelayBoard.c
  10. 2 1
      EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c
  11. 4 0
      EVSE/Projects/DD360Tcci/Apps/ModulePrimary/Module_PrimaryComm.c
  12. 37 7
      EVSE/Projects/DD360Tcci/Apps/ReadCmdline.c
  13. BIN
      EVSE/Projects/DD360Tcci/Apps/UnsafetyOutputTask
  14. 0 171
      EVSE/Projects/DD360Tcci/Apps/simulation.c
  15. 0 8
      EVSE/Projects/DD360Tcci/Apps/simulation.h
  16. BIN
      EVSE/Projects/DD360Tcci/Images/ramdisk.gz
  17. BIN
      EVSE/Projects/DD360Tcci/output/FactoryConfig
  18. BIN
      EVSE/Projects/DD360Tcci/output/Module_ChkSysTask
  19. BIN
      EVSE/Projects/DD360Tcci/output/Module_DoComm
  20. BIN
      EVSE/Projects/DD360Tcci/output/Module_EvComm
  21. BIN
      EVSE/Projects/DD360Tcci/output/Module_EventLogging
  22. BIN
      EVSE/Projects/DD360Tcci/output/Module_InternalComm
  23. BIN
      EVSE/Projects/DD360Tcci/output/Module_LcmControl
  24. BIN
      EVSE/Projects/DD360Tcci/output/Module_PrimaryComm
  25. BIN
      EVSE/Projects/DD360Tcci/output/Module_UpdateFW
  26. BIN
      EVSE/Projects/DD360Tcci/output/ReadCmdline
  27. BIN
      EVSE/Projects/DD360Tcci/output/UnsafetyOutputTask
  28. BIN
      EVSE/Projects/DD360Tcci/output/main
  29. BIN
      EVSE/Projects/DD360Tcci/output/simulation

+ 10 - 4
EVSE/Projects/DD360Tcci/Apps/CSU/RFID.c

@@ -464,7 +464,7 @@ void CreateRfidFork(void)
         }
         //log_info("RFID fork Child's PID is %d", getpid());
         int result;
-        int is_idle = FALSE;
+        int is_idle = TRUE;
         while (isContinue) {
         	result = 0;
             usleep(500000);
@@ -472,6 +472,12 @@ void CreateRfidFork(void)
             SeqEndTime.time = time(NULL);
             tm = localtime(&SeqEndTime.time);
 
+            if (ShmDcCommonData->DebugFlag == TRUE) {
+                ShmDcCommonData->PreAuth_Config = _CREDITCARD_IDLE;
+                ShmDcCommonData->PreAuth_Result = 0;
+                continue;
+            }
+
             if (ShmDcCommonData->UnionSettlement) {
                 ShmDcCommonData->UnionSettlement = 0;
                 result = CreditCardUnionSettlement(fd, "TCC Test", &ShmDcCommonData->pCreditCard[0]);
@@ -481,11 +487,11 @@ void CreateRfidFork(void)
                 else
                     log_info("CreditCardUnionSettlement FAIL");
             }
-            is_idle = FALSE;
+            is_idle = TRUE;
 			for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
 				pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
-				if (pDcChargingInfo->SystemStatus == S_IDLE) {
-					is_idle = TRUE;
+				if (pDcChargingInfo->SystemStatus != S_IDLE) {
+					is_idle = FALSE;
 				}
 				if (ShmDcCommonData->StopCharge[gunIndex] == TRUE && ShmDcCommonData->finalcost_flag[gunIndex]) {
                     ShmDcCommonData->StopCharge[gunIndex] = FALSE;

+ 9 - 3
EVSE/Projects/DD360Tcci/Apps/CSU/main.c

@@ -81,8 +81,8 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V2.06.00.0000.00"; // Phihong version
-char* DebugVersion = "v2.06.01";      // Software debug version
+char *fwVersion = "V2.07.00.0000.00"; // Phihong version
+char* DebugVersion = "v2.07.00";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -3543,6 +3543,12 @@ static void ReviewCriticalAlarm(void)
 			ShmSelectGunInfo->EthDevStatus.Backend == 0 ||
 			ShmSelectGunInfo->EthDevStatus.Backend == 2
        ) {
+        if ((ShmSelectGunInfo->EthDevStatus.Backend == 0 ||
+            ShmSelectGunInfo->EthDevStatus.Backend == 2) &&
+            ShmDcCommonData->DebugFlag == TRUE) {
+            pSysWarning->Level = WARN_LV_NL;
+            return;
+        }
         pSysWarning->Level = WARN_LV_ER;
     } else {
         pSysWarning->Level = WARN_LV_NL;
@@ -4632,7 +4638,7 @@ CheckStatus:
                     ShmDcCommonData->PreAuth_Result != 0 && cancelcount < 30) {
                     sleep(1);
                     cancelcount++;
-                    log_info("Cancel Not Complete yet");
+                    //log_info("Cancel Not Complete yet");
                     break;
                 }
                 if (pSysWarning->Level == WARN_LV_ER) {

+ 2 - 0
EVSE/Projects/DD360Tcci/Apps/Config.h

@@ -496,6 +496,8 @@ typedef struct StDcCommonInfo {
     int RoutineReupload;
     int TZOffset;
     int ClearServiceQR;
+    int DebugFlag;
+    int chillerCtrl;
 } DcCommonInfo;
 
 #endif /* CONFIG_H_ */

+ 6 - 6
EVSE/Projects/DD360Tcci/Apps/Define/define.c

@@ -236,11 +236,11 @@ char AlarmStatusCode[160][6]=
 "012324", // Connector 1 detects abnormal voltage on the output line
 "012325", // Connector 2 detects abnormal voltage on the output line
 "012326", // System task is lost
-"012327", // DC input ovp
-"012328", // DC input uvp
-"012329",   // reserved
-"012330",   // reserved
-"012331",   // reserved
+"012327",   // DC input ovp
+"012328",   // DC input uvp
+"012329",   // Psu Can Communication Fault
+"012330",   // Psu Dc to Dc OTP
+"012331",   // Psu Dc to Dc OVP
 "012332",   // reserved
 "012333",   // reserved
 "012334",   // reserved
@@ -255,7 +255,7 @@ char AlarmStatusCode[160][6]=
 "012343",   // reserved
 "012344",   // AC: Meter IC communication timeout
 "012345",   // AC: Pilot negative error
-"012346",   // reserved
+"012346",   // Psu Communication error with CSU
 "012347",   // reserved
 "012348",   // reserved
 "012349",   // reserved

+ 70 - 50
EVSE/Projects/DD360Tcci/Apps/Define/define.h

@@ -322,6 +322,7 @@ enum CoreProfile {
      TimeOffsetNextTransition,
      SystemUptimeSec,
      FreeVend,
+     FreeVendIdtag,
      OcppServer,
      MaintainServer,
      StatusNotificationPeriodically,
@@ -417,8 +418,16 @@ struct LED
 	unsigned char			Blue[3];					// Blue color	0~100, element 0: IDLE		1: CHARGING		2: FAULT
 };
 
+struct LCD_NOUSE
+{
+    unsigned char           page_index;                 // LCD override page index
+    unsigned char           duration;                   // LCD override duration
+    unsigned char           isOverideReq:1;             // LCD override request
+};
+
 struct LCD_OVERRIDE
 {
+    unsigned char           connectorId;                // LCD override connector id
     unsigned char           page_index;                 // LCD override page index
     unsigned char           duration;                   // LCD override duration
     unsigned char           isOverideReq:1;             // LCD override request
@@ -564,7 +573,7 @@ struct SysConfigData
 	unsigned char           isReqFirstUpgrade;          //EVSE is request first upgrade from PH server
 	unsigned char           isEnableLocalPowerSharging; //0: Disable power sharing  1: Enable power sharing
 	unsigned char           StopChargingByButton;       //0: Disable  1: Enable
-    struct LCD_OVERRIDE     LcdOveride;                 // LCD override info
+    struct LCD_NOUSE        Legacy_LcdOveride;          // LCD override info (no use anymore)
     struct TTIA             TTIA_Info;                  // TTIA configuration struct
 
     /************PowerCabinet************/
@@ -709,7 +718,16 @@ typedef union
         unsigned int FirmwareUpdateRequest:1;           // firmware update request
         unsigned int FirmwareUpdateConfirm:1;           // firmware update start
         unsigned int FirmwareUpdateCompleted:1;         // firmware update completed
-        unsigned int res:21;
+        unsigned int BackendStatusRequest:1;            // 0: no request,   1: backend connection status has changed            ( cabinet -> dispenser)
+        unsigned int EthernetStatusRequest:1;           // 0: no request,   1: ethernet connection status has changed           ( cabinet -> dispenser)
+        unsigned int WiFiStatusRequest:1;               // 0: no request,   1: wifi connection status has changed               ( cabinet -> dispenser)
+        unsigned int TelcomModemStatusRequest:1;        // 0: no request,   1: 4g connection status has changed                 ( cabinet -> dispenser)
+        unsigned int BillingStatusRequest:1;            // 0: no request,   1: billing status has changed                       ( cabinet -> dispenser)
+        unsigned int StopButtonStatusRequest:1;         // 0: no request,   1: stop charging button status has changed          ( cabinet -> dispenser)
+        unsigned int AuthModeConfigRequest:1;           // 0: no request,   1: AuthMode Config has changed                      ( cabinet -> dispenser)
+        unsigned int EVCCIDConfigRequest:1;             // 0: no request,   1: EVCCID Config has changed                        ( cabinet -> dispenser)
+        unsigned int LEDIntensityRequest:1;             // 0: no request,   1: LED Intensity has changed                        ( cabinet -> dispenser)
+        unsigned int res:12;
     }bits;
 }DispenserSettingFlag;
 
@@ -819,7 +837,7 @@ typedef union
         unsigned int  Disconnection:1;
         unsigned int  GfdDetection:1;                   // 0: stop,         1: start
         unsigned int  GetStartChargingSoc:1;            // 0: no effect,    1: get start soc
-        unsigned int  res:13;
+        unsigned int  res:14;
     }bits;
 }ConnectorParameter;
 
@@ -856,10 +874,10 @@ struct ConnectorInfoData
     float                   CapabilityCurrent;              // unit 0.1A
     float                   CapabilityPower;                // unit 0.1kW
 
-    unsigned int            UserPrice;                      // connector user's user price, unit: 0.01 (dollar / kWh)
-    unsigned int            TotalCost;                      // connector user's total cost, unit: 0.01 dollar
-    int                     AccountBalance;                 // connector user's account balance, unit: 0.01 dollar
-    int                     CostDiscount;                   // connector user's account balance, unit: 0.01 dollar
+    float                   UserPrice;                      // connector user's user price, unit: 1 (dollar / kWh)
+    float                   TotalCost;                      // connector user's total cost, unit: 1 dollar
+    float                   AccountBalance;                 // connector user's account balance, unit: 1 dollar
+    float                   CostDiscount;                   // connector user's account balance, unit: 1 dollar
 };
 
 typedef union
@@ -981,6 +999,7 @@ struct SysInfoData
     DC_Meter_Info DcMeterInfo[4];
     unsigned char           OTPTemp;                    // OTP Temperature
     unsigned char           OTPTempR;                   // OTP Recovery Temperature
+    struct LCD_OVERRIDE     LcdOveride;                 // LCD override info (no use anymore)
 };
 
 struct SysConfigAndInfo
@@ -1299,9 +1318,9 @@ char AlarmStatusCode[160][6]=
     "012326",   // System task is lost
     "012327",   // DC input ovp
     "012328",   // DC input uvp
-    "012329",   // reserved
-    "012330",   // reserved
-    "012331",   // reserved
+    "012329",   // Psu Can Communication Fault
+    "012330",   // Psu Dc to Dc OTP
+    "012331",   // Psu Dc to Dc OVP
     "012332",   // reserved
     "012333",   // reserved
     "012334",   // reserved
@@ -1316,7 +1335,7 @@ char AlarmStatusCode[160][6]=
     "012343",   // reserved
     "012344",   // AC: Meter IC communication timeout
     "012345",   // AC: Pilot negative error
-    "012346",   // reserved
+    "012346",   // Psu Communication error with CSU
     "012347",   // reserved
     "012348",   // reserved
     "012349",   // reserved
@@ -1486,13 +1505,17 @@ struct AlarmCodeData
             unsigned char DcInputOVP:1;                             //bit 7
             //AlarmVal[16]
             unsigned char DcInputUVP:1;                             //bit 0
-            unsigned char :7;                                       //reserved bit 1 ~ bit 7
-            //AlarmVal[17]
+            unsigned char PsuCanCommFault:1;                        //bit 1
+            unsigned char PsuDcDcOtp:1;                             //bit 2
+            unsigned char PsuDcDcOvp:1;                             //bit 3
+            unsigned char :4;                                       //reserved bit 4 ~ bit 7
+    //AlarmVal[17]
             unsigned char :8;                                       //reserved bit 0 ~ bit 7
             //AlarmVal[18]
             unsigned char MeterIcCommTimeout:1;                     //bit 0
             unsigned char PilotNegativeError:1;                     //bit 1
-            unsigned char :6;                                       //reserved bit 2 ~ bit 7
+            unsigned char PsuComminicationErrWithCSU:1;             //bit 2
+            unsigned char :5;                                       //reserved bit 3 ~ bit 7
             //AlarmVal[19]
             unsigned char :8;                                       //reserved bit 0 ~ bit 7
 		}bits;
@@ -2277,6 +2300,7 @@ struct PsuData
 	unsigned char           GroupCount;
 	unsigned char           Work_Step;
 	struct PsuModuleVer     PsuVersion[MAX_PSU_QUANTITY];
+	unsigned char 			PsuStopChargeFlag;
 };
 
 /************************************************************************************/
@@ -4566,60 +4590,53 @@ struct StructSessionTarget
 //===================================
 // YES custom protocol
 //===================================
-struct StructRefundStatus
+struct StructChargerInfo
 {
-    unsigned char status[10];
-    unsigned char chargeDate[32];
-    int holdAmt;
-    int chargeAmt;
-    int refundAmt;
-    int page;
+    unsigned char station_name[64];
 };
 
-struct StructDeductStatus
+struct StructWeatherInfo
 {
-    unsigned char status[10];
-    int autoLoadAmt;
-    int beforeAmt;
-    int chargeAmt;
-    int afterAmt;
-    int page;
+    int   weatherId;
+    float temperature;
 };
 
-struct StructChargerInfo
+struct StructCreditDeductResult
 {
-    unsigned char station_name[64];
-    unsigned char station_id[64];
-    unsigned char charge_id[4][64];
+    int txId;
+    unsigned char creditNo[64];
+    unsigned char vemData[80];
+    unsigned char ROC[20];
+    unsigned char RRN[20];
+    unsigned char storeId[20];
+    unsigned char approvalNo[20];
+    double        amount;
+    unsigned char deductResult:1;
+    unsigned char isDonateInvoice:1;
 };
 
-struct StructWeatherInfo
+struct StructReaderStatus
 {
-    int   weatherId;
-    float temperature;
+	int readerStatus;
+	unsigned char creditNo[64];
+    unsigned char ReportReaderStatusReq:1;
 };
 
-struct StructYesCustomData
+struct StructTcciCustomData
 {
-    struct StructRefundStatus RefundStatus;
-    struct StructDeductStatus DeductStatus;
     struct StructChargerInfo ChargerInfo;
     struct StructWeatherInfo WeatherInfo;
-    unsigned char QrCode[4][128];
-    unsigned char CallReaderStatus[10];
-
-    unsigned char CallReaderReq:1;
-    unsigned char CallReaderConf:1;
-    unsigned char RefundStatusReq:1;
-    unsigned char RefundStatusConf:1;
-    unsigned char DeductStatusReq:1;
-    unsigned char DeductStatusConf:1;
+    struct StructCreditDeductResult DeductInfo;
+    struct StructReaderStatus ReaderStatus[CONNECTOR_QUANTITY];
+    unsigned char TriggerReaderReq[3];
+    unsigned char SerialNo[CONNECTOR_QUANTITY][37];
+	unsigned char VEMData[CONNECTOR_QUANTITY][65];
+
+    unsigned char ReportCreditDeductReq:1;
     unsigned char ChargerInfoReq:1;
     unsigned char ChargerInfoConf:1;
     unsigned char WeatherInfoReq:1;
     unsigned char WeatherInfoConf:1;
-    unsigned char SetQrCodeReq:1;
-    unsigned char SetQrCodeConf:1;
 };
 
 struct OCPP16Data
@@ -4811,7 +4828,7 @@ struct OCPP16Data
     struct StructSignCertificate                    SignCertificate;
     struct StructSignedFirmwareStatusNotification   SignedFirmwareStatusNotification;
     struct StructSessionTarget                      SessionTarget[CONNECTOR_QUANTITY];
-    struct StructYesCustomData                      YesCustomData;
+    struct StructTcciCustomData                     TcciCustomData;
 };
 
 
@@ -4856,6 +4873,7 @@ enum OCPP20CtrlrVariable
 	ChargingStation_SupplyPhases,
 	ChargingStation_SystemUptimeSec,
 	ChargingStation_FreeVend,
+	ChargingStation_FreeVendIdtag,
 	Connector_Available,
 	Connector_ConnectorType,
 	Connector_SupplyPhases,
@@ -4904,6 +4922,8 @@ enum OCPP20CtrlrVariable
 	OCPPCommCtrlr_WebSocketPingInterval,
 	OCPPCommCtrlr_ResetRetries,
 	OCPPCommCtrlr_PublicKeyWithSignedMeterValue,
+    OCPPCommCtrlr_StatusNotificationPeriodically,
+    OCPPCommCtrlr_StatusNotificationInterval,
     OCPPCommCtrlr_VariableVersion,
 	ReservationCtrlr_Enabled,
 	ReservationCtrlr_Available,

+ 2 - 15
EVSE/Projects/DD360Tcci/Apps/Makefile

@@ -114,11 +114,6 @@ CHKSYSTASK_SRC_FILES = $(patsubst %.o, %.c, $(CHKSYSTASK_OBJ_FILES))
 %.o: %.c
 	$(CC) $(CFLAGS) -c $<
 
-#Simulation
-SIMULATION_OBJ_FILES = $(COMMON_OBJ_FILES) simulation.o
-SIMULATION_SRC_FILES = $(patsubst %.o, %.c, $(SIMULATION_OBJ_FILES))
-%.o: %.c
-	$(CC) $(CFLAGS) -c $<
 
 #Event Log
 EVENTLOG_OBJ_FILES = $(COMMON_OBJ_FILES) $(DataBaseLib)/DataBase.o \
@@ -152,7 +147,7 @@ all: CopyFile apps
 apps: MainTask DoCommTask EvCommTask UpdateFWTask ChkSysTask \
 		EventLoggingTask InternalCommTask LcmControlTask \
 			PrimaryCommTask ReadCmdlineTask UnsafetyOutputTool \
-				SimulationApp FactoryConfigApp OtherTools CleanExec
+				FactoryConfigApp OtherTools CleanExec
 
 MainTask:
 	$(CC) $(DEFINE) $(MAIN_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) $(SQLite3_H) $(ModuleUpgrade_H) $(RateCurrent_H) \
@@ -184,11 +179,6 @@ ChkSysTask:
 	#$(CC) $(DEFINE) $(CFLAGS) -c -o Module_ChkSysTask.o $(ChkSysTaskLib)/Module_ChkSysTask.c
 	#$(CC) -o Module_ChkSysTask Module_ChkSysTask.o 
 
-SimulationApp:
-	$(CC) $(DEFINE) $(SIMULATION_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) -o simulation 
-	#$(CC) $(DEFINE) $(CFLAGS) -c -o simulation.o simulation.c
-	#$(CC) -o simulation simulation.o
-
 EventLoggingTask:
 	$(CC) $(DEFINE) $(EVENTLOG_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) $(SQLite3_H) $(Lib_SQLite3) -o Module_EventLogging
 	#$(CC) $(DEFINE) $(CFLAGS) -c -o define.o $(DefineLib)/define.c
@@ -246,7 +236,6 @@ OtherTools:
 	cp -f Module_EvComm $(RootPath)
 	cp -f Module_UpdateFW $(RootPath)
 	cp -f Module_ChkSysTask $(RootPath)
-	cp -f simulation $(RootPath)
 	cp -f Module_EventLogging $(RootPath)
 	cp -f Module_InternalComm $(RootPath)
 	cp -f Module_LcmControl $(RootPath)
@@ -266,7 +255,6 @@ OtherTools:
 	cp -f Module_EvComm $(OutputPath)
 	cp -f Module_UpdateFW $(OutputPath)
 	cp -f Module_ChkSysTask $(OutputPath)
-	cp -f simulation $(OutputPath)
 	cp -f Module_EventLogging $(OutputPath)
 	cp -f Module_InternalComm $(OutputPath)
 	cp -f Module_LcmControl $(OutputPath)
@@ -285,8 +273,7 @@ CleanExec:
 	rm main
 	rm Module_EvComm
 	rm Module_UpdateFW
-	rm Module_ChkSysTask
-	rm simulation 
+	rm Module_ChkSysTask 
 	rm Module_EventLogging
 	rm Module_InternalComm
 	rm Module_LcmControl

+ 7 - 2
EVSE/Projects/DD360Tcci/Apps/ModuleChkSysTask/Module_ChkSysTask.c

@@ -24,6 +24,7 @@ struct ChargingInfoData *pAcChargingInfo = NULL;
 static struct ChargingInfoData *pDcChargingInfo = NULL;
 struct SysConfigAndInfo         *ShmSysConfigAndInfo;
 struct StatusCodeData           *ShmStatusCodeData;
+static DcCommonInfo* ShmDcCommonData = NULL;
 
 bool Taskconutstring(char *src, char *taskname)
 {
@@ -230,16 +231,20 @@ void main(void)
     pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
     ShmOCPP16Data = (struct OCPP16Data *)GetShmOCPP16Data();
     ShmSysConfigAndInfo = (struct SysConfigAndInfo *)GetShmSysConfigAndInfo();
-    ShmStatusCodeData = (struct StatusCodeData *)GetShmStatusCodeData();	
+	ShmStatusCodeData = (struct StatusCodeData*)GetShmStatusCodeData();
+	ShmDcCommonData = (DcCommonInfo*)GetShmDcCommonData();
     MappingGunChargingInfo("CheckSystem Task");
     while(true)
     {
+		sleep(3);
       	for (uint8_t gun = 0; gun < pSysConfig->TotalConnectorCount; gun++) {
     		pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gun);
 			if (pDcChargingInfo->SystemStatus == SYS_MODE_UPDATE )
 				continue;
 		}
+		if (ShmDcCommonData->DebugFlag == TRUE) {
+			continue;
+		}
 		CheckSystemTaskAlive();
-		sleep(3);
     }
 }

+ 20 - 11
EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.c

@@ -1437,7 +1437,7 @@ static int writeDispenserRequest(int fd, uint8_t id, uint8_t gunIndex)
         dispenserReq.Value[3] = 1;
         AddDispenserReq(data, &dispenserReq);
         count++;
-        log_info("Write Gun %d CHARGING_CANCEL", gunIndex);
+        //log_info("Write Gun %d CHARGING_CANCEL", gunIndex);
     }
 
     if ((ret = composeSocketData(fd,
@@ -2114,7 +2114,7 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
 					pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(plugNum);
 					ShmDcCommonData->finalcost[plugNum] = pDcChargingInfo->ChargingFee;
 					ShmDcCommonData->finalcost_flag[plugNum] = TRUE;
-					log_info("Gun %d get final cost", plugNum);
+					log_info("Gun %d get final cost %f", plugNum, pDcChargingInfo->ChargingFee);
                 }
             }
             curReg = REG_PLUG_IN_STATE;
@@ -2442,11 +2442,15 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
         {
             DeductResultReq[plugNum] = YES;
             log_info("Write Gun %d Deduct Result", plugNum);
-            if (writeDeductInfo(fd, gunID, plugNum, &ShmDcCommonData->TransactionInfo[plugNum]) != PASS)
+            if (writeDeductInfo(fd, gunID, plugNum, &ShmDcCommonData->TransactionInfo[plugNum]) == PASS) {                
+                ShmDcCommonData->finalcost_flag[plugNum] = FALSE;
+                ShmDcCommonData->PayFinish[plugNum] = FALSE;
+                ShmDcCommonData->TransactionInfo[plugNum].IsUpload = YES;
+                UpdateDeductInfoStatus(plugNum, &ShmDcCommonData->TransactionInfo[plugNum]);
+                log_info("writeDeductInfo finish");
+            } else {
                 log_info("Write Deduct fail");
-            ShmDcCommonData->finalcost_flag[plugNum] = FALSE;
-            ShmDcCommonData->PayFinish[plugNum] = FALSE;
-            log_info("writeDeductInfo finish");
+            }
         }
         break;
 
@@ -2618,11 +2622,16 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
         {
             DeductResultReq[plugNum] = YES;
             log_info("Write Gun %d Deduct Result", plugNum);
-            if (writeDeductInfo(fd, gunID, plugNum, &ShmDcCommonData->TransactionInfo[plugNum]) != PASS)
-                log_info("Deduct Result fail");
-            ShmDcCommonData->finalcost_flag[plugNum] = FALSE;
-            ShmDcCommonData->PayFinish[plugNum] = FALSE;
-            log_info("writeDeductInfo finish");
+            if (writeDeductInfo(fd, gunID, plugNum, &ShmDcCommonData->TransactionInfo[plugNum]) == PASS) {
+                ShmDcCommonData->finalcost_flag[plugNum] = FALSE;
+                ShmDcCommonData->PayFinish[plugNum] = FALSE;
+                ShmDcCommonData->TransactionInfo[plugNum].IsUpload = YES;
+                UpdateDeductInfoStatus(plugNum, &ShmDcCommonData->TransactionInfo[plugNum]);
+                log_info("writeDeductInfo finish");
+            }
+            else {
+                log_info("Write Deduct fail");
+            }
         }
         break;
 

+ 1 - 1
EVSE/Projects/DD360Tcci/Apps/ModuleInternalComm/RelayBoard.c

@@ -1240,7 +1240,7 @@ static void GetFanSpeed(void)
 
 static void GetFanSpeedByFunction(void)
 {
-    if (pSysConfig->SwitchDebugFlag == YES) {
+    if (ShmDcCommonData->DebugFlag == YES) {
         return;
     }
 

+ 2 - 1
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -1032,7 +1032,8 @@ void ChangeCarBonValue(float data)
     memset(cmd, 0x00, sizeof(cmd));
     _carbon = data * 0.577;
     //log_info("Carbon:%d",(int)_carbon);
-
+    if (data > 0 && _carbon < 1)
+        _carbon = 1;
 	sprintf((char *) value, "%d", (int)_carbon);
     string2ByteArray(value, cmd);
     DisplayValueToLcm(_String_Carbon, cmd, sizeof(cmd));

+ 4 - 0
EVSE/Projects/DD360Tcci/Apps/ModulePrimary/Module_PrimaryComm.c

@@ -44,6 +44,7 @@ static struct SysInfoData *pSysInfo = NULL;
 static struct AlarmCodeData *pAlarmCode = NULL;
 static struct FaultCodeData *pFaultCode = NULL;
 static struct PrimaryMcuData *ShmPrimaryMcuData;
+static DcCommonInfo* ShmDcCommonData = NULL;
 
 const char *priPortName = "/dev/ttyS1";
 uint8_t gun_count; //DS60-120 add
@@ -261,6 +262,8 @@ static void checkChillerStatus(Gpio_out *gpio)
             _chillerNeedOn = YES;
         }
     }
+    if (ShmDcCommonData->DebugFlag == YES) 
+        _chillerNeedOn = ShmDcCommonData->chillerCtrl;
 
     if(_chiller.ChillerSwitch != _chillerNeedOn)
     {
@@ -438,6 +441,7 @@ int main(void)
     pAlarmCode = (struct AlarmCodeData *)GetShmAlarmCodeData();
     pFaultCode = (struct FaultCodeData *)GetShmFaultCodeData();
     ShmPrimaryMcuData = (struct PrimaryMcuData *)GetShmPrimaryMcuData();
+    ShmDcCommonData = (DcCommonInfo*)GetShmDcCommonData();
 
     Uart1Fd = InitComPort();
     //log_info("407 Port id = %d ", Uart1Fd);

+ 37 - 7
EVSE/Projects/DD360Tcci/Apps/ReadCmdline.c

@@ -514,12 +514,27 @@ void GetGunSelectedNum(char *v1)
         }
     }
 }
-
+void writeChillerStatus(char* v1)
+{
+    if (ShmDcCommonData->DebugFlag == YES) {
+        ShmDcCommonData->chillerCtrl = atoi(newString[1]);
+        if (ShmDcCommonData->chillerCtrl)
+            printf("Chiller set on\n");
+        else
+            printf("Chiller set off\n");
+    }
+    else
+        printf("Please open Debug mode\n");
+}
 void SetFanSpeed(char *v1)
 {
     int speed = atoi(v1);
-
-    ShmFanModuleData->TestFanSpeed = speed;
+    if (ShmDcCommonData->DebugFlag == YES) {
+        ShmFanModuleData->TestFanSpeed = speed;
+        printf("Set Fan speed: %d \n", ShmFanModuleData->TestFanSpeed);
+    }
+    else
+        printf("Please open debug mode\n");
 }
 
 void GetFanSpeed()
@@ -534,8 +549,9 @@ void SetDebugMode(char *v1)
 {
     int mode = atoi(v1);
 
-    pSysConfig->SwitchDebugFlag = mode;
-    printf("Debug Flag:%d\n", pSysConfig->SwitchDebugFlag);
+    //pSysConfig->SwitchDebugFlag = mode;
+    ShmDcCommonData->DebugFlag = mode;
+    printf("Debug Flag:%d\n", ShmDcCommonData->DebugFlag);
 }
 
 void SetGFDMode(char *v1)
@@ -723,6 +739,9 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
     //kill ev task
     system("killall Module_EvComm");
 
+    printf("Warming!!!!\n Please pay attention chiller on or off !!!!\n");
+    
+
     pSysInfo->CurGunSelected = _GunIndex;
 
     while (isContinue) {
@@ -738,20 +757,24 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
 #if defined DD360Audi
                 setConfirmSelGun(curGun);
 #endif //defined DD360Audi
-
+                pSysInfo->SystemPage = _PAGE_SENSING;
                 strcpy((char *)pSysConfig->UserId, "AutoStartCharging");
                 pDcChargingInfo->ConnectorPlugIn = 1;
                 printf ("[UnconditionalCharge - S_IDLE]\n");
                 pDcChargingInfo->Type = 9;
+                ShmDcCommonData->AuthPass_flag[curGun] = TRUE;
 
             }
             if (ShmOCPP16Data->SpMsg.bits.AuthorizeConf == 1) {
                 pSysInfo->StartToChargingFlag = 0x01;
                 pDcChargingInfo->SystemStatus = S_PREPARNING;
+                
             }
             break;
 
         case S_PREPARNING:
+            ShmDcCommonData->chillerCtrl = TRUE;
+
             if (PreviousSystemStatus[curGun] != pDcChargingInfo->SystemStatus) {
                 PreviousSystemStatus[curGun] = pDcChargingInfo->SystemStatus;
 
@@ -941,6 +964,7 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
 
             pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(curGun);
             pDcChargingInfo->PresentChargingPower = 0;
+            ShmDcCommonData->chillerCtrl = FALSE;
 
             if (stopChg == pSysConfig->TotalConnectorCount) {
                 system("/root/Module_EvComm &");
@@ -1242,6 +1266,7 @@ int main(void)
                      "       tempR                             : print connector header and chiller temperature\r\n"
     			     "       btnl                              : press left button\n"
     			  	 "       btnr                              : press right button\n"
+                     "       chiller                           : set chiller on/off\n"
                      "       settlement                        : Credit Card UnionSettlement\n"
                      "       rededuct                          : Credit Card rededuct\n"
                      "\r\n";
@@ -1404,7 +1429,10 @@ int main(void)
                 printf ("Input cmd fail ------  strchg [vol 150-1000] [cru 2-100]\n");
                 continue;
             }
-
+            if (ShmDcCommonData->DebugFlag == FALSE) {
+                printf("Not open debug mode\n");
+                continue;
+            }
             // 槍狀態
             RunUnconditionalChargeIndex1(newString[1], newString[2], newString[3]);
         } else if (strcmp(newString[0], "tempW") == 0) { //測試槍頭和水冷機溫度
@@ -1423,6 +1451,8 @@ int main(void)
             ShmDcCommonData->UnionSettlement = 1;
         } else if(strcmp(newString[0], "rededuct") == 0) {
             ShmDcCommonData->Exe_ReDeduct = 1;
+        } else if (strcmp(newString[0], "chiller") == 0) { //測試槍頭和水冷機溫度
+            writeChillerStatus(newString[1]);
         } else {
             printf("%s\n", usageMsg);
         }

BIN
EVSE/Projects/DD360Tcci/Apps/UnsafetyOutputTask


+ 0 - 171
EVSE/Projects/DD360Tcci/Apps/simulation.c

@@ -1,171 +0,0 @@
-#include <sys/time.h>
-#include <sys/timeb.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
-#include <linux/wireless.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-
-#include <unistd.h>
-#include <stdarg.h>
-#include <stdio.h>      /*標準輸入輸出定義*/
-#include <stdlib.h>     /*標準函數庫定義*/
-#include <stdint.h>
-#include <unistd.h>     /*Unix 標準函數定義*/
-#include <fcntl.h>      /*檔控制定義*/
-#include <termios.h>    /*PPSIX 終端控制定義*/
-#include <errno.h>      /*錯誤號定義*/
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <ctype.h>
-#include <ifaddrs.h>
-#include <math.h>
-#include <stdbool.h>
-
-#include "./ShareMemory/shmMem.h"
-#include "./Define/define.h"
-#include "./SelectGun/SelectGun.h"
-#include "Config.h"
-
-#include "simulation.h"
-
-static struct SysConfigData *pSysConfig = NULL;
-static struct SysInfoData *pSysInfo = NULL;
-
-static struct FaultCodeData *pFaultCode = NULL;
-static struct AlarmCodeData *pAlarmCode = NULL;
-static struct CHAdeMOData *ShmCHAdeMOData = NULL;
-static struct GBTData *ShmGBTData = NULL;
-static struct CcsData *ShmCcsData = NULL;
-static DcCommonInfo *ShmDcCommonData = NULL;
-static SelectGunInfo *ShmSelectGunInfo = NULL;
-struct ChargingInfoData *pDcChargingInfo = NULL;
-static struct WARNING_CODE_INFO *pSysWarning = NULL;
-void SetFaultTest()
-{
-    pAlarmCode->AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning = NO;
-    pFaultCode->FaultEvents.bits.CcsLiquidChillerWaterLevelFault = NO;
-    pAlarmCode->AlarmEvents.bits.DisconnectedFromDo = NORMAL;
-    pSysWarning->Level = WARN_LV_NL;
-
-}
-void SetSelfTest(bool status)
-{
-    uint8_t index = 0;
-    struct SysConfigData *pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
-    struct SysInfoData *pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
-
-    struct CHAdeMOData *ShmCHAdeMOData = (struct CHAdeMOData *)GetShmCHAdeMOData();
-    struct GBTData *ShmGBTData = (struct GBTData *)GetShmGBTData();
-    struct CcsData *ShmCcsData = (struct CcsData *)GetShmCcsData();
-
-    struct RelayModuleData *ShmRelayModuleData = (struct RelayModuleData *)GetShmRelayModuleData();
-    ShmRelayModuleData->SelfTest_Comp = status;
-
-    if (status) {
-        strcpy((char*)pSysInfo->RelayModuleFwRev,SIM_VERSION);
-        strcpy((char*)pSysInfo->FanModuleFwRev,SIM_VERSION);
-        strcpy((char*)pSysInfo->CsuPrimFwRev,SIM_VERSION);
-        for (index = 0; index < pSysConfig->TotalConnectorCount; index++) {
-            pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(index);
-            if (pDcChargingInfo->Type == _Type_Chademo) {
-                strcpy((char*)ShmCHAdeMOData->evse[pDcChargingInfo->type_index].version,SIM_VERSION);
-            } else if (pDcChargingInfo->Type == _Type_GB) {
-                strcpy((char*)ShmGBTData->evse[pDcChargingInfo->type_index].version,SIM_VERSION);
-            } else if (pDcChargingInfo->Type == _Type_CCS_2) {
-                strcpy((char*)ShmCcsData->V2GMessage_DIN70121[pDcChargingInfo->type_index].version,SIM_VERSION);
-            }
-            ShmDcCommonData->GunRelayWeldingOccur[index] = false;
-        }
-    }
-}
-
-void main()
-{
-    uint8_t gunIndex = 0;
-
-
-    if (CreateAllCsuShareMemory() == FAIL) {
-        printf("create share memory error");
-        return;
-    }
-
-    MappingGunChargingInfo("Simulation Task");
-
-    pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
-    pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
-    pAlarmCode = (struct AlarmCodeData *)GetShmAlarmCodeData();
-    pFaultCode = (struct FaultCodeData *)GetShmFaultCodeData();
-    ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
-    ShmCHAdeMOData = (struct CHAdeMOData *)GetShmCHAdeMOData();
-    ShmGBTData = (struct GBTData *)GetShmGBTData();
-    ShmCcsData = (struct CcsData *)GetShmCcsData();
-    ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
-    SetSelfTest(SELFTESTRESULT);
-
-    while (1) {
-        for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
-            pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
-
-            switch (pDcChargingInfo->SystemStatus) {
-            case S_IDLE:
-                // Authorizing data
-                strcpy((char *)&pSysConfig->UserId, USER_ID);
-                break;
-            case S_REASSIGN_CHECK:
-                break;
-            case S_REASSIGN:
-                break;
-            case S_PREPARNING:
-                //ShmPsuData->SystemPresentPsuQuantity = 500;
-                //ShmPsuData->SystemAvailablePower = 500;
-                break;
-            case S_PREPARING_FOR_EV:
-                pDcChargingInfo->GunLocked = START;
-                break;
-            case S_PREPARING_FOR_EVSE:
-                pDcChargingInfo->GroundFaultStatus = GFD_PASS;
-                break;
-            case S_CCS_PRECHARGE_ST0:
-            case S_CCS_PRECHARGE_ST1:
-                ShmCcsData->V2GMessage_DIN70121[pDcChargingInfo->type_index].PresentMsgFlowStatus = 45;
-                sleep(1);
-                pDcChargingInfo->RelayK1K2Status = YES;
-                break;
-
-            case S_CHARGING:
-                break;
-            case S_TERMINATING:
-                break;
-            case S_COMPLETE:
-                break;
-            case S_ALARM:
-                break;
-            case S_FAULT:
-                SetFaultTest();
-                break;
-            case S_RESERVATION:
-                break;
-            case S_BOOKING:
-                break;
-            case S_MAINTAIN:
-                break;
-            case S_DEBUG:
-                break;
-            case S_UPDATE:
-                break;
-            }
-        }
-        usleep(100);
-    }
-    return;
-}
-

+ 0 - 8
EVSE/Projects/DD360Tcci/Apps/simulation.h

@@ -1,8 +0,0 @@
-#ifndef _SIMULATIONEV_H_
-#define _SIMULATIONEV_H_
-#define SELFTESTRESULT  1
-#define SIM_VERSION     "Test"
-#define USER_ID         "AutoStartCharging"
-
-#endif
-

BIN
EVSE/Projects/DD360Tcci/Images/ramdisk.gz


BIN
EVSE/Projects/DD360Tcci/output/FactoryConfig


BIN
EVSE/Projects/DD360Tcci/output/Module_ChkSysTask


BIN
EVSE/Projects/DD360Tcci/output/Module_DoComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EvComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EventLogging


BIN
EVSE/Projects/DD360Tcci/output/Module_InternalComm


BIN
EVSE/Projects/DD360Tcci/output/Module_LcmControl


BIN
EVSE/Projects/DD360Tcci/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Tcci/output/Module_UpdateFW


BIN
EVSE/Projects/DD360Tcci/output/ReadCmdline


BIN
EVSE/Projects/DD360Tcci/output/UnsafetyOutputTask


BIN
EVSE/Projects/DD360Tcci/output/main


BIN
EVSE/Projects/DD360Tcci/output/simulation