Frequently Asked Question
Press "Ctrl + F" to find the keyword of your interest.
If you wish to have a direct link access to the video timestamps, please follow these instructions.
Found this video helpful? Why not take the whole HIL Specialist course? A Certificate is waiting for you for free at HIL Academy.
Would you or your organization benefit from having these videos narrated in your native language? Contact us and let us know if you wish to contribute.
Hello everyone. Now let s have a look at how to configure and implement the Modbus TCP
Client component on the HIL device. For that, let s open the Modbus Client
setup model under the communications protocol tab in the Example Explorer.
The Modbus Client component, which can be found in the Library Explorer under the Communication tab,
implements the Modbus TCP Client Master functionality. You can simply drag and
drop the component as shown here.If you double click the component,
a dialog window opens with different properties that we can define.
The first property is the client setup. Here all network configuration for the client is defined,
such as IP address, Netmask, and gateway. It is important to choose a free IP for the client, and
it should differ from the server one. We went over this process in detail in the previous lesson,
and we will be covering this again in the lesson on the HIL SCADA application of Modbus Client.
For now, the default address should work for us.The Server setup is also defined here. In
this section, you must enter the target Server IP address and port.
The Slave ID is also important when using the component together with Modbus RTU.
Here you can also define a request timeout, which is the time that the Client waits for a Server
response before triggering a timeout event. This is useful for detecting when a connection
between the Server and Client has failed.In the Request information properties window,
we can define all the requests performed by the client. Here we can add them one by one
from the user interface by clicking in the add button as shown here.
Then, we need to define a name for each request, the function code performed, the starting address
of each request, the number of addresses to read or write, the transmit type, and the period. For
transmit type, we can choose between three types, on event, on timer and on event and on timer.
Timer requests will be performed once at the start of every chosen transmit period,
while event requests will be performed after every event change that meets pre-defined conditions.
On event and on timer requests will be performed on both events, when programed time reaches its
value or when an event trigger is detected at the respective input terminal of the component.
Let s have a look at how you can add and configure requests in the user interface. Let s add an extra
request to this example to write to a single register and let s call it HIL specialist.
The write address should not overlap with the ones already defined for holding registers,
so let s define register 110, and the request will be on timer every 2000 milliseconds.
By hitting the OK button all the changes are saved to the component.
Now we can see an extra input terminal with the name HIL specialist appeared on the component,
thanks to the change we made previously. You can connect any signal processing terminal
or SCADA input to this port.In our case, let s connect a
constant component with a value of 10, for example, to write it to the Modbus Server.
Now we can see that for every request, there is a terminal in the component.
Write requests are inputs from the model to the component and read requests are outputs
from the component to the model. This means that when the Modbus client performs a read
request to the Server it will send the values to the model while write requests are sent
from the model to the targeted Modbus Server.Also, for every on event transmit type request,
there will be an input terminal which represents the event that will trigger the request.
In this demonstration, we have SCADA inputs for coils inputs and holding register inputs.
These components let us send values from the SCADA to the Modbus Client component, which will perform
a writing request to the Modbus Server.Similarly, SCADA inputs are placed at
each of the event input terminals, so we can trigger these events directly from SCADA.
At the right side of the component, you can see that probes are connected to the output terminals.
These probes read the value from the Modbus Server, and so you can them in the SCADA panel.
In order to perform communication with the Modbus Client in this model,
we can use any external Modbus Server device. For this example, we will use the Modbus Slave
software from Modbus Tools, a Modbus Server simulator that run on windows PC. You can
find a link to this tool in the Materials Tab.Let s compile and load the model to HIL SCADA.
After opening the pre-built SCADA panel,
we need to properly setup the Modbus Server on the Modbus Slave application.
Let s open the Modbus Slave software and go to the Setup tab.
From here, we need to choose the Slave ID that matches the value we defined for
the Modbus Client. Each slave in a network is assigned a unique unit address from 1 to 247.
When the master, or client, requests data, the first byte it sends is the Slave address.
This way each slave knows after the first byte whether or not to ignore the message.
The next step is to select the desired Function code,
which in this case is holding register , and type in the address and quantity of registers.
After that, let s go to Connection, choose to connect, and select the Trial period
option. A dialog window with the holding registers will appear. In this dialog,
we need to type the desired numbers into it and hit enter. Let s try 10, 20, 30, 40, and 50.
Now let s return to the Modbus Client in HIL SCADA.
We can see the values displayed in the Holding values subpanel.
Let s follow the same process for coils. Since coils are on-event triggers,
let s press the button event in the read coils section on the SCADA panel.
Now we should see the LEDs turn into red.
We can also write to the Modbus Server coil registers by simply changing the Slave setup
from the slave definition properties under the Slave tab of the Modbus Server application.
Then we can select the coil status and type the right address and number, like shown here.
Now let s go back to SCADA, change the values of the Coil register values,
and click the button event. When we return to the Modbus Server application,
we can see the registers are updated.Now we ve covered how to setup the Modbus Client
component in Schematic Editor. In the next lesson, we ll look at another implementation of Modbus
Client using SCADA API. Thank you for watching and see you in the next lesson!