Skip to main content

Collect your first point

Use the built-in protocol simulator to create a register containing 1234, then read it through Collection Configuration. This exercise needs no PLC or separate Modbus software. MQTT, history, and rules can be added after the first reading works.

Follow Quick Start to start TGateway and sign in. All steps below use the same Runtime; Studio is not required.

Prepare the simulated source​

1. Create the simulated slave​

Open Development Configuration → Protocol Simulator. On an empty page, select New Channel; otherwise use the plus button beside the channel list.

Enter the channel name and plugin on Channel Configuration, then open Transport Configuration and Modbus Configuration.

SettingValue for this exercise
Channel nameDemo_Modbus_Simulator
Protocol pluginModbus Slave
Channel typeTCP Service
Listen address127.0.0.1
Port15030
Frame formatModbus TCP
Station number1

Keep other settings at their defaults. Save the channel and leave it stopped while adding the variable. Stop it before reopening its configuration later.

Simulator transport listening locally on port 15030

127.0.0.1 refers to the machine running Runtime, even when your browser runs elsewhere. If port 15030 is occupied, choose a free port and use the same port in the collection channel below.

2. Add a fixed source value​

Select the simulator channel, open Variables, and click the plus button for Add Variable.

SettingValue for this exercise
Variable nameSourceValue
Protocol addressS=1;F=3;0
Data typeInt16
Array length1
Initial value1234
Data-change designer: enable automatic changesOff

The address assistant can generate the same address: station 1, holding register, offset 0. Keep other settings unchanged. Save the variable and start the simulator channel. Confirm that it is running and the source value is 1234.

SourceValue configured with initial value 1234

Configure the collection path​

3. Create the collection channel​

Open Development Configuration → Collection Configuration and click Add Channel at the top left.

SettingValue for this exercise
Channel nameDemo_Modbus_Channel
Channel typeTCP client (TcpClient)
Remote address127.0.0.1:15030
EnableOn
Cache timeoutKeep the default 500 ms; do not enter 0

Keep the other timeout, heartbeat, and concurrency settings at their defaults, then confirm. Reopen the channel through More → Edit Channel when you need to check it.

Collection channel connecting to the local simulator

The simulator listens as a TCP server; this collection channel connects as a TCP client. Verify the direction at both ends.

4. Create the collection device​

Click Add Device at the top left. On Basic Information, enter a name, select the plugin, and associate the collection channel.

SettingValue for this exercise
Device nameDemo_Modbus_Device
Associated channelDemo_Modbus_Channel
Device pluginModbus Master
Execution interval1000 ms
EnableOn
Plugin properties: Modbus typeModbus TCP
Plugin properties: default station1
Plugin properties: DTU IDEmpty

After choosing the plugin, open Plugin Properties and check Modbus TCP, station 1, and the empty DTU ID. Keep other settings at their defaults and confirm.

Device associated with the demonstration collection channel

5. Add the collection point​

Select Demo_Modbus_Device in the left tree, then click Add Variable above the variable table.

SettingValue for this exercise
Variable nameDemo_Modbus_Value
DeviceDemo_Modbus_Device
Variable address40001
Data typeInt16
EnableOn
Array lengthKeep 0 for a scalar collection value
Read/write expressionsEmpty

Confirm to return to the variable table. For a collection-only point, use read-only access.

Collection point using address 40001 and Int16

40001 selects the first holding register, matching simulator address S=1;F=3;0. Its protocol offset is 0. Start with this one known point before adding a larger point table.

Verify the reading and continue​

6. Check the reading​

Wait one or two collection cycles, refresh the table, and locate Demo_Modbus_Value. Verify all three results:

  • The variable is online and healthy.
  • Its current value is 1234, matching the simulator.
  • Its collection time keeps advancing.

Healthy collection with current and raw values both 1234

Unexpected resultCheck
Device cannot connectSimulator is running; both ends use the same port
Read failsStation 1, source S=1;F=3;0, collection address 40001
Value differs from 1234Both types are Int16; source initial and current values are correct
Point is missingSelected device and any name/status filters

Continue when needed​

Next taskGuide
Connect a physical deviceModbus Master: replace the endpoint, station, and addresses with the actual point table
Forward this value to MQTTMQTT Client Producer: prepare a reachable broker
Save local historyHistorical Data Storage: SQLite can be used without a separate database service
Convert 1234 to 123.4Script Management
Evaluate a conditionRule Engine
Import more pointsExcel import/export
Build a complete projectProject configuration and delivery

Finish the exercise​

Keep the configuration if you want to continue later. To release the listening port, disable the demonstration collection device first, then stop Demo_Modbus_Simulator in Protocol Simulator.

Before deleting demonstration objects, remove any forwarding, script, or rule references you added. Select the individual demonstration objects for cleanup.