59
« on: December 22, 2011, 02:33:21 PM »
Evening all.
I have some questions regarding the MBTCP functions within the PLC.
We are using seven nano's to control some pumps in different locations around one of our customer?s site.
The master is also connected to the site SCADA system which views the system status via the web page in the nano.
The topology is one master connected to a tank level sensor and six slave pump panels.
Each panel communicates using a WiFi gateway and the communication is good between all PLC?s.
The master PLC reads the tank level and if the level is above or below the set point, it uses a writemodbus function 1 or a 0 to a DM value in each of the slaves ? simple as that. Each of the slaves reacts depending on the DM value.
The first question I have is about the number of connections limit. Is this six for incoming and outgoing connections?
We have set the MBTCP connections to 2 and Server connections to 4. Were assuming the web traffic comes in via the server connection allocation but you know what they say about assumptions!
As described above we have six slaves, when we attempt to connect to a slave, if the connection is successful we call the modbus function above, if the MB write is good we close the connection and move on to the next panel.
We have some error detection code that recalls the function 3 times for both the TCP connection and the MB write before we move on anyway to avoid hanging up the system if one of the slaves is off-line etc. Every time there is an error or before we connect to the new slave the TCP connection is closed.
This way we are only using one connection to connect to all the slaves which was necessary as there will hopefully be more slaves (panels) in the future.
Second question, when we close the TCP connection does this close all TCP connections in and out?
Third question, is this the best / most efficient way of communicating to each of the slaves?
We have considered using the host link commands but we would still need to open / close the connections as we move around so we thought we would stick with the devil we know. 
The problem we have is the panel locks up completely randomly, sometimes hours, sometimes weeks after a power cycle and I can?t seam to pinpoint the failure because the PLC does not accept any TCP communications and we are not local enough to go in via the RS485.
Any thoughts or wise words greatly appreciated.
Cheers