Reads energy measuremens from Carlo Gavazzi Wired AC Sensors (hence cgwacs), and puts in on the D-Bus. Supported models: EM24, ET112, and ET340.
The application consists of several layers:
- Data acquisition layer:
- The ModbusRtu class provides a simple implementation of the modbus RTU protocol, which supports the functions ReadHoldingRegisters (3), ReadInputRegisters (4) and WriteSingleRegister (6) only.
- AcSensorUpdater connects to an ac sensor, retrieves its identity (type & serial) and retrieves measured data. The data retrieved will be stored in an AcSensor object.
- Data model
- AcSensor contains the latest measurements taken from an AC sensor.
- Settings Persistent settings objects which contains global settings.
- AcSensorSettings Persistent AC sensor settings.
- D-Bus layer
- AcSensorBridge produces the com.victronenergy.grid.ttyUSB?? D-Bus service. Information is taken from an AcSensor, and an AcSensorSettings object.
- AcSensorSettingsBridge consumes a subtree from the local settings. Path: /Settings/CGwacs/D[serial]
Finally AcSensorMediator ties everything together.
It is important for dbus-cgwacs to terminate if it is not talking to a Carlo Gavazzi meter, otherwise serial-starter cannot work properly. Two kinds of errors are possible.
- A timeout:
- There was no response to a modbus request. The default timeout is 250ms
(2 seconds for zigbee) and can be overridden with the
--timeout
commandline option. - dbus-cgwacs will terminate after 5 consecutive requests ends in a timeout.
- There was no response to a modbus request. The default timeout is 250ms
(2 seconds for zigbee) and can be overridden with the
- A modbus error:
- These include outright errors such as unsupported registers or CRC errors.
- In order to be forgiving to intermittent conditions causing CRC errors, dbus-cgwacs will terminate after 20 consecutive errors.