Example
Version: 1.0.0
This example will serve the purpose to set up a basic functioning IEC 62056 test system using the com.eurotech.framework.iec62056.driver.Iec62056Driver
.
1. Simulate a IEC 62056 slave meter
A simple IEC 62056 meter simulator can be found here: https://github.com/serbayozkan/IEC62056-Slave-Simulator
Edit the file AMRParams.json
to set the serial port in which the simulator must be running. The file AMRProcess.py
may need to be fixed in order to explicitly add \r\n
to messages so that they comply with the protocol. Run the simulator by issuing python main.py
in the computer console. Ensure that the current user has rights to write the port file, otherwise run the command in elevated privileges.
If you are running the driver in an emulated ESF, you may need to have a virtual serial port. It can be set up with this command:
socat -d -d pty,raw,echo=0,link=/dev/ttyS2 pty,raw,echo=0,link=/dev/ttyS1
It will create two 'endpoints' of the serial connection, identified by /dev/ttyS1
and /dev/ttyS2
. Please note also that ESF may have security restrictions on ports other than ttyS*
.
2. Create the Driver instance
Go in ESF Drivers and Assets and create a new driver. Select com.eurotech.framework.iec62056.driver.Iec62056Driver
as Driver Factory. Once created, in the driver parameters set the Serial port name as the serial port to connect to (whether simulated or not) and the Device address (for instance, 12345672
if using the simulator).
3. Create the Asset and test readings
In order to test readings directly, a sample asset can be instantiated under the driver and can be made of the following channels:
An example ESF Wire Graph can be built with a simple schema of: Timer → WireAsset → Logger