|
@@ -350,14 +350,58 @@ void GetAvailableCapCallback(byte address, short maxVol, short minVol, short max
|
|
|
|
|
|
int _groupPower = 0, _groupCurrent = 0;
|
|
|
byte group = FindTargetGroup(address);
|
|
|
+ float _chargingVol = 0, _targetVol = 0;
|
|
|
|
|
|
if (group == 1)
|
|
|
address -= ShmPsuData->PsuGroup[group - 1].GroupPresentPsuQuantity;
|
|
|
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX)
|
|
|
+ {
|
|
|
+ for (byte groupIndex = 0; groupIndex < _gunCount; groupIndex++)
|
|
|
+ {
|
|
|
+ if (chargingInfo[groupIndex]->EvBatteryMaxVoltage > 0)
|
|
|
+ {
|
|
|
+ _chargingVol = chargingInfo[groupIndex]->EvBatteryMaxVoltage;
|
|
|
+ _targetVol = chargingInfo[groupIndex]->EvBatterytargetVoltage;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+// PRINTF_FUNC("group = %d, DeratingChargingCurrent = %f, RealRatingPower = %d \n",
|
|
|
+// group, chargingInfo[group]->DeratingChargingCurrent, chargingInfo[group]->RealRatingPower);
|
|
|
+
|
|
|
if (chargingInfo[group]->DeratingChargingCurrent == 0)
|
|
|
- ShmPsuData->PsuGroup[group].PsuModule[address].AvailableCurrent = PSU_MIN_CUR;
|
|
|
+ {
|
|
|
+ // 在還沒取得真正可輸出的電流前,依照 GFD 階段得到的真正 POWER / 模塊個數 / 車子電池最大電壓
|
|
|
+ if (ShmPsuData->PsuGroup[group].GroupRealOutputPower > 0 && _chargingVol > 0)
|
|
|
+ {
|
|
|
+// printf("GroupRealOutputPower = %d, GroupPresentPsuQuantity = %d\n",
|
|
|
+// ShmPsuData->PsuGroup[group].GroupRealOutputPower,
|
|
|
+// ShmPsuData->PsuGroup[group].GroupPresentPsuQuantity);
|
|
|
+
|
|
|
+ ShmPsuData->PsuGroup[group].PsuModule[address].AvailableCurrent =
|
|
|
+ ((ShmPsuData->PsuGroup[group].GroupRealOutputPower / ShmPsuData->PsuGroup[group].GroupPresentPsuQuantity) * 1000 / (int)_chargingVol) * 10;
|
|
|
+
|
|
|
+// PRINTF_FUNC(" *1* AvailableCurrent = %d \n",
|
|
|
+// ShmPsuData->PsuGroup[group].PsuModule[address].AvailableCurrent);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 注一 : 獲取模塊最大輸出能力 (忽視 Derating 狀態),所以這邊需要限制實際可輸出的電流
|
|
|
+ if (ShmPsuData->PsuGroup[group].PsuModule[address].AvailableCurrent <= 0)
|
|
|
+ ShmPsuData->PsuGroup[group].PsuModule[address].AvailableCurrent = PSU_MIN_CUR;
|
|
|
+
|
|
|
+// PRINTF_FUNC(" *2* group = %d, AvailableCurrent = %d \n",
|
|
|
+// group, ShmPsuData->PsuGroup[group].PsuModule[address].AvailableCurrent);
|
|
|
+ }
|
|
|
+// PRINTF_FUNC("group = %d, address = %d, AvailableCurrent = %d \n",
|
|
|
+// group, address, ShmPsuData->PsuGroup[group].PsuModule[address].AvailableCurrent);
|
|
|
+ }
|
|
|
else
|
|
|
+ {
|
|
|
ShmPsuData->PsuGroup[group].PsuModule[address].AvailableCurrent = maxCur;
|
|
|
+ }
|
|
|
|
|
|
ShmPsuData->PsuGroup[group].PsuModule[address].AvailablePower = totalPow;
|
|
|
// 總和該 Group 的可輸出電流
|
|
@@ -373,7 +417,7 @@ void GetAvailableCapCallback(byte address, short maxVol, short minVol, short max
|
|
|
|
|
|
chargingInfo[group]->MaximumChargingVoltage = maxVol;
|
|
|
|
|
|
- int _power = 0, _current = 0, _ratingcurrent = 0;
|
|
|
+ int _power = 0, _current = 0, _ratingcurrent = 0, _sysRealPower = 0;
|
|
|
bool isGetAllDeratingCurrent = true;
|
|
|
|
|
|
for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
@@ -381,6 +425,7 @@ void GetAvailableCapCallback(byte address, short maxVol, short minVol, short max
|
|
|
_power += ShmPsuData->PsuGroup[index].GroupAvailablePower;
|
|
|
_current += ShmPsuData->PsuGroup[index].GroupAvailableCurrent;
|
|
|
_ratingcurrent += chargingInfo[index]->DeratingChargingCurrent;
|
|
|
+ _sysRealPower += ShmPsuData->PsuGroup[index].GroupRealOutputPower;
|
|
|
if (ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage >= PSU_MIN_VOL &&
|
|
|
chargingInfo[index]->DeratingChargingCurrent == 0)
|
|
|
isGetAllDeratingCurrent = false;
|
|
@@ -388,7 +433,13 @@ void GetAvailableCapCallback(byte address, short maxVol, short minVol, short max
|
|
|
|
|
|
// 如果不是所有群都得到 Derating current,則先不採樣該次的 ratingCurrent
|
|
|
if (!isGetAllDeratingCurrent) _ratingcurrent = 0;
|
|
|
+ // 因應注一,為避免一值改變通知車子電樁最大可輸出電流所做的限制
|
|
|
+ // 而因為 rating value 一般都會小於模塊的最大可輸出電流
|
|
|
+ // 所以如果該值大於在注一所限制的輸出電流,則以此值為主
|
|
|
+ if (_ratingcurrent != 0) _current = _ratingcurrent;
|
|
|
|
|
|
+ //printf("=============== _current ==================== %d \n", _current);
|
|
|
+ //printf("=============== _ratingcurrent ==================== %d \n", _ratingcurrent);
|
|
|
ShmPsuData->SystemAvailableCurrent = _current;
|
|
|
ShmPsuData->SystemAvailablePower = _power;
|
|
|
|
|
@@ -399,6 +450,7 @@ void GetAvailableCapCallback(byte address, short maxVol, short minVol, short max
|
|
|
int halfPow = ShmPsuData->PsuGroup[group].GroupAvailablePower;
|
|
|
int halfCur = ShmPsuData->PsuGroup[group].GroupAvailableCurrent;
|
|
|
int ratingCur = chargingInfo[group]->DeratingChargingCurrent;
|
|
|
+ int gpRealPow = ShmPsuData->PsuGroup[group].GroupRealOutputPower;
|
|
|
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_GET_NEW_CAP &&
|
|
|
ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_RELAY_M_TO_A))
|
|
@@ -427,16 +479,27 @@ void GetAvailableCapCallback(byte address, short maxVol, short minVol, short max
|
|
|
// 2. 智能切換成均充過程
|
|
|
chargingInfo[group]->AvailableChargingCurrent = halfCur;
|
|
|
chargingInfo[group]->AvailableChargingPower = halfPow;
|
|
|
+ chargingInfo[group]->RealRatingPower = gpRealPow;
|
|
|
|
|
|
if(chargingInfo[group]->DeratingChargingCurrent > 0)
|
|
|
{
|
|
|
- chargingInfo[group]->RealRatingPower = (chargingInfo[group]->DeratingChargingCurrent * chargingInfo[group]->PresentChargingVoltage) / 100000;
|
|
|
+ unsigned short _powBuf = 0;
|
|
|
+ _powBuf = ((chargingInfo[group]->DeratingChargingCurrent / 10) * ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage / 10) / 1000; // 單位是 KW
|
|
|
+
|
|
|
+ if (_powBuf > ShmPsuData->PsuGroup[group].GroupRealOutputPower ||
|
|
|
+ chargingInfo[group]->EvBatterytargetVoltage > 0)
|
|
|
+ {
|
|
|
+ ShmPsuData->PsuGroup[group].GroupRealOutputPower = _powBuf;
|
|
|
+// PRINTF_FUNC("group = %d, DeratingChargingCurrent = %f, RealRatingPower = %d \n",
|
|
|
+// group, chargingInfo[group]->DeratingChargingCurrent, chargingInfo[group]->RealRatingPower);
|
|
|
+ }
|
|
|
}
|
|
|
//printf("(Aver.) RealRatingPower = %d \n", chargingInfo[group]->RealRatingPower);
|
|
|
}
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX)
|
|
|
{
|
|
|
+ //PRINTF_FUNC("group = %d, Final = %d \n", group, _current);
|
|
|
GetMaxPowerAndCur(_MAIN_CHARGING_MODE_MAX, _ratingcurrent, &_power, &_current);
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == YES)
|
|
@@ -446,6 +509,7 @@ void GetAvailableCapCallback(byte address, short maxVol, short minVol, short max
|
|
|
chargingInfo[count]->MaximumChargingVoltage = maxVol;
|
|
|
chargingInfo[count]->AvailableChargingCurrent = _current;
|
|
|
chargingInfo[count]->AvailableChargingPower = _power;
|
|
|
+ chargingInfo[count]->RealRatingPower = _sysRealPower;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -453,13 +517,21 @@ void GetAvailableCapCallback(byte address, short maxVol, short minVol, short max
|
|
|
// 如果是最大充,該槍資訊中的輸出能力為各群輸出能力的和
|
|
|
chargingInfo[group]->AvailableChargingCurrent = _current;
|
|
|
chargingInfo[group]->AvailableChargingPower = _power;
|
|
|
+ chargingInfo[group]->RealRatingPower = _sysRealPower;
|
|
|
}
|
|
|
|
|
|
- if(_ratingcurrent > 0)
|
|
|
+ if(chargingInfo[group]->DeratingChargingCurrent > 0)
|
|
|
{
|
|
|
- chargingInfo[group]->RealRatingPower = (_ratingcurrent * chargingInfo[group]->PresentChargingVoltage) / 100000;
|
|
|
+ unsigned short _powBuf = 0;
|
|
|
+ _powBuf = ((chargingInfo[group]->DeratingChargingCurrent / 10) * ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage / 10) / 1000; // 單位是 KW
|
|
|
+
|
|
|
+ if (_powBuf > ShmPsuData->PsuGroup[group].GroupRealOutputPower ||
|
|
|
+ chargingInfo[group]->EvBatterytargetVoltage > 0 ||
|
|
|
+ _targetVol > 0)
|
|
|
+ {
|
|
|
+ ShmPsuData->PsuGroup[group].GroupRealOutputPower = _powBuf;
|
|
|
+ }
|
|
|
}
|
|
|
- //printf("(Max.) RealRatingPower = %d \n", chargingInfo[group]->RealRatingPower);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -637,10 +709,11 @@ void GetIavailableCallback(byte address, unsigned short Iavail, unsigned short V
|
|
|
|
|
|
bool isPass = true;
|
|
|
int totalCur = 0;
|
|
|
+ byte sampleCount = 8;
|
|
|
|
|
|
if (Iavail == 0)
|
|
|
{
|
|
|
- for (byte count = 0; count < 2; count++)
|
|
|
+ for (byte count = 0; count < sampleCount; count++)
|
|
|
{
|
|
|
chargingInfo[group]->SampleChargingCur[count] = Iavail;
|
|
|
}
|
|
@@ -653,7 +726,7 @@ void GetIavailableCallback(byte address, unsigned short Iavail, unsigned short V
|
|
|
totalCur += ShmPsuData->PsuGroup[group].PsuModule[index].IAvailableCurrent;
|
|
|
}
|
|
|
|
|
|
- for (byte count = 0; count < 2; count++)
|
|
|
+ for (byte count = 0; count < sampleCount; count++)
|
|
|
{
|
|
|
if (chargingInfo[group]->SampleChargingCur[count] == 0)
|
|
|
{
|
|
@@ -674,106 +747,223 @@ void GetIavailableCallback(byte address, unsigned short Iavail, unsigned short V
|
|
|
|
|
|
if (isPass)
|
|
|
{
|
|
|
- //PRINTF_FUNC("rating pass value = %d \n", totalCur);
|
|
|
+// if (totalCur != 0)
|
|
|
+// PRINTF_FUNC("group = %d, rating pass value = %d \n", group, totalCur);
|
|
|
+
|
|
|
chargingInfo[group]->DeratingChargingCurrent = totalCur;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//==========================================
|
|
|
-// 特規用指令
|
|
|
-//==========================================
|
|
|
-void GetOutputAndTempCallback(byte address, unsigned short outputVol_s,
|
|
|
- unsigned short outputCur_s, unsigned short outputPower, unsigned char Temperature)
|
|
|
+void GetPresentOutputFCallback(byte group, float outVol, float outCur)
|
|
|
{
|
|
|
- if (ShmPsuData->Work_Step < GET_SYS_CAP)
|
|
|
- return;
|
|
|
-
|
|
|
- unsigned short outVol = outputVol_s;
|
|
|
- unsigned short outCur = outputCur_s;
|
|
|
-
|
|
|
- if (IsOverModuleCount(address))
|
|
|
- return;
|
|
|
+ // isinf : -1 = 負無窮,1 = 正無窮,0 = 其他
|
|
|
+ if (isinf(outVol) == 0)
|
|
|
+ ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage = (unsigned short)(outVol * 10);
|
|
|
+ else
|
|
|
+ ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage = 0;
|
|
|
|
|
|
- byte group = FindTargetGroup(address);
|
|
|
+ if (isinf(outCur) == 0)
|
|
|
+ ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent = (unsigned short)(outCur * 10);
|
|
|
+ else
|
|
|
+ ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent = 0;
|
|
|
|
|
|
- if (group == 1)
|
|
|
- address -= ShmPsuData->PsuGroup[group - 1].GroupPresentPsuQuantity;
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX ||
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_AVER &&
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_WAITING &&
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_COMP))
|
|
|
+ )
|
|
|
+ {
|
|
|
+ unsigned short outputVol = 0;
|
|
|
+ unsigned short outputCur = 0;
|
|
|
+ unsigned char _maxTOaver = 0;
|
|
|
|
|
|
- // PSU Group - 電壓
|
|
|
- ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage = outVol;
|
|
|
- // PSU Group - 電流
|
|
|
- ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent = outCur;
|
|
|
+ for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
+ {
|
|
|
+ bool needtoAdd = true;
|
|
|
|
|
|
- if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX ||
|
|
|
- (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_AVER &&
|
|
|
- (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_WAITING &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_COMP))
|
|
|
- )
|
|
|
- {
|
|
|
- unsigned short outputVol = 0;
|
|
|
- unsigned short outputCur = 0;
|
|
|
+ if (ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage > outputVol)
|
|
|
+ outputVol = ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage;
|
|
|
|
|
|
- for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
- {
|
|
|
- bool needtoAdd = true;
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_ADJUST_M_TO_A &&
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_RELAY_M_TO_A)
|
|
|
+ {
|
|
|
+ if (chargingInfo[index]->DividChargingCurrent == 0)
|
|
|
+ needtoAdd = false;
|
|
|
+ else
|
|
|
+ _maxTOaver = index;
|
|
|
+ }
|
|
|
|
|
|
- if (ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage > outputVol)
|
|
|
- outputVol = ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage;
|
|
|
+ if (needtoAdd)
|
|
|
+ outputCur += ShmPsuData->PsuGroup[index].GroupPresentOutputCurrent;
|
|
|
+ }
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_ADJUST_M_TO_A &&
|
|
|
ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_RELAY_M_TO_A)
|
|
|
{
|
|
|
- if (chargingInfo[index]->DividChargingCurrent == 0)
|
|
|
- needtoAdd = false;
|
|
|
+ if (chargingInfo[_maxTOaver]->DividChargingCurrent != 0)
|
|
|
+ {
|
|
|
+ float _cur_buf = outputCur;
|
|
|
+ _cur_buf /= 10;
|
|
|
+ chargingInfo[_maxTOaver]->PresentChargingCurrent = _cur_buf;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (needtoAdd)
|
|
|
- outputCur += ShmPsuData->PsuGroup[index].GroupPresentOutputCurrent;
|
|
|
- }
|
|
|
+ // 黑白機
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == YES)
|
|
|
+ {
|
|
|
+ for (byte count = 0; count < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; count++)
|
|
|
+ {
|
|
|
+ float _vol_buf = outputVol;
|
|
|
+ float _cur_buf = outputCur;
|
|
|
|
|
|
- // 黑白機
|
|
|
- if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == YES)
|
|
|
- {
|
|
|
- for (byte count = 0; count < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; count++)
|
|
|
+ // EVSE - 電壓
|
|
|
+ _vol_buf /= 10;
|
|
|
+ chargingInfo[count]->PresentChargingVoltage = _vol_buf;
|
|
|
+
|
|
|
+ _cur_buf /= 10;
|
|
|
+ chargingInfo[count]->PresentChargingCurrent = _cur_buf;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((chargingInfo[group]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[group]->SystemStatus <= S_COMPLETE) ||
|
|
|
+ (chargingInfo[group]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[group]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
{
|
|
|
float _vol_buf = outputVol;
|
|
|
float _cur_buf = outputCur;
|
|
|
|
|
|
// EVSE - 電壓
|
|
|
_vol_buf /= 10;
|
|
|
- chargingInfo[count]->PresentChargingVoltage = _vol_buf;
|
|
|
- // EVSE - 電流
|
|
|
+ chargingInfo[group]->PresentChargingVoltage = _vol_buf;
|
|
|
+
|
|
|
_cur_buf /= 10;
|
|
|
- chargingInfo[count]->PresentChargingCurrent = _cur_buf;
|
|
|
+ chargingInfo[group]->PresentChargingCurrent = _cur_buf;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if ((chargingInfo[group]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[group]->SystemStatus <= S_COMPLETE) ||
|
|
|
- (chargingInfo[group]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[group]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
+ else
|
|
|
{
|
|
|
- float _vol_buf = outputVol;
|
|
|
- float _cur_buf = outputCur;
|
|
|
+ float _vol_buf = ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage;
|
|
|
+ float _cur_buf = ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent;
|
|
|
|
|
|
// EVSE - 電壓
|
|
|
_vol_buf /= 10;
|
|
|
chargingInfo[group]->PresentChargingVoltage = _vol_buf;
|
|
|
- // EVSE - 電流
|
|
|
+
|
|
|
_cur_buf /= 10;
|
|
|
chargingInfo[group]->PresentChargingCurrent = _cur_buf;
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- float _vol_buf = ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage;
|
|
|
- float _cur_buf = ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent;
|
|
|
-
|
|
|
- // EVSE - 電壓
|
|
|
- _vol_buf /= 10;
|
|
|
- chargingInfo[group]->PresentChargingVoltage = _vol_buf;
|
|
|
- // EVSE - 電流
|
|
|
- _cur_buf /= 10;
|
|
|
- chargingInfo[group]->PresentChargingCurrent = _cur_buf;
|
|
|
- }
|
|
|
+}
|
|
|
+
|
|
|
+//==========================================
|
|
|
+// 特規用指令
|
|
|
+//==========================================
|
|
|
+void GetOutputAndTempCallback(byte address, unsigned short outputVol_s,
|
|
|
+ unsigned short outputCur_s, unsigned short outputPower, unsigned char Temperature)
|
|
|
+{
|
|
|
+ if (ShmPsuData->Work_Step < GET_SYS_CAP)
|
|
|
+ return;
|
|
|
+
|
|
|
+ //unsigned short outVol = outputVol_s;
|
|
|
+ //unsigned short outCur = outputCur_s;
|
|
|
+
|
|
|
+ if (IsOverModuleCount(address))
|
|
|
+ return;
|
|
|
+
|
|
|
+ byte group = FindTargetGroup(address);
|
|
|
+
|
|
|
+ if (group == 1)
|
|
|
+ address -= ShmPsuData->PsuGroup[group - 1].GroupPresentPsuQuantity;
|
|
|
+
|
|
|
+// // PSU Group - 電壓
|
|
|
+// ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage = outVol;
|
|
|
+// // PSU Group - 電流
|
|
|
+// ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent = outCur;
|
|
|
+// // PSU Group - 能量
|
|
|
+// ShmPsuData->PsuGroup[group].GroupPresentOutputPower = outVol * outCur;
|
|
|
+//
|
|
|
+// if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX ||
|
|
|
+// (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_AVER &&
|
|
|
+// (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_WAITING &&
|
|
|
+// ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_COMP))
|
|
|
+// )
|
|
|
+// {
|
|
|
+// unsigned short outputVol = 0;
|
|
|
+// unsigned short outputCur = 0;
|
|
|
+// unsigned char _maxTOaver = 0;
|
|
|
+//
|
|
|
+// for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
+// {
|
|
|
+// bool needtoAdd = true;
|
|
|
+//
|
|
|
+// if (ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage > outputVol)
|
|
|
+// outputVol = ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage;
|
|
|
+//
|
|
|
+//// if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_ADJUST_M_TO_A &&
|
|
|
+//// ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_RELAY_M_TO_A)
|
|
|
+//// {
|
|
|
+//// if (chargingInfo[index]->DividChargingCurrent == 0)
|
|
|
+//// needtoAdd = false;
|
|
|
+//// else
|
|
|
+//// _maxTOaver = index;
|
|
|
+//// }
|
|
|
+//
|
|
|
+// if (needtoAdd)
|
|
|
+// outputCur += ShmPsuData->PsuGroup[index].GroupPresentOutputCurrent;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_ADJUST_M_TO_A &&
|
|
|
+// ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_RELAY_M_TO_A)
|
|
|
+// {
|
|
|
+// if (chargingInfo[_maxTOaver]->DividChargingCurrent != 0)
|
|
|
+// {
|
|
|
+// float _cur_buf = outputCur;
|
|
|
+// _cur_buf /= 10;
|
|
|
+// chargingInfo[_maxTOaver]->PresentChargingCurrent = _cur_buf;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 黑白機
|
|
|
+// if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == YES)
|
|
|
+// {
|
|
|
+// for (byte count = 0; count < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; count++)
|
|
|
+// {
|
|
|
+// float _vol_buf = outputVol;
|
|
|
+// float _cur_buf = outputCur;
|
|
|
+//
|
|
|
+// // EVSE - 電壓
|
|
|
+// _vol_buf /= 10;
|
|
|
+// chargingInfo[count]->PresentChargingVoltage = _vol_buf;
|
|
|
+//
|
|
|
+// _cur_buf /= 10;
|
|
|
+// chargingInfo[count]->PresentChargingCurrent = _cur_buf;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if ((chargingInfo[group]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[group]->SystemStatus <= S_COMPLETE) ||
|
|
|
+// (chargingInfo[group]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[group]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
+// {
|
|
|
+// float _vol_buf = outputVol;
|
|
|
+// float _cur_buf = outputCur;
|
|
|
+//
|
|
|
+// // EVSE - 電壓
|
|
|
+// _vol_buf /= 10;
|
|
|
+// chargingInfo[group]->PresentChargingVoltage = _vol_buf;
|
|
|
+//
|
|
|
+// _cur_buf /= 10;
|
|
|
+// chargingInfo[group]->PresentChargingCurrent = _cur_buf;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// float _vol_buf = ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage;
|
|
|
+// float _cur_buf = ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent;
|
|
|
+//
|
|
|
+// // EVSE - 電壓
|
|
|
+// _vol_buf /= 10;
|
|
|
+// chargingInfo[group]->PresentChargingVoltage = _vol_buf;
|
|
|
+//
|
|
|
+// _cur_buf /= 10;
|
|
|
+// chargingInfo[group]->PresentChargingCurrent = _cur_buf;
|
|
|
+// }
|
|
|
|
|
|
ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp1 = Temperature;
|
|
|
ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp2 = Temperature;
|
|
@@ -953,6 +1143,8 @@ void Initialization()
|
|
|
count = 1;
|
|
|
else if (strcmp(EvsePower, "60") == EQUAL)
|
|
|
count = 2;
|
|
|
+ else if (strcmp(EvsePower, "12") == EQUAL)
|
|
|
+ count = 4;
|
|
|
else if (strcmp(EvsePower, "18") == EQUAL)
|
|
|
count = 6;
|
|
|
else if (strcmp(EvsePower, "36") == EQUAL)
|
|
@@ -1074,6 +1266,7 @@ int main(void)
|
|
|
RefreshGetOutput(&GetPresentOutputCallback);
|
|
|
RefreshFanInfo(&GetFanSpeedCallback);
|
|
|
RefreshIavailable(&GetIavailableCallback);
|
|
|
+ RefreshGetOutputF(&GetPresentOutputFCallback);
|
|
|
|
|
|
// GetPresentOutputCallback & GetStatusCallback
|
|
|
AutoMode_RefreshOutputAndTemp(&GetOutputAndTempCallback);
|
|
@@ -1138,8 +1331,6 @@ int main(void)
|
|
|
|
|
|
if (time > 2000)
|
|
|
{
|
|
|
- PRINTF_FUNC("== PSU == indexCount = %d, moduleCount = %d, sysCount = %d\n",
|
|
|
- ShmPsuData->GroupCount, moduleCount, ShmPsuData->SystemPresentPsuQuantity);
|
|
|
// if (ShmPsuData->GroupCount == 0)
|
|
|
// ShmPsuData->GroupCount = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
|
|
|
// 分別取各群模組數量
|
|
@@ -1151,6 +1342,8 @@ int main(void)
|
|
|
// 取各群模組數量
|
|
|
GetModuleCount(index);
|
|
|
}
|
|
|
+ PRINTF_FUNC("== PSU == indexCount = %d, moduleCount = %d, sysCount = %d\n",
|
|
|
+ ShmPsuData->GroupCount, moduleCount, ShmPsuData->SystemPresentPsuQuantity);
|
|
|
|
|
|
// 發送取得目前全部模組數量
|
|
|
GetModuleCount(SYSTEM_CMD);
|
|
@@ -1175,7 +1368,6 @@ int main(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- _getCapDelayCount = 7;
|
|
|
gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
}
|
|
|
}
|
|
@@ -1186,30 +1378,42 @@ int main(void)
|
|
|
|
|
|
if (time > 1000)
|
|
|
{
|
|
|
- for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
+ bool isFinish = true;
|
|
|
+ for (byte psuCount = 0; psuCount < ShmPsuData->SystemPresentPsuQuantity; psuCount++)
|
|
|
{
|
|
|
- // Pooling Status
|
|
|
- //GetStatus(index);
|
|
|
+ if (strcmp((char *)ShmPsuData->PsuVersion[psuCount].FwPrimaryVersion, "") == EQUAL ||
|
|
|
+ ShmPsuData->SystemAvailablePower <= 0 || ShmPsuData->SystemAvailableCurrent <= 0)
|
|
|
+ {
|
|
|
+ isFinish = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- // 取系統總輸出能力
|
|
|
- GetModuleCap(index);
|
|
|
+ if (!isFinish)
|
|
|
+ {
|
|
|
+ for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
+ {
|
|
|
+ // Pooling Status
|
|
|
+ //GetStatus(index);
|
|
|
|
|
|
- // 取版號
|
|
|
- GetModuleVer(index);
|
|
|
- }
|
|
|
- _getCapDelayCount--;
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
- }
|
|
|
+ // 取系統總輸出能力
|
|
|
+ GetModuleCap(index);
|
|
|
|
|
|
- // 判斷系統輸出額定功率與電流
|
|
|
- if (ShmPsuData->SystemAvailablePower > 0 && ShmPsuData->SystemAvailableCurrent > 0 &&
|
|
|
- _getCapDelayCount <= 0)
|
|
|
- {
|
|
|
- PRINTF_FUNC("SystemAvailableCurrent = %d, SystemAvailablePower = %d \n",
|
|
|
+ // 取版號
|
|
|
+ GetModuleVer(index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 判斷系統輸出額定功率與電流
|
|
|
+ PRINTF_FUNC("SystemAvailableCurrent = %d, SystemAvailablePower = %d \n",
|
|
|
ShmPsuData->SystemAvailableCurrent, ShmPsuData->SystemAvailablePower);
|
|
|
|
|
|
- PRINTF_FUNC("== PSU == BOOTING_COMPLETE \n");
|
|
|
- ShmPsuData->Work_Step = BOOTING_COMPLETE;
|
|
|
+ PRINTF_FUNC("== PSU == BOOTING_COMPLETE \n");
|
|
|
+ ShmPsuData->Work_Step = BOOTING_COMPLETE;
|
|
|
+ }
|
|
|
+
|
|
|
+ gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -1247,7 +1451,7 @@ int main(void)
|
|
|
//GetStatus(index);
|
|
|
|
|
|
// 取得模塊輸出額定電流能力
|
|
|
- GetModuleIavailable(index);
|
|
|
+ //GetModuleIavailable(index);
|
|
|
|
|
|
if (chargingInfo[index]->SystemStatus == S_CHARGING)
|
|
|
{
|
|
@@ -1301,12 +1505,18 @@ int main(void)
|
|
|
// 取系統總輸出能力
|
|
|
GetModuleCap(groupIndex);
|
|
|
|
|
|
+ // 取各群輸出電壓電流 (float)
|
|
|
+ GetModuleOutputF(groupIndex);
|
|
|
+
|
|
|
+ // 取得模塊輸出額定電流能力
|
|
|
+ GetModuleIavailable(groupIndex);
|
|
|
+
|
|
|
// 針對各槍當前狀態,傳送需要回傳的資料指令
|
|
|
if (((chargingInfo[groupIndex]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[groupIndex]->SystemStatus <= S_CHARGING) && chargingInfo[groupIndex]->RelayK1K2Status) ||
|
|
|
(chargingInfo[groupIndex]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[groupIndex]->SystemStatus <= S_CHARGING && chargingInfo[groupIndex]->Type == _Type_GB) ||
|
|
|
(chargingInfo[groupIndex]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[groupIndex]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
{
|
|
|
- if (time > 1500)
|
|
|
+ //if (time > 1000)
|
|
|
{
|
|
|
if (chargingInfo[groupIndex]->FireChargingVoltage > 0 &&
|
|
|
evseOutVol != (chargingInfo[groupIndex]->FireChargingVoltage / 10))
|
|
@@ -1321,7 +1531,7 @@ int main(void)
|
|
|
evseOutCur != (chargingInfo[groupIndex]->PresentChargingCurrent * 10))
|
|
|
{
|
|
|
evseOutCur = (chargingInfo[groupIndex]->PresentChargingCurrent * 10);
|
|
|
- PRINTF_FUNC("groupIndex = %d, evse output cur = %f \n", groupIndex,
|
|
|
+ PRINTF_FUNC("groupIndex = %d, ev need cur = %f, evse output cur = %f \n", groupIndex,
|
|
|
(chargingInfo[groupIndex]->EvBatterytargetCurrent * 10),
|
|
|
(chargingInfo[groupIndex]->PresentChargingCurrent * 10));
|
|
|
}
|
|
@@ -1351,6 +1561,7 @@ int main(void)
|
|
|
else
|
|
|
{
|
|
|
chargingInfo[groupIndex]->DividChargingCurrent = 0;
|
|
|
+ chargingInfo[groupIndex]->MaxChargingToAverPassFlag = 0;
|
|
|
}
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag == _REASSIGNED_GET_NEW_CAP)
|
|
@@ -1459,8 +1670,10 @@ int main(void)
|
|
|
|
|
|
if (reassignIndex != ELEMENT_NOT_FIND)
|
|
|
{
|
|
|
- if ((GetTimeoutValue(_derating_time) / 1000) <= 50)
|
|
|
+ if ((GetTimeoutValue(_derating_time) / 1000) <= 50 ||
|
|
|
+ chargingInfo[groupIndex]->MaxChargingToAverPassFlag == 0)
|
|
|
{
|
|
|
+ chargingInfo[groupIndex]->MaxChargingToAverPassFlag = 1;
|
|
|
// A 模塊維持當前電壓電流
|
|
|
//PRINTF_FUNC("A : index = %d, cur = %d \n", groupIndex, ShmPsuData->PsuGroup[groupIndex].GroupPresentOutputCurrent);
|
|
|
//PresentOutputVol(groupIndex, targetVol, ShmPsuData->PsuGroup[groupIndex].GroupPresentOutputCurrent);
|
|
@@ -1505,7 +1718,7 @@ int main(void)
|
|
|
(chargingInfo[groupIndex]->EvBatterytargetVoltage * 10),
|
|
|
(chargingInfo[groupIndex]->EvBatterytargetCurrent * 10));
|
|
|
}
|
|
|
- else
|
|
|
+ else if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX)
|
|
|
{
|
|
|
// PRINTF_FUNC("set out (sys) value = %f, smart step = %d******** 4 \n",
|
|
|
// chargingInfo[groupIndex]->EvBatterytargetCurrent, ShmSysConfigAndInfo->SysInfo.ReAssignedFlag);
|
|
@@ -1866,6 +2079,9 @@ int main(void)
|
|
|
{
|
|
|
// 取系統總輸出能力
|
|
|
GetModuleCap(index);
|
|
|
+
|
|
|
+ // 取各群輸出電壓電流 (float)
|
|
|
+ GetModuleOutputF(index);
|
|
|
}
|
|
|
|
|
|
gettimeofday(&_cmdSubPriority_time, NULL);
|
|
@@ -1880,7 +2096,7 @@ int main(void)
|
|
|
SetDirModulePresentOutput(connector_1[_groupCount_1],
|
|
|
(chargingInfo[0]->EvBatterytargetVoltage * 10),
|
|
|
(chargingInfo[0]->EvBatterytargetCurrent * 10),
|
|
|
- _switch);
|
|
|
+ _switch, _switch);
|
|
|
}
|
|
|
|
|
|
for (byte _groupCount_2 = 0; _groupCount_2 < conn_2_count; _groupCount_2++)
|
|
@@ -1888,7 +2104,7 @@ int main(void)
|
|
|
SetDirModulePresentOutput(connector_2[_groupCount_2],
|
|
|
(chargingInfo[0]->EvBatterytargetVoltage * 10),
|
|
|
(chargingInfo[0]->EvBatterytargetCurrent * 10),
|
|
|
- _switch);
|
|
|
+ _switch, _switch);
|
|
|
}
|
|
|
}
|
|
|
break;
|