forked from softwarecrash/Solar2MQTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinverter.h
184 lines (169 loc) · 3.33 KB
/
inverter.h
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
175
176
177
178
179
180
181
182
183
184
#include <Arduino.h>
//Send and receive periodic inverter commands
void serviceInverter();
bool sendCommand(String com);
void sendMNCHGC(int val);
void sendMUCHGC(int val);
enum qCommand
{
QPI,
QID,
QVFW,
QVFW2,
QPIRI,
QFLAG,
QALL,
QMOD,
QPIWS,
QDI,
QMCHGCR,
QMUCHGCR,
QBOOT,
QOPM,
};
void requestInverter(qCommand);
struct QpiMessage
{
byte protocolId;
};
struct QallMessage
{
float gridV;
float gridHz;
float acOutV;
float acOutHz;
short acOutVa;
short acOutW;
byte acOutPercent;
short busV;
float battV;
byte battChargeA;
byte battPercent;
float heatSinkDegC;
byte solarA;
byte solarV;
float sccBattV;
byte battDischargeA;
short solarW;
float addSbuPriorityVersion;
float isConfigChanged;
float isSccFirmwareUpdated;
float battVoltageToSteadyWhileCharging;
float chargingStatus;
float reservedY;
float reservedZ;
float reservedAA;
float reservedBB;
float cSOC;
};
struct QmodMessage
{
char mode;
String operationMode;
};
struct QpiwsMessage
{
bool reserved0;
bool inverterFault;
bool busOver;
bool busUnder;
bool busSoftFail;
bool lineFail;
bool opvShort;
bool overTemperature;
bool fanLocked;
bool batteryVoltageHigh;
bool batteryLowAlarm;
bool reserved13;
bool batteryUnderShutdown;
bool reserved15;
bool overload;
bool eepromFault;
bool inverterOverCurrent;
bool inverterSoftFail;
bool selfTestFail;
bool opDcVoltageOver;
bool batOpen;
bool currentSensorFail;
bool batteryShort;
bool powerLimit;
bool pvVoltageHigh;
bool mpptOverloadFault;
bool mpptOverloadWarning;
bool batteryTooLowToCharge;
bool reserved30;
bool reserved31;
};
struct QflagMessage
{
bool disableBuzzer;
bool enableOverloadBypass;
bool enablePowerSaving;
bool enableLcdEscape;
bool enableOverloadRestart;
bool enableOvertempRestart;
bool enableBacklight;
bool enablePrimarySourceInterruptedAlarm;
bool enableFaultCodeRecording;
};
//QPIRI<cr>: Device Rating Information inquiry
struct QpiriMessage
{
float gridRatingV; //Grid rating voltage
float gridRatingA; //Grid rating current
float acOutRatingV; //AC output rating voltage
float acOutRatingHz; //AC output rating frequency
float acOutRatingA; //AC output rating current
float acOutRatungVA; //AC output rating apparent power
float acOutRatingW; //AC output rating active power
float battRatingV; //Battery rating voltage
float battreChargeV; //Battery re-charge voltage
float battUnderV; //Battery under voltage
float battBulkV; //Battery bulk voltage
float battFloatV; //Battery float voltage
String battType; //Battery type
byte battMaxAcChrgA; //Current max AC charging current
byte battMaxChrgA; //Current max charging current
};
//for future use
struct QmdMessage
{
};
struct QidMessage
{
char id[16];
};
struct QchgcrMessage
{
byte chargeModes[12];
byte uChargeModes[12];
};
//for raw answer from inverter
struct QRaw
{
String QALL;
String QPIRI;
String QMOD;
String QPIWS;
String QFLAG;
String QID;
String QPI;
String QET;
String QT;
String QMCHGCR;
String QMUCHGCR;
String P006FPADJ;
};
/*
struct QAv //Query Avaible
{
bool QALL = true;
bool QPIRI = true;
bool QMOD = true;
bool QPIWS = true;
bool QFLAG = true;
bool QID = true;
bool QPI = true;
bool QET = true;
bool QT = true;
};*/