Jump to content

Losing connection on socket 1 to PLC


etalon

Recommended Posts

Hello, 

 

I am having an issue with intermittant connection to a remote PLC.

 

The setup is as follows: Server has a VPN connection to a GSM router on site.  This is connected via ethernet to the PLC.

 

What I have found:

 

I lose the ability to do a socket ping to the PLC on 20256.  When I lose this ability, I also lose the ability to pull telemetry data off the PLC from the registers.  (makes sense, they use the same port).

 

I am doing this ping test from the local router on site, over the VPN.  The issue is therefore not with the VPN itself, but the connection between the router and the PLC.

 

The ladder logic code that manages the connection is attached.  Can you see where I have gone wrong?  How can I increase the robustness?

 

Additionally, can you suggest timeout/keepalive settings that would help?  At the moment, I can regain the connection by restarting the router (set to a automatic timed restart at the moment).  Additionally, I have noticed more than once that if I go into the socket parameter screen on the PLC, it has sprung back into life. (maybe coincidence?)

 

Many thanks in advance for any help!

 

 
 

 

post-24913-0-57087000-1457706615_thumb.png

  • Like 1
Link to comment
Share on other sites

Thanks for you comment, yes I will look into this...
 
I was very suspicious about this connection code, hence me pasting it here! (this is something someone else had gotten working on a bench and then left me the project, excuses, excuses I know..).
 
I looked at the true values of the SI on the running plant.  They were as follows for socket 1:
SI104 (socket 1 keep alive):0
SI108 (socket 1 connection keep):0
 
I have changed the code on the PLC as per the attachment (an integer direct store on startup of socket 1 SI initially to 10 (1000ms) and 20 (2000ms).
 
Confirmed that values are being stored.  Uploaded, testing now.  Is there a need to set the values on the other sockets I am not communicating over?

post-24913-0-21858300-1457952467_thumb.png

Link to comment
Share on other sites

*update*

 

So, reliability seems to be much improved, not had a communication failure yet.  I have modified the parameters suggested though, 

 

I am setting SI104 and SI108 to 100 and 200 (10,000ms and 20,000ms) respectively.  I found that the shorter time values made remote access unreliable over the slow VPN connection we have available to the site.

 

Many thanks for your help.

Link to comment
Share on other sites

  • MVP 2023

Glad it helped. I'll also point out that Setting SB168 using SB2 when you have the Power-Up value as "SET" is redundant. Same with the values you're assigning to SI 104 & 108. You can either set a Power-Up value or assign a value with SB2 - your option, but there is no need to do both.

 

As to your other question - there is no need to set values for the Sockets you aren't using, but it won't hurt anything if you do.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...