Our Modbus functionality operates solely as a periodic polling system designed to retrieve sensor data, typically from power meters and similar devices.
To set up modbus on a controller, you must first purchase a modbus license and have it applied to the controller/s you wish to run on.
zencontrol controllers support retrieval of data from modbus slaves via RS485 (Half Duplex) for data tracking and triggering.
zencontrol controllers cannot function as a modbus slave - they do not have any registers to query for information.
Controllers must be at least running a version of 2.x.x to support modbus.
How Modbus Devices Are Represented In the System
Modbus devices are represented in the zencontrol system as emulated Dali Control Devices with General Purpose Sensor instances associated with each of the registers you have selected. The data these instances produce can be used for triggers, analytic history and alarms.
Currently, we support 32 points per device, which is the instance limit per control device. This may be expanded in the future, where we will have multiple control devices associated with a single modbus devices.
If we recognise the modbus device, we will create and set up the modbus points for you. If not, you will need to manually configure points (addresses, data types, sizes, scaling) etc. This will be discussed later.
Information you will need
- The baud rate and parity setting for the RS485 devices you are connecting to
- A manual for the modbus registers you will be retrieving data from
Note that all devices on the modbus line must be running the same baud rate/parity.
During setup, you may need to run a dali monitor on your controller to check interaction with your modbus device.
Enabling Modbus and configuring the RS485 Baud Rate
To enable and configure modbus, go to Add-Ons->Modbus
If your modbus is configured, once rebooted, you may see a message on the monitor indicating the status of the device.
Please do not worry if you do not see this event - some connections are not fast enough to show this event (it is very early in a controller startup).
If your modbus is not configured, you may see this message on the monitor during startup:
You may also see a message indicating that modbus could not load because the RS485 was already claimed. This may occur if you have other features such as somfy turned on.
Discovering or Creating Modbus Devices
Each device should be set up with a unique address between 1 and 247. This is generally done via a button press scheme or dipswitch on each device. This will be mentioned in the product manual.
Modbus is not well standardised in terms of device discovery. In some cases, it may be necessary to manually add the address, without detection.
Regardless of whether you are discovering or creating a device, right click on the controller and choose Discover devices->Modbus devices
From here, you can choose to scan/create a modbus device on channels 1-247. The scan type field can allow you to differentiate between quick scan (scans for answers on common registers), a thorough scan (scans a lot of registers - very slow) and Generate devices which skips scanning for register answers and creates devices without checking to see if they exist.
It is highly recommended that you try to ensure that your address scan range is as small as possible - scans can take quite some time due to large timeouts and the aforementioned issue of needing to account for differences in the supported registers for devices.
Also note that when you do Generate Devices, the controller will instead create however many custom devices from an address start. It will not write over currently created devices. These devices will at the start have 0 points and you will need to add your points manually.
Driver Types
At this point, modbus devices are scanned/created and if any are found, you should see Control Devices appear. It should be noted that this process can take some time on the cloud.
The monitor will show the following message, for a new device (note that Already Known is set to 0, meaning that the device is going to created). We do not do anything to a device that has already been found.
The following driver types currently exist. If your device is recognised, the system will create modbus points for you. Otherwise, your device will be given the custom drive type.
| Driver Type Number | Description | Driver Ready |
| 0 | Unidentified Modbus Device (Custom) | Yes |
| 1 | Schneider 3xxx Energy Meter | Yes |
| 2 | Schneider 2xxx Energy Meter | No |
| 3 | Legrand IME NEMO96 Energy Meter | No |
| 4 | Schneider PM3250 Energy Meter | Yes |
| 5 | CHINT DDSU666 Energy Meter | Yes |
In the case of the CHINT DDSU666, all available data points are created. You can skip to the Setting up the general purpose sensor section.
Editing a custom device
If we do not recognise your device but have received an answer or you have simply created your device, your device will be created as a 0 point Custom driver type.
Alternatively, if your device has been identified with a driver but the implemented driver points do not contain points you wish to see, you may wish to convert the driver type to custom and expand as needed. If you are missing a register you wish to see, you will need to convert the device to a custom driver type so you can edit the points.
If your device is initially custom with 0 points, your device will only appear in Modbus->Device. You must first adjust the number of points and wait for the value to go black.
Once the value has gone black, you will have blank modbus points in the Modbus->Point section. There will also be a control device, with instances created but no data will be exchanged, as yet.
In Modbus->Point you can adjust the pertinent information for your points
To set up your modbus points, you will need to browse the product documentation for your device Please note that product documents can vary significantly in how information is presented!
Function type refers to the function - for example, read input register, read holding register, read coil etc.
Modbus points can come from a few different types of registers, but the most common are as follows:
Coils (discrete outputs): 00001-09999 (0xxxx range)
Discrete inputs: 10001-19999 (1xxxx range)
Input registers: 30001-39999 (3xxxx range)
Holding registers: 40001-49999 (4xxxx range)
The two main registers you will be reading from are input registers and holding registers. In general, holding registers are writeable and are used for configurable values, input values are used for sensor type data.
For some documents, you will see the following:
The Address field refers to the modbus register address to read from.
In this document, you would set the function type to Read Input Register, the address to 0 for Voltage V1N.
In Schneider documents, it is not clear which type of register should be read (but they seem to answer correctly for holding registers). Additionally, the actual real register address is the address suggested, plus 1.
Therefore, in this scenario, the actual register address to put into the field is 3023.
In CHINT documents, the value is present only in hexadecimal form (Ie, 0x2000 = 8192) but no +1 offset is applied.
Data type is sometimes well documented and other times, must be deduced from the size. If the language suggests "floating" then there will be decimal element and will probably be using FLOAT32.
Size in modbus documents is generally represented as the number of words (2 byte) values, therefore, the number of words gives clues as to the datatype of the CHINT register. Here we can see it is a float and it has 2 words (4 bytes)
Therefore, the CHINT register is a FLOAT32 and we would fill in 4 bytes as the size.
In Modbus->Point we represent our size in number of bytes
| Data Type | Number of bytes |
| UTF8 | Varies |
| UINT16 | 2 |
| UINT32 | 4 |
| UINT64 | 8 |
| FLOAT32 | 4 |
| INT16 | 2 |
| INT32 | 4 |
| INT64 | 8 |
| FLOAT64 | 8 |
Endianness refers to how the bytes are represented. There is no standard for how the bytes are represented and thus, this can be a frustrating process to establish. If you're lucky, your documentation may indicated how the bytes are represented.
There are 4 options for this:
| Value | Endianness | Description |
| 0 | Big-Endian | ABCD - Most significant 16-bit word in first register |
| 1 | Little-Endian | CDAB - Least significant 16-bit word in first register |
| 2 | Big-Endian Byte Swapped | BADC - Big-endian words, but bytes swapped within each word |
| 3 | Little-Endian Byte Swapped | DCBA - Little-endian words with byte swapping |
We suggest choose Big-Endian order (default and most likely), setting a point with expected / known data up to read (see below to ensure you have set up the resultant general purpose sensor instance) and then reading the monitor. We provide the 3 remaining endianness translations in our results so that you can quickly ascertain what might be necessary.
Example:
The following monitor output shows that we read Input Register address 0 with Big Endian endianness and our result was -1.9509627E-20 which being voltage, seems incorrect. If we look at all the translations after, we can see that Little Endian Swapped produces 226.62V which means that our device (a Selec MRJ4M-SL) uses this scheme.
If we then change our scheme to Little Endian swapped, our results look correct:
Quantity Name and Unit provide ways to classify the data for analytic purposes.
Scaling data
Important Note: Modbus points apply scaling to data before it enters the general purpose sensor. General purpose sensors have their own scaling option as well (since they can interface with various data sources, not just Modbus points). As a best practice, when using Modbus points, the scaling value in the general purpose sensor should match the magnitude configured in the Modbus point.
Scaling refers to adjustments we apply to convert the value that the register produces to the precision we require. This is typically going to be done when we're either converting to a smaller / larger precision because the dali standard does not implement that precision (ie, we must convert kilowatt hours to watt hours) or we need to prepare the system for decimal precision.
Limits to our data size:
If the register you are retrieving from is larger than a 32bit value, you may need to scale it down if the value produced is larger than 32bit. You may see the following text in the poll of a modbus point:
Register Address 2699 (0x0A8B) on Modbus Address 10 (0x0A) produces out of range value (breaches INT32 boundary 2147483647)
This indicates that we have polled a 64bit register and the answer is larger than a 32bit number.
Example Scaling results
| Raw Value | Scaling | Resultant value |
| 1.64 | -3 | 1640 |
| 1.64 | -2 | 164 |
| 1.64 | -1 | 16.4 |
| 1.64 | 0 | 1.64 (No scaling) |
| 1.64 | 1 | 0.164 |
| 1.64 | 2 | 0.0164 |
Magnitude refers to the precision that we have scaled our data to and for the system to show
| Magnitude | Result |
| -2 | Two decimal points |
| -1 | One decimal point |
| 0 | No decimal (whole numbers only) |
| 1 | Divided by 10 |
Example:
A register produces a FLOAT32 for the voltage detected. We put FLOAT32 in for data type, 4 bytes as the size.
Our data comes from the modbus register as 240.1V. If we select 0 for scaling and magnitude, our data is whole numbers only and the result will be rounded down to 240V.
If we wish to see the decimal point, we must first apply scaling of -1 (to change it to 2401), which we then inform the system that the magnitude is in -1.
Now, the voltage will show as 240.1V. We can expand the decimal point precision to 2 points by increasing the scaling to -2 and setting the magnitude to -2.
Example 2:
A register produces a FLOAT32 of kWh.
Dali has a unit value in Wh. Therefore, our data must be multiplied by 1000 to get Wh.
Data comes in as 240.12345 kWH (240123.45 WH)
As the unit we can select is wH, we first must convert kWh to Wh. This is done by applying a scaling of -3. Our data will now be 240123 WH and the magnitude will be 0.
We could of course also set the the scaling to 0 and the magnitude to 3. Both are valid.
Example 3:
In the previous example, we lost two decimal points of data. If we wish to see decimal points, we must further expand the scaling.
If we increase the scaling from -3 to -5 and set the magnitude to -2. We will now see the information as 240123.45Wh.
Setting up a Modbus Point General Purpose Sensor Instance
Once you have configured your point, an associated general purpose sensor will be found in Instance Types -> General Purpose Sensor. Some of the values that you have set are available in the same view but it would be wise to only adjust these values in the Modbus Point section.
By default, your new sensor will have a retrieval method of Poll Time and a retrieval time of Every 60 Seconds. This can be adjusted down to a minimum of 10 seconds. Please note that modification of your retrieval behaviour to Hysteresis will not work. Hysteresis can only be used with a dali general purpose sensors that support sending messages when a threshold has been breached.
You will see in the value field that there is no data
This is because there is no application behaviour for the profile you are currently in. Once the system is instructed that the point should be active in this profile, it will begin polling the modbus point.
For the purposes of keeping this document simple, the behaviours you can select depict whether you want triggers (if you give the instance a target) and whether you send analytics for historical data tracking.
If you give the instance a target of a system variable, you will be able to check the value in an On System Variable Changed trigger via your trigger map and sequences.
Deleting Modbus Devices or Points
You can only delete points by way of decreasing the number of points in Modbus ->Modbus Device.
You can start again with any modbus device by simply deleting the associated control device in Device Location. This will remove all traces of the modbus device and you will need to run the Discovery again.
Comments
0 comments
Article is closed for comments.