10/26/2018 9:38 AM | |
Posts: 13 Rating:
|
Hello, I do not know the bay to start this, so a quick overview: We want to build an Open User Communication (TCP/IP, UDP...) application on basis of Basic Examples for Open User Communication (OUC) . As documentation states: "The FB for controlling the OUC instructions (TCON, TSEND, TRCV and TDISCON) is realized as state machine. The design model of a state machine is particularly suitable for the modeling of complex asynchronous processes, for example, the communication between partners that stretch over several cycles. Also: "The application example shows in which places you can integrate your individual expansions in the code". There are at least three Application Examples using this approach:
This is exactly what the goal is: use OUC to establish connection to communication partner, send and receive some data in reliable way and process errors correctly. Now to the problem: Most manuals, and forum topics, deal with OUC in following way: establish connection, send data if there are some errors abort connection and check your program online and see what is wrong. These examples do some more processing. As an example of sending some data:
As always proper reaction on error condition is most difficult In order to make reliable connection we need to synchronize FIVE state machines: TCON, TDISCON, TSEND, TRCV and user program state machine we program. And this is difficult with information I can find. To demonstrate: Online help for OUC functions explains inputs, outputs, error codes but does not distinguish between "recoverable" and "fatal" error codes, nor is shows mechanisms for checking connection state (as in our example, with TRCV). There are bits of information on forum from expert users like:
or
etc... State machines coded in mentioned examples handle error states differently. They are, in my opinion, best structured and handled and can be used only as a base for upgrade. I am rewriting this for my application and would publish the code, but I need some help (please). Now we come to the question: Is there any document describing state machine of T functions, proper way of handling error states and way to monitor and maintain connection to remote partner? How to handle different cases (TCP/UDP, client/server, read/write) in proper way? If not would some of the experts be willing to share this? Thank you
|
Last edited by: Jen_Moderator at: 10/26/2018 12:15:51 PMOptimized link. |
|
10/30/2018 8:53 AM | |
Posts: 13 Rating:
|
@Owei: Thank you. This is what I could read from Basic Example. I have written the procedure for sending data to partner based on example and your comments and it works fine. Communication is stable and I detect communication problems correctly. You ask what my requirements are. Exactly this: To understand what is necessary to have stable communication and understand what these guys write in example. In next days I will post a project, based on this and my current project, to test all we are talking now. @Kaulquappe: I have no experience in PC programming. All I do is work with (and program) PLC. If you follow closely "resent" development of coding practices, you will see that FSM are becoming more and more "standard" ("becoming" is not exactly correct: lot of library functions, from different manufacturers dating to more than a decade ago, use FSM). If you follow closely PLCOpen recommendations and other documents:
you will se that FSM are the core concept they use. FSM are here to stay. If you look at IEC61499 you will see that at core of the system are FSM. They use different terminology but it is still FSM. I do not follow closely, but this Basic Example is first use I see with Siemens on support site. They use FSM to coordinate asynchronous processes, and use all elements to process FSM. If you look at Example documentation (Part 3.2 Details on the mode of operation) you can see what they do:
So, in my opinion, FSM are excellent tool any PLC programmer should know how to use them efficiently. And they are here to stay. |
Last edited by: drgry at: 10/30/2018 10:08:52 AM |
|
11/28/2018 8:58 AM | |
Posts: 13 Rating:
|
Hello, On following link you can find Project Archive for example use of Open User Communication realized through FSM. Project contains two function blocks: TCP_Service and UDP_Service which can be used in projects. Also there are PLC Data Types for defining parameters of connection and example structure for data exchange. Test cases for UDP and TCP communication using two and one way communication are inside also. Communication is demonstrated between one S7-300 and one S7-1200 PLC, but these procedures can be used on other PLC types. There is example of sending data to ibaPDA PC application using VIP data protocol. This example uses small amount of fixed and structured data but can be used on any amount of data supported by T functions on PLC type used. There are two state transition diagrams explaining inner workings of FB's. These state diagrams are in fact one diagram, but divided in "normal" and error transitions for easier understanding. Numbers in small blue and red circles on start point of transition represent execution order/priority of transition. Function blocks are capable of two way communication. Examples should be strait forward to understand, but just a few remarks:
Anyway I would your opinion. All comments are welcome. Best regards |
Last edited by: drgry at: 11/28/2018 9:09:34 AMLast edited by: drgry at: 11/28/2018 9:12:17 AM |
|
This contribution was helpful to
2 thankful Users |
Follow us on