SentinelSCADA › Tutorial › Chapter 10

Chapter 10: Add a Modbus Device

Goal Connect a real Modbus/TCP device on your network, add two tags to it, and operate them from a switch and a knob on a screen.

Until now we have relied on the Modbus Simulator for tags to develop our ideas with. In this chapter we add a real Modbus/TCP device on the local network. For our example the target is an FX3U-ENET Ethernet interface attached to a Mitsubishi FX3G PLC, but any Modbus/TCP device works the same way.

Open your BoilerHouse project, then choose System > Device/Tag Setup…

Part 1: Add the device

Press the + Add Device button. If you have followed the tutorial so far you will already see a Modbus Simulator and a WorldSystem device in the list. We can have one of each of those, one AstroPLC (the logic engine), and then as many Modbus devices as we need, up to 240 devices in total under the licence limit. When OPC UA arrives, it will share that same limit.

The Devices list in Device/Tag Setup showing the Modbus Simulator and World System devices, with the Add Device button highlighted

The Driver Type list defaults to Modbus TCP. The Simulator and World System entries are greyed out because they are already in the project.

The Driver Type list open, showing Modbus TCP, Modbus SIM and World System (both marked already in project), and AstroPLC

In our example the device is at IP address 192.168.8.70 and serves Modbus on port 1502. Enter the details for your own device, and give it a name that will mean something to you later. We called ours FX3G.

The new Modbus TCP device form with Name FX3G, IP Host 192.168.8.70, Port 1502 and Unit ID 1 highlighted, plus Poll 1000, Address Offset and 32/64-bit Word Order
Unit ID
The Modbus TCP driver is a multi-device interface. You might have sixteen devices, each with its own IP address, or one IP address with sixteen slave devices routed through it, and the Unit ID tells them apart. It is a required setting and defaults to 1, which suits most devices that have an address to themselves. Any valid Unit ID can be used, even for a one-to-one connection, so set whatever your device is configured to answer to. If several devices sit behind one address, each needs its own valid Unit ID, for example 1, 2, 3, 10 and 20.
Poll (ms)
How often the driver fetches data from the device. Keep it high enough for the device to answer reliably, but not so low that requests pile up. Think about how many devices, and how many tags per device, you really need to read each second. SentinelSCADA has been tested with 240 devices and around 6,000 tags in total.
Address Offset
Do the internal Modbus stores start at 0 or at 1? Is a holding register 40000 or 40001? Manufacturers have used both conventions over the decades. As Set uses addresses exactly as you enter them, and Subtract One shifts everything down by one for devices whose documentation is 1-based. If you are not sure, try each until valid data comes back.
32/64-bit Word Order
For values that span several registers, some devices send the most significant word first and some the least. LoHi is the default; switch to HiLo if multi-register values read back scrambled. Single-register values are not affected.

Press Save Device when you are done. The new device joins the list, though you may need to scroll the list to see it. Use Edit to change a device later. Del removes it, and any tags attached to it, after a warning prompt.

The device list with the new FX3G device at 192.168.8.70:1502 highlighted

Part 2: Add a tag

For our example we need just two tags: a binary (on/off) value and a 16-bit word value. In the lower part of the dialog, press + Add Tag.

The Tags list with the Add Tag button highlighted

There are a lot of settings here. This is where tags earn their keep: everything from scaling to data logging to alarm levels is set in this form. Do not worry about most of them for now.

The new tag form with its default options
Select the device first Two things to note here. (1) Choose the target Device before anything else. (2) The small ? help button beside Register Group opens an addressing overview that is specific to the device type you chose, so if you have not selected your device yet, the help may seem irrelevant.
The tag form with the Device selection marked 1 and the help button marked 2

We selected a Modbus TCP device, so this is the help we get. It is worth reading until you have the swing of it: the register groups and their address ranges, how multi-register values are stored, and what Address Offset and Word Order do.

The Modbus TCP Standard Addressing help, listing Coil, Discrete Input, Input Register and Holding Register ranges

Let us set up the binary tag first. We will call it PlantExtend and say it is a button the occupants can press to start, or extend, the heating for a preset time. That makes it a Coil. Enter the Tag Name/ID, choose the Coil register group and, for our PLC, address 10. Complete the other settings as required.

The tag form with Tag Name PlantExtend, Device FX3G, Register Group Coil, Address 10 and Type Coil highlighted

Press Save Tag (1), then Close & Reload SCADA Engine (2).

The Save Tag button marked 1 and the Close and Reload SCADA Engine button marked 2

Part 3: A switch for PlantExtend

We can set up and test the new tag straight away. On the screen, drag a Button/Switch from the Controls group of the Toolbox. With it selected, look at its properties.

A Switch widget on the canvas with its Data Tag Bind box empty and a browse button beside it

Set the bound tag to PlantExtend. There are two ways to find it. You can start typing in the Data Tag Bind box and the list narrows as you type, matching on name, address and device. You can type several words, so plant coil would find it too. Or press the … button beside the box for a fuller search dialog with device and type filters, and columns you can click to sort. That one comes into its own when a project has thousands of tags.

The Select Data Tag dialog with extend typed in the search box, listing the ExtendMinutes and PlantExtend tags

Choose the tag. The widget's label under the switch now shows the tag it is bound to.

The switch with Data Tag Bind set to PlantExtend (Coil:10)
Deleted a tag by mistake? If a tag is later deleted in Device/Tag Setup, widgets bound to it keep their binding, so re-adding the tag reconnects them. In the meantime the label under the widget turns red with a warning symbol, and the Data Tag Bind box shows the name followed by (missing tag).

Expand Geometry & Limits and make sure Mode is Toggle, which is the default.

The Mode list open, showing Toggle, Pulse, Write 1 and Write 0, with Toggle selected

Let us assume that when we set this coil, the PLC runs the plant extension and then resets the coil itself at the end. Let us also assume that if the coil is reset from the screen, the extension stops. How the PLC is programmed is of course entirely up to you.

Finally, in Styling & Appearance, change the Button Text to something meaningful. This is the text the operator sees on the switch.

The Styling and Appearance section with Button Text set to Plant Extend and the switch showing that text

Save the screen with File > Save Screen, then choose View > Run Mode.

Try the toggle

In Run Mode every widget's properties are still visible to us; in Kiosk Mode they are not, which is why Kiosk is the mode for operators. Click the switch once and it toggles the coil in the PLC, and the button colour follows the new state.

Clicking the switch also opens the Manual Control section in the properties panel, so we could equally operate the switch from there.

The Plant Extend switch in Run Mode with the Actions section open, showing the Manual Control ON / Write 1 and OFF / Write 0 buttons and a Value box

Part 4: Extend minutes

Now for the second tag. Open System > Device/Tag Setup… again, press + Add Tag, and remember to choose the FX3G device first. We will call it ExtendMinutes, with a Holding Register at address 40010 and a type of Int16.

There are many adjustments and features on a tag, but for how long to extend the heating, perhaps 15 to 90 minutes would be sensible limits. Set Min Value to 15, Max Value to 90 and Step to 1. As before, press Save Tag, then Close & Reload SCADA Engine.

The tag form with ExtendMinutes on device FX3G, Holding Register address 40010, type Int16, and Min Value 15, Max Value 90 and Step 1 highlighted

Back on our screen, this time we will use an Analog Knob. Bind ExtendMinutes to it, using the same search box or browse button as before.

An Analog Knob on the canvas with Data Tag Bind set to ExtendMinutes

Save the screen with File > Save Screen, choose View > Run Mode, and try to adjust the value. Because the tag itself has limits, the system will not let us go outside them.

A browser message reading Write failed: Value 10 is outside the permitted range [15, 90] for this tag

We can avoid that message by giving the knob the same limits, and showing them on the knob also makes it easier to read. In Geometry & Limits, set Min Scale Value to 15 and Max Scale Value to 90, with a Step Size of 1 and no Decimal Places. Tick Show Min/Max & Ticks.

The knob showing 15 and 90 at its ends, with Min Scale Value 15, Max Scale Value 90, Step Size 1, Decimal Places 0 and Show Min/Max and Ticks ticked
Two layers of limits The tag's own Min and Max are the real protection, and they apply to every widget and every operator. The knob's limits just make the widget behave sensibly. Set both.

Finally, in Styling & Appearance, give the knob a Title Label of Extension Minutes.

The knob with the title Extension Minutes above it and the Title Label field highlighted

Here is the finished result. There are many more settings to play with to get the look and feel you want, and we will leave those for you to explore.

The finished Extension Minutes knob above the green Plant Extend switch

Summary

This is the last chapter in the Getting Started series. Together, the ten chapters cover the essential steps to get up and running with SentinelSCADA, and we hope you now have a feel for how things work and how straightforward the methods are. That simplicity carries on through the rest of the screens, widgets and controls. There are more advanced setups to tackle should you need them, such as Keycloak and the Telegram Alarm Manager.

The built-in Web Help and Sentinel Launcher Help describe every feature and function in detail, and also include various examples. Training and direct support are also available if you need them; see the XML Control website for more.

Thank you for your interest in SentinelSCADA!