Skip to content

iluwaaa/qslave

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QSlave: Modbus network emulator

Introduction

This application is software emulator of Modbus network. It emulate several slave devices connected by virtual network. This network connected to the physical Modbus network.

Adapter USB RS485 required for connection QSlave with physical network.

1. Installation

1.1. Building from sources

  1. Get sources from repository
$ mkdir qslave
$ cd qslave
$ git clone https://github.com/maisvendoo/qslave.git qslave
  1. Make build directory
$ mkdir build
$ cd build
  1. Generate Makefile
$ qmake ../qslave
  1. Run make
$ make

1.2. Windows setup

Download last release from release page. Run qslave-vX.Y.Z-setup.exe and folow installation instructions.

2. Setup virtual network configuration

You need several configuration files in XML format for setup network configuration. You can see example configuration in directory cfg/example. The list of virtual slaves is in file exmaple.net

<?xml version="1.0" encoding="UTF-8" ?>
<Config>
	<Slave>
		<!-- Slave description -->
		<Description>Traffic light</Description>
		<!-- Slave ID -->
		<id>1</id>
		<!-- Slave config file (without *.xml extension) -->
		<config>traffic-light</config>
	</Slave>
</Config>

Earch slave has own config file. You can see file traffic-light.xml for example of slave configuration

<?xml version="1.0" encoding="UTF-8" ?>
<Config>
	<!-- Coils list -->
	<Coil>
		<address>16</address>
		<description>Red signal</description>
		<value>0</value>
	</Coil>
	<Coil>
		<address>17</address>
		<description>Yellow signal</description>
		<value>0</value>
	</Coil>
	<Coil>
		<address>18</address>
		<description>Green signal</description>
		<value>0</value>
	</Coil>
	
	<!-- Discrete inputs list -->
	<DiscreteInput>
		<address>0</address>
		<description>Ready</description>
		<value>1</value>
	</DiscreteInput>
	
	<!-- Holding registers list -->
	<HoldingRegister>
		<address>5</address>
		<description>Signal activity time</description>
		<value>15</value>
	</HoldingRegister>
	
	<!-- Input registers list -->
	<InputRegister>
		<address>2</address>
		<description>Signals count</description>
		<value>3</value>
	</InputRegister>
</Config>

3. Load configuration and work with QSlave

  1. Run QSlave
  2. Load network configuration from *.net file (File -> Open config)

  1. Select device in device list. You can see all device data structures in application Windows

  1. Plugin USB RS485 adapter to you PC USB port. Adapter must connected to physical Modbus RTU network.
  2. Select connection parameters (port name, baudrate, etc.) and press connect button
  3. You can change all values in tables of device memory (Coils, Holding registers, Discrete inputs and Input registers). You also can see changes in coils and holding registers, when master device send data to virtual device.

About

Modbus network emulator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 87.4%
  • C 7.6%
  • QMake 2.0%
  • Inno Setup 1.8%
  • Shell 1.2%