Jelajahi Sumber

2021-04-13 / Eason Yang
Action
1. Fixed : Present charging energy accuracy 1000.00-> 10.00
2. Added : Power saving logic for CP state A , B and B1
3. Added : New timer for power saving in CP state B

Files
1. main.c
Action 1
Action 2

2. main.h
Action 3

Image version: D0.49.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N: XXXXXXX
Hardware Version: XXXXXXX

8009 4 tahun lalu
induk
melakukan
3080276e8b
2 mengubah file dengan 26 tambahan dan 6 penghapusan
  1. 25 5
      EVSE/Projects/AW-CCS/Apps/main.c
  2. 1 1
      EVSE/Projects/AW-CCS/Apps/main.h

+ 25 - 5
EVSE/Projects/AW-CCS/Apps/main.c

@@ -2164,15 +2164,15 @@ int presentChargedEnergyUpdate(unsigned char gun_index)
 	if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount==1)
 	{
 		// Resolution: 0.01 kwh
-		ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += (((float)(ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption - ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption_at_start))/1000.0) - presentChargedEnergyTotal(gun_index);
+		ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += (((float)(ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption - ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption_at_start))/10.0) - presentChargedEnergyTotal(gun_index);
 
 	}
 	else
 	{
 		// Resolution: 0.01 kwh
-		ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += ((((float)(ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption_at_start))/1000.0) +
-																				    (((float)(ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption_at_start))/1000.0) +
-																				    (((float)(ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption_at_start))/1000.0))
+		ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += ((((float)(ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption_at_start))/10.0) +
+																				    (((float)(ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption_at_start))/10.0) +
+																				    (((float)(ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption_at_start))/10.0))
 																					- presentChargedEnergyTotal(gun_index);
 	}
 
@@ -3746,12 +3746,31 @@ int main(void)
 			 *	TODO:
 			 *	1. Power saving logic
 			 */
-			if(ShmCharger->gun_info[gun_index].GPIO_Input.Button_Mode_Switch == ON)
+
+			if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
+			{
+				ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]);
+			}
+
+			if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_CHARGING) ||
+			   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_TERMINATING))
 			{
 				ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
 				ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
 				ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
 			}
+			else
+			{
+				if((ShmCharger->gun_info[gun_index].GPIO_Input.Button_Mode_Switch == ON) ||
+				   (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_PREPARING)) &&
+					(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) &&
+					(DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]) < 10000)))
+				{
+					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
+					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
+					ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
+				}
+			}
 
 			if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_LCD]) > TIMEOUT_SPEC_POWERSAVING_LCD)
 			{
@@ -3892,6 +3911,7 @@ int main(void)
 						ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
 						ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
 						ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
+						ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]);
 					}
 
 					if(ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass &&

+ 1 - 1
EVSE/Projects/AW-CCS/Apps/main.h

@@ -219,7 +219,7 @@ enum TIMER_IDX
 	TMR_IDX_POWERSAVING_LCD,
 	TMR_IDX_POWERSAVING_RFID,
 	TMR_IDX_POWERSAVING_METER,
-	TMR_IDX_10,
+	TMR_IDX_POWERSAVING_STATE_B,
 	TMR_IDX_11,
 	TMR_IDX_12,
 	TMR_IDX_13,