|
@@ -833,7 +833,7 @@ void GetOrClearId(char *v1)
|
|
|
printf("Card Number = %s \n", _chargingData[_index]->StartUserId);
|
|
|
}
|
|
|
|
|
|
-void FwUpdateFlagProc()
|
|
|
+void FwUpdateFlagProc(char *inputCmd, unsigned int opt)
|
|
|
{
|
|
|
ShmSysConfigAndInfo->SysInfo.FirmwareUpdate = 0x01;
|
|
|
}
|
|
@@ -1034,20 +1034,23 @@ void GetTemperature(char *inputCmd, unsigned int opt)
|
|
|
|
|
|
if(_chargingData[i]->ConnectorTemp != 0 && _chargingData[i]->ConnectorTemp != 0xFF)
|
|
|
{
|
|
|
- sprintf(strGunTemp, "%3d", _chargingData[i]->ConnectorTemp - 60);
|
|
|
+ int _connectorTemp = (int)_chargingData[i]->ConnectorTemp - 60;
|
|
|
+ sprintf(strGunTemp, "%3d", _connectorTemp);
|
|
|
}
|
|
|
if(_chargingData[i]->ChillerTemp != 0 && _chargingData[i]->ChillerTemp != 0xFF)
|
|
|
{
|
|
|
- sprintf(strChillerTemp, "%3d", _chargingData[i]->ChillerTemp - 60);
|
|
|
+ int _chillerTemp = (int)_chargingData[i]->ChillerTemp - 60;
|
|
|
+ sprintf(strChillerTemp, "%3d", _chillerTemp);
|
|
|
}
|
|
|
printf(" %d %s %s ", i + 1, strGunTemp, strChillerTemp);
|
|
|
|
|
|
for(int j = 0; j < ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity; j++)
|
|
|
{
|
|
|
- printf(" %3d/%3d/%3d",
|
|
|
- ShmPsuData->PsuGroup[i].PsuModule[j].ExletTemp,
|
|
|
- ShmPsuData->PsuGroup[i].PsuModule[j].InletTemp,
|
|
|
- ShmPsuData->PsuGroup[i].PsuModule[j].CriticalTemp1);
|
|
|
+ int ExletTemp = (int)ShmPsuData->PsuGroup[i].PsuModule[j].ExletTemp - 60;
|
|
|
+ int InletTemp = (int)ShmPsuData->PsuGroup[i].PsuModule[j].InletTemp - 60;
|
|
|
+ int CriticalTemp1 = (int)ShmPsuData->PsuGroup[i].PsuModule[j].CriticalTemp1 - 60;
|
|
|
+
|
|
|
+ printf(" %3d/%3d/%3d", ExletTemp, InletTemp, CriticalTemp1);
|
|
|
}
|
|
|
printf("\r\n");
|
|
|
}
|
|
@@ -1113,91 +1116,6 @@ void GetInputVol(char *inputCmd, unsigned int opt)
|
|
|
printf("\r\n");
|
|
|
}
|
|
|
|
|
|
-void GetPsuInformation(char *v1, char *v2, char *v3)
|
|
|
-{
|
|
|
- printf("**********************AC Contact needed*************************\n");
|
|
|
- if(strcmp(v1, "count") == 0)
|
|
|
- {
|
|
|
- for (int i = 0; i < 4; i++)
|
|
|
- {
|
|
|
- printf("Group Index = %d, Module Count = %d \n", i, ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity);
|
|
|
- }
|
|
|
- }
|
|
|
- else if(strcmp(v1, "ver") == 0)
|
|
|
- {
|
|
|
- for (int i = 0; i < ShmPsuData->SystemInitialPsuQuantity; i++)
|
|
|
- {
|
|
|
- printf("Psu Index = %d, PriVersion = %s, SecVersion = %s \n",
|
|
|
- i, ShmPsuData->PsuVersion[i].FwPrimaryVersion, ShmPsuData->PsuVersion[i].FwSecondVersion);
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < ShmPsuData->GroupCount; i++)
|
|
|
- {
|
|
|
- for (int j = 0; j < ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity; j++)
|
|
|
- {
|
|
|
- printf("Group Index = %d, Psu Index = %d, Version = %s \n",
|
|
|
- i, j, ShmPsuData->PsuGroup[i].PsuModule[j].FwVersion);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else if(strcmp(v1, "cap") == 0)
|
|
|
- {
|
|
|
- for (int i = 0; i < ShmPsuData->GroupCount; i++)
|
|
|
- {
|
|
|
- printf("Group Index = %d, MaxCur = %d, Power = %d \n",
|
|
|
- i, ShmPsuData->PsuGroup[i].GroupAvailableCurrent, ShmPsuData->PsuGroup[i].GroupAvailablePower);
|
|
|
- }
|
|
|
- }
|
|
|
- else if(strcmp(v1, "input") == 0)
|
|
|
- {
|
|
|
- for (int i = 0; i < ShmPsuData->GroupCount; i++)
|
|
|
- {
|
|
|
- for (byte count = 0; count < ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity; count++)
|
|
|
- {
|
|
|
- printf("gp = %d, Index = %d, volR = %d, volS = %d, volT = %d \n",
|
|
|
- i, count,
|
|
|
- ShmPsuData->PsuGroup[i].PsuModule[count].InputVoltageL1,
|
|
|
- ShmPsuData->PsuGroup[i].PsuModule[count].InputVoltageL2,
|
|
|
- ShmPsuData->PsuGroup[i].PsuModule[count].InputVoltageL3);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else if (strcmp(v1, "output") == 0)
|
|
|
- {
|
|
|
- for (int i = 0; i < ShmPsuData->GroupCount; i++)
|
|
|
- {
|
|
|
- printf("Group Index = %d, OutputV = %d, OutputC = %d \n",
|
|
|
- i, ShmPsuData->PsuGroup[i].GroupPresentOutputVoltage, ShmPsuData->PsuGroup[i].GroupPresentOutputCurrent);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (strcmp(v1, "test") == 0)
|
|
|
- {
|
|
|
- int mode = atoi(v2);
|
|
|
-
|
|
|
- if (mode >= _TEST_MODE && mode <= _TEST_MODE)
|
|
|
- {
|
|
|
- ShmPsuData->Work_Step = mode;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (strcmp(v1, "out") == 0)
|
|
|
- {
|
|
|
- float vol = atof(v2);
|
|
|
- float cur = atof(v3);
|
|
|
-
|
|
|
- if (ShmPsuData->Work_Step >= _TEST_MODE && ShmPsuData->Work_Step <= _TEST_MODE)
|
|
|
- {
|
|
|
- if (!FindChargingInfoData(0, &_chargingData[0]))
|
|
|
- {
|
|
|
- printf ("FindChargingInfoData error\n");
|
|
|
- return;
|
|
|
- }
|
|
|
- _chargingData[0]->EvBatterytargetVoltage = vol;
|
|
|
- _chargingData[0]->EvBatterytargetCurrent = cur;
|
|
|
- }
|
|
|
- }
|
|
|
- printf("*************************************************\n");
|
|
|
-}
|
|
|
-
|
|
|
void GetConnectorCapInfo(char *v1)
|
|
|
{
|
|
|
int _GunIndex = atoi(v1);
|
|
@@ -2732,6 +2650,7 @@ void EraseWhiteCard(char *v1)
|
|
|
|
|
|
// MaxChargingProfile: %s
|
|
|
// Offline MaxPower: %s
|
|
|
+// LocalPowerSharing: %s
|
|
|
// Max Total Power: XXXX kW, Total Current: XXXX A, MaxSoc: XXX %
|
|
|
// Total Energy: XXXX kWh, Duration: XXXX Minute(s)
|
|
|
void ShowMaxLimit(void)
|
|
@@ -2761,6 +2680,24 @@ void ShowMaxLimit(void)
|
|
|
}
|
|
|
printf(" Offline MaxPower: %s\r\n", tempString);
|
|
|
//************************************************************************************************
|
|
|
+ memset(tempString, 0x00, sizeof(tempString));
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing == _SYS_POWER_SHARING_MODE_DISABLE)
|
|
|
+ {
|
|
|
+ sprintf(tempString, " %s", "Disable");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing == _SYS_POWER_SHARING_MODE_MASTER)
|
|
|
+ {
|
|
|
+ sprintf(tempString, " %s, PowerSharingPower: %d W", "Master", ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf(tempString, " %s", "Slave");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ printf(" LocalPowerSharing: %s\r\n", tempString);
|
|
|
+ //************************************************************************************************
|
|
|
printf(" Max Total Power: %4d kW, Total Current: %4d A, MaxSoc: %3d %%\r\n",
|
|
|
ShmSysConfigAndInfo->SysConfig.MaxChargingPower,
|
|
|
ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent,
|
|
@@ -2774,9 +2711,8 @@ void ShowGunLimit(int gun_index)
|
|
|
{
|
|
|
char *str_gun_type[] = {STR_GUN_TYPE_CHADEMO, STR_GUN_TYPE_CCS, STR_GUN_TYPE_GBT};
|
|
|
|
|
|
- // Gun Enable Type Psu Phy_Vol Phy_Cur Config_Ocpp_MaxOcpp_Pow Config_Ocpp_MaxOcpp_Cur
|
|
|
- // 1 0 CHAdeMO 00 0000 V 0000 A 0000 / 0000 / 0000 kW 0000 / 0000 A
|
|
|
- // Gun 1 Enable, Type: CCS, Psu Cnt: 00, Max Physical Vol: 0000 V, Cur: 0000 A, Max Config Pow: 0000 kW, Cur: 0000 A
|
|
|
+ // Gun Enable Type Psu Phy_Vol Phy_Cur Config_Ocpp_MaxOcpp_Pow Config_Ocpp_MaxOcpp_Cur LocalPowerSharing
|
|
|
+ // 1 0 CHAdeMO 00 0000 V 0000 A 0000 / 0000 / 0000 kW 0000 / 0000 A 0000 >> 0000 A
|
|
|
printf(" %d %d ", gun_index + 1, ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].Enable);
|
|
|
if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].Enable)
|
|
|
{
|
|
@@ -2795,6 +2731,8 @@ void ShowGunLimit(int gun_index)
|
|
|
printf(" %4d / %4d A",
|
|
|
((int)ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxTotalChargingCurrent / 10),
|
|
|
_chargingData[gun_index]->ChargingProfileCurrent == -1 ? (int)_chargingData[gun_index]->ChargingProfileCurrent : ((int)_chargingData[gun_index]->ChargingProfileCurrent / 10));
|
|
|
+
|
|
|
+ printf(" %4d >> %4d A", ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent[gun_index], (int)_chargingData[gun_index]->LocalPowerLimitCurrent);
|
|
|
}
|
|
|
printf("\r\n");
|
|
|
}
|
|
@@ -2820,13 +2758,13 @@ void ShowChargerLimit(char *inputCmd, unsigned int opt)
|
|
|
{
|
|
|
if(reflash)
|
|
|
{
|
|
|
- ConsoleReflash(1, 6);
|
|
|
+ ConsoleReflash(1, 7);
|
|
|
ConsoleReflash(CONNECTOR_QUANTITY, 1);
|
|
|
}
|
|
|
|
|
|
ShowMaxLimit();
|
|
|
printf("\r\n");
|
|
|
- printf(" Gun Enable Type Psu Phy_Vol Phy_Cur Config_Ocpp_MaxOcpp_Pow Config_Ocpp_MaxOcpp_Cur\r\n");
|
|
|
+ printf(" Gun Enable Type Psu Phy_Vol Phy_Cur Config_Ocpp_MaxOcpp_Pow Config_Ocpp_MaxOcpp_Cur LocalPowerSharing\r\n");
|
|
|
for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
|
|
|
{
|
|
|
ShowGunLimit(i);
|
|
@@ -5029,6 +4967,541 @@ void ShowPrice(char *inputCmd, unsigned int opt)
|
|
|
printf("\r\n");
|
|
|
}
|
|
|
|
|
|
+void SetOccupancyNotifyDisplay(char *inputCmd)
|
|
|
+{
|
|
|
+ int gun = 0;
|
|
|
+ float fee = 0;
|
|
|
+ int totalCnt = 0;
|
|
|
+
|
|
|
+ char *str_occupancy_status[] = {STR_NO_OCCUPANCY, STR_SYNC_OCCUPANCY, STR_OCCUPIED, STR_REQUEST_FEE, STR_WAIT_TO_PAY, STR_PAID_ONLINE_OK, STR_PAID_ONLINE_FAIL};
|
|
|
+ char _sn[37];
|
|
|
+ char cmdBuf[32];
|
|
|
+ struct timeb nowTime;
|
|
|
+ struct tm *tm;
|
|
|
+
|
|
|
+ memset(_sn, 0x00, sizeof(_sn));
|
|
|
+
|
|
|
+ totalCnt = GetSubCommand(inputCmd);
|
|
|
+
|
|
|
+ if(totalCnt == 3)
|
|
|
+ {
|
|
|
+ gun = atoi(&MultiSubCmd[0][0]);
|
|
|
+ if(gun <= 0 || gun > GENERAL_GUN_QUANTITY)
|
|
|
+ {
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Gun [%s] out of range\r\n\r\n", &MultiSubCmd[0][0]);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ strncpy(_sn, &MultiSubCmd[1][0], strlen(&MultiSubCmd[1][0]) >= (sizeof(_sn) - 1) ? (sizeof(_sn) - 1) : strlen(&MultiSubCmd[1][0]));
|
|
|
+
|
|
|
+ fee = atof(&MultiSubCmd[2][0]);
|
|
|
+ if(fee <= 0)
|
|
|
+ {
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Fee [%s] out of range\r\n\r\n", &MultiSubCmd[2][0]);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmChargerInfo->AllBill.OccupancyInfo[gun - 1].Status = _Parking_Occupied;
|
|
|
+ memcpy(ShmChargerInfo->AllBill.OccupancyInfo[gun - 1].OccupancyBill.Sn, _sn, sizeof(_sn));
|
|
|
+ ShmChargerInfo->AllBill.OccupancyInfo[gun - 1].OccupancyBill.Fee = fee;
|
|
|
+ ShmChargerInfo->AllBill.OccupancyInfo[gun - 1].OccupancyBill.Duration = 5;
|
|
|
+
|
|
|
+ ftime(&nowTime);
|
|
|
+ tm = localtime(&nowTime.time);
|
|
|
+ // StartTime: [2022/09/27 13:50]
|
|
|
+ sprintf(cmdBuf, "%04d//%02d//%02d %02d:%02d",
|
|
|
+ tm->tm_year + 1900,
|
|
|
+ tm->tm_mon + 1,
|
|
|
+ tm->tm_mday,
|
|
|
+ tm->tm_hour,
|
|
|
+ tm->tm_min);
|
|
|
+ memcpy(ShmChargerInfo->AllBill.OccupancyInfo[gun - 1].OccupancyBill.StartTime, cmdBuf, sizeof(cmdBuf));
|
|
|
+
|
|
|
+ ShmChargerInfo->AllBill.OccupancyInfo[gun - 1].OccupancyReq.bits.SelfReq = true;
|
|
|
+
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Set Gun [%s] [%s], SN: [%s], Fee: [%.2f]\r\n\r\n", &MultiSubCmd[0][0], str_occupancy_status[_Parking_Occupied], _sn, fee);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Input cmd fail ------ parking notify display [gun 1-4] [sn] [fee]\r\n\r\n");
|
|
|
+}
|
|
|
+
|
|
|
+void SetOccupancyNotifyCancel(char *inputCmd)
|
|
|
+{
|
|
|
+ int gun = 0;
|
|
|
+ char subMain[MAX_SUB_CMD_LENGTH];
|
|
|
+ char subSub[MAX_SUB_CMD_LENGTH];
|
|
|
+ char *str_occupancy_status[] = {STR_NO_OCCUPANCY, STR_SYNC_OCCUPANCY, STR_OCCUPIED, STR_REQUEST_FEE, STR_WAIT_TO_PAY, STR_PAID_ONLINE_OK, STR_PAID_ONLINE_FAIL};
|
|
|
+
|
|
|
+ memset(subMain, 0x00, sizeof(subMain));
|
|
|
+ memset(subSub, 0x00, sizeof(subSub));
|
|
|
+
|
|
|
+ if(MainAndSubCommandParsing(inputCmd, subMain, subSub) == 1)
|
|
|
+ {
|
|
|
+ gun = atoi(subMain);
|
|
|
+ if(gun <= 0 || gun > GENERAL_GUN_QUANTITY)
|
|
|
+ {
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Gun [%s] out of range\r\n\r\n", subMain);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmChargerInfo->AllBill.OccupancyInfo[gun - 1].Status = _Parking_NoOccupancy;
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Set Gun [%s] [%s]\r\n\r\n", subMain, str_occupancy_status[_Parking_NoOccupancy]);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Input cmd fail ------ parking notify cancel [gun 1-4]\r\n\r\n");
|
|
|
+}
|
|
|
+
|
|
|
+void OccupancyNotifyCmd(char *inputCmd, unsigned int opt)
|
|
|
+{
|
|
|
+ char subMain[MAX_SUB_CMD_LENGTH];
|
|
|
+ char subSub[MAX_SUB_CMD_LENGTH];
|
|
|
+
|
|
|
+ memset(subMain, 0x00, sizeof(subMain));
|
|
|
+ memset(subSub, 0x00, sizeof(subSub));
|
|
|
+
|
|
|
+ if(MainAndSubCommandParsing(inputCmd, subMain, subSub) == 2)
|
|
|
+ {
|
|
|
+ if(strcmp(subMain, "display") == 0)
|
|
|
+ {
|
|
|
+ SetOccupancyNotifyDisplay(subSub);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(subMain, "cancel") == 0)
|
|
|
+ {
|
|
|
+ SetOccupancyNotifyCancel(subSub);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Input cmd fail ------ parking notify [display | cancel] [gun 1-4] [...]\r\n\r\n");
|
|
|
+}
|
|
|
+
|
|
|
+void OccupancySetCmd(char *inputCmd, unsigned int opt)
|
|
|
+{
|
|
|
+ char subMain[MAX_SUB_CMD_LENGTH];
|
|
|
+ char subSub[MAX_SUB_CMD_LENGTH];
|
|
|
+
|
|
|
+ memset(subMain, 0x00, sizeof(subMain));
|
|
|
+ memset(subSub, 0x00, sizeof(subSub));
|
|
|
+
|
|
|
+ float _price = 0;
|
|
|
+
|
|
|
+ if(MainAndSubCommandParsing(inputCmd, subMain, subSub) == 1)
|
|
|
+ {
|
|
|
+ _price = atof(subMain);
|
|
|
+ if(_price > 0)
|
|
|
+ {
|
|
|
+ ShmChargerInfo->CabinetMiscValue.ParkingPrice = _price;
|
|
|
+ for(int i = 0; i < MAX_DISPENSER_QUANTITY; i++)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LocalStatus != _DS_None &&
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LocalStatus != _DS_Timeout)
|
|
|
+ {
|
|
|
+ ShmChargerInfo->DispenserMiscReq[i].bits.ParkingPrice = true;
|
|
|
+ printf("Set Dispenser %d Parking price [%s]\r\n\r\n", i + 1, subMain);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Parking price [%s] out of range\r\n\r\n", subMain);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Input cmd fail ------ parking set [price]\r\n\r\n");
|
|
|
+}
|
|
|
+
|
|
|
+void OccupancyCmd(char *inputCmd, unsigned int opt)
|
|
|
+{
|
|
|
+ char subMain[MAX_SUB_CMD_LENGTH];
|
|
|
+ char subSub[MAX_SUB_CMD_LENGTH];
|
|
|
+
|
|
|
+ memset(subMain, 0x00, sizeof(subMain));
|
|
|
+ memset(subSub, 0x00, sizeof(subSub));
|
|
|
+
|
|
|
+ if(MainAndSubCommandParsing(inputCmd, subMain, subSub) >= 2)
|
|
|
+ {
|
|
|
+ if(strcmp(subMain, "notify") == EQUAL)
|
|
|
+ {
|
|
|
+ OccupancyNotifyCmd(subSub, opt);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(subMain, "set") == EQUAL)
|
|
|
+ {
|
|
|
+ OccupancySetCmd(subSub, opt);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Input cmd fail ------ parking [set | notify] [...]\r\n\r\n");
|
|
|
+}
|
|
|
+
|
|
|
+// Status SN Fee StartTime Duration
|
|
|
+// 4fb5beab-c1dc-4fa8-8f80-aee1a26df705 XXXXX.XX
|
|
|
+// Gun 1 NoOccupancy XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX.XX YYYY/MM/DD HH:MM XXXX
|
|
|
+int ShowOccupancyInfo(int gun)
|
|
|
+{
|
|
|
+ int showLine = 1;
|
|
|
+ char *str_occupancy_status[] = {STR_NO_OCCUPANCY, STR_SYNC_OCCUPANCY, STR_OCCUPIED, STR_REQUEST_FEE, STR_WAIT_TO_PAY, STR_PAID_ONLINE_OK, STR_PAID_ONLINE_FAIL};
|
|
|
+ char _sn[37], _time[32];
|
|
|
+
|
|
|
+ if(ShmChargerInfo->AllBill.OccupancyInfo[gun].Status == _Parking_NoOccupancy)
|
|
|
+ {
|
|
|
+ sprintf(_sn, " N/A ");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf(_sn, "%s", ShmChargerInfo->AllBill.OccupancyInfo[gun].OccupancyBill.Sn);
|
|
|
+ }
|
|
|
+ if(ShmChargerInfo->AllBill.OccupancyInfo[gun].Status == _Parking_WaitToPay)
|
|
|
+ {
|
|
|
+ sprintf(_time, "%s", ShmChargerInfo->AllBill.OccupancyInfo[gun].OccupancyBill.StartTime);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf(_time, " N/A ");
|
|
|
+ }
|
|
|
+
|
|
|
+ //************************************************************************************************
|
|
|
+ printf(" Gun %d %11s %36s %8.2f %16s %4d\r\n",
|
|
|
+ gun + 1,
|
|
|
+ str_occupancy_status[ShmChargerInfo->AllBill.OccupancyInfo[gun].Status],
|
|
|
+ _sn,
|
|
|
+ ShmChargerInfo->AllBill.OccupancyInfo[gun].OccupancyBill.Fee,
|
|
|
+ _time,
|
|
|
+ ShmChargerInfo->AllBill.OccupancyInfo[gun].OccupancyBill.Duration
|
|
|
+ );
|
|
|
+
|
|
|
+ return showLine;
|
|
|
+}
|
|
|
+
|
|
|
+void ShowOccupancy(char *inputCmd, unsigned int opt)
|
|
|
+{
|
|
|
+ int totalLine = 0;
|
|
|
+ bool keepRun = false;
|
|
|
+ bool reflash = false;
|
|
|
+ int time = 0;
|
|
|
+ struct timespec _Loop_time;
|
|
|
+
|
|
|
+ if((opt & OPTION_REFLASH) || (opt & OPTION_LOOP) > 0)
|
|
|
+ {
|
|
|
+ keepRun = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ printf("\r\n");
|
|
|
+ do
|
|
|
+ {
|
|
|
+ time = GetTimeoutValue(_Loop_time) / mSEC_VAL;
|
|
|
+ if(time >= 1000)
|
|
|
+ {
|
|
|
+ if(reflash)
|
|
|
+ {
|
|
|
+ ConsoleReflash(1, 2);
|
|
|
+ ConsoleReflash(CONNECTOR_QUANTITY, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ printf("OccupancyPrice: [%.2f]\r\n", ShmChargerInfo->CabinetMiscValue.ParkingPrice);
|
|
|
+ printf(" Status SN Fee StartTime Duration\r\n");
|
|
|
+
|
|
|
+ for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
|
|
|
+ {
|
|
|
+ totalLine += ShowOccupancyInfo(i);
|
|
|
+ }
|
|
|
+ GetClockTime(&_Loop_time);
|
|
|
+
|
|
|
+ if((opt & OPTION_REFLASH) > 0)
|
|
|
+ {
|
|
|
+ reflash = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(keepRun)
|
|
|
+ {
|
|
|
+ keepRun = IsLoopStopCmd() ? false : true;
|
|
|
+ usleep(10000);
|
|
|
+ }
|
|
|
+ }while(keepRun);
|
|
|
+ printf("\r\n");
|
|
|
+}
|
|
|
+
|
|
|
+int ShowPsuCount(void)
|
|
|
+{
|
|
|
+ int line = 0;
|
|
|
+ for(int i = 0; i < MAX_GROUP_QUANTITY; i++)
|
|
|
+ {
|
|
|
+ printf("Group Index = %d, Module Count = %2d\r\n", i, ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity);
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+ return line;
|
|
|
+}
|
|
|
+
|
|
|
+int ShowPsuVersion(void)
|
|
|
+{
|
|
|
+ int line = 0;
|
|
|
+ for(int i = 0; i < ShmPsuData->SystemInitialPsuQuantity; i++)
|
|
|
+ {
|
|
|
+ printf("Psu Index = %2d, PriVersion = %s, SecVersion = %s\r\n",
|
|
|
+ i, ShmPsuData->PsuVersion[i].FwPrimaryVersion, ShmPsuData->PsuVersion[i].FwSecondVersion);
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i = 0; i < ShmPsuData->GroupCount; i++)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity; j++)
|
|
|
+ {
|
|
|
+ printf("Group Index = %d, Psu Index = %2d, Version = %s\r\n",
|
|
|
+ i, j, ShmPsuData->PsuGroup[i].PsuModule[j].FwVersion);
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return line;
|
|
|
+}
|
|
|
+
|
|
|
+int ShowPsuCap(void)
|
|
|
+{
|
|
|
+ int line = 0;
|
|
|
+ for(int i = 0; i < ShmPsuData->GroupCount; i++)
|
|
|
+ {
|
|
|
+ printf("Group Index = %d, MaxCur = %4d.%d A, Power = %d kW\r\n",
|
|
|
+ i,
|
|
|
+ (ShmPsuData->PsuGroup[i].GroupAvailableCurrent / 10),
|
|
|
+ (ShmPsuData->PsuGroup[i].GroupAvailableCurrent % 10),
|
|
|
+ (ShmPsuData->PsuGroup[i].GroupAvailablePower / 10));
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+ return line;
|
|
|
+}
|
|
|
+
|
|
|
+int ShowPsuInput(void)
|
|
|
+{
|
|
|
+ int line = 0;
|
|
|
+ for(int i = 0; i < ShmPsuData->GroupCount; i++)
|
|
|
+ {
|
|
|
+ for(byte count = 0; count < ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity; count++)
|
|
|
+ {
|
|
|
+ printf("Group[%d] Index = %2d, VolR = %d, VolS = %d, VolT = %d\r\n",
|
|
|
+ i, count,
|
|
|
+ ShmPsuData->PsuGroup[i].PsuModule[count].InputVoltageL1,
|
|
|
+ ShmPsuData->PsuGroup[i].PsuModule[count].InputVoltageL2,
|
|
|
+ ShmPsuData->PsuGroup[i].PsuModule[count].InputVoltageL3);
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return line;
|
|
|
+}
|
|
|
+
|
|
|
+int ShowPsuOutput(void)
|
|
|
+{
|
|
|
+ int line = 0;
|
|
|
+ for(int i = 0; i < ShmPsuData->GroupCount; i++)
|
|
|
+ {
|
|
|
+ printf("Group Index = %d, OutputV = %4d.%d V, OutputC = %4d.%d A\r\n",
|
|
|
+ i,
|
|
|
+ (ShmPsuData->PsuGroup[i].GroupPresentOutputVoltage / 10),
|
|
|
+ (ShmPsuData->PsuGroup[i].GroupPresentOutputVoltage % 10),
|
|
|
+ (ShmPsuData->PsuGroup[i].GroupPresentOutputCurrent / 10),
|
|
|
+ (ShmPsuData->PsuGroup[i].GroupPresentOutputCurrent % 10));
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+ return line;
|
|
|
+}
|
|
|
+
|
|
|
+int ShowPsuGroupInfo(int group)
|
|
|
+{
|
|
|
+ if(ShmPsuData->PsuGroup[group].GroupPresentPsuQuantity > 0)
|
|
|
+ {
|
|
|
+ printf(" G-%d %2d %4d.%d V %4d.%d A %4d kW %4d A %4d kW",
|
|
|
+ group + 1,
|
|
|
+ ShmPsuPosition->GroupLocationInfo[group].GroupPsuQuantity,
|
|
|
+ (ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage / 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage % 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent / 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent % 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].GroupPresentOutputPower / 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].GroupAvailableCurrent / 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].GroupAvailablePower / 10));
|
|
|
+
|
|
|
+ printf(" | %d%d%d%d | %d%d%d%d\r\n",
|
|
|
+ ShmChargerInfo->PsuGrouping.GroupPsuStatus_OR[group].bits.Lock,
|
|
|
+ ShmChargerInfo->PsuGrouping.GroupPsuStatus_OR[group].bits.Alarm,
|
|
|
+ ShmChargerInfo->PsuGrouping.GroupPsuStatus_OR[group].bits.Fault,
|
|
|
+ ShmChargerInfo->PsuGrouping.GroupPsuStatus_OR[group].bits.Output,
|
|
|
+ ShmChargerInfo->PsuGrouping.GroupPsuStatus_AND[group].bits.Lock,
|
|
|
+ ShmChargerInfo->PsuGrouping.GroupPsuStatus_AND[group].bits.Alarm,
|
|
|
+ ShmChargerInfo->PsuGrouping.GroupPsuStatus_AND[group].bits.Fault,
|
|
|
+ ShmChargerInfo->PsuGrouping.GroupPsuStatus_AND[group].bits.Output);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ printf(" G-%d %2d N/A N/A N/A N/A N/A\r\n", group + 1, ShmPsuPosition->GroupLocationInfo[group].GroupPsuQuantity);
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+int ShowSinglePsuInfo(int psu_index)
|
|
|
+{
|
|
|
+ int group = 0, gIndex = 0;
|
|
|
+ unsigned int _power = 0;
|
|
|
+
|
|
|
+ group = ShmPsuPosition->PsuAddressInfo[psu_index].GroupNo;
|
|
|
+ gIndex = ShmPsuPosition->PsuAddressInfo[psu_index].GIndex;
|
|
|
+
|
|
|
+ printf(" %2d %2d %4d.%d V %4d.%d A %4d kW %4d A %4d kW",
|
|
|
+ gIndex + 1,
|
|
|
+ psu_index,
|
|
|
+ (ShmPsuData->PsuGroup[group].PsuModule[gIndex].PresentOutputVoltage / 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].PsuModule[gIndex].PresentOutputVoltage % 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].PsuModule[gIndex].PresentOutputCurrent / 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].PsuModule[gIndex].PresentOutputCurrent % 10),
|
|
|
+ _power,
|
|
|
+ (ShmPsuData->PsuGroup[group].PsuModule[gIndex].IAvailableCurrent / 10),
|
|
|
+ (ShmPsuData->PsuGroup[group].PsuModule[gIndex].AvailablePower / 10));
|
|
|
+
|
|
|
+ int CriticalTemp1 = 0, CriticalTemp2 = 0, CriticalTemp3 = 0, InletTemp = 0, OutletTemp = 0, InletTemp_1 = 0, InletTemp_2 = 0;
|
|
|
+ CriticalTemp1 = (int)ShmPsuData->PsuGroup[group].PsuModule[gIndex].CriticalTemp1 - 60;
|
|
|
+ CriticalTemp2 = (int)ShmPsuData->PsuGroup[group].PsuModule[gIndex].CriticalTemp2 - 60;
|
|
|
+ CriticalTemp3 = (int)ShmPsuData->PsuGroup[group].PsuModule[gIndex].CriticalTemp3 - 60;
|
|
|
+ InletTemp = (int)ShmPsuData->PsuGroup[group].PsuModule[gIndex].InletTemp - 60;
|
|
|
+ OutletTemp = (int)ShmPsuData->PsuGroup[group].PsuModule[gIndex].OutletTemp - 60;
|
|
|
+ InletTemp_1 = (int)ShmPsuData->PsuGroup[group].PsuModule[gIndex].InletTemp_1 - 60;
|
|
|
+ InletTemp_2 = (int)ShmPsuData->PsuGroup[group].PsuModule[gIndex].InletTemp_2 - 60;
|
|
|
+
|
|
|
+ printf(" %4d %4d / %4d %4d / %4d %4d / %4d",
|
|
|
+ CriticalTemp1, InletTemp, OutletTemp, InletTemp_1, InletTemp_2, CriticalTemp2, CriticalTemp3);
|
|
|
+
|
|
|
+ printf(" | %d%d%d%d\r\n",
|
|
|
+ ShmPsuPosition->SinglePsuStatus[psu_index].bits.Lock,
|
|
|
+ ShmPsuPosition->SinglePsuStatus[psu_index].bits.Alarm,
|
|
|
+ ShmPsuPosition->SinglePsuStatus[psu_index].bits.Fault,
|
|
|
+ ShmPsuPosition->SinglePsuStatus[psu_index].bits.Output);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+// Group Psu Out_Vol Out_Cur Out_Pow Ava_Cur Ava_Pow Ambient Liq_In_Out DD_In 1 & 2 DD_Out 1 & 2 OR_LAFO AND_LAFO
|
|
|
+// G-X 4 XXXX.X V XXXX.X A XXXX kW XXXX A XXXX kW | XXXX | XXXX
|
|
|
+// G-X 0 N/A N/A N/A N/A N/A
|
|
|
+// X 0 XXXX.X V XXXX.X A XXXX kW XXXX A XXXX kW XXXX XXXX / XXXX XXXX / XXXX XXXX / XXXX | XXXX | XXXX
|
|
|
+
|
|
|
+// Group Out_Vol Out_Cur Out_Pow Ava_Cur Ava_Pow Version Ambient Liq_In_Out DD_In 1 & 2 DD_Out 1 & 2 OR_LAFO AND_LAFO
|
|
|
+// G-X XXXX.X V XXXX.X A XXXX kW XXXX A XXXX kW, Total: XX | XXXX | XXXX
|
|
|
+// G-X N/A N/A N/A N/A N/A
|
|
|
+// X XXXX.X V XXXX.X A XXXX kW XXXX A XXXX kW XXXXXXXXXX XXXX XXXX / XXXX XXXX / XXXX XXXX / XXXX | XXXX | XXXX
|
|
|
+int ShowPsuInfo(void)
|
|
|
+{
|
|
|
+ int line = 2;
|
|
|
+ printf(" PFC & DD\r\n");
|
|
|
+ printf(" Group Psu Out_Vol Out_Cur Out_Pow Ava_Cur Ava_Pow Ambient Liq_In_Out DD_In 1 & 2 DD_Out 1 & 2 OR_LAFO AND_LAFO\r\n");
|
|
|
+
|
|
|
+ for(int i = 0; i < CONNECTOR_QUANTITY; i++)
|
|
|
+ {
|
|
|
+ line += ShowPsuGroupInfo(i);
|
|
|
+ if(ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity > 0)
|
|
|
+ {
|
|
|
+ for(int j = 0; j < ShmPsuData->PsuGroup[i].GroupPresentPsuQuantity; j++)
|
|
|
+ {
|
|
|
+ int psu_index = ShmPsuPosition->GroupLocationInfo[i].PsuIndex[j];
|
|
|
+ line += ShowSinglePsuInfo(psu_index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return line;
|
|
|
+}
|
|
|
+
|
|
|
+void PsuCmd(char *inputCmd, unsigned int opt)
|
|
|
+{
|
|
|
+ bool keepRun = false;
|
|
|
+ bool reflash = false;
|
|
|
+ int reflashLine = 0;
|
|
|
+ int time = 0;
|
|
|
+ struct timespec _Loop_time;
|
|
|
+
|
|
|
+ if((opt & OPTION_REFLASH) || (opt & OPTION_LOOP) > 0)
|
|
|
+ {
|
|
|
+ keepRun = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ int totalCnt = 0, maxPara = 0;
|
|
|
+
|
|
|
+ maxPara = 1;
|
|
|
+ totalCnt = GetSubCommand(inputCmd);
|
|
|
+
|
|
|
+ if(totalCnt != maxPara)
|
|
|
+ {
|
|
|
+ printf("Input cmd fail ------ psu [count | ver | cap | input | output | info]\r\n\r\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ printf("\r\n");
|
|
|
+ do
|
|
|
+ {
|
|
|
+ time = GetTimeoutValue(_Loop_time) / mSEC_VAL;
|
|
|
+ if(time >= 1000)
|
|
|
+ {
|
|
|
+ if(reflash && reflashLine > 0)
|
|
|
+ {
|
|
|
+ ConsoleReflash(1, reflashLine);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(&MultiSubCmd[0][0], "info") == EQUAL)
|
|
|
+ {
|
|
|
+ reflashLine = ShowPsuInfo();
|
|
|
+ }
|
|
|
+ else if(strcmp(&MultiSubCmd[0][0], "count") == EQUAL)
|
|
|
+ {
|
|
|
+ reflashLine = ShowPsuCount();
|
|
|
+ }
|
|
|
+ else if(strcmp(&MultiSubCmd[0][0], "ver") == EQUAL)
|
|
|
+ {
|
|
|
+ reflashLine = ShowPsuVersion();
|
|
|
+ }
|
|
|
+ else if(strcmp(&MultiSubCmd[0][0], "cap") == EQUAL)
|
|
|
+ {
|
|
|
+ reflashLine = ShowPsuCap();
|
|
|
+ }
|
|
|
+ else if(strcmp(&MultiSubCmd[0][0], "input") == EQUAL)
|
|
|
+ {
|
|
|
+ reflashLine = ShowPsuInput();
|
|
|
+ }
|
|
|
+ else if(strcmp(&MultiSubCmd[0][0], "output") == EQUAL)
|
|
|
+ {
|
|
|
+ reflashLine = ShowPsuOutput();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ printf("Input cmd parsing fail ------ psu [count | ver | cap | input | output | info]\r\n");
|
|
|
+ keepRun = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ GetClockTime(&_Loop_time);
|
|
|
+
|
|
|
+ if((opt & OPTION_REFLASH) > 0)
|
|
|
+ {
|
|
|
+ reflash = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(keepRun)
|
|
|
+ {
|
|
|
+ keepRun = IsLoopStopCmd() ? false : true;
|
|
|
+ usleep(10000);
|
|
|
+ }
|
|
|
+ }while(keepRun);
|
|
|
+ printf("\r\n");
|
|
|
+}
|
|
|
+
|
|
|
int main(void)
|
|
|
{
|
|
|
char newString[32][MAX_SUB_CMD_LENGTH];
|
|
@@ -5161,10 +5634,10 @@ int main(void)
|
|
|
//GetFwVerProc(newString[1]);
|
|
|
ShowFwVer();
|
|
|
}
|
|
|
- else if (strcmp(newString[0], "update") == 0)
|
|
|
+ else if(strcmp(mainCmd, "update") == 0)
|
|
|
{
|
|
|
// 更新
|
|
|
- FwUpdateFlagProc(newString[1]);
|
|
|
+ FwUpdateFlagProc(subCmd, option);
|
|
|
}
|
|
|
else if (strcmp(newString[0], "ac") == 0)
|
|
|
{
|
|
@@ -5223,17 +5696,9 @@ int main(void)
|
|
|
// 取得三向輸入電壓
|
|
|
GetInputVol(subCmd, option);
|
|
|
}
|
|
|
- else if(strcmp(newString[0], "psu") == 0)
|
|
|
+ else if(strcmp(mainCmd, "psu") == 0)
|
|
|
{
|
|
|
- //如果連一個參數都沒有 (此命令不理會) 加上判斷第二參數
|
|
|
- if (strcmp(newString[1], "-1") == 0 || strcmp(newString[1], "") == 0)
|
|
|
- {
|
|
|
- printf ("PSU : Param fail..Please retry again......\n");
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- // 取得 PSU 資訊
|
|
|
- GetPsuInformation(newString[1], newString[2], newString[3]);
|
|
|
+ PsuCmd(subCmd, option);
|
|
|
}
|
|
|
else if (strcmp(newString[0], "cap") == 0)
|
|
|
{
|
|
@@ -5432,6 +5897,14 @@ int main(void)
|
|
|
else if(strcmp(mainCmd, "price") == 0)
|
|
|
{
|
|
|
ShowPrice(subCmd, option);
|
|
|
+ }
|
|
|
+ else if(strcmp(mainCmd, "parking") == 0)
|
|
|
+ {
|
|
|
+ OccupancyCmd(subCmd, option);
|
|
|
+ }
|
|
|
+ else if(strcmp(mainCmd, "occupancy") == 0)
|
|
|
+ {
|
|
|
+ ShowOccupancy(subCmd, option);
|
|
|
}
|
|
|
else
|
|
|
{
|