LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Speed Question....

I have been working with the NI Modbus VIs now for the past 4-5 months to communicate with an AC Motor Drive...

I have no problem communicating, sending and receiving messages or anything like that... but as my program and the project it deals with gets more complex... the inner workings of these VIs have more recently gained my attention... With special attention to the seemingly long delays in a typical modbus query.

The problem that brought on this investigation was when I tried reading an encoder position off the AC motor drive, 32767 counts per rev. I noticed each query took on average 50mS to respond... this is quite unacceptable as I need 5 mS between data points... AT MOST.  I am trying to read torque as the motor rotates at a very slow rate along with the encoder position readouts, this will allow me to interpolate the torque reading to the angular position of the motor.

I can take that data and make a cool polar coordinates plot of the change in torque in respect to angle so you can see the different torque spikes with respect to the angle of rotation of the motor... soo cool!! Smiley Very Happy ........ but Im getting off topic.... sorry I get excited.......


So I suppose my first round of question become... where is this delay comming? I know the modbus requires certain delays to wait for the devices to respond to queries and such. TWO delays in question are posted in pictures below, and are found in the MB Serial Receive.  I can only assume these delays are necessary to assure all the proper data sent out is read. These two delays still only account for 20mS of the 50mS delay it takes to query the drive through the LabVIEW modbus commands... I am running 19.2 KBaud which is the fastest the drive allows... but it's still not meeting my needs. Literature on MODBUS leads me to believe that data reads/writes are dependent on CPU speed, and even a slow processor by todays standards should more then meet my needs.

Just to recap , I am using MODBUSRTU, 19.2 KBaud, RS-232 serial cable, reading a register address off an AC Drive, getting a 50mS delay between queries using "MB Serial Master Query.vi"

Im am trying to narrow the problem down... I've expressed concern that the queries to the Drive seem slow, but the Drive guys will pin the guilt on labview.... and I know us Labview gurus would question the Drive's speed.  So let's just start with these two delays found in the MB Serial Receive.vi .... maybe go from there?? 
0 Kudos
Message 1 of 4
(5,197 Views)

Does the drive only act like a slave device?? If the drive has a master mode and can send/broadcast data, you could make the communication a one sided transfer. Labview would be a slave and only listen for transmitted data. I don't think serial will get you anywhere near 5ms considering that Windows will have to handle the serial port  communication. Does the drive have an option to stick in a modbus tcp port or a modbus plus port?? I had to buffer data in the plc memory and then read larger chunks to make stripcharts with Labview/Dsc Module and an opc server.

When you look at the hex data transmitted out the serial port, only a small portion is the actual data value. Lots of overhead to format the device address, data to read, how much to read, and checksums.

Message Edited by unclebump on 10-17-2006 05:28 PM

0 Kudos
Message 2 of 4
(5,187 Views)
hmm.. Not sure if the drive can act as a master and broadcast. I would assume it could as the drive seems very robust.

I also assume the drive only operates through the serial port, and doesn't have options for the tcp, or plus ports.

I know I could have the drive dump data off to a digital output, and if I fed that to a daq card I figure it could read that as fast as my heart desired.

That may be the way to go, as it would sever my ties to the OS. Ill have to look into the master mode option and have Labview act as just a listener.

Thanks for the ideas, the gears are turning again.
0 Kudos
Message 3 of 4
(5,150 Views)
Just to make some rough considerations: 19.2K baud means that you need about 0,05 ms to generate a single bit; given an average of 10 bits/char (8 data + 1 start + 1 stop), you need 0,5 ms for each character (byte) only to send or receive.
If you add the delay inherent into the Modbus protocol, the time needed for the device to recognize the command and prepare the answer, the latency of the OS (Windows can delay by several tens or even in some cases hundreds of ms) I don't think that you have any chance to reach a 200 Hz frequency through RS-232
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 4
(5,148 Views)