Ver Fonte

[Improve][AW-CCS][Module_InternalComm.c]
2022-06-01 / EASON YANG
Action
1. Improve: Simulation for 3 phases power consumption.

File
1. Module_InternalComm.c
Action 1

FIRMWARE VERSION: B0.62.XX.XXXX.PX

8009 há 2 anos atrás
pai
commit
c0c30237a3
1 ficheiros alterados com 23 adições e 1 exclusões
  1. 23 1
      EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c

+ 23 - 1
EVSE/Projects/AW-CCS/Apps/Module_InternalComm.c

@@ -52,6 +52,9 @@ struct Charger					*ShmCharger;
 uint16_t						stepIndex=21, logIndex;
 long long						tsLast, tsNow, tsPrintLog[2];
 uint64_t						tmpPowerConsumption;
+uint64_t						tmpL1PowerConsumption;
+uint64_t						tmpL2PowerConsumption;
+uint64_t						tmpL3PowerConsumption;
 
 void trim(char *s);
 int mystrcmp(char *p1,char *p2);
@@ -1000,7 +1003,26 @@ unsigned char Query_Power_Consumption(unsigned char fd, unsigned char targetAddr
 
 #else	//SIMULATION
 			tsNow = current_timestamp();
-			tmpPowerConsumption += (uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrent)*((tsNow-tsLast)/360000.0));
+
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				tmpPowerConsumption += ((uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrent)*((tsNow-tsLast)/360000.0)) +
+										(uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltageL2*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrentL2)*((tsNow-tsLast)/360000.0)) +
+										(uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltageL3*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrentL3)*((tsNow-tsLast)/360000.0)));
+
+				tmpL1PowerConsumption += (uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrent)*((tsNow-tsLast)/360000.0));
+				tmpL2PowerConsumption += (uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltageL2*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrentL2)*((tsNow-tsLast)/360000.0));
+				tmpL3PowerConsumption += (uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltageL3*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrentL3)*((tsNow-tsLast)/360000.0));
+
+				Ret_Buf_L1-> power_consumption = tmpL1PowerConsumption;
+				Ret_Buf_L2-> power_consumption = tmpL2PowerConsumption;
+				Ret_Buf_L3-> power_consumption = tmpL3PowerConsumption;
+			}
+			else
+			{
+				tmpPowerConsumption += (uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrent)*((tsNow-tsLast)/360000.0));
+			}
+
 			Ret_Buf_T-> power_consumption = tmpPowerConsumption;
 			tsLast = tsNow;
 #endif	//SIMULATION