Author Topic: F1616  (Read 12336 times)

EDGAR

  • Jr. Member
  • Posts: 60
  • Automating concepts around the world!
    • View Profile
    • Kinemics
F1616
« on: October 03, 2009, 02:12:11 PM »
I understand that the plc F1616 can receive 5 simultaneously Modbus Server TCP connections,now how many client connections can be created?
Low cost Modbus OPC DA Server, supporting Modbus RTU, ASCII, and TCP. Download your demo today! Go to www.kinemics.com/modbus.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:F1616
« Reply #1 on: October 03, 2009, 05:12:55 PM »
Client connection is under the program control, and you can only open one client connection at a time to any server. In order to make another connection to a different server you will need to close the first connection.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

EDGAR

  • Jr. Member
  • Posts: 60
  • Automating concepts around the world!
    • View Profile
    • Kinemics
Re:F1616
« Reply #2 on: October 04, 2009, 07:00:24 AM »
That's what i thought. I have the plc polling data from 2 boilers and writing it to a cabinet as follows.
PollBoiler1()  // in this function I start by opening the TCP connection polling the Modbus data  and end by closing it with a delay of 5 seconds.
PollBoiler2() // in this function I start by opening the TCP connection polling the Modbus data  and end by closing it with a delay of 5 seconds.
WriteToCabinet() // in this function I start by opening the TCP connection writing the Modbus data  received from boiler 1 and 2 and then end by closing it with a delay of 5 seconds.

When I close the connection I need a delay of 5 seconds before I can reconnect it this true? what would you say is the min time?

ConnectTCP()-----------------------------
PRINT #4 "<MBTCPCONNECT "+ D$ +":502>" 'CONNECT TO MOORE PAC
CALL GetTCPStatusC4

IF STRCMP(A$,"<CONNECTED>")<> 0    ' did not received "CONNECTED" message
   SETLCD 2,1,"Not Connected           "  
else
   SETLCD 2,1,"Connected                  "
ENDIF

RETURN  
-----------------------------------------------

CloseTCP ----------------------------------
Print #4 </CLOSE>
DELAY 5000
RETURN
-----------------------------------------------
Thank you
Ed
Low cost Modbus OPC DA Server, supporting Modbus RTU, ASCII, and TCP. Download your demo today! Go to www.kinemics.com/modbus.

EDGAR

  • Jr. Member
  • Posts: 60
  • Automating concepts around the world!
    • View Profile
    • Kinemics
Re:F1616
« Reply #3 on: October 04, 2009, 06:39:40 PM »
On Connection close, I replaced the 'delay 5000' for a 'for next' as follows.

FOR I = 0 TO 2000
  REFRESH
NEXT

Is this ok, can i use the REFRESH this many times? or do you have an alternate method?
Low cost Modbus OPC DA Server, supporting Modbus RTU, ASCII, and TCP. Download your demo today! Go to www.kinemics.com/modbus.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:F1616
« Reply #4 on: October 05, 2009, 12:33:47 AM »
When you close a connection with one server you probably don't need to wait very long before you connect to another server.  But if you want to reconnect back to the same server it is a good idea to wait a few seconds for the last connection to close properly before making another connection. You can do some trial and error to determine the best delay to insert.

It is not efficient use of CPU time to put a delay 5000 or with a big loop of refresh. There is no problem using REFRESH but it will not let you execute other ladder program or custom function anyway so it is not serving much purpose.

What you can do is to start a timer and when the timer times out you can trigger another action.

E.g. You can start a timer #1 with label T1 as follow:

   CLRIO T1    ' make sure the bit is cleared.
   TIMERPV[1] = 50   '  50 x 0.1s = 5s.

so the contact of T1 will be used to start another connection. This way the PLC can continue to execute other ladder programs.
   
Email: support@triplc.com
Tel: 1-877-TRI-PLCS