aboutsummaryrefslogtreecommitdiff
path: root/src/protocol_17/defines.cc
blob: 25898612ffb9d4aa8201ce0bb9fd21362006b06b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// SPDX-License-Identifier: BSD-3-Clause

#include <iostream>

#include "defines.h"
#include "types.h"

namespace p17 {

const std::map<CommandType, std::string> raw_commands = {
    {CommandType::GetProtocolID,                                  "PI"},
    {CommandType::GetSeriesNumber,                                "ID"},
    {CommandType::GetCPUVersion,                                  "VFW"},
    {CommandType::GetSecondaryCPUVersion,                         "VFW2"},
    {CommandType::GetDeviceModel,                                 "MD"},
    {CommandType::GetRatedInformation,                            "PIRI"},
    {CommandType::GetGeneralStatus,                               "GS"},
    {CommandType::GetPowerStatus,                                 "PS"},
    {CommandType::GetWorkingMode,                                 "MOD"},
    {CommandType::GetWarningStatus,                               "WS"},
    {CommandType::GetFlags,                                       "FLAG"},
    {CommandType::GetCurrentTime,                                 "T"},
    {CommandType::GetTotalGenerated,                              "ET"},
    {CommandType::GetYearGenerated,                               "EY"},
    {CommandType::GetMonthGenerated,                              "EM"},
    {CommandType::GetDayGenerated,                                "ED"},
    {CommandType::GetHourGenerated,                               "EH"},
    {CommandType::GetACInputVoltageRange,                         "GOV"},
    {CommandType::GetACInputFrequencyRange,                       "GOF"},
    {CommandType::GetMaximumOutputPower,                          "OPMP"},
    {CommandType::GetMaximumGridOutputPower,                      "GPMP"},
    {CommandType::GetSolarInputMPPTRange,                         "MPPTV"},
    {CommandType::GetSolarInputVoltageRange,                      "SV"},
    {CommandType::GetLCDSleepTimeout,                             "LST"},
    {CommandType::GetDefaults,                                    "DI"},
    {CommandType::GetBatterySettings,                             "BATS"},
    {CommandType::GetMachineModel,                                "DM"},
    {CommandType::GetMachineAdjustableRanges,                     "MAR"},
    {CommandType::GetFaults,                                      "CFS"},
    {CommandType::GetFaultsHistory,                               "HFS"},
    {CommandType::GetEnergyControlStatus,                         "HECS"},
    {CommandType::GetACInputLongTimeHighestAvgVoltage,            "GLTHV"},
    {CommandType::GetFirstGeneratedEnergySavedTime,               "FET"},
    {CommandType::GetFeedWaitTime,                                "FT"},
    {CommandType::GetACChargingTimeBucket,                        "ACCT"},
    {CommandType::GetACLoadsSupplyTimeBucket,                     "ACLT"},
    {CommandType::GetFeedingGridPowerCalibration,                 "FPADJ"},
    {CommandType::GetFeedInPowerFactor,                           "FPPF"},
    {CommandType::GetAutoAdjustPFWithPowerInformation,            "AAPF"},
    {CommandType::GetAllowOneOfSTPhaseLossStatus,                 "PLE"},
    {CommandType::SetLoads,                                       "LON"},
    {CommandType::SetFlag,                                        "P"},
    {CommandType::SetDateTime,                                    "DAT"},
    {CommandType::SetACInputHighestVoltageForFeedingPower,        "GOHV"},
    {CommandType::SetACInputHighestFrequencyForFeedingPower,      "GOHF"},
    {CommandType::SetACInputLowestVoltageForFeedingPower,         "GOLV"},
    {CommandType::SetACInputLowestFrequencyForFeedingPower,       "GOLF"},
    {CommandType::SetMaxOutputPower,                              "OPMP"},
    {CommandType::SetMaxFeedingGridPower,                         "GPMP"},
    {CommandType::SetSolarInputHighestVoltage,                    "SIHV"},
    {CommandType::SetSolarInputLowestVoltage,                     "SILV"},
    {CommandType::SetSolarInputHighestMPPTVoltage,                "MPPTHV"},
    {CommandType::SetSolarInputLowestMPPTVoltage,                 "MPPTLV"},
    {CommandType::SetLCDSleepTimeout,                             "LST"},
    {CommandType::SetBatteryMaxChargingCurrent,                   "MCHGC"},
    {CommandType::SetBatteryMaxChargingVoltage,                   "MCHGV"},
    {CommandType::SetACInputLongTimeHighestAverageVoltage,        "GLTHV"},
    {CommandType::SetBatteryDischargingVoltage,                   "BATDV"},
    {CommandType::SetSolarEnergyDistributionOfPriority,           "SEP"},
    {CommandType::SetEnergyDistribution,                          "ED"},
    {CommandType::SetBatteryChargerApplicationInFloatingCharging, "BCA"},
    {CommandType::SetMachineModel,                                "DM"},
    {CommandType::SetDefaults,                                    "PF"},
    {CommandType::SetACOutputFreq,                                "F"},
    {CommandType::SetACOutputRatedVoltage,                        "V"},
    {CommandType::SetFeedWaitTime,                                "FT"},
    {CommandType::SetACChargingTimeBucket,                        "ACCT"},
    {CommandType::SetACLoadsSupplyTimeBucket,                     "ACLT"},
    {CommandType::SetBatteryType,                                 "BT"},
    {CommandType::SetBatteryInstallTime,                          "BIT"},
    {CommandType::SetLiFeBatterySelfTest,                         "BST"},
    {CommandType::SetACChargerKeepBatteryVoltageSetting,          "ACCB"},
    {CommandType::SetBatteryTempSensorCompensation,               "BTS"},
    {CommandType::SetBatteryMaxACChargingCurrent,                 "MUCHGC"},
    {CommandType::SetFeedingGridPowerCalibration,                 "FPADJ"},
    {CommandType::SetBatteryMaxDischargingCurrentInHybridMode,    "BDCM"},
    {CommandType::SetFeedInPowerFactor,                           "FPPF"},
    {CommandType::SetParallelOutput,                              "PALE"},
    {CommandType::SetRPhaseFeedingGridPowerCalibration,           "FPRADJ"},
    {CommandType::SetSPhaseFeedingGridPowerCalibration,           "FPSADJ"},
    {CommandType::SetTPhaseFeedingGridPowerCalibration,           "FPTADJ"},
    {CommandType::SetAutoAdjustPFWithPowerInformation,            "AAPF"},
    {CommandType::SetAllowOneOfSTPhaseLoss,                       "PLE"},
    {CommandType::SetEmergencyPowerSupplyControl,                 "EPS"}
};

const std::map<int, std::string> fault_codes = {
    {1, "BUS exceed the upper limit"},
    {2, "BUS dropp to the lower limit"},
    {3, "BUS soft start circuit timeout"},
    {4, "Inverter voltage soft start timeout"},
    {5, "Inverter current exceed the upper limit"},
    {6, "Temperature over"},
    {7, "Inverter relay work abnormal"},
    {8, "Current sample abnormal when inverter doesn't work"},
    {9, "Solar input voltage exceed upper limit"},
    {10, "SPS power voltage abnormal"},
    {11, "Solar input current exceed upper limit"},
    {12, "Leakage current exceed permit range"},
    {13, "Solar insulation resistance too low"},
    {14, "Inverter DC current exceed permit range when feed power"},
    {15, "The AC input voltage or frequency has been detected different between master CPU and slave CPU"},
    {16, "Leakage current detect circuit abnormal when inverter doesn't work"},
    {17, "Communication loss between master CPU and slave CPU"},
    {18, "Communicate data discordant between master CPU and slave CPU"},
    {19, "AC input ground wire loss"},
    {22, "Battery voltage exceed upper limit"},
    {23, "Over load"},
    {24, "Battery disconnected"},
    {26, "AC output short"},
    {27, "Fan lock"},
    {32, "Battery DC-DC current over"},
    {33, "AC output voltage too low"},
    {34, "AC output voltage too high"},
    {35, "Control board wiring error"},
    {36, "AC circuit voltage sample error"},
};

const std::array<Flag, 6> flags = {{
    {"BUZZ", 'A', "Mute buzzer beep"},
    {"BUZS", 'B', "Mute buzzer beep in standby mode"},
    {"BUZB", 'C', "Mute buzzer beep only on battery discharged status"},
    {"GENI", 'D', "Generator as AC input"},
    {"WAIR", 'E', "Wide AC input range"},
    {"NGRF", 'F', "N/G relay function"},
}};

}