cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Modbus Slave Simulator with ThingWorx Industrial Connectivity

nagrawal-2
1-Visitor

Modbus Slave Simulator with ThingWorx Industrial Connectivity

Hi,

I am new to working with Modbus protocol. To understand how things work with Modbus and how would we collect the Data from Modbus using Industrial Connectivity, I am using Modbus Slave simulator which sends dummy data to some Register Addresses.

I have used My IP address for Host and 502 as a Port number. The simulator is kept refreshing the data every 1 sec.

To collect the data in Industrial Connectivity I have created new Channel with Driver: Modbus TCP/IP Ethernet and Port Number 502. Then I have created Device within Modbus Channel with the following Configuration:

ModbusDevice.PNG ModbusDevice2.PNG

After that, I have created new Tag with 40001 Address and Datatype Default. But I am not receiving any data. To verify my connection, I did Launch Quick OPC Client but I am not receiving any data:

OPC Quick Client.PNG


Can you please help me out, I have only four days trial version of Modbus Simulator. I can't work with Edge MS as suggested here: Modbus PLC Simulator, ThingWorx and You aAs I am not able to download the Modbus Package.


Thanks in advance.

Best regards,

Neetu

ACCEPTED SOLUTION

Accepted Solutions

Hi Neetu,

It looks like you have only one network adapter (NIC) available on this PC. The Device ID of 127.0.0.1 (loopback adapter address), and the Device ID of 192.168.0.15 (the IP address of the NIC itself) will both signal the Modbus TCP driver to enter into Modbus Slave mode. You want the Industrial Connectivity Modbus Master to communicate with the Modbus Slave Simulator software. When both applications are fulfilling the role of Modbus Slave, you will not be able to read values from the Modbus Slave Simulator, you will be reading the values for the Industrial Connectivity Modbus Slave (which default at zero at startup).

To solve this, you will need to do one of the following:

1. Install the Modbus Slave Simulator software on a different PC. You will want the two PCs to ideally be on the same network, or at the very least they need to be able to form a TCP socket connection from one to the other.

2. Install a new NIC on the PC, and use one NIC for your Modbus Slave Simulator software, and the other NIC for the Industrial Connectivity Modbus Master driver. The Device ID will then be the IP address of the NIC the Modbus Simulator Software is binding to.

3. Multi-home the NIC, giving it more than one IP address. Then, when you open the Channel Properties in Industrial Connectivity, you will see each IP available for selection from the Network Adapters list. You will assign a unique IP to each application, just as with Step 2.

The key will be that the Industrial Connectivity driver and the Modbus Slave Simulator are not both binding to the same NIC.

Best regards,

Steven M

View solution in original post

14 REPLIES 14

You may want to take a look at the Manufacturing Apps portal. It has some examples.

https://www.ptc.com/en/thingworx/manufacturing-apps/Dashboard/Get-Started

You need to register first. You can also post questions related to these manufacturing apps.

Manufacturing Apps

Hi Varathan,

Thanks for your response. I will try to look into the portal.

Neetu

Greetings Neetu,

Looking at your screenshots, it appears the tags you have created are reading as "Good" Quality in the Quick Client. This implies the Industrial Connectivity OPC DA Server has attempted to communicate with the Device at those tag addresses, and it has received a valid response for this driver. Since the driver is configured as a Modbus TCP master, this also implies it has received a valid Modbus response from the device. It is likely the address being requested from the Modbus Simulator has a Value of "0" for the address requested.

Perhaps the Modbus simulator is using address 40001, with zero-based addressing disabled. With your current settings, try creating a new tag in the Industrial Connectivity server with an address of 40002. Do you find the value you are expecting now appears in the Quick Client?

Best regards,

Steven M

Hi Steven,

Thanks for your response.

I have tried your solution but it didn't work. I am not receiving any values. Strangely I am receiving some values in item SuccefulReads of Channel Statistics which is keep updating. It is not making sense to me.

ModbusDevice_Stats.PNG

I am new to this Modbus protocol so probably I am not understanding the configuration in right way. I am using Modbus Simulator as a Slave and Modbus TCP driver in industrial connectivity as a Master which will read data from Simulator. Is this correct ?

Regards,

Neetu

Hi Neetu,

Yes, your description is correct.

That incrementing value for _SuccessfulReads reflects each successful attempt on the part of the Driver (the Modbus Master) to read a value from the Device (the Modbus Slave simulator), and this will increment at the rate of the requests being sent by the OPC Quick Client. This means the Modbus Slave simulator currently holds a value of "0" for the address being requested; and there have been 351 successful read request / read response transactions since you opened the QuickClient.

What values do you expect to see for these addresses?

Best regards,

Steven M

Hi Steven,

Thanks for the response again.

My Simulator is generating values for around 10 addresses. Please see the image below:

Modbus_Slave_Simulator.PNG

And this is the Map Address Configuration for my Slave of device id 10

Modbus_Slave_MapAddress.PNG

Regards,

Neetu

Hi Neetu,

Thank you for the screenshots. It looks like you may have the Industrial Connectivity Device (Modbus Master) configured to communicate with Slave ID 1. The format for the Device ID, in the Device Properties, is '<IP Address>.<SlaveID>'.

Try entering this into the ID field: <192.168.0.15>.10

Or, if the Modbus Slave simulator application displays the Slave ID in Hex, you will want to use this ID: <192.168.0.15>.16


Do the values you are expecting display now?

Best,

Steven M

Hi Steven,

I was using SlaveID 1 earlier but I changed it to 10 and I made the updates both in Slave Simulator and Industrial Connectivity. I have also received this message in Event log of Industrial Connectivity "Created memory for slave device. | Slave device ID = 10". But I am not receiving any values other than 0


Regards,

Neetu

Hi Steven,

Would it possible for you to try the same Simulator at your end? I feel I am very close to making it work but the values aren't updating, It would be very appreciated if you can give it a try.

Many thanks,

Neetu

I have tried another Simulator http://www.plcsimulator.org/Home , like earlier I am able to make successful connection but I am not reading data other than 0. When I check the logs in this Simulator I am receiving this error .

Accept() Error on Listen Socket wsaeinval

Greetings Neetu,

I have a different thought on what might be occurring, since you are seeing this message: "Created memory for slave device. | Slave device ID = 10". This message signifies the Modbus TCP driver has been placed into Modbus Slave mode, rather than functioning as the default Modbus Master. When you enter the loopback IP address of the network adapter specified for the Modbus TPC driver Channel into the Device Properties' "Device ID", the driver will then be switched into Modbus Slave mode. The loopback address usually used is "127.0.0.1", but if the IP you are using (192.168.0.15) is the IP address of your network adapter, that will also trigger Modbus Slave mode for the driver.

You will be unable to have the Industrial Connectivity Modbus TCP Driver function as a Master if it is binding to the same network adapter as your Modbus Slave simulator. Do you have an additional network adapter available on this PC? To check and change this, open the Channel Properties > select the Ethernet Communications property group. The "Network Adapter" is likely set to "Default". If you select the ellipses next to "Default", a menu of "Available Network Adapters" will be displayed. Can you use a different adapter for this Channel?

Best regards,

Steven M

Hi Steven,

Thanks for your response. I have changed the Network Adaptor to this :

network_adaptor.PNG

But I still receive this message in TW "Created memory for slave device. | Slave device ID = 10", but yes I don't receive Accept() Error in my Modbus Simulator. I have created two devices within same Channel with following IDs :

Device 1: <127.0.0.1>.10

Device 2: <192.168.0.15>.10

But still, I am not able to receive any data.

Hi Neetu,

It looks like you have only one network adapter (NIC) available on this PC. The Device ID of 127.0.0.1 (loopback adapter address), and the Device ID of 192.168.0.15 (the IP address of the NIC itself) will both signal the Modbus TCP driver to enter into Modbus Slave mode. You want the Industrial Connectivity Modbus Master to communicate with the Modbus Slave Simulator software. When both applications are fulfilling the role of Modbus Slave, you will not be able to read values from the Modbus Slave Simulator, you will be reading the values for the Industrial Connectivity Modbus Slave (which default at zero at startup).

To solve this, you will need to do one of the following:

1. Install the Modbus Slave Simulator software on a different PC. You will want the two PCs to ideally be on the same network, or at the very least they need to be able to form a TCP socket connection from one to the other.

2. Install a new NIC on the PC, and use one NIC for your Modbus Slave Simulator software, and the other NIC for the Industrial Connectivity Modbus Master driver. The Device ID will then be the IP address of the NIC the Modbus Simulator Software is binding to.

3. Multi-home the NIC, giving it more than one IP address. Then, when you open the Channel Properties in Industrial Connectivity, you will see each IP available for selection from the Network Adapters list. You will assign a unique IP to each application, just as with Step 2.

The key will be that the Industrial Connectivity driver and the Modbus Slave Simulator are not both binding to the same NIC.

Best regards,

Steven M

Greetings Steven,

Sorry for the late response, I was very occupied in resolving the License issue.

Your method of running Modbus Slave and Modbus Master on two different PC worked like a charm.

Thanks a ton.

Best regards,

Neetu

Announcements


Top Tags