LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 56 on reading Satec meter via TCP/IP, timeout & wait?

This VI successfully reads data from this Satec power meter. The issue I'm having is that it will over time through out Error 56. Whats interesting is if I place a Wait Function and increase the wait time (from 10ms to 800ms) it seems to last longer! I'm not sure whats going on. My goal is to get it to run continuously but increasing the wait may negate its usefulness. I have no clue whats causing this error 56 to show up, it certain can read the meter. Any thoughts?

0 Kudos
Message 1 of 8
(1,894 Views)

That's tough to say. The default timeout for the Modbus library TCP is 10 seconds. Quite a long time. Could be the device is not responding correctly after so long, could be a network problem. Are you going through a router or directly to the device? A workaround could be to shorten the timeout to something more reasonable, a few hundred ms to a second, then check for error 56. What you do next you have to figure out. Can you just try again and get a response or do you need to initiate a new TCP connection? 

Message 2 of 8
(1,891 Views)

sorry, meant to say throws out error 56, excuse my spelling/grammar mistakes

 

Yes, I have it running through a router but I have also tried directly to the ethernet port and the performance is about the same.

 

Wait function set to 100ms -> error 56 occurs around 1500 seconds

Wait function set to 750ms -> error 56 occurs around 5000 seconds or longer

 

So there's definitely a correlation between how long a loop occurs and how long the error 56 will show up, but it is inevitable in all cases. Is it possible there is a finite amount of data the Satec outputs and once it reaches it, perhaps through a buffer limit or something, then produces that error?

 

I have not tried to programmatically re-connect to the Satec meter but thats a good idea to work around this issue. I'll give a try and see what happens.

0 Kudos
Message 3 of 8
(1,840 Views)

After some more digging I believe I found the cause and the solution to this error. The error occurs because there is an increasing number of sessions being opened to communicate with the device. After a certain amount of these sessions the network dumps the connection throwing out error 56.

 

The solution would be to close out these piling up sessions so there is no error thrown. That may have to be done on the VI coder's side, so an even easier solution is to simply ignore error 56 all together. I created a case structure for the error condition which resets to a False error. The VI will continue to run uninterrupted reading from the device indefinitely. This solution has worked continuously so far.

0 Kudos
Message 4 of 8
(1,804 Views)

@J_K_er wrote:

After some more digging I believe I found the cause and the solution to this error. The error occurs because there is an increasing number of sessions being opened to communicate with the device. After a certain amount of these sessions the network dumps the connection throwing out error 56.

 

The solution would be to close out these piling up sessions so there is no error thrown. That may have to be done on the VI coder's side, so an even easier solution is to simply ignore error 56 all together. I created a case structure for the error condition which resets to a False error. The VI will continue to run uninterrupted reading from the device indefinitely. This solution has worked continuously so far.


This is like driving off a cliff to avoid a pothole.  New (and more dangerous) issues await both scenarios.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 8
(1,799 Views)

A more elegant solution is desirable but so far so good! It has run continuously for 24 hours straight so far. Not a blip yet. It goes without saying the case structure only looks for error 56. A disconnect error (62) would halt the VI as it should. I'll be sure to update this thread should any complications arise from doing this.

0 Kudos
Message 6 of 8
(1,778 Views)

@J_K_er wrote:

A more elegant solution is desirable but so far so good! It has run continuously for 24 hours straight so far. Not a blip yet. It goes without saying the case structure only looks for error 56. A disconnect error (62) would halt the VI as it should. I'll be sure to update this thread should any complications arise from doing this.


More explicitly, keep an eye on your memory resources.  Every unclosed reference is a memory leak.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 8
(1,772 Views)

think you are using the NI Modbus library, but some of the names are different (Close instead of Shutdown). You might want to make sure you have the latest version. I have used this library on several projects and not had any issues. 

0 Kudos
Message 8 of 8
(1,767 Views)