rasProject_01 / weSweetHome  R. 146 2026-09-26
process control       /     RasPi software         by   weinert-automation
Loading...
Searching...
No Matches
meterVal_t Struct Reference

One smart meter's readings. More...

#include <sweetHome.h>

Data Fields

int err
 Modbus error.
int hourOffs
 Actual offset in hours of local time zone.
uint16_t ms
 Absolute time's miliseconds.
uint16_t msDurRead
 Duration of last Modbus operation, probably read, in ms.
float pSum
 Power sum [W] over all (three) phases.
char rTmTxt [34]
 Local time as text.
uint32_t stmpS
 Absolute time stamp for the current value.
float vals [18]
 Compact and re-sorted meter readings.

Detailed Description

One smart meter's readings.

The (first) four timing values are the start of reading; to have the end add .msDurRead.

Field Documentation

◆ stmpS

uint32_t stmpS

Absolute time stamp for the current value.

This value and its supplements meterVal_t.ms, meterVal_t.hourOffs and meterVal_t.rTmTxt are updated at every Modbus read.

◆ ms

uint16_t ms

Absolute time's miliseconds.

This is a ms supplement to meterVal_t.stmpS.

◆ hourOffs

int hourOffs

Actual offset in hours of local time zone.

A positive value means east of UTC (Greenwich).

◆ rTmTxt

char rTmTxt[34]

Local time as text.

The text's lenght is 32. See also meterVal_t::stmpS, meterVal_t::ms

◆ err

int err

Modbus error.

0 is OK; -99 means not yet initialised. Otherwise err - MODBUS_ENOBASE is the last operations modbus error as defined by StǸphane Raimbault.

◆ msDurRead

uint16_t msDurRead

Duration of last Modbus operation, probably read, in ms.

A value well below 500ms is significant for a successful read. Significantly above means timeout / error.

◆ vals

float vals[18]

Compact and re-sorted meter readings.

These values are to be updated on every error-free meter reading (by Modbus, RS485 e.g.). Each pair of 16bit-Modbus-registers holds a 32bit IEEE754 floating point number, i.e. a C float.
The values are:

indexes: values : registers : unit
0..2 : U (L1, L2, L3) : 1.. 6 : /V
3..5 : I (L1, L2, L3) : 7..12 : /A
6..8 : P (L1, L2, L3) : 13..18 : /W
9 : f : 71..72 : /Hz
10, 11 : ::Wimp ::Wexp : 73..76 : /Wh
12..14 : phi(L1, L2, L3) : 37..42 : /deg Celsius
15..17 : reserve (not used in R.115++)
#define Wexp
Work exported [Wh] in the array vals.
Definition sweetHome.h:305
#define Wimp
Work imported [Wh] in the array vals.
Definition sweetHome.h:297

The documentation for this struct was generated from the following file: