okinelin

"p-Modbustcp 0010: Timeout" Error

Recommended Posts

Hi,

 

I am using DaqFactory to communicate with HMI/Controller via Modbus TCP.

The system is working fine. When the network cable is unplugged, the error message "P-ModbusTCP 0010: Timeout"  is displayed in the Command/Alert window. That's fine.

 

Please how can I capture this error and use in a sequence to alert the user that there is a break in communication especially when the program is in runtime mode and full screen?

 

Thanks

 

 

Share this post


Link to post
Share on other sites

If you are using channels to poll over Modbus, you'll need to use the OnAlert sequence function to capture any alerts (section 5.28 in help).  Or you can use the strAlert system variable (14.3 in help).

Share this post


Link to post
Share on other sites

If you are using channels to poll over Modbus, you'll need to use the OnAlert sequence function to capture any alerts (section 5.28 in help).  Or you can use the strAlert system variable (14.3 in help).

 

Thanks for the lead. I am taking a look at the two options but I need further clarification;

 

Please confirm that strAlert[0] will containn "P-ModbusTCP 0010: Timeout" when a connection is lost? The "P-ModbusTCP 0010: Timeout" is the error message displayed when I pull out the network cable.

 

If I plug back the cable and the connection is re-established and the there is no other alert message, what will be the content of  strAlert[0]? Will it still contain "P-ModbusTCP 0010: Timeout" or something else?

 

Regards

Share this post


Link to post
Share on other sites

The best way to confirm is to actually try it.  strAlert[0] will hold the last alert message until the next one comes in, at which point, the message moves to [1], etc.  I believe it will store the last 100.  Its really designed to allow you to use a table component or similar to simply display the message history.  To actually do something more specific, you should really use OnAlert.  Then you can do whatever you want.

Share this post


Link to post
Share on other sites

Hi,

 

This was the exact thread title I was going to use.

 

I have a UE9 and a PSL PQube on a network working with DAQ Factory.

 

I have a "p-Modbustcp 0010: Timeout" Error that comes up sporadically, I haven't figured out why yet.

sometimes I lose the PQube for minutes or more at a time to this error, and sometimes it runs fine.

 

the ue9 seems to be ok for the most-part but I have a "C1038 Timing lag, data acquisition stalled.  Resetting. Timing: 1.000, Offset: 0.000" That comes up sometimes and seems to repeat every ~20sec.

It looks like it occurs when I have lost comms to the PQube.

 

I am using a sequence to get the LJ channels read because of the speed (2khz), but am still using the "channels" to read the registers from the PQube at 1hz..

 

please advise.

 

Thanks.

Share this post


Link to post
Share on other sites

You get the timing lag because the Timeout's slow down the Timing loops to the point where they lag far enough behind that DAQFactory resets them.  Ignore that error as its a biproduct of your main Timeout error.  This is also why you should put UE9 and PSL channels on different Timing / Offset combos.  If they are the same, the timeouts will drag down the UE9 poll rate.

 

You can try reiniting the port if you lose data for more than, say, 3 seconds.  Its easiest to do this if you are not using channel timing, but even with channel timing you can do it.  Let's say you have a channel called PSL on a device called PQube:

 

private lastTime = systime()

private watchdogTimeout = 3

while(1)

   if ((systime() - PSL > watchdogTimeout) && (systime() - lastTime > 60))

      device.PQube.initComm()

      lastTime = systime()

  endif

  delay(1)

endwhile

 

Something like that.  Note that you don't want to continuously reinit the port, otherwise it'll never get inited, so I only do it once a minute if the connection stays dead.

Share this post


Link to post
Share on other sites

ok..
Sorry, I should have mentioned that there are ~5 channels on the LJ that I believe are timed by the sequence and there are ~11 registers being read from the pqube.
 
how would you advise their timing being adjusted.
 
I'll attach the .ctl

 

Thanks!

PQUBE GUI.ctl

Share this post


Link to post
Share on other sites

You are streaming the LabJack so ignore my mention of Timing.  The LabJack timing is determined by the stream.

Share this post


Link to post
Share on other sites

Its probably a hardware issue.  You may be over-driving it.  Try polling it slower and see if that affects the failure rate.

Share this post


Link to post
Share on other sites

Hi,

I am also using DaqFactory to communicate with HMI via Modbus TCP.   Communication works fine and receiving data from HMI correctly and can not find anything is wrong but the error message "P-ModbusTCP 0010: Timeout" keeps displaying in the Command/Alert window.

I checked channel settings,  tried different timeout values but does not change. I can not figure out why getting this P-ModbusTCP timeout error while communication seems all fine.  Please advise.

Share this post


Link to post
Share on other sites

It is hard to say.  It is probably just one channel that is causing it.  Either you are querying an invalid tag, or you have other settings wrong on one of your channels, such as D# set to 0 instead of the proper Modbus ID.  I would go through and set the Timing of all your channels to 0, then reset them one by one until the message starts appearing.  Then you'll know which channel is causing the troubles.  

Share this post


Link to post
Share on other sites

I tested with only one channel and checked again. Still keeps getting this timeout errors in the Command/Alert windows.   Modbus ID and reading registers are all correct. The value read from the HMI is matching with no problem at all.  Please see the attached screenshot and my test application. Tried also timing to 0 to reset but it does not semm to work. Once I put timing back to 1, timeout error pops up again.  I am only test on desk so the cable is quite short. Can't think what else could cause this error?

Screen Shot 03-08-19 at 11.04 AM 001.PNG

Screen Shot 03-08-19 at 11.04 AM.PNG

Read Channels.ctl

Share this post


Link to post
Share on other sites

That is still pretty odd.  Does that number actually update?  Try creating a variable value control with this Expression:

CH1.time[0]

and see if it changes as well.

Share this post


Link to post
Share on other sites

Expression CH1.time[0] changes the value displayed., "p-Modbustcp 0010: Timeout" Error still keeps coming to "command/alert" window.   

CH1 value on screen does update correctly. But this "p-Modbustcp 0010: Timeout" error can not be cleared. It does not make sense to me that showing this alert when data communication is working fine.  How can I get rid of this alert? 

Share this post


Link to post
Share on other sites

When I disconnect and reconnect Ethernet cable, it stops the error after short time when connection establish.  But with the cable being connected and If I close exit the runtime and then reopen the application runtime, the error comes up again. and will never stop in command/alert windows, but after short while the values and displays are all correct from channel reading and value also updates. Indicating connection is working but error still does not stop.  Error stop only if I disconnect and reconnect the cable.   Can you please advise any code to stop this error when start the runtime while cable is connected?  Thanks,

I am learner of DaqFactory and really feel frustrated about this Ethernet communication. 

Share this post


Link to post
Share on other sites

First, does the error keep reappearing, or is it simply left over from when the cable was unplugged?  Errors in the command/alert don't go away unless you explicitly clear the command/alert window by right clicking and selecting Clear.

Share this post


Link to post
Share on other sites

keeps reappearing.  right click clears errors in the window instantly but then error appears again and again one after the other. Cable is always plugged in.   The errors only stops if you unplug and plug back cable.

Share this post


Link to post
Share on other sites

This is what the problem is now:  While Ethernet cable  being connected,  open the DF runtime application to start, it will not establish Modbus TCP communication over Ethernet cable.  It keeps getting this Modbus TCP timeout error all the time.  It will only establish good communication by unplug then plug back the cable.

I also tried to use Device.Mydevice.InitComm(), it does not help.   

I can not tell customer that every time after you open  to run the application, cable must be unplugged then plugged in to make it work. 

Is there any code to use to initiate port in the same way as restarting the comm port when cable is plugged in?   

What else should I try to stop this timeout error when open the runtime application?

Share this post


Link to post
Share on other sites

Are you sure you don't have another piece of software or another device communicating with device?  Many devices support only one connection at a time.  Disconnecting and reconnecting would drop an existing connection and give DAQFactory a chance to connect.

 

 

Share this post


Link to post
Share on other sites

100% sure . There is no any other device connected to DAQFactory PC.  The PC is brand new with only windows 10 and DAQFactory development 17.1 installed and no any other software. It is purely used for this one device communication, one software and one connection only.    

Would it be possible to simulate cable disconnecting and reconnecting process while cable is actually connected?   I mean kind of like windows device management that you can disable a device then rescan to find it to reconnect.

Share this post


Link to post
Share on other sites

I meant more than one device / software connected to the remote device.  Does it do it from a fresh boot?

Does the Ethernet comms light light up when the ethernet is plugged in but DAQFactory won't communicate?

Does your remote device use DHCP to get its IP address?

Share this post


Link to post
Share on other sites

Only one device and only one channel used. The Ethernet port connecting to PC. Ethernet comms light  lights up normal so PC DAQFactory page reads values from the device correctly even when this error keeps appearing. communication seems working fine but still getting this errors.  And I noticed while error is popping out to the alert windows, it does slow down reading speed of the channel a little bit but the vale still updates from the device to screen.   I will put details as below:

Configuration:

a. PC  with windows 10, no other software except DAQFactory 17.1 installed,  Only one device connected to PC via Ethernet port using Modbus TCP protocol. 

b. Remote device is a HMI that has Ethernet port for data communication,  only one Modbus RTU sensor connected via RS485 port.  No other device or software connect to this HMI.

c. PC set as Ethernet client   IP: x.x.x.200     sub: 255.255.255.0

d. Device set as Ethernet server   IP: x.x.x.100   sub: 255.255.255.0

    (DHCP is not used anywhere)

Operation:

1. Connect Ethernet cable between PC.   Then open the application runtime file Read Channel.ctl which the same one as uploaded here previously. 

2. Watch screen page  and command/alert windows.  The variable reading shown on the screen becomes normal and value updated from the device connected. Error as mentioned keeps popping into the alert windows and never stops.  Ethernet port lights looks normal as ordinary.

3. At this stage, if I disconnect the Ethernet cable for a few seconds and then reconnect.  After a few seconds, the error to the alert window stops. And I can the just right click to clear the alert window.  Now everything works good.  It runs perfect as I expected.

4. But If I close the DF runtime, then open the file again, it will do the same as above again, errors keep coming up. I can only stop this error by disconnecting Ethernet cable and reconnect it.

I can not see where else I could have mistake in setting up just one channel read to screen. Please advise.

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now