|
@@ -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
|