Эх сурвалжийг харах

2022-09-05 / Simon Xue

Action:
1. [Add] Check Chiller alarm status (PE6 pin)
2. [Add] Check chiller temperature less than zero degree turn on heater(PB4).
         Temperature bigger than 10 degree turn on heater.
3. [Add] ReadCmdline check chiller status and temperture.

Files
As the following commit history files

Image Version: T1.23.XX.XXXX.XX
Simon Xue 2 жил өмнө
parent
commit
9a1531bd97

+ 7 - 0
EVSE/Projects/DD360/Apps/CSU/Primary.c

@@ -415,6 +415,13 @@ void ChkPrimaryStatus(void)
         ReleaseEmsOccureByString(0, "012251");
     }
 
+    if (ShmPrimaryMcuData->InputDet.bits.Ac_Drop == ABNORMAL) {
+        pAlarmCode->AlarmEvents.bits.ChillerAlarmFail = YES;
+        EmcOccureByString("012348");
+    } else {
+        ReleaseEmsOccureByString(0, "012348");
+    }
+    
     if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == ABNORMAL) {
         pAlarmCode->AlarmEvents.bits.MainPowerBreakerTrip = YES;
         EmcOccureByString("012238");

+ 288 - 262
EVSE/Projects/DD360/Apps/Define/define.h

@@ -345,6 +345,7 @@ enum CoreProfile {
      OffLineMaxChargingPower,
      ConfigurationVersion,
 	 CharingProfileRefreshInterval,
+	 CpoName,
 	 OcppSoftwareVersion,
 	 _CoreProfile_CNT
 };
@@ -697,6 +698,7 @@ struct ChargingInfoData
 	unsigned char 		EvConnAlarmCode[7];
 	float 				ChargingProfileCurrent;			// unit: 0.1A
 	float 				ChargingProfilePower;			// unit: 1W
+	float               LocalPowerLimitCurrent;         // unit: 1A
 	float 				PresentChargingVoltageL2;		//0~6553.5 volt
 	float 				PresentChargingVoltageL3;		//0~6553.5 volt
 	float 				PresentChargingCurrentL2;		//0~6553.5 amp	
@@ -1422,7 +1424,7 @@ char AlarmStatusCode[160][6]=
     "012345",   // AC: Pilot negative error
     "012346",   // Psu Communication error with CSU
     "012347",   // AC: Local power sharing communication error (Slave disconnect from Master)
-    "012348",   // reserved
+    "012348",   // Chiller Alarm failure
     "012349",   // reserved
     "012350",   // reserved
     "012351",   // reserved
@@ -1603,7 +1605,8 @@ struct AlarmCodeData
             unsigned char PilotNegativeError:1;                     //bit 1
             unsigned char PsuComminicationErrWithCSU:1;             //bit 2
             unsigned char LocalPowerSharingCommunicationError:1;    //bit 3
-            unsigned char :4;                                       //reserved bit 4 ~ bit 7
+            unsigned char ChillerAlarmFail:1;                       //bit 4
+			unsigned char :3;                                       //reserved bit 4 ~ bit 7
             //AlarmVal[19]
             unsigned char PaymentCommTimeout:1;                     //Payment system communication timeout
             unsigned char :7;                                       //reserved bit 1 ~ bit 7
@@ -2425,7 +2428,7 @@ struct DynamicReleaseCtrl
     unsigned char       ReleaseLoopStep;    // 0 : None, 1 : Limit Pwr, 2 : Pwr OFF, 3. RCB OFF, 4. Finish
     float               CheckOutPwrIsStable;// 0.1kw
     unsigned char       TargetRelay;        // 255 : None
-    unsigned char		AutoRelease;
+    unsigned char       AutoRelease;
 
     float               LimitCurCap;        // Inform 0.1A
     float               LimitPwrCap;        // Inform 0.1kw
@@ -4127,7 +4130,8 @@ struct PrimaryMcuData
             unsigned char Key1:1;                               //bit 2,    H: ON,      L:OFF
             unsigned char Key2:1;                               //bit 3,    H: ON,      L:OFF
             unsigned char Key3:1;                               //bit 4,    H: ON,      L:OFF
-            unsigned char :3;                                   //bit 5~7,  Reserved
+            unsigned char Ac_Drop;                              //bit 4,    H: Trigger, L:Normal
+			unsigned char :2;                                   //bit 5~7,  Reserved
         }bits;
     }InputDet;
 };
@@ -4429,9 +4433,9 @@ struct StructDataTransfer
 {
 	unsigned char VendorId[256];
 	unsigned char MessageId[52];
-	unsigned char Data[512];
+	unsigned char Data[10240];
 	unsigned char ResponseStatus[18];	//Accepted, Rejected,UnknownMessageId,UnknownVendorId
-	unsigned char ResponseData[512];
+	unsigned char ResponseData[10240];
 };
 struct StructDiagnosticsStatusNotification
 {
@@ -4740,261 +4744,6 @@ struct StructSessionTarget
     unsigned short      targetDuration;     // Unit: Minutes    0 is unlimit
 };
 
-//===================================
-// YES custom protocol
-//===================================
-struct StructChargerInfo
-{
-    unsigned char station_name[64];
-};
-
-struct StructWeatherInfo
-{
-    int   weatherId;
-    float temperature;
-};
-
-struct StructCreditDeductResult
-{
-    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 StructReaderStatus
-{
-    int readerStatus;
-    unsigned char creditNo[64];
-    unsigned char ReportReaderStatusReq:1;
-};
-
-struct StructTcciCustomData
-{
-    struct StructChargerInfo ChargerInfo;
-    struct StructWeatherInfo WeatherInfo;
-    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 :3;                  // bit 5-7 , reserved
-};
-
-struct OCMFData
-{
-	unsigned char SendOcmfDataReq:1;   // bit 0 , Flag to ask OCPP sending OCMF message to backend.
-	unsigned char :7;                  // bit 1-7 , reserved
-	unsigned char DataString[2048];    // Data got from meter.
-	unsigned char PublicKey[256];      // PublicKey with header got from meter.
-};
-
-struct OCPP16Data
-{
-    unsigned char                           OcppServerURL[512];     //http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
-    unsigned char                           ChargeBoxId[128];
-    unsigned char                           OcppConnStatus;         //0: disconnected, 1: connected
-    unsigned int                            Timeout_Secs;
-    unsigned short                          Ping_Pong_Interval;
-    long  int	                            procDogTime;            // Process watch dog refresh timer
-    union
-    {
-        //Operations Initiated by Charge Point
-        unsigned char CpMsgValue[CONNECTOR_QUANTITY];
-        struct
-        {
-            //CpMsgValue[0]
-            unsigned char DataTransferReq:1;        //bit 0,
-            unsigned char DataTransferConf:1;       //bit 1,
-            unsigned char StartTransactionReq:1;    //bit 2,
-            unsigned char StartTransactionConf:1;   //bit 3,
-            unsigned char StopTransactionReq:1;     //bit 4,
-            unsigned char StopTransactionConf:1;    //bit 5,
-            unsigned char :2;                       //bit 6,7 , reserved
-        } bits[CONNECTOR_QUANTITY];
-    }CpMsg;
-
-    union
-    {
-        //Operations Initiated by Sequence Point
-        unsigned char SpMsgValue[2];
-        struct
-        {
-            //SpMsgValue[0]
-            unsigned char BootNotificationReq :1;                   //bit 0,
-            unsigned char BootNotificationConf :1;                  //bit 1,
-            unsigned char AuthorizeReq :1;                          //bit 2,
-            unsigned char AuthorizeConf :1;                         //bit 3,
-            unsigned char DiagnosticsStatusNotificationReq :1;      //bit 4,
-            unsigned char DiagnosticsStatusNotificationConf :1;     //bit 5,
-            unsigned char FirmwareStatusNotificationReq :1;         //bit 6,
-            unsigned char FirmwareStatusNotificationConf :1;        //bit 7,
-            //SpMsgValue[1]
-            unsigned char LogStatusNotificationReq :1;              //bit 0,
-            unsigned char LogStatusNotificationConf :1;             //bit 1,
-            unsigned char SecurityEventNotificationReq :1;          //bit 2,
-            unsigned char SecurityEventNotificationConf :1;         //bit 3,
-            unsigned char SignCertificateReq :1;                    //bit 4,
-            unsigned char SignCertificateConf :1;                   //bit 5,
-            unsigned char SignedFirmwareStatusNotificationReq :1;   //bit 6,
-            unsigned char SignedFirmwareStatusNotificationConf :1;  //bit 7,
-        } bits;
-    } SpMsg;
-
-    union
-    {
-        //Operations Initiated by Central System
-        unsigned char CsMsgValue[3 * (CONNECTOR_QUANTITY)];
-        struct
-        {
-            //CsMsgValue[0]
-            unsigned char CancelReservationReq :1;      //bit 0,
-            unsigned char CancelReservationConf :1;     //bit 1,
-            unsigned char ChangeAvailabilityReq :1;     //bit 2,
-            unsigned char ChangeAvailabilityConf :1;    //bit 3,
-            unsigned char ReserveNowReq :1;             //bit 4,
-            unsigned char ReserveNowConf :1;            //bit 5,
-            unsigned char SetChargingProfileReq :1;     //bit 6,
-            unsigned char SetChargingProfileConf :1;    //bit 7,
-            //CsMsgValue[1]
-            unsigned char TriggerMessageReq :1;         //bit 0,
-            unsigned char TriggerMessageConf :1;        //bit 1,
-            unsigned char UnlockConnectorReq :1;        //bit 2,
-            unsigned char UnlockConnectorConf :1;       //bit 3,
-            unsigned char RemoteStartTransactionReq :1; //bit 4,
-            unsigned char RemoteStartTransactionConf :1;//bit 5,
-            unsigned char RemoteStopTransactionReq :1;  //bit 6,
-            unsigned char RemoteStopTransactionConf :1; //bit 7,
-            //CsMsgValue[2]
-            unsigned char ClearChargingProfileReq :1;   //bit 0,
-            unsigned char ClearChargingProfileConf :1;  //bit 1,
-            unsigned char DataTransferReq :1;           //bit 2,
-            unsigned char DataTransferConf :1;          //bit 3,
-            unsigned char GetCompositeScheduleReq :1;   //bit 4,
-            unsigned char GetCompositeScheduleConf :1;  //bit 5,
-            unsigned char :2;                           //bit 6,7
-        } bits[CONNECTOR_QUANTITY];
-    }CsMsg;
-
-    union
-    {
-        //Operations Initiated by Main System
-        unsigned char MsMsgValue[4];
-        struct
-        {
-            //CsMsgValue[0]
-            unsigned char ChangeConfigurationReq :1;                //bit 0,
-            unsigned char ChangeConfigurationConf :1;               //bit 1,
-            unsigned char ClearCacheReq :1;                         //bit 2,
-            unsigned char ClearCacheConf :1;                        //bit 3,
-            unsigned char GetConfigurationReq :1;                   //bit 4,
-            unsigned char GetConfigurationConf :1;                  //bit 5,
-            unsigned char UpdateFirmwareReq :1;                     //bit 6,
-            unsigned char UpdateFirmwareConf :1;                    //bit 7,
-            //CsMsgValue[1]
-            unsigned char GetDiagnosticsReq :1;                     //bit 0,
-            unsigned char GetDiagnosticsConf :1;                    //bit 1,
-            unsigned char GetLocalListVersionReq :1;                //bit 2,
-            unsigned char GetLocalListVersionConf :1;               //bit 3,
-            unsigned char ResetReq :1;                              //bit 4,
-            unsigned char ResetConf :1;                             //bit 5,
-            unsigned char SendLocalListReq :1;                      //bit 6,
-            unsigned char SendLocalListConf :1;                     //bit 7,
-            //CsMsgValue[2]
-            unsigned char CertificateSignedReq :1;                  //bit 0
-            unsigned char CertificateSignedConf :1;                 //bit 1
-            unsigned char DeleteCertificateReq :1;                  //bit 2
-            unsigned char DeleteCertificateConf :1;                 //bit 3
-            unsigned char ExtendedTriggerMessageReq :1;             //bit 4
-            unsigned char ExtendedTriggerMessageConf :1;            //bit 5
-            unsigned char GetInstalledCertificateIdsReq :1;         //bit 6
-            unsigned char GetInstalledCertificateIdsConf :1;        //bit 7
-            //CsMsgValue[3]
-            unsigned char GetLogReq :1;                             //bit 0
-            unsigned char GetLogConf :1;                            //bit 1
-            unsigned char InstallCertificateReq :1;                 //bit 2
-            unsigned char InstallCertificateConf :1;                //bit 3
-            unsigned char SignedUpdateFirmwareReq :1;               //bit 4
-            unsigned char SignedUpdateFirmwareConf :1;              //bit 5
-            unsigned char isRemoteStartWaitReq :1;                  //bit 6
-            unsigned char :1;                                       //bit 7
-        } bits;
-    } MsMsg;
-
-    union
-    {
-        //Operations triggered by CSU
-        unsigned char CSUMsgValue[CONNECTOR_QUANTITY];
-        struct
-        {
-            //CSUMsgValue[0]
-            unsigned char ChargingProfileReq:1;     //bit 0,
-            unsigned char ChargingProfileConf:1;    //bit 0,
-            unsigned char :6;                       //bit 1,2,3,4,5,6,7 , reserved
-        } bits[CONNECTOR_QUANTITY];
-    }CSUMsg;
-
-    struct StructBootNotification                   BootNotification;
-    struct StructHeartbeat                          Heartbeat;
-    struct StructAuthorize                          Authorize;
-    struct StructStartTransaction                   StartTransaction[CONNECTOR_QUANTITY];
-    struct StructStopTransaction                    StopTransaction[CONNECTOR_QUANTITY];
-    struct StructStatusNotification                 StatusNotification[CONNECTOR_QUANTITY];
-    struct StructCancelReservation                  CancelReservation[CONNECTOR_QUANTITY];
-    struct StructChangeAvailability                 ChangeAvailability[CONNECTOR_QUANTITY];
-    struct StructChangeConfiguration                ChangeConfiguration;
-    struct StructClearCache                         ClearCache;
-    struct StructClearChargingProfile               ClearChargingProfile[CONNECTOR_QUANTITY];
-    struct StructDataTransfer                       DataTransfer[CONNECTOR_QUANTITY];
-    struct StructDiagnosticsStatusNotification      DiagnosticsStatusNotification;
-    struct StructFirmwareStatusNotification         FirmwareStatusNotification;
-    struct StructGetCompositeSchedule               GetCompositeSchedule[CONNECTOR_QUANTITY];
-    struct StructGetConfiguration                   GetConfiguration;
-    struct StructGetDiagnostics                     GetDiagnostics;
-    struct StructGetLocalListVersion                GetLocalListVersion;
-    struct StructMeterValues                        MeterValues[CONNECTOR_QUANTITY];
-    struct StructRemoteStartTransaction             RemoteStartTransaction[CONNECTOR_QUANTITY];
-    struct StructRemoteStopTransaction              RemoteStopTransaction[CONNECTOR_QUANTITY];
-    struct StructReserveNow                         ReserveNow[CONNECTOR_QUANTITY];
-    struct StructReset                              Reset;
-    struct StructSendLocalList                      SendLocalList;
-    struct StructSetChargingProfile                 SetChargingProfile[CONNECTOR_QUANTITY];
-    struct StructTriggerMessage                     TriggerMessage[CONNECTOR_QUANTITY];
-    struct StructUnlockConnector                    UnlockConnector[CONNECTOR_QUANTITY];
-    struct StructUpdateFirmware                     UpdateFirmware;
-    struct OCPP16ConfigurationTable                 ConfigurationTable;
-    struct StructChargingProfile                    SmartChargingProfile[CONNECTOR_QUANTITY];
-    struct StructChargingProfile                    MaxChargingProfile;
-    struct StructCost                               Cost;
-    struct StructCertificateSigned                  CertificateSigned;
-    struct StructDeleteCertificate                  DeleteCertificate;
-    struct StructExtendedTrigger                    ExtendedTriggerMessage;
-    struct StructGetInstalledCertificateIds         GetInstalledCertificateIds;
-    struct StructGetLog                             GetLog;
-    struct StructInstallCertificate                 InstallCertificate;
-    struct StructSignedUpdateFirmware               SignedUpdateFirmware;
-    struct StructLogStatusNotification              LogStatusNotification;
-    struct StructSecurityEventNotification          SecurityEventNotification;
-    struct StructSignCertificate                    SignCertificate;
-    struct StructSignedFirmwareStatusNotification   SignedFirmwareStatusNotification;
-    struct StructSessionTarget                      SessionTarget[CONNECTOR_QUANTITY];
-    struct StructTcciCustomData                     TcciCustomData;
-    struct OCMFData                                 OcmfData[CONNECTOR_QUANTITY];
-};
-
-
 /**************************************************************************************/
 /************************* OCPP 2.0 Share memory **************************************/
 /**************************************************************************************/
@@ -6113,6 +5862,283 @@ struct NetworkConnectionProfile_20
     struct NetworkConnectionProfileType connectionData;
 };
 
+//===================================
+// YES custom protocol
+//===================================
+struct StructChargerInfo
+{
+    unsigned char station_name[64];
+};
+
+struct StructWeatherInfo
+{
+    int   weatherId;
+    float temperature;
+};
+
+struct StructCreditDeductResult
+{
+    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 StructReaderStatus
+{
+    int readerStatus;
+    unsigned char creditNo[64];
+    unsigned char ReportReaderStatusReq:1;
+};
+
+struct StructTcciCustomData
+{
+    struct StructChargerInfo ChargerInfo;
+    struct StructWeatherInfo WeatherInfo;
+    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 :3;                  // bit 5-7 , reserved
+};
+
+struct OCMFData
+{
+    unsigned char SendOcmfDataReq:1;   // bit 0 , Flag to ask OCPP sending OCMF message to backend.
+    unsigned char :7;                  // bit 1-7 , reserved
+    unsigned char DataString[2048];    // Data got from meter.
+    unsigned char PublicKey[256];      // PublicKey with header got from meter.
+};
+
+struct OCPP16_V2g_Extend
+{
+	struct Authorize_20						Authorize;
+	struct CertificateSigned_20				CertificateSigned;
+	struct DeleteCertificate_20				DeleteCertificate;
+	struct Get15118EVCertificate_20			Get15118EVCertificate;
+	struct GetCertificateStatus_20			GetCertificateStatus;
+	struct GetInstalledCertificateIds_20	GetInstalledCertificateIds;
+	struct InstallCertificate_20			InstallCertificate;
+	struct SignCertificate_20				SignCertificate;
+
+
+	unsigned char							AuthorizeReq:1;
+	unsigned char							AuthorizeConf:1;
+	unsigned char							Get15118EVCertificateReq:1;
+	unsigned char 							Get15118EVCertificateConf:1;
+	unsigned char							GetCertificateStatusReq:1;
+	unsigned char 							GetCertificateStatusConf:1;
+	unsigned char							SignCertificateReq:1;
+	unsigned char							SignCertificateConf:1;
+};
+
+struct OCPP16Data
+{
+    unsigned char                           OcppServerURL[512];     //http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
+    unsigned char                           ChargeBoxId[128];
+    unsigned char                           OcppConnStatus;         //0: disconnected, 1: connected
+    unsigned int                            Timeout_Secs;
+    unsigned short                          Ping_Pong_Interval;
+    long int                                procDogTime;            // Process watch dog refresh timer
+    union
+    {
+        //Operations Initiated by Charge Point
+        unsigned char CpMsgValue[CONNECTOR_QUANTITY];
+        struct
+        {
+            //CpMsgValue[0]
+            unsigned char DataTransferReq:1;        //bit 0,
+            unsigned char DataTransferConf:1;       //bit 1,
+            unsigned char StartTransactionReq:1;    //bit 2,
+            unsigned char StartTransactionConf:1;   //bit 3,
+            unsigned char StopTransactionReq:1;     //bit 4,
+            unsigned char StopTransactionConf:1;    //bit 5,
+            unsigned char :2;                       //bit 6,7 , reserved
+        } bits[CONNECTOR_QUANTITY];
+    }CpMsg;
+
+    union
+    {
+        //Operations Initiated by Sequence Point
+        unsigned char SpMsgValue[2];
+        struct
+        {
+            //SpMsgValue[0]
+            unsigned char BootNotificationReq :1;                   //bit 0,
+            unsigned char BootNotificationConf :1;                  //bit 1,
+            unsigned char AuthorizeReq :1;                          //bit 2,
+            unsigned char AuthorizeConf :1;                         //bit 3,
+            unsigned char DiagnosticsStatusNotificationReq :1;      //bit 4,
+            unsigned char DiagnosticsStatusNotificationConf :1;     //bit 5,
+            unsigned char FirmwareStatusNotificationReq :1;         //bit 6,
+            unsigned char FirmwareStatusNotificationConf :1;        //bit 7,
+            //SpMsgValue[1]
+            unsigned char LogStatusNotificationReq :1;              //bit 0,
+            unsigned char LogStatusNotificationConf :1;             //bit 1,
+            unsigned char SecurityEventNotificationReq :1;          //bit 2,
+            unsigned char SecurityEventNotificationConf :1;         //bit 3,
+            unsigned char SignCertificateReq :1;                    //bit 4,
+            unsigned char SignCertificateConf :1;                   //bit 5,
+            unsigned char SignedFirmwareStatusNotificationReq :1;   //bit 6,
+            unsigned char SignedFirmwareStatusNotificationConf :1;  //bit 7,
+        } bits;
+    } SpMsg;
+
+    union
+    {
+        //Operations Initiated by Central System
+        unsigned char CsMsgValue[3 * (CONNECTOR_QUANTITY)];
+        struct
+        {
+            //CsMsgValue[0]
+            unsigned char CancelReservationReq :1;      //bit 0,
+            unsigned char CancelReservationConf :1;     //bit 1,
+            unsigned char ChangeAvailabilityReq :1;     //bit 2,
+            unsigned char ChangeAvailabilityConf :1;    //bit 3,
+            unsigned char ReserveNowReq :1;             //bit 4,
+            unsigned char ReserveNowConf :1;            //bit 5,
+            unsigned char SetChargingProfileReq :1;     //bit 6,
+            unsigned char SetChargingProfileConf :1;    //bit 7,
+            //CsMsgValue[1]
+            unsigned char TriggerMessageReq :1;         //bit 0,
+            unsigned char TriggerMessageConf :1;        //bit 1,
+            unsigned char UnlockConnectorReq :1;        //bit 2,
+            unsigned char UnlockConnectorConf :1;       //bit 3,
+            unsigned char RemoteStartTransactionReq :1; //bit 4,
+            unsigned char RemoteStartTransactionConf :1;//bit 5,
+            unsigned char RemoteStopTransactionReq :1;  //bit 6,
+            unsigned char RemoteStopTransactionConf :1; //bit 7,
+            //CsMsgValue[2]
+            unsigned char ClearChargingProfileReq :1;   //bit 0,
+            unsigned char ClearChargingProfileConf :1;  //bit 1,
+            unsigned char DataTransferReq :1;           //bit 2,
+            unsigned char DataTransferConf :1;          //bit 3,
+            unsigned char GetCompositeScheduleReq :1;   //bit 4,
+            unsigned char GetCompositeScheduleConf :1;  //bit 5,
+            unsigned char :2;                           //bit 6,7
+        } bits[CONNECTOR_QUANTITY];
+    }CsMsg;
+
+    union
+    {
+        //Operations Initiated by Main System
+        unsigned char MsMsgValue[4];
+        struct
+        {
+            //CsMsgValue[0]
+            unsigned char ChangeConfigurationReq :1;                //bit 0,
+            unsigned char ChangeConfigurationConf :1;               //bit 1,
+            unsigned char ClearCacheReq :1;                         //bit 2,
+            unsigned char ClearCacheConf :1;                        //bit 3,
+            unsigned char GetConfigurationReq :1;                   //bit 4,
+            unsigned char GetConfigurationConf :1;                  //bit 5,
+            unsigned char UpdateFirmwareReq :1;                     //bit 6,
+            unsigned char UpdateFirmwareConf :1;                    //bit 7,
+            //CsMsgValue[1]
+            unsigned char GetDiagnosticsReq :1;                     //bit 0,
+            unsigned char GetDiagnosticsConf :1;                    //bit 1,
+            unsigned char GetLocalListVersionReq :1;                //bit 2,
+            unsigned char GetLocalListVersionConf :1;               //bit 3,
+            unsigned char ResetReq :1;                              //bit 4,
+            unsigned char ResetConf :1;                             //bit 5,
+            unsigned char SendLocalListReq :1;                      //bit 6,
+            unsigned char SendLocalListConf :1;                     //bit 7,
+            //CsMsgValue[2]
+            unsigned char CertificateSignedReq :1;                  //bit 0
+            unsigned char CertificateSignedConf :1;                 //bit 1
+            unsigned char DeleteCertificateReq :1;                  //bit 2
+            unsigned char DeleteCertificateConf :1;                 //bit 3
+            unsigned char ExtendedTriggerMessageReq :1;             //bit 4
+            unsigned char ExtendedTriggerMessageConf :1;            //bit 5
+            unsigned char GetInstalledCertificateIdsReq :1;         //bit 6
+            unsigned char GetInstalledCertificateIdsConf :1;        //bit 7
+            //CsMsgValue[3]
+            unsigned char GetLogReq :1;                             //bit 0
+            unsigned char GetLogConf :1;                            //bit 1
+            unsigned char InstallCertificateReq :1;                 //bit 2
+            unsigned char InstallCertificateConf :1;                //bit 3
+            unsigned char SignedUpdateFirmwareReq :1;               //bit 4
+            unsigned char SignedUpdateFirmwareConf :1;              //bit 5
+            unsigned char isRemoteStartWaitReq :1;                  //bit 6
+            unsigned char :1;                                       //bit 7
+        } bits;
+    } MsMsg;
+
+    union
+    {
+        //Operations triggered by CSU
+        unsigned char CSUMsgValue[CONNECTOR_QUANTITY];
+        struct
+        {
+            //CSUMsgValue[0]
+            unsigned char ChargingProfileReq:1;     //bit 0,
+            unsigned char ChargingProfileConf:1;    //bit 0,
+            unsigned char :6;                       //bit 1,2,3,4,5,6,7 , reserved
+        } bits[CONNECTOR_QUANTITY];
+    }CSUMsg;
+
+    struct StructBootNotification                   BootNotification;
+    struct StructHeartbeat                          Heartbeat;
+    struct StructAuthorize                          Authorize;
+    struct StructStartTransaction                   StartTransaction[CONNECTOR_QUANTITY];
+    struct StructStopTransaction                    StopTransaction[CONNECTOR_QUANTITY];
+    struct StructStatusNotification                 StatusNotification[CONNECTOR_QUANTITY];
+    struct StructCancelReservation                  CancelReservation[CONNECTOR_QUANTITY];
+    struct StructChangeAvailability                 ChangeAvailability[CONNECTOR_QUANTITY];
+    struct StructChangeConfiguration                ChangeConfiguration;
+    struct StructClearCache                         ClearCache;
+    struct StructClearChargingProfile               ClearChargingProfile[CONNECTOR_QUANTITY];
+    struct StructDataTransfer                       DataTransfer[CONNECTOR_QUANTITY];
+    struct StructDiagnosticsStatusNotification      DiagnosticsStatusNotification;
+    struct StructFirmwareStatusNotification         FirmwareStatusNotification;
+    struct StructGetCompositeSchedule               GetCompositeSchedule[CONNECTOR_QUANTITY];
+    struct StructGetConfiguration                   GetConfiguration;
+    struct StructGetDiagnostics                     GetDiagnostics;
+    struct StructGetLocalListVersion                GetLocalListVersion;
+    struct StructMeterValues                        MeterValues[CONNECTOR_QUANTITY];
+    struct StructRemoteStartTransaction             RemoteStartTransaction[CONNECTOR_QUANTITY];
+    struct StructRemoteStopTransaction              RemoteStopTransaction[CONNECTOR_QUANTITY];
+    struct StructReserveNow                         ReserveNow[CONNECTOR_QUANTITY];
+    struct StructReset                              Reset;
+    struct StructSendLocalList                      SendLocalList;
+    struct StructSetChargingProfile                 SetChargingProfile[CONNECTOR_QUANTITY];
+    struct StructTriggerMessage                     TriggerMessage[CONNECTOR_QUANTITY];
+    struct StructUnlockConnector                    UnlockConnector[CONNECTOR_QUANTITY];
+    struct StructUpdateFirmware                     UpdateFirmware;
+    struct OCPP16ConfigurationTable                 ConfigurationTable;
+    struct StructChargingProfile                    SmartChargingProfile[CONNECTOR_QUANTITY];
+    struct StructChargingProfile                    MaxChargingProfile;
+    struct StructCost                               Cost;
+    struct StructCertificateSigned                  CertificateSigned;
+    struct StructDeleteCertificate                  DeleteCertificate;
+    struct StructExtendedTrigger                    ExtendedTriggerMessage;
+    struct StructGetInstalledCertificateIds         GetInstalledCertificateIds;
+    struct StructGetLog                             GetLog;
+    struct StructInstallCertificate                 InstallCertificate;
+    struct StructSignedUpdateFirmware               SignedUpdateFirmware;
+    struct StructLogStatusNotification              LogStatusNotification;
+    struct StructSecurityEventNotification          SecurityEventNotification;
+    struct StructSignCertificate                    SignCertificate;
+    struct StructSignedFirmwareStatusNotification   SignedFirmwareStatusNotification;
+    struct StructSessionTarget                      SessionTarget[CONNECTOR_QUANTITY];
+    struct StructTcciCustomData                     TcciCustomData;
+    struct OCMFData                                 OcmfData[CONNECTOR_QUANTITY];
+    struct OCPP16_V2g_Extend						v2g_extend;
+};
+
 struct OCPP20Data
 {
 	unsigned char 							OcppServerURL[512];		//http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
@@ -6120,7 +6146,7 @@ struct OCPP20Data
 	unsigned char 							OcppConnStatus;			//0: disconnected, 1: connected
 	unsigned int 							Timeout_Secs;
 	unsigned short 							Ping_Pong_Interval;
-	long int 							procDogTime;            // Process watch dog refresh timer
+	long int                                procDogTime;            // Process watch dog refresh timer
 	struct ReportDataType                   ControllerComponentVariable[CtrlrVariable_CNT];
 	struct NetworkConnectionProfile_20      NetworkConnectionProfile[10];
 

+ 12 - 0
EVSE/Projects/DD360/Apps/ModuleEvComm/Module_EvTxComm.c

@@ -334,6 +334,7 @@ static void SetPresentChargingOutputCap(void)
     float pow2 = 0, cur2 = 0;
     struct ChargingInfoData *chargingData_1 = NULL;
     struct ChargingInfoData *chargingData_2 = NULL;
+    struct PrimaryMcuData* ShmPrimaryMcuData = (struct PrimaryMcuData*)GetShmPrimaryMcuData();
 
     if (pSysConfig->TotalConnectorCount == 1) {
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
@@ -379,6 +380,7 @@ static void SetPresentChargingOutputCap(void)
             deratingIndex[0] = chargingData_1->deratingByConnOtp.deratingIndex;
         }
     }
+
     pow2 = chargingData_2->AvailableChargingPower;
     cur2 = chargingData_2->AvailableChargingCurrent;
 
@@ -412,6 +414,16 @@ static void SetPresentChargingOutputCap(void)
         }
     }
 
+    if (ShmPrimaryMcuData->InputDet.bits.Ac_Drop == ABNORMAL) {
+        if (cur1 > 1500) {
+            log_info("Gun0 chiller alarm set current less than 150A");
+            cur1 = 1500;
+        }
+        if (cur2 > 1500) {
+            log_info("Gun1 chiller alarm set current less than 150A");
+            cur2 = 1500;
+        }
+    }
     //DS60-120 add
     if ((LogInfo[0][EV_LOG_OUTPUT_CAP_POW] <= pow1 - 5 ||
             LogInfo[0][EV_LOG_OUTPUT_CAP_POW] >= pow1 + 5) ||

+ 15 - 3
EVSE/Projects/DD360/Apps/ModulePrimary/Module_PrimaryComm.c

@@ -186,6 +186,8 @@ void GetInputGpioStatus(int fd)
     }
 
     ShmPrimaryMcuData->InputDet.bits.SpdDetec = gpio_in.SPD;
+    ShmPrimaryMcuData->InputDet.bits.Ac_Drop = ~gpio_in.AC_Drop; // Chiller Alarm ping
+
 #ifdef DD360ComBox
     EmgBtn_flag = 0;
 #else
@@ -364,7 +366,7 @@ static void checkChillerStatus(Gpio_out *gpio)
         pGpio->AC_Connector = 0x00;
         return;
     }
-
+    // 設定chiller 開關
     for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
         if (!ShmDcCommonData->pGunInfo[gunIndex].withChiller)
             continue;
@@ -385,8 +387,14 @@ static void checkChillerStatus(Gpio_out *gpio)
                 pChillerInfo->ChillerSwitch = NO;
             }
         }
+        // 檢查Chiller溫度點,若小於零下時開啟heater,大於10度時關閉heater
+        if (pDcChargingInfo->ChillerTemp < 60) {
+            pGpio->AC_Breaker = YES;
+        } else if(pDcChargingInfo->ChillerTemp > 70) {
+            pGpio->AC_Breaker = NO;
+        }
+        //log_info("Set Heater %s", pGpio->AC_Breaker ? "ON" : "OFF");
     }
-
     uint8_t _chillerNeedOn = NO;
     for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++)
     {
@@ -400,12 +408,16 @@ static void checkChillerStatus(Gpio_out *gpio)
     if (ShmDcCommonData->debugflag == YES)
         _chillerNeedOn = ShmDcCommonData->chillerCtrl;
     */
+    if (ShmPrimaryMcuData->InputDet.bits.Ac_Drop == ABNORMAL) {
+        _chillerNeedOn = NO;
+    }
 
     if(_chiller.ChillerSwitch != _chillerNeedOn) {
         log_info("Chiller Need Turn %s", _chillerNeedOn == YES ? "ON" : "OFF");
     }
     _chiller.ChillerSwitch = _chillerNeedOn;
     pGpio->AC_Connector = _chiller.ChillerSwitch;//Chiller ON/OFF Control, "0: Chiller disable, 1: Chiller enable"
+
 }
 
 void SetOutputGpio(int fd, uint8_t outputValue)
@@ -439,7 +451,7 @@ void SetOutputGpio(int fd, uint8_t outputValue)
 
     checkChillerStatus(&gpio);
 
-    gpio.AC_Breaker = 0x00;
+    //gpio.AC_Breaker = 0x00;
 
     Config_Gpio_Output(fd, OP_ADDR_IO_EXTEND, &gpio);
 }

+ 6 - 0
EVSE/Projects/DD360/Apps/ReadCmdline.c

@@ -1043,6 +1043,12 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
                         printf("Derating Current:%.3f Power:%.3f\n", pInfo->EvBatterytargetCurrent, pInfo->AvailableChargingPower);
                     }
                 }
+                if (ShmPrimaryMcuData->InputDet.bits.Ac_Drop == ABNORMAL) {
+                    if (pInfo->EvBatterytargetCurrent > 1500) {
+                        pInfo->EvBatterytargetCurrent = 1500;
+                        printf("Chiller alarm limit target Current under 150A");
+                    }
+                }
             } // for
 
             pDcChargingInfo->PresentChargingPower =

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


BIN
EVSE/Projects/DD360/output/FactoryConfig


BIN
EVSE/Projects/DD360/output/Module_ChkSysTask


BIN
EVSE/Projects/DD360/output/Module_DoComm


BIN
EVSE/Projects/DD360/output/Module_EvComm


BIN
EVSE/Projects/DD360/output/Module_EventLogging


BIN
EVSE/Projects/DD360/output/Module_InternalComm


BIN
EVSE/Projects/DD360/output/Module_LcmControl


BIN
EVSE/Projects/DD360/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360/output/Module_UpdateFW


BIN
EVSE/Projects/DD360/output/ReadCmdline


BIN
EVSE/Projects/DD360/output/main


+ 7 - 0
EVSE/Projects/DD360Audi/Apps/CSU/Primary.c

@@ -415,6 +415,13 @@ void ChkPrimaryStatus(void)
         ReleaseEmsOccureByString(0, "012251");
     }
 
+    if (ShmPrimaryMcuData->InputDet.bits.Ac_Drop == ABNORMAL) {
+        pAlarmCode->AlarmEvents.bits.ChillerAlarmFail = YES;
+        EmcOccureByString("012348");
+    } else {
+        ReleaseEmsOccureByString(0, "012348");
+    }
+    
     if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == ABNORMAL) {
         pAlarmCode->AlarmEvents.bits.MainPowerBreakerTrip = YES;
         EmcOccureByString("012238");

+ 288 - 262
EVSE/Projects/DD360Audi/Apps/Define/define.h

@@ -345,6 +345,7 @@ enum CoreProfile {
      OffLineMaxChargingPower,
      ConfigurationVersion,
 	 CharingProfileRefreshInterval,
+	 CpoName,
 	 OcppSoftwareVersion,
 	 _CoreProfile_CNT
 };
@@ -697,6 +698,7 @@ struct ChargingInfoData
 	unsigned char 		EvConnAlarmCode[7];
 	float 				ChargingProfileCurrent;			// unit: 0.1A
 	float 				ChargingProfilePower;			// unit: 1W
+	float               LocalPowerLimitCurrent;         // unit: 1A
 	float 				PresentChargingVoltageL2;		//0~6553.5 volt
 	float 				PresentChargingVoltageL3;		//0~6553.5 volt
 	float 				PresentChargingCurrentL2;		//0~6553.5 amp	
@@ -1422,7 +1424,7 @@ char AlarmStatusCode[160][6]=
     "012345",   // AC: Pilot negative error
     "012346",   // Psu Communication error with CSU
     "012347",   // AC: Local power sharing communication error (Slave disconnect from Master)
-    "012348",   // reserved
+    "012348",   // Chiller Alarm failure
     "012349",   // reserved
     "012350",   // reserved
     "012351",   // reserved
@@ -1603,7 +1605,8 @@ struct AlarmCodeData
             unsigned char PilotNegativeError:1;                     //bit 1
             unsigned char PsuComminicationErrWithCSU:1;             //bit 2
             unsigned char LocalPowerSharingCommunicationError:1;    //bit 3
-            unsigned char :4;                                       //reserved bit 4 ~ bit 7
+            unsigned char ChillerAlarmFail:1;                       //bit 4
+			unsigned char :3;                                       //reserved bit 4 ~ bit 7
             //AlarmVal[19]
             unsigned char PaymentCommTimeout:1;                     //Payment system communication timeout
             unsigned char :7;                                       //reserved bit 1 ~ bit 7
@@ -2425,7 +2428,7 @@ struct DynamicReleaseCtrl
     unsigned char       ReleaseLoopStep;    // 0 : None, 1 : Limit Pwr, 2 : Pwr OFF, 3. RCB OFF, 4. Finish
     float               CheckOutPwrIsStable;// 0.1kw
     unsigned char       TargetRelay;        // 255 : None
-    unsigned char		AutoRelease;
+    unsigned char       AutoRelease;
 
     float               LimitCurCap;        // Inform 0.1A
     float               LimitPwrCap;        // Inform 0.1kw
@@ -4127,7 +4130,8 @@ struct PrimaryMcuData
             unsigned char Key1:1;                               //bit 2,    H: ON,      L:OFF
             unsigned char Key2:1;                               //bit 3,    H: ON,      L:OFF
             unsigned char Key3:1;                               //bit 4,    H: ON,      L:OFF
-            unsigned char :3;                                   //bit 5~7,  Reserved
+            unsigned char Ac_Drop;                              //bit 4,    H: Trigger, L:Normal
+			unsigned char :2;                                   //bit 5~7,  Reserved
         }bits;
     }InputDet;
 };
@@ -4429,9 +4433,9 @@ struct StructDataTransfer
 {
 	unsigned char VendorId[256];
 	unsigned char MessageId[52];
-	unsigned char Data[512];
+	unsigned char Data[10240];
 	unsigned char ResponseStatus[18];	//Accepted, Rejected,UnknownMessageId,UnknownVendorId
-	unsigned char ResponseData[512];
+	unsigned char ResponseData[10240];
 };
 struct StructDiagnosticsStatusNotification
 {
@@ -4740,261 +4744,6 @@ struct StructSessionTarget
     unsigned short      targetDuration;     // Unit: Minutes    0 is unlimit
 };
 
-//===================================
-// YES custom protocol
-//===================================
-struct StructChargerInfo
-{
-    unsigned char station_name[64];
-};
-
-struct StructWeatherInfo
-{
-    int   weatherId;
-    float temperature;
-};
-
-struct StructCreditDeductResult
-{
-    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 StructReaderStatus
-{
-    int readerStatus;
-    unsigned char creditNo[64];
-    unsigned char ReportReaderStatusReq:1;
-};
-
-struct StructTcciCustomData
-{
-    struct StructChargerInfo ChargerInfo;
-    struct StructWeatherInfo WeatherInfo;
-    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 :3;                  // bit 5-7 , reserved
-};
-
-struct OCMFData
-{
-	unsigned char SendOcmfDataReq:1;   // bit 0 , Flag to ask OCPP sending OCMF message to backend.
-	unsigned char :7;                  // bit 1-7 , reserved
-	unsigned char DataString[2048];    // Data got from meter.
-	unsigned char PublicKey[256];      // PublicKey with header got from meter.
-};
-
-struct OCPP16Data
-{
-    unsigned char                           OcppServerURL[512];     //http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
-    unsigned char                           ChargeBoxId[128];
-    unsigned char                           OcppConnStatus;         //0: disconnected, 1: connected
-    unsigned int                            Timeout_Secs;
-    unsigned short                          Ping_Pong_Interval;
-    long  int	                            procDogTime;            // Process watch dog refresh timer
-    union
-    {
-        //Operations Initiated by Charge Point
-        unsigned char CpMsgValue[CONNECTOR_QUANTITY];
-        struct
-        {
-            //CpMsgValue[0]
-            unsigned char DataTransferReq:1;        //bit 0,
-            unsigned char DataTransferConf:1;       //bit 1,
-            unsigned char StartTransactionReq:1;    //bit 2,
-            unsigned char StartTransactionConf:1;   //bit 3,
-            unsigned char StopTransactionReq:1;     //bit 4,
-            unsigned char StopTransactionConf:1;    //bit 5,
-            unsigned char :2;                       //bit 6,7 , reserved
-        } bits[CONNECTOR_QUANTITY];
-    }CpMsg;
-
-    union
-    {
-        //Operations Initiated by Sequence Point
-        unsigned char SpMsgValue[2];
-        struct
-        {
-            //SpMsgValue[0]
-            unsigned char BootNotificationReq :1;                   //bit 0,
-            unsigned char BootNotificationConf :1;                  //bit 1,
-            unsigned char AuthorizeReq :1;                          //bit 2,
-            unsigned char AuthorizeConf :1;                         //bit 3,
-            unsigned char DiagnosticsStatusNotificationReq :1;      //bit 4,
-            unsigned char DiagnosticsStatusNotificationConf :1;     //bit 5,
-            unsigned char FirmwareStatusNotificationReq :1;         //bit 6,
-            unsigned char FirmwareStatusNotificationConf :1;        //bit 7,
-            //SpMsgValue[1]
-            unsigned char LogStatusNotificationReq :1;              //bit 0,
-            unsigned char LogStatusNotificationConf :1;             //bit 1,
-            unsigned char SecurityEventNotificationReq :1;          //bit 2,
-            unsigned char SecurityEventNotificationConf :1;         //bit 3,
-            unsigned char SignCertificateReq :1;                    //bit 4,
-            unsigned char SignCertificateConf :1;                   //bit 5,
-            unsigned char SignedFirmwareStatusNotificationReq :1;   //bit 6,
-            unsigned char SignedFirmwareStatusNotificationConf :1;  //bit 7,
-        } bits;
-    } SpMsg;
-
-    union
-    {
-        //Operations Initiated by Central System
-        unsigned char CsMsgValue[3 * (CONNECTOR_QUANTITY)];
-        struct
-        {
-            //CsMsgValue[0]
-            unsigned char CancelReservationReq :1;      //bit 0,
-            unsigned char CancelReservationConf :1;     //bit 1,
-            unsigned char ChangeAvailabilityReq :1;     //bit 2,
-            unsigned char ChangeAvailabilityConf :1;    //bit 3,
-            unsigned char ReserveNowReq :1;             //bit 4,
-            unsigned char ReserveNowConf :1;            //bit 5,
-            unsigned char SetChargingProfileReq :1;     //bit 6,
-            unsigned char SetChargingProfileConf :1;    //bit 7,
-            //CsMsgValue[1]
-            unsigned char TriggerMessageReq :1;         //bit 0,
-            unsigned char TriggerMessageConf :1;        //bit 1,
-            unsigned char UnlockConnectorReq :1;        //bit 2,
-            unsigned char UnlockConnectorConf :1;       //bit 3,
-            unsigned char RemoteStartTransactionReq :1; //bit 4,
-            unsigned char RemoteStartTransactionConf :1;//bit 5,
-            unsigned char RemoteStopTransactionReq :1;  //bit 6,
-            unsigned char RemoteStopTransactionConf :1; //bit 7,
-            //CsMsgValue[2]
-            unsigned char ClearChargingProfileReq :1;   //bit 0,
-            unsigned char ClearChargingProfileConf :1;  //bit 1,
-            unsigned char DataTransferReq :1;           //bit 2,
-            unsigned char DataTransferConf :1;          //bit 3,
-            unsigned char GetCompositeScheduleReq :1;   //bit 4,
-            unsigned char GetCompositeScheduleConf :1;  //bit 5,
-            unsigned char :2;                           //bit 6,7
-        } bits[CONNECTOR_QUANTITY];
-    }CsMsg;
-
-    union
-    {
-        //Operations Initiated by Main System
-        unsigned char MsMsgValue[4];
-        struct
-        {
-            //CsMsgValue[0]
-            unsigned char ChangeConfigurationReq :1;                //bit 0,
-            unsigned char ChangeConfigurationConf :1;               //bit 1,
-            unsigned char ClearCacheReq :1;                         //bit 2,
-            unsigned char ClearCacheConf :1;                        //bit 3,
-            unsigned char GetConfigurationReq :1;                   //bit 4,
-            unsigned char GetConfigurationConf :1;                  //bit 5,
-            unsigned char UpdateFirmwareReq :1;                     //bit 6,
-            unsigned char UpdateFirmwareConf :1;                    //bit 7,
-            //CsMsgValue[1]
-            unsigned char GetDiagnosticsReq :1;                     //bit 0,
-            unsigned char GetDiagnosticsConf :1;                    //bit 1,
-            unsigned char GetLocalListVersionReq :1;                //bit 2,
-            unsigned char GetLocalListVersionConf :1;               //bit 3,
-            unsigned char ResetReq :1;                              //bit 4,
-            unsigned char ResetConf :1;                             //bit 5,
-            unsigned char SendLocalListReq :1;                      //bit 6,
-            unsigned char SendLocalListConf :1;                     //bit 7,
-            //CsMsgValue[2]
-            unsigned char CertificateSignedReq :1;                  //bit 0
-            unsigned char CertificateSignedConf :1;                 //bit 1
-            unsigned char DeleteCertificateReq :1;                  //bit 2
-            unsigned char DeleteCertificateConf :1;                 //bit 3
-            unsigned char ExtendedTriggerMessageReq :1;             //bit 4
-            unsigned char ExtendedTriggerMessageConf :1;            //bit 5
-            unsigned char GetInstalledCertificateIdsReq :1;         //bit 6
-            unsigned char GetInstalledCertificateIdsConf :1;        //bit 7
-            //CsMsgValue[3]
-            unsigned char GetLogReq :1;                             //bit 0
-            unsigned char GetLogConf :1;                            //bit 1
-            unsigned char InstallCertificateReq :1;                 //bit 2
-            unsigned char InstallCertificateConf :1;                //bit 3
-            unsigned char SignedUpdateFirmwareReq :1;               //bit 4
-            unsigned char SignedUpdateFirmwareConf :1;              //bit 5
-            unsigned char isRemoteStartWaitReq :1;                  //bit 6
-            unsigned char :1;                                       //bit 7
-        } bits;
-    } MsMsg;
-
-    union
-    {
-        //Operations triggered by CSU
-        unsigned char CSUMsgValue[CONNECTOR_QUANTITY];
-        struct
-        {
-            //CSUMsgValue[0]
-            unsigned char ChargingProfileReq:1;     //bit 0,
-            unsigned char ChargingProfileConf:1;    //bit 0,
-            unsigned char :6;                       //bit 1,2,3,4,5,6,7 , reserved
-        } bits[CONNECTOR_QUANTITY];
-    }CSUMsg;
-
-    struct StructBootNotification                   BootNotification;
-    struct StructHeartbeat                          Heartbeat;
-    struct StructAuthorize                          Authorize;
-    struct StructStartTransaction                   StartTransaction[CONNECTOR_QUANTITY];
-    struct StructStopTransaction                    StopTransaction[CONNECTOR_QUANTITY];
-    struct StructStatusNotification                 StatusNotification[CONNECTOR_QUANTITY];
-    struct StructCancelReservation                  CancelReservation[CONNECTOR_QUANTITY];
-    struct StructChangeAvailability                 ChangeAvailability[CONNECTOR_QUANTITY];
-    struct StructChangeConfiguration                ChangeConfiguration;
-    struct StructClearCache                         ClearCache;
-    struct StructClearChargingProfile               ClearChargingProfile[CONNECTOR_QUANTITY];
-    struct StructDataTransfer                       DataTransfer[CONNECTOR_QUANTITY];
-    struct StructDiagnosticsStatusNotification      DiagnosticsStatusNotification;
-    struct StructFirmwareStatusNotification         FirmwareStatusNotification;
-    struct StructGetCompositeSchedule               GetCompositeSchedule[CONNECTOR_QUANTITY];
-    struct StructGetConfiguration                   GetConfiguration;
-    struct StructGetDiagnostics                     GetDiagnostics;
-    struct StructGetLocalListVersion                GetLocalListVersion;
-    struct StructMeterValues                        MeterValues[CONNECTOR_QUANTITY];
-    struct StructRemoteStartTransaction             RemoteStartTransaction[CONNECTOR_QUANTITY];
-    struct StructRemoteStopTransaction              RemoteStopTransaction[CONNECTOR_QUANTITY];
-    struct StructReserveNow                         ReserveNow[CONNECTOR_QUANTITY];
-    struct StructReset                              Reset;
-    struct StructSendLocalList                      SendLocalList;
-    struct StructSetChargingProfile                 SetChargingProfile[CONNECTOR_QUANTITY];
-    struct StructTriggerMessage                     TriggerMessage[CONNECTOR_QUANTITY];
-    struct StructUnlockConnector                    UnlockConnector[CONNECTOR_QUANTITY];
-    struct StructUpdateFirmware                     UpdateFirmware;
-    struct OCPP16ConfigurationTable                 ConfigurationTable;
-    struct StructChargingProfile                    SmartChargingProfile[CONNECTOR_QUANTITY];
-    struct StructChargingProfile                    MaxChargingProfile;
-    struct StructCost                               Cost;
-    struct StructCertificateSigned                  CertificateSigned;
-    struct StructDeleteCertificate                  DeleteCertificate;
-    struct StructExtendedTrigger                    ExtendedTriggerMessage;
-    struct StructGetInstalledCertificateIds         GetInstalledCertificateIds;
-    struct StructGetLog                             GetLog;
-    struct StructInstallCertificate                 InstallCertificate;
-    struct StructSignedUpdateFirmware               SignedUpdateFirmware;
-    struct StructLogStatusNotification              LogStatusNotification;
-    struct StructSecurityEventNotification          SecurityEventNotification;
-    struct StructSignCertificate                    SignCertificate;
-    struct StructSignedFirmwareStatusNotification   SignedFirmwareStatusNotification;
-    struct StructSessionTarget                      SessionTarget[CONNECTOR_QUANTITY];
-    struct StructTcciCustomData                     TcciCustomData;
-    struct OCMFData                                 OcmfData[CONNECTOR_QUANTITY];
-};
-
-
 /**************************************************************************************/
 /************************* OCPP 2.0 Share memory **************************************/
 /**************************************************************************************/
@@ -6113,6 +5862,283 @@ struct NetworkConnectionProfile_20
     struct NetworkConnectionProfileType connectionData;
 };
 
+//===================================
+// YES custom protocol
+//===================================
+struct StructChargerInfo
+{
+    unsigned char station_name[64];
+};
+
+struct StructWeatherInfo
+{
+    int   weatherId;
+    float temperature;
+};
+
+struct StructCreditDeductResult
+{
+    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 StructReaderStatus
+{
+    int readerStatus;
+    unsigned char creditNo[64];
+    unsigned char ReportReaderStatusReq:1;
+};
+
+struct StructTcciCustomData
+{
+    struct StructChargerInfo ChargerInfo;
+    struct StructWeatherInfo WeatherInfo;
+    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 :3;                  // bit 5-7 , reserved
+};
+
+struct OCMFData
+{
+    unsigned char SendOcmfDataReq:1;   // bit 0 , Flag to ask OCPP sending OCMF message to backend.
+    unsigned char :7;                  // bit 1-7 , reserved
+    unsigned char DataString[2048];    // Data got from meter.
+    unsigned char PublicKey[256];      // PublicKey with header got from meter.
+};
+
+struct OCPP16_V2g_Extend
+{
+	struct Authorize_20						Authorize;
+	struct CertificateSigned_20				CertificateSigned;
+	struct DeleteCertificate_20				DeleteCertificate;
+	struct Get15118EVCertificate_20			Get15118EVCertificate;
+	struct GetCertificateStatus_20			GetCertificateStatus;
+	struct GetInstalledCertificateIds_20	GetInstalledCertificateIds;
+	struct InstallCertificate_20			InstallCertificate;
+	struct SignCertificate_20				SignCertificate;
+
+
+	unsigned char							AuthorizeReq:1;
+	unsigned char							AuthorizeConf:1;
+	unsigned char							Get15118EVCertificateReq:1;
+	unsigned char 							Get15118EVCertificateConf:1;
+	unsigned char							GetCertificateStatusReq:1;
+	unsigned char 							GetCertificateStatusConf:1;
+	unsigned char							SignCertificateReq:1;
+	unsigned char							SignCertificateConf:1;
+};
+
+struct OCPP16Data
+{
+    unsigned char                           OcppServerURL[512];     //http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
+    unsigned char                           ChargeBoxId[128];
+    unsigned char                           OcppConnStatus;         //0: disconnected, 1: connected
+    unsigned int                            Timeout_Secs;
+    unsigned short                          Ping_Pong_Interval;
+    long int                                procDogTime;            // Process watch dog refresh timer
+    union
+    {
+        //Operations Initiated by Charge Point
+        unsigned char CpMsgValue[CONNECTOR_QUANTITY];
+        struct
+        {
+            //CpMsgValue[0]
+            unsigned char DataTransferReq:1;        //bit 0,
+            unsigned char DataTransferConf:1;       //bit 1,
+            unsigned char StartTransactionReq:1;    //bit 2,
+            unsigned char StartTransactionConf:1;   //bit 3,
+            unsigned char StopTransactionReq:1;     //bit 4,
+            unsigned char StopTransactionConf:1;    //bit 5,
+            unsigned char :2;                       //bit 6,7 , reserved
+        } bits[CONNECTOR_QUANTITY];
+    }CpMsg;
+
+    union
+    {
+        //Operations Initiated by Sequence Point
+        unsigned char SpMsgValue[2];
+        struct
+        {
+            //SpMsgValue[0]
+            unsigned char BootNotificationReq :1;                   //bit 0,
+            unsigned char BootNotificationConf :1;                  //bit 1,
+            unsigned char AuthorizeReq :1;                          //bit 2,
+            unsigned char AuthorizeConf :1;                         //bit 3,
+            unsigned char DiagnosticsStatusNotificationReq :1;      //bit 4,
+            unsigned char DiagnosticsStatusNotificationConf :1;     //bit 5,
+            unsigned char FirmwareStatusNotificationReq :1;         //bit 6,
+            unsigned char FirmwareStatusNotificationConf :1;        //bit 7,
+            //SpMsgValue[1]
+            unsigned char LogStatusNotificationReq :1;              //bit 0,
+            unsigned char LogStatusNotificationConf :1;             //bit 1,
+            unsigned char SecurityEventNotificationReq :1;          //bit 2,
+            unsigned char SecurityEventNotificationConf :1;         //bit 3,
+            unsigned char SignCertificateReq :1;                    //bit 4,
+            unsigned char SignCertificateConf :1;                   //bit 5,
+            unsigned char SignedFirmwareStatusNotificationReq :1;   //bit 6,
+            unsigned char SignedFirmwareStatusNotificationConf :1;  //bit 7,
+        } bits;
+    } SpMsg;
+
+    union
+    {
+        //Operations Initiated by Central System
+        unsigned char CsMsgValue[3 * (CONNECTOR_QUANTITY)];
+        struct
+        {
+            //CsMsgValue[0]
+            unsigned char CancelReservationReq :1;      //bit 0,
+            unsigned char CancelReservationConf :1;     //bit 1,
+            unsigned char ChangeAvailabilityReq :1;     //bit 2,
+            unsigned char ChangeAvailabilityConf :1;    //bit 3,
+            unsigned char ReserveNowReq :1;             //bit 4,
+            unsigned char ReserveNowConf :1;            //bit 5,
+            unsigned char SetChargingProfileReq :1;     //bit 6,
+            unsigned char SetChargingProfileConf :1;    //bit 7,
+            //CsMsgValue[1]
+            unsigned char TriggerMessageReq :1;         //bit 0,
+            unsigned char TriggerMessageConf :1;        //bit 1,
+            unsigned char UnlockConnectorReq :1;        //bit 2,
+            unsigned char UnlockConnectorConf :1;       //bit 3,
+            unsigned char RemoteStartTransactionReq :1; //bit 4,
+            unsigned char RemoteStartTransactionConf :1;//bit 5,
+            unsigned char RemoteStopTransactionReq :1;  //bit 6,
+            unsigned char RemoteStopTransactionConf :1; //bit 7,
+            //CsMsgValue[2]
+            unsigned char ClearChargingProfileReq :1;   //bit 0,
+            unsigned char ClearChargingProfileConf :1;  //bit 1,
+            unsigned char DataTransferReq :1;           //bit 2,
+            unsigned char DataTransferConf :1;          //bit 3,
+            unsigned char GetCompositeScheduleReq :1;   //bit 4,
+            unsigned char GetCompositeScheduleConf :1;  //bit 5,
+            unsigned char :2;                           //bit 6,7
+        } bits[CONNECTOR_QUANTITY];
+    }CsMsg;
+
+    union
+    {
+        //Operations Initiated by Main System
+        unsigned char MsMsgValue[4];
+        struct
+        {
+            //CsMsgValue[0]
+            unsigned char ChangeConfigurationReq :1;                //bit 0,
+            unsigned char ChangeConfigurationConf :1;               //bit 1,
+            unsigned char ClearCacheReq :1;                         //bit 2,
+            unsigned char ClearCacheConf :1;                        //bit 3,
+            unsigned char GetConfigurationReq :1;                   //bit 4,
+            unsigned char GetConfigurationConf :1;                  //bit 5,
+            unsigned char UpdateFirmwareReq :1;                     //bit 6,
+            unsigned char UpdateFirmwareConf :1;                    //bit 7,
+            //CsMsgValue[1]
+            unsigned char GetDiagnosticsReq :1;                     //bit 0,
+            unsigned char GetDiagnosticsConf :1;                    //bit 1,
+            unsigned char GetLocalListVersionReq :1;                //bit 2,
+            unsigned char GetLocalListVersionConf :1;               //bit 3,
+            unsigned char ResetReq :1;                              //bit 4,
+            unsigned char ResetConf :1;                             //bit 5,
+            unsigned char SendLocalListReq :1;                      //bit 6,
+            unsigned char SendLocalListConf :1;                     //bit 7,
+            //CsMsgValue[2]
+            unsigned char CertificateSignedReq :1;                  //bit 0
+            unsigned char CertificateSignedConf :1;                 //bit 1
+            unsigned char DeleteCertificateReq :1;                  //bit 2
+            unsigned char DeleteCertificateConf :1;                 //bit 3
+            unsigned char ExtendedTriggerMessageReq :1;             //bit 4
+            unsigned char ExtendedTriggerMessageConf :1;            //bit 5
+            unsigned char GetInstalledCertificateIdsReq :1;         //bit 6
+            unsigned char GetInstalledCertificateIdsConf :1;        //bit 7
+            //CsMsgValue[3]
+            unsigned char GetLogReq :1;                             //bit 0
+            unsigned char GetLogConf :1;                            //bit 1
+            unsigned char InstallCertificateReq :1;                 //bit 2
+            unsigned char InstallCertificateConf :1;                //bit 3
+            unsigned char SignedUpdateFirmwareReq :1;               //bit 4
+            unsigned char SignedUpdateFirmwareConf :1;              //bit 5
+            unsigned char isRemoteStartWaitReq :1;                  //bit 6
+            unsigned char :1;                                       //bit 7
+        } bits;
+    } MsMsg;
+
+    union
+    {
+        //Operations triggered by CSU
+        unsigned char CSUMsgValue[CONNECTOR_QUANTITY];
+        struct
+        {
+            //CSUMsgValue[0]
+            unsigned char ChargingProfileReq:1;     //bit 0,
+            unsigned char ChargingProfileConf:1;    //bit 0,
+            unsigned char :6;                       //bit 1,2,3,4,5,6,7 , reserved
+        } bits[CONNECTOR_QUANTITY];
+    }CSUMsg;
+
+    struct StructBootNotification                   BootNotification;
+    struct StructHeartbeat                          Heartbeat;
+    struct StructAuthorize                          Authorize;
+    struct StructStartTransaction                   StartTransaction[CONNECTOR_QUANTITY];
+    struct StructStopTransaction                    StopTransaction[CONNECTOR_QUANTITY];
+    struct StructStatusNotification                 StatusNotification[CONNECTOR_QUANTITY];
+    struct StructCancelReservation                  CancelReservation[CONNECTOR_QUANTITY];
+    struct StructChangeAvailability                 ChangeAvailability[CONNECTOR_QUANTITY];
+    struct StructChangeConfiguration                ChangeConfiguration;
+    struct StructClearCache                         ClearCache;
+    struct StructClearChargingProfile               ClearChargingProfile[CONNECTOR_QUANTITY];
+    struct StructDataTransfer                       DataTransfer[CONNECTOR_QUANTITY];
+    struct StructDiagnosticsStatusNotification      DiagnosticsStatusNotification;
+    struct StructFirmwareStatusNotification         FirmwareStatusNotification;
+    struct StructGetCompositeSchedule               GetCompositeSchedule[CONNECTOR_QUANTITY];
+    struct StructGetConfiguration                   GetConfiguration;
+    struct StructGetDiagnostics                     GetDiagnostics;
+    struct StructGetLocalListVersion                GetLocalListVersion;
+    struct StructMeterValues                        MeterValues[CONNECTOR_QUANTITY];
+    struct StructRemoteStartTransaction             RemoteStartTransaction[CONNECTOR_QUANTITY];
+    struct StructRemoteStopTransaction              RemoteStopTransaction[CONNECTOR_QUANTITY];
+    struct StructReserveNow                         ReserveNow[CONNECTOR_QUANTITY];
+    struct StructReset                              Reset;
+    struct StructSendLocalList                      SendLocalList;
+    struct StructSetChargingProfile                 SetChargingProfile[CONNECTOR_QUANTITY];
+    struct StructTriggerMessage                     TriggerMessage[CONNECTOR_QUANTITY];
+    struct StructUnlockConnector                    UnlockConnector[CONNECTOR_QUANTITY];
+    struct StructUpdateFirmware                     UpdateFirmware;
+    struct OCPP16ConfigurationTable                 ConfigurationTable;
+    struct StructChargingProfile                    SmartChargingProfile[CONNECTOR_QUANTITY];
+    struct StructChargingProfile                    MaxChargingProfile;
+    struct StructCost                               Cost;
+    struct StructCertificateSigned                  CertificateSigned;
+    struct StructDeleteCertificate                  DeleteCertificate;
+    struct StructExtendedTrigger                    ExtendedTriggerMessage;
+    struct StructGetInstalledCertificateIds         GetInstalledCertificateIds;
+    struct StructGetLog                             GetLog;
+    struct StructInstallCertificate                 InstallCertificate;
+    struct StructSignedUpdateFirmware               SignedUpdateFirmware;
+    struct StructLogStatusNotification              LogStatusNotification;
+    struct StructSecurityEventNotification          SecurityEventNotification;
+    struct StructSignCertificate                    SignCertificate;
+    struct StructSignedFirmwareStatusNotification   SignedFirmwareStatusNotification;
+    struct StructSessionTarget                      SessionTarget[CONNECTOR_QUANTITY];
+    struct StructTcciCustomData                     TcciCustomData;
+    struct OCMFData                                 OcmfData[CONNECTOR_QUANTITY];
+    struct OCPP16_V2g_Extend						v2g_extend;
+};
+
 struct OCPP20Data
 {
 	unsigned char 							OcppServerURL[512];		//http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
@@ -6120,7 +6146,7 @@ struct OCPP20Data
 	unsigned char 							OcppConnStatus;			//0: disconnected, 1: connected
 	unsigned int 							Timeout_Secs;
 	unsigned short 							Ping_Pong_Interval;
-	long int 							procDogTime;            // Process watch dog refresh timer
+	long int                                procDogTime;            // Process watch dog refresh timer
 	struct ReportDataType                   ControllerComponentVariable[CtrlrVariable_CNT];
 	struct NetworkConnectionProfile_20      NetworkConnectionProfile[10];
 

+ 12 - 0
EVSE/Projects/DD360Audi/Apps/ModuleEvComm/Module_EvTxComm.c

@@ -334,6 +334,7 @@ static void SetPresentChargingOutputCap(void)
     float pow2 = 0, cur2 = 0;
     struct ChargingInfoData *chargingData_1 = NULL;
     struct ChargingInfoData *chargingData_2 = NULL;
+    struct PrimaryMcuData* ShmPrimaryMcuData = (struct PrimaryMcuData*)GetShmPrimaryMcuData();
 
     if (pSysConfig->TotalConnectorCount == 1) {
         chargingData_1 = (struct ChargingInfoData *)GetDcChargingInfoData(0);
@@ -379,6 +380,7 @@ static void SetPresentChargingOutputCap(void)
             deratingIndex[0] = chargingData_1->deratingByConnOtp.deratingIndex;
         }
     }
+
     pow2 = chargingData_2->AvailableChargingPower;
     cur2 = chargingData_2->AvailableChargingCurrent;
 
@@ -412,6 +414,16 @@ static void SetPresentChargingOutputCap(void)
         }
     }
 
+    if (ShmPrimaryMcuData->InputDet.bits.Ac_Drop == ABNORMAL) {
+        if (cur1 > 1500) {
+            log_info("Gun0 chiller alarm set current less than 150A");
+            cur1 = 1500;
+        }
+        if (cur2 > 1500) {
+            log_info("Gun1 chiller alarm set current less than 150A");
+            cur2 = 1500;
+        }
+    }
     //DS60-120 add
     if ((LogInfo[0][EV_LOG_OUTPUT_CAP_POW] <= pow1 - 5 ||
             LogInfo[0][EV_LOG_OUTPUT_CAP_POW] >= pow1 + 5) ||

+ 15 - 3
EVSE/Projects/DD360Audi/Apps/ModulePrimary/Module_PrimaryComm.c

@@ -186,6 +186,8 @@ void GetInputGpioStatus(int fd)
     }
 
     ShmPrimaryMcuData->InputDet.bits.SpdDetec = gpio_in.SPD;
+    ShmPrimaryMcuData->InputDet.bits.Ac_Drop = ~gpio_in.AC_Drop; // Chiller Alarm ping
+
 #ifdef DD360ComBox
     EmgBtn_flag = 0;
 #else
@@ -364,7 +366,7 @@ static void checkChillerStatus(Gpio_out *gpio)
         pGpio->AC_Connector = 0x00;
         return;
     }
-
+    // 設定chiller 開關
     for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
         if (!ShmDcCommonData->pGunInfo[gunIndex].withChiller)
             continue;
@@ -385,8 +387,14 @@ static void checkChillerStatus(Gpio_out *gpio)
                 pChillerInfo->ChillerSwitch = NO;
             }
         }
+        // 檢查Chiller溫度點,若小於零下時開啟heater,大於10度時關閉heater
+        if (pDcChargingInfo->ChillerTemp < 60) {
+            pGpio->AC_Breaker = YES;
+        } else if(pDcChargingInfo->ChillerTemp > 70) {
+            pGpio->AC_Breaker = NO;
+        }
+        //log_info("Set Heater %s", pGpio->AC_Breaker ? "ON" : "OFF");
     }
-
     uint8_t _chillerNeedOn = NO;
     for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++)
     {
@@ -400,12 +408,16 @@ static void checkChillerStatus(Gpio_out *gpio)
     if (ShmDcCommonData->debugflag == YES)
         _chillerNeedOn = ShmDcCommonData->chillerCtrl;
     */
+    if (ShmPrimaryMcuData->InputDet.bits.Ac_Drop == ABNORMAL) {
+        _chillerNeedOn = NO;
+    }
 
     if(_chiller.ChillerSwitch != _chillerNeedOn) {
         log_info("Chiller Need Turn %s", _chillerNeedOn == YES ? "ON" : "OFF");
     }
     _chiller.ChillerSwitch = _chillerNeedOn;
     pGpio->AC_Connector = _chiller.ChillerSwitch;//Chiller ON/OFF Control, "0: Chiller disable, 1: Chiller enable"
+
 }
 
 void SetOutputGpio(int fd, uint8_t outputValue)
@@ -439,7 +451,7 @@ void SetOutputGpio(int fd, uint8_t outputValue)
 
     checkChillerStatus(&gpio);
 
-    gpio.AC_Breaker = 0x00;
+    //gpio.AC_Breaker = 0x00;
 
     Config_Gpio_Output(fd, OP_ADDR_IO_EXTEND, &gpio);
 }

+ 6 - 0
EVSE/Projects/DD360Audi/Apps/ReadCmdline.c

@@ -1043,6 +1043,12 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
                         printf("Derating Current:%.3f Power:%.3f\n", pInfo->EvBatterytargetCurrent, pInfo->AvailableChargingPower);
                     }
                 }
+                if (ShmPrimaryMcuData->InputDet.bits.Ac_Drop == ABNORMAL) {
+                    if (pInfo->EvBatterytargetCurrent > 1500) {
+                        pInfo->EvBatterytargetCurrent = 1500;
+                        printf("Chiller alarm limit target Current under 150A");
+                    }
+                }
             } // for
 
             pDcChargingInfo->PresentChargingPower =

+ 5 - 3
EVSE/Projects/define.h

@@ -1419,7 +1419,7 @@ char AlarmStatusCode[160][6]=
     "012345",   // AC: Pilot negative error
     "012346",   // Psu Communication error with CSU
     "012347",   // AC: Local power sharing communication error (Slave disconnect from Master)
-    "012348",   // reserved
+    "012348",   // Chiller Alarm failure
     "012349",   // reserved
     "012350",   // reserved
     "012351",   // reserved
@@ -1599,7 +1599,8 @@ struct AlarmCodeData
             unsigned char PilotNegativeError:1;                     //bit 1
             unsigned char PsuComminicationErrWithCSU:1;             //bit 2
             unsigned char LocalPowerSharingCommunicationError:1;    //bit 3
-            unsigned char :4;                                       //reserved bit 4 ~ bit 7
+            unsigned char ChillerAlarmFail:1;                       //bit 4
+			unsigned char :3;                                       //reserved bit 4 ~ bit 7
             //AlarmVal[19]
             unsigned char PaymentCommTimeout:1;                     //Payment system communication timeout
             unsigned char :7;                                       //reserved bit 1 ~ bit 7
@@ -4121,7 +4122,8 @@ struct PrimaryMcuData
             unsigned char Key1:1;                               //bit 2,    H: ON,      L:OFF
             unsigned char Key2:1;                               //bit 3,    H: ON,      L:OFF
             unsigned char Key3:1;                               //bit 4,    H: ON,      L:OFF
-            unsigned char :3;                                   //bit 5~7,  Reserved
+            unsigned char Ac_Drop;                              //bit 4,    H: Trigger, L:Normal
+			unsigned char :2;                                   //bit 5~7,  Reserved
         }bits;
     }InputDet;
 };

+ 0 - 31
build_rootfs_copy.sh

@@ -1,31 +0,0 @@
-#!/bin/bash
-# Absolute path to this script, e.g. /home/user/bin/foo.sh
-SCRIPT=$(readlink -f "$0")
-
-# Absolute path this script is in, thus /home/user/bin
-SCRIPTPATH=$(dirname "$SCRIPT")
-echo $SCRIPTPATH
-
-ProjectPath="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects"
-
-
-sudo rm /dev/ram*
-sleep 3
-sudo cp -r /mnt/d/Phihong/Project/DD360Audi/Apps/* $ProjectPath/DD360Audi/Apps/
-rm -rf $ProjectPath/DD360/Apps/;
-cp -r $ProjectPath/DD360Audi/Apps/ $ProjectPath/DD360/Apps;
-cp -r $ProjectPath/DD360Audi/ModelNameList.txt  $ProjectPath/DD360/ModelNameList.txt;
-
-#rm -rf $ProjectPath/DD360ComBox/Apps/;
-#cp -r $ProjectPath/DD360Audi/Apps/ $ProjectPath/DD360ComBox/Apps;
-#cp -r $ProjectPath/DD360Audi/ModelNameList.txt $ProjectPath/DD360ComBox/ModelNameList.txt;
-#sudo cp -r /mnt/d/Phihong/Project/DD360Tcci/Apps/* $ProjectPath/DD360Tcci/Apps/
-sudo make DD360-rootfs
-#cp /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360Audi/Images/* /mnt/e/Image/DD360Audi/
-#sudo make DD360Tcci-rootfs
-#cp $ProjectPath/DD360Tcci/Images/* /mnt/d/Image/DD360Tcc/
-#sudo make DD360ComBox-rootfs
-#cp /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360ComBox/Images/* /mnt/e/Image/DD360ComBox/
-#sudo make DD360UCar-rootfs
-#cp /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Projects/DD360UCar/Images/* /mnt/d/Image/DD360UCar/
-