rossmann-engineering / EasyModbusTCP.NET

Modbus TCP, Modbus UDP and Modbus RTU client/server library for .NET implementations
949 stars 413 forks source link

EasyModbus TCP slows down the windows application #32

Closed nayanavv closed 5 years ago

nayanavv commented 5 years ago

Hi, I'm using EasyModbus TCP to connect to a slave device from a windows application (WinForms). I'm sending and receiving float values using the methods inside the timer for Modbus communication since the values should be communicated continuously.

modbusClient.WriteMultipleRegisters(register, ModbusClient.ConvertFloatToRegisters((float)variable, ModbusClient.RegisterOrder.HighLow)); (for writing to Slave)

and

ModbusClient.ConvertRegistersToFloat(modbusClient.ReadHoldingRegisters(register, 2), ModbusClient.RegisterOrder.HighLow); (for Reading from Slave)

It works well when the number of methods used inside the timer is less, but the application slows down when the number of methods increases.

Is there any way to speed up the whole communication?

Thanks Nayana

Padanian commented 5 years ago

I don't have any problem with this and don't see any speed reduction.Can you please share your code or would you please explain how you call the methods and how often?

----- Messaggio Originale ----- Da: "rossmann-engineering/EasyModbusTCP.NET" A:"rossmann-engineering/EasyModbusTCP.NET" Cc:"Subscribed" Inviato:Mon, 14 Oct 2019 10:49:53 +0000 (UTC) Oggetto:[rossmann-engineering/EasyModbusTCP.NET] EasyModbus TCP slows down the windows application (#32)

Hi,

I'm using EasyModbus TCP to connect to a slave device from a windows application (WinForms). I'm sending and receiving float values using the methods inside the timer for Modbus communication since the values should be communicated continuously.

modbusClient.WriteMultipleRegisters(register,

ModbusClient.ConvertFloatToRegisters((float)variable, ModbusClient.RegisterOrder.HighLow)); (for writing to Slave)

and 

ModbusClient.ConvertRegistersToFloat(modbusClient.ReadHoldingRegisters(register,

2), ModbusClient.RegisterOrder.HighLow); (for Reading from Slave)

It works well when the number of methods used inside the timer is

less, but the application slows down when the number of methods increases.

Is there any way to speed up the whole communication? 

Thanks

Nayana

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/rossmann-engineering/EasyModbusTCP.NET/issues/32?email_source=notificationsu0026email_token=AB3I2BFLFSVQ2Z4UUT4JK7LQORFEVA5CNFSM4JANPYH2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HRRYJLQ", "url": "https://github.com/rossmann-engineering/EasyModbusTCP.NET/issues/32?email_source=notificationsu0026email_token=AB3I2BFLFSVQ2Z4UUT4JK7LQORFEVA5CNFSM4JANPYH2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HRRYJLQ", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/rossmann-engineering/EasyModbusTCP.NET/issues/32?email_source=notifications&email_token=AB3I2BFLFSVQ2Z4UUT4JK7LQORFEVA5CNFSM4JANPYH2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HRRYJLQ [2] https://github.com/notifications/unsubscribe-auth/AB3I2BGLIJKRBUAGOU56QWLQORFEVANCNFSM4JANPYHQ

nayanavv commented 5 years ago

Hi Padanian,

I have resolved this issue by multithreading. The slow Modbus read and write applications were making the whole application not responsive(slow).