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 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
Tick the enable box, enter a valid baud rate and select your parity.
Value | Parity |
0 | Odd |
1 | Even |
2 | None |
This will changed to a drop down option with the names of the parity schemes, shortly.
If your modbus is configured, once rebooted, you may see a the following message (note that in this case, EVEN parity was applied to the controller).
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 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 adjust our firmware to add detection for your device. Please contact support with your product information if you find this to be the case.
To discover a device, right click on the controller and choose Discover devices->Modbus devices
From here, you can choose to scan for a modbus device on channels 1-247. The scan type field is currently not used but may be used in the future to controller how many registers (the depth) we attempt to scan, in order to find a device.
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.
Driver Types
At this point, modbus devices are scanned 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, 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!
The Address field refers to the modbus register address to read from.
In Schneider documents, 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 |
Quantity Name and Unit provide ways to classify the data for analytic purposes.
Scaling data
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.
When data is read from a modbus point, it is scaled and then we inform the system of what magnitude the resultant value is in.
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 |
Note: Modbus points have their own scaling before the data comes into the general purpose sensor. There is a further scaling option in the general purpose sensor. For all practical purposes, this should be set the same value as the magnitude.
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.
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.