12-19-2017 03:48 AM
Hello to everyone,
I am currently trying to run a Phoenix bus controller via Modbus TCP protocol to read out a connected AI module. According to the specs of the devices the sampleinterval should be roughly 40 to 50µs (including ADC conversion and bus cycletime). Unfortunately I am not able to get below 2 - 3 ms (details follow below).
Hardware used:
- USB 2.0 Ethernet adapter 10/100 Mbit (Modbus data + analog in data should be 128 Bit alltogether - should be sufficient if I am not mistaken)
- Phoenix AXL F BK ETH (Ethernet bus controller that supports Modbus TCP - they call it Modbus UDP - according to spec the bus cycle time should be in range of one digit µs)
- Phoenix AXL F AI4 I (Analog input module, that is connected via local bus to ethernet bus controller - according to spec the ADC conversion and bus time should not exceed 40 µs per cycle)
Software used:
- Labview 2014 SP1
- NI Modbus Library v1.1.5.39
- Port used for Modbus communication: 502 (standard port)
- TCP Server on port 3366
- PC is located in company network with firewalls etc (I was suspecting this to be the root cause but I could not test)
Now I created a quick and simple test vi (please see the attachment - sorry for the bad style) to read the Modbus holding registers as fast as possible and I placed multiple timers to get the duration of these polls. Due to the fact that these timers can only return milliseconds, I additionally calculate the duration by total samples divided by total duration. The result is always the same: 2.8 ms.
Unfortunately I was not able to find similar problems in forums. They are mostly facing problems of seconds and it seems as if nobody is working in µs intervals.
My questions are:
- Does somebody have experience with the NI Modbus library and maybe knows what could slow it down?
- Does somebody have an idea what I am doing wrong? I am new to Modbus so I think the error is most likely sitting in front of the display.
Thanks in advance!
Best Regards
Jenso
12-19-2017 04:54 AM
Modbus is not a Real-Time protocol! You can request the current values of data registers. Each request consists of sending out a message via TCP, waiting for the response (again via TCP) and parsing that response. Overall I think 2-3 ms is a good loop time for that.
Regards, Jens
12-19-2017 06:24 AM
Hey Jens,
thanks for the quick response. Ok, I have to admit, that I am new to those topics and it looks like i have found a task until christmas: Get infos about real time protocols.
In the meanwhile I analyzed network communication with wireshark and found that the duration mainly lies on the response side. So this verifies your idea. In addition I was able to increase speed again by getting rid of the USB Adapter. This one seemed to have an impact on the speed. Right now I am at 1.5 ms (mean).
Thanks!
Best Regards,
Jenso