0% found this document useful (0 votes)
33 views

Pythommodbustcprtu

The document describes converting data from 4 RTU stations to TCP. It shows the process of reading settings from a database, initializing threads for each RTU station, reading and writing data, and sending it over TCP. The data is split and read individually from each RTU station and sent to a TCP server over a network.

Uploaded by

Ahmad Abunassar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Pythommodbustcprtu

The document describes converting data from 4 RTU stations to TCP. It shows the process of reading settings from a database, initializing threads for each RTU station, reading and writing data, and sending it over TCP. The data is split and read individually from each RTU station and sent to a TCP server over a network.

Uploaded by

Ahmad Abunassar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ModBus Converter from 4 rtu

station to tcp

Modbus RTU Python script Modbus TCP Python Script

Read Number Read Modbus


Of server TCP settings
From DB from DB

Check number of Initialize


RTU Modbus Slave
136 slave

1 2 3 4
Create TCP
Server then
START START START start it
START
THREAD THREAD THREAD
THREAD 1
1&2 1&2&3 1&2&3&4

Read RTU1 Read RTU2 Read RTU3 Read RTU4


settings settings settings settings Read All
From From From From Commands From
Database Database Database Database
Commands table

START START START START


THREAD 1 THREAD 2 THREAD 3 THREAD 4

Set Settings Set Settings Set Settings Set Settings


and create and create and create and create
While Loop
Connection Connection Connection Connection int=Number Of
to rtu1 to rtu2 to rtu3 to rtu4 Commands

Select all Select all Select all Select all


commands commands commands commands
from from from from
database database database database
have have have have
RTUloop1 RTUloo p2 RTUloop3 RTUloop4
and Create and create and create and create While Loo p
while loop while loop while loop while loop int=Number Of
Commands

Split Split Split Split


Commands Command s Commands Commands
And Read And Read And Read And Read
Each one Each one Each one Each one
alone alone alone alone
No
Read Write Read Write Read Write Read Write ReadDiscre ReadHoldin ReadHoldin ReadInputR ReadInputR WriteMulti WriteMulti WriteMulti
ReadCoils/
tInput/ gRegisters/ gRegisters/ egisters/ egisters/ pleCoils/ pleRegister pleRegister
Read
Read int/Read float/Read int/Read float/Read Write s/int/Write s/int/Write

Read Read Read Read Read Read Read Read Read


Id,type,ar Id,type,ar It,type,ar It,type,ar Id,arrang Id,arrang Id,arrang Id,arrang Value And Value And Value And Value And Value And Value And Value And Value And Value And
range,for range,for range,for range,for e,type,for e,type,for e,type,for e,type,for Address Address Address Address Address Address Address Address Address
mat mat mat mat mat mat mat mat From From From From From From From From From
Same DataBase DataBase DataBase DataBase DataBase DataBase DataBase DataBase DataBase
As First
Thread
Put Put Put Put Put Put Put Put Put
WriteMultiple WriteMultiple Address Address Address Address Address Address Address Address Address
Coils Registers And And And And And AND And And And
Values In Values In Values In Values in Values In Values In Values in Values In Values In
Lists lists List Lists Lists Lists Lists Lists Lists
Id,type,ar Id,type,ar
range,for range,for
mat mat Send To Send To Send To Send To Send To Send To Send To Send To Send To
ModBus ModBus ModBus ModBus ModBus ModBus ModBus ModBus ModBus
TCP TCP TCP TCP TCP TCP TCP TCP TCP
ReadFro ReadFro Server Server Server Server Server Server Server Server Server
mDB mDB

WriteToSl WriteToSl
ave ave

Read ReadHoldingR ReadHoldingR ReadInputRegi ReadInputRegi


ReadCoils No No No No No
DiscretInput egister(int) egisters(float) sters(int) sters(float)

yes Yes Yes Yes Yes Yes

Determine Determine Determine Determine Determine Determine


start address start address start address start address start address start address
and length and length and length and length and length and length
from from from from from from
Command Command Command Command Command Command

Read From Read From Read From Read From Read From Read From
Modbu sRTU Modbu sRTU Modbus RTU Modbus RTU Modbus RTU Modbus RTU

Create while Create while Create while Create while Create while Create while
loop loop loop loop loop loop
depen ding on depen ding on depen ding on depen ding on depen ding on depen ding on
length length length length length length

Append(RTUm Append(RTUm Append(RTUm Append(RTUm Append(RTUm Append(RTUm


odbusaddress, odbusaddress, odbusaddress, odbusaddress, odbusaddress, odbusaddress,
Rtvalue,RTUrea Rtvalue,RTUrea Rtvalue,RTUrea Rtvalue,RTUrea Rtvalue,RTUrea Rtvalue,RTUrea
dingType,RTUF dingType,RTUF dingType,RTUF dingType,RTUF dingType,RTUF dingType,RTUF
unction,RTUloo unction,RTUloo unction,RTUloo unction,RTUloo unction,RTUloo unction,RTUloo
pnumber,ID,Cu pnumber,ID,Cu pnumber,ID,Cu pnumber,ID,Cu pnumber,ID,Cu pnumber,ID,Cu
rrentTime,Arra rrentTime,Arra rrentTime,Arra rrentTime,Arra rrentTime,Arra rrentTime,Arra
nge,Command nge,Command nge,Command nge,Command nge,Command nge,Command Next Command
number) into number) into number) into number) into number) into number) into
lists lists lists lists lists lists

No
End Of While End Of While End Of While End Of While End Of While End Of While
Loop Loop Loop Loop Loop Loop

Yes Yes Yes Yes Yes Yes


Save Readings Save Readings Save Readings Save Readings Save Readings Save Readings
Into Database Into Database Into Database Into Database Into Database Into Database
Through Through Through Through Through Through
pmmsql pmmsql pmmsql pmmsql pmmsql pmmsql
(InsertInTable) (InsertInTable) (InsertInTable) (InsertInTable) (InsertInTable) (InsertInTable)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy