summaryrefslogtreecommitdiff
path: root/src/protocol_18/types.h
blob: d3574e98b7408893e65d87fc6d1ef91fb1839e6a (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// SPDX-License-Identifier: BSD-3-Clause

#ifndef INVERTER_TOOLS_P18_TYPES_H
#define INVERTER_TOOLS_P18_TYPES_H

#include <string>

#define ENUM_STR(enum_type) std::ostream& operator<< (std::ostream& os, enum_type val)
#define ENUM_STR_DEFAULT    return os << val

namespace p18 {

enum class CommandType: int {
    GetProtocolID = 0,
    GetCurrentTime,
    GetTotalGenerated,
    GetYearGenerated,
    GetMonthGenerated,
    GetDayGenerated,
    GetSeriesNumber,
    GetCPUVersion,
    GetRatedInformation,
    GetGeneralStatus,
    GetWorkingMode,
    GetFaultsAndWarnings,
    GetFlagsAndStatuses,
    GetDefaults,
    GetAllowedChargingCurrents,
    GetAllowedACChargingCurrents,
    GetParallelRatedInformation,
    GetParallelGeneralStatus,
    GetACChargingTimeBucket,
    GetACLoadsSupplyTimeBucket,
    SetLoads = 100,
    SetFlag,
    SetDefaults,
    SetBatteryMaxChargingCurrent,
    SetBatteryMaxACChargingCurrent,
    SetACOutputFreq,
    SetBatteryMaxChargingVoltage,
    SetACOutputRatedVoltage,
    SetOutputSourcePriority,
    SetBatteryChargingThresholds, /* Battery re-charging and re-discharing voltage when utility is available */
    SetChargingSourcePriority,
    SetSolarPowerPriority,
    SetACInputVoltageRange,
    SetBatteryType,
    SetOutputModel,
    SetBatteryCutOffVoltage,
    SetSolarConfig,
    ClearGenerated,
    SetDateTime,
    SetACChargingTimeBucket,
    SetACLoadsSupplyTimeBucket,
};

enum class BatteryType {
    AGM     = 0,
    Flooded = 1,
    User    = 2,
};
ENUM_STR(BatteryType);

enum class InputVoltageRange {
    Appliance = 0,
    USP       = 1,
};
ENUM_STR(InputVoltageRange);

enum class OutputSourcePriority {
    SolarUtilityBattery = 0,
    SolarBatteryUtility = 1,
};
ENUM_STR(OutputSourcePriority);

enum class ChargerSourcePriority {
    SolarFirst      = 0,
    SolarAndUtility = 1,
    SolarOnly       = 2,
};
ENUM_STR(ChargerSourcePriority);

enum class MachineType {
    OffGridTie = 0,
    GridTie    = 1,
};
ENUM_STR(MachineType);

enum class Topology {
    TransformerLess = 0,
    Transformer     = 1,
};
ENUM_STR(Topology);

enum class OutputModelSetting {
    SingleModule             = 0,
    ParallelOutput           = 1,
    Phase1OfThreePhaseOutput = 2,
    Phase2OfThreePhaseOutput = 3,
    Phase3OfThreePhaseOutput = 4,
};
ENUM_STR(OutputModelSetting);

enum class SolarPowerPriority {
    BatteryLoadUtility = 0,
    LoadBatteryUtility = 1,
};
ENUM_STR(SolarPowerPriority);

enum class MPPTChargerStatus {
    Abnormal    = 0,
    NotCharging = 1,
    Charging    = 2,
};
ENUM_STR(MPPTChargerStatus);

enum class BatteryPowerDirection {
    DoNothing = 0,
    Charge    = 1,
    Discharge = 2,
};
ENUM_STR(BatteryPowerDirection);

enum class DC_AC_PowerDirection {
    DoNothing = 0,
    AC_DC     = 1,
    DC_AC     = 2,
};
ENUM_STR(DC_AC_PowerDirection);

enum class LinePowerDirection {
    DoNothing = 0,
    Input     = 1,
    Output    = 2,
};
ENUM_STR(LinePowerDirection);

enum class WorkingMode {
    PowerOnMode  = 0,
    StandbyMode  = 1,
    BypassMode   = 2,
    BatteryMode  = 3,
    FaultMode    = 4,
    HybridMode   = 5,
};
ENUM_STR(WorkingMode);

enum class ParallelConnectionStatus {
    NotExistent = 0,
    Existent    = 1,
};
ENUM_STR(ParallelConnectionStatus);

enum class LoadConnectionStatus {
    Disconnected = 0,
    Connected    = 1,
};
ENUM_STR(LoadConnectionStatus);

enum class ConfigurationStatus {
    Default = 0,
    Changed = 1,
};
ENUM_STR(ConfigurationStatus);

struct Flag {
    std::string flag;
    char letter;
    std::string description;
};

}

#endif //INVERTER_TOOLS_P18_TYPES_H