22 _supla_int64_t totalFwdActEnergy = 0;
23 _supla_int64_t fwdActEnergy;
26 _supla_int64_t totalRvrActEnergy = 0;
27 _supla_int64_t rvrActEnergy;
30 _supla_int64_t totalFwdReactEnergy = 0;
31 _supla_int64_t fwdReactEnergy;
34 _supla_int64_t totalRvrReactEnergy = 0;
35 _supla_int64_t rvrReactEnergy;
56 virtual void updateChannelValues();
59 void setFwdActEnergy(
int phase,
unsigned _supla_int64_t energy);
62 void setRvrActEnergy(
int phase,
unsigned _supla_int64_t energy);
65 void setFwdReactEnergy(
int phase,
unsigned _supla_int64_t energy);
68 void setRvrReactEnergy(
int phase,
unsigned _supla_int64_t energy);
72 void setFwdBalancedEnergy(uint64_t energy);
76 void setRvrBalancedEnergy(uint64_t energy);
79 void setVoltage(
int phase,
unsigned _supla_int16_t voltage);
82 void setCurrent(
int phase,
unsigned _supla_int_t current);
85 void setFreq(
unsigned _supla_int16_t freq);
88 void setPowerActive(
int phase, int64_t power);
91 void setPowerReactive(
int phase, int64_t power);
94 void setPowerApparent(
int phase, int64_t power);
97 void setPowerFactor(
int phase, _supla_int_t powerFactor);
100 void setPhaseAngle(
int phase, _supla_int_t phaseAngle);
103 void setVoltagePhaseAngle12(
unsigned _supla_int16_t voltagePhaseAngle);
106 void setVoltagePhaseAngle13(
unsigned _supla_int16_t voltagePhaseAngle);
109 void setVoltagePhaseSequence(
bool clockwise);
112 void setCurrentPhaseSequence(
bool clockwise);
127 unsigned _supla_int64_t getFwdActEnergy(
int phase);
130 unsigned _supla_int64_t getRvrActEnergy(
int phase);
133 uint64_t getFwdBalancedActEnergy();
136 uint64_t getRvrBalancedActEnergy();
139 unsigned _supla_int64_t getFwdReactEnergy(
int phase);
142 unsigned _supla_int64_t getRvrReactEnergy(
int phase);
145 unsigned _supla_int16_t getVoltage(
int phase);
148 unsigned _supla_int_t getCurrent(
int phase);
151 unsigned _supla_int16_t getFreq();
154 int64_t getPowerActive(
int phase);
157 int64_t getPowerReactive(
int phase);
160 int64_t getPowerApparent(
int phase);
163 _supla_int_t getPowerFactor(
int phase);
166 _supla_int_t getPhaseAngle(
int phase);
169 uint16_t getVoltagePhaseAngle12()
const;
172 uint16_t getVoltagePhaseAngle13()
const;
175 bool isVoltagePhaseSequenceSet()
const;
178 bool isVoltagePhaseSequenceClockwise()
const;
181 bool isCurrentPhaseSequenceSet()
const;
184 bool isCurrentPhaseSequenceClockwise()
const;
187 static unsigned _supla_int64_t
192 static unsigned _supla_int64_t
200 static unsigned _supla_int64_t
205 static unsigned _supla_int64_t
213 static unsigned _supla_int64_t
218 static unsigned _supla_int64_t
223 static unsigned _supla_int16_t
227 static unsigned _supla_int_t
231 static unsigned _supla_int16_t
235 static int64_t getPowerActive(
239 static int64_t getPowerReactive(
243 static int64_t getPowerApparent(
247 static _supla_int_t getPowerFactor(
251 static _supla_int_t getPhaseAngle(
255 static uint16_t getVoltagePhaseAngle12(
259 static uint16_t getVoltagePhaseAngle13(
263 static bool isVoltagePhaseSequenceSet(
267 static bool isVoltagePhaseSequenceClockwise(
271 static bool isCurrentPhaseSequenceSet(
275 static bool isCurrentPhaseSequenceClockwise(
278 static bool isVoltagePhaseAngle12Used(
281 static bool isVoltagePhaseAngle13Used(
284 static bool isFwdActEnergyUsed(
287 static bool isRvrActEnergyUsed(
290 static bool isFwdReactEnergyUsed(
293 static bool isRvrReactEnergyUsed(
296 static bool isFwdBalancedActEnergyUsed(
299 static bool isRvrBalancedActEnergyUsed(
302 static bool isVoltageUsed(
305 static bool isCurrentUsed(
308 static bool isFreqUsed(
311 static bool isPowerActiveUsed(
314 static bool isPowerReactiveUsed(
317 static bool isPowerApparentUsed(
320 static bool isPowerFactorUsed(
323 static bool isPhaseAngleUsed(
326 void resetReadParameters();
327 void resetReadParametersForPhase(
int phase);
332 virtual void readValuesFromDevice();
337 bool local)
override;
338 void fillChannelConfig(
void *channelConfig,
340 uint8_t configType)
override;
354 virtual void resetStorage();
361 void handleAction(
int event,
int action)
override;
363 void setRefreshRate(
unsigned int sec);
365 void sendDataWithDelay(
int delayMs = 0);
367 Channel *getChannel()
override;
368 const Channel *getChannel()
const override;
371 void enableChannelConfig();
372 void addCtType(uint64_t ctType);
373 void addPhaseLedType(uint64_t ledType);
374 bool isCtTypeSupported(uint64_t ctType)
const;
376 int8_t getPhaseLedType()
const;
377 int32_t getLedVoltageLow()
const;
378 int32_t getLedVoltageHigh()
const;
379 int32_t getLedPowerLow()
const;
380 int32_t getLedPowerHigh()
const;
381 bool isPhaseLedTypeSupported(uint64_t ledType)
const;
386 uint32_t lastChannelUpdateTime = 0;
387 uint32_t rawCurrent[MAX_PHASES] = {};
388 int64_t rawActivePower[MAX_PHASES] = {};
389 int64_t rawReactivePower[MAX_PHASES] = {};
390 int64_t rawApparentPower[MAX_PHASES] = {};
392 uint32_t lastReadTime = 0;
393 uint16_t refreshRateSec = 5;
394 bool valueChanged =
false;
395 bool currentMeasurementAvailable =
false;
396 bool powerActiveMeasurementAvailable =
false;
397 bool powerReactiveMeasurementAvailable =
false;
398 bool powerApparentMeasurementAvailable =
false;
400 uint64_t availableCtTypes = 0;
401 uint64_t availablePhaseLedTypes = 0;
402 bool channelConfigUsed =
false;
403 int8_t usedCtType = -1;
405 int8_t usedPhaseLedType = -1;
407 int32_t ledVoltageLow = 21000;
408 int32_t ledVoltageHigh = 25000;
409 int32_t ledPowerLow = -5000;
410 int32_t ledPowerHigh = 5000;