Profinet IRT Gateway: latency using cycleloop() or mainloop()

Moderator: RevPiModIO

Post Reply
flk
Posts: 13
Joined: 21 Nov 2022, 13:56

Profinet IRT Gateway: latency using cycleloop() or mainloop()

Post by flk »

Hi,

I am using a RevPi Core S and the Profinet IRT gateway. In order to examine latency issues which I am facing, I did the following:

In the RevPi, the revpimodio2 cycleloop() is running with a cycletime of 5 ms. As soon as Input__5 is set to 5, I am sending a ping from the RevPi to my PC:


Code: Select all


self.rpi.cycleloop(self.cycleprogram, cycletime = 5, blocking = False)

 

def cycleprogram(self, cycletools):

        if(cycletools.io.Input__5.value == 5):

            os.system("ping -c 1 " + "192.168.1.1")



In order to trigger this ping, I am sending a Profinet message to the RevPi to set Input__5 = 5.

In Wireshark, I am comparing the first time at which the Profinet message with Input__5 = 5 is sent to the Gateway with the first time that the ping is sent from the RevPi to my PC. This takes almost 40 ms which appears to be a lot for reacting to the Profinet message! Similar latencies apply when using mainloop() and register the ping callback to Input__5 instead of using cycleloop().



Are these 40 ms usual or what am I doing wrong?



Thank you very much for any help

Florian
User avatar
RevPiModIO
KUNBUS
Posts: 325
Joined: 20 Jan 2017, 08:44
Contact:

Re: Profinet IRT Gateway: latency using cycleloop() or mainloop()

Post by RevPiModIO »

Hello Florian!

Your measurement of time creates a delay itself. With os.system, Python first has to create a new sub-process, execute the ping command and your computer must also receive it at the end. This will give you at least 12-20ms delay or more depending on the network.

The piBridge, which exchanges the values between Revolution Pi and gateways, also has a small delay.

Perhaps you could run such a test directly on the Revoluton Pi. It should receive the Profinet packet via its network interface, so you have the timestamp from the system. The Python program outputs the system timestamp via a print command at the point where you are currently using os.system.

Sven
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
flk
Posts: 13
Joined: 21 Nov 2022, 13:56

Re: Profinet IRT Gateway: latency using cycleloop() or mainloop()

Post by flk »

Hello Sven,

Thank you very much for your reply. I like your idea to measure the latency directly on the RevPi.
I just want to get the idea right concerning your statement "It should receive the Profinet packet via its network interface". Right now, the Profinet communication is between my Profinet IO controller and the Profinet IRT Gateway.

So does your idea mean to additionally attach the RevPi (i. e. in addition to the IO Controller and the IRT Gateway) to the Profinet network? And then analyze the Ethernet packages in the RevPi? This is the step which is unclear to me as the RevPi does not receive the Profinet message that is sent from the IO Controller to the Profinet IRT Gateway.
So how can I compare the time at which the Profinet message arrives (e.g. directly at the RevPi) with the time at which the process image update sets the corresponding input from the IRT Gateway to the RevPi?

Thank you for your clarification on your idea of the measurement setup.

Kind regards,

Florian
Post Reply