Научная статья на тему 'Исследование протокола iec60870-5-10 и проекта программного обеспечения коммуникации, основанного на конечных автоматических сетях'

Исследование протокола iec60870-5-10 и проекта программного обеспечения коммуникации, основанного на конечных автоматических сетях Текст научной статьи по специальности «Строительство и архитектура»

CC BY
106
24
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
СТАНДАРТ IEC60870-5 / ОБЪЕКТНО-ОРИЕНТИРОВАННЫЙ.

Аннотация научной статьи по строительству и архитектуре, автор научной работы — Fu Qincui, Liu Ziying, Fu Kejia

Предлагается концепция стандарта IEC60870-5 общения между станциями телеуправления через интернет-услуги в системах телеуправления органов власти. Проведен анализ 104 протоколов.мулированы проблемы создания программного обеспечения в соответствии с протоколом Международной Электротехнической Комиссии 60870-5-104.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «Исследование протокола iec60870-5-10 и проекта программного обеспечения коммуникации, основанного на конечных автоматических сетях»

ИРКУТСКИЙ ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ ПУТЕЙ СООБЩЕНИЯ

sentences in the text, students can write and memorize the essay and the passage at the same time.

In addition, teachers can also make students write English letters, resumes birthday or new year cards to apply and practice what they've learned. If they lack some knowledge in a certain area, they are able to renew and input them immediately through application. This forms a good circle of input and output of knowledge. Application is the source of memory.

4. Conclusion

Generally, this paper has discussed the issue of students' memorial cultivation during their English learning, and has put forward six teaching methods for improving students' memorial competence. The discussion has expounded the memorial principle and students' psychological characteristics. Combining the two aspects, the implementation of the methods are explained in detail.

It is not easy to train students memory in teaching and learning. Firstly, the teaching subjects and students have predominated their own peculiarity. Secondly, each teacher has different experiences, teaching methods and requirements which will affect their

Fu Qin-cui, Liu Zi-ying, Fu Ke-jia

teaching efficiency. Even for these factors, teachers have still many methods to stimulate this kind of quality. In teaching, teachers should lay stress on these training methods and encourage students to form a good habit of memorization, and then also try best to use various means to make class actively. With perceptible influence of the new teaching method, our educational system will be more and more perfect and efficient.

REFERENCES

1. An Action Research on Helping Students of Special Majors Becoming Autonomous Learners through Formative Assessment, Journal of Irkutsk State Transport, University, NO.2(18), 2008

2. Research on Teaching Assessment System for Foreign Teachers in Colleges, Journal of East China Jiaotong University, Vol.24 No.6, Dec., 2007

3. Research on Credit-Transfer System—Important Factor of Education Globalization, Jiangxi Provincial Education Research Project, Dec. 2005

y^K 004.45

RESEARCH OF IEC60870-5-104 PROTOCOL AND DESIGN OF COMMUNICATION SOFTWARE BASED ON FINITE STATE MACHINES

1. INTRODUCTION

IEC 60870-5-101 is an international communication protocol standard for the telecontrol of electric power transmission systems, which is being widely adopted in many countries throughout the world. The standard specifies the use of permanent directly connected links between telecontrol stations, such as conventional PSTN modem and leased-line. There is now a growing desire to use the 60870-5 Standards to communicate between telecontrol stations via Internet services. A companion standard called IEC 60870-5-104[1] (thereinafter referred to as the 104 protocol) has been published by the IEC for this purpose.

Presently, people make a deep study of the application of the 104 protocol and have obtained a cer-

tain success. But on the software design, there is not a relatively universal design pattern. This paper puts forward a kind of design method used for the realization of the 104 protocol based on Finite State Machines (FSM). In this method, the 104 protocol is modeled via the FSM theory. In addition an object-oriented FSM implementation framework is produced. And then a tool is presented that automates the configuration of the framework. The tool effectively enables developers to create FSMs from a specification.

The remainder of this paper is organized as follows: In Section 2, the IEC 60870-5-104 protocol is introduced. In Section 3, the idea of analyzing with FSM is discussed. In Section 4, the design and im-

plementation for the protocol are presented. In Section 5, assessments are made about the design. 2. INTRODUCTION OF IEC 60870-5-104 PROTOCOL

2.1. The protocol structure

The name of the IEC60870-5-104 standard is 'Network access for IEC60870-5-101 using standard transport profiles'. Fig. 1 shows the protocol structure. As shown in the structure, every telecontrol station conforming to the IEC 60870-5-104 standard has an Internet Transport Interface between its Application layer and the layers below. The interface and the lower layers are defined by the appropriate Internet standards. These include the Transmission Control Protocol (TCP), for the Transport layer immediately below the Transport Interface.

Selection of application functions of IEC 60870-5-5 according to IEC 60870-5-101 Initialization User process

Selection of ASDUs from IEC 60870-5-101 and IEC 60870-5-104 Application (layer 7)

APCI (Application Protocol Control Information) Transport Interface (user to TCP interface)

Selection of TCP/IP protocol suite (RFC 2200) Transport (layer 4) Network (layer 3) Link (layer 2) Physical (layer 1)

NOTE Layers 5 and 6 are not used.

Fig. 1. The protocol structure of the IEC60870-5-104 protocol

2.2. The addition of APCI to the Application Layer

Some Application Protocol Control Information (APCI) is added to each Application Service Data Unit (ASDU) so as to obtain an Application Protocol Data Unit (APDU) that is suitable for Internet transportation.

The APCI starts with a fixed octet (value = 68 Hex) followed by an octet specifying the length of the rest of the APDU and the four control field octets.

There define three types of control field formats: used to perform numbered information transfer (I format), numbered supervisory functions (S format) and unnumbered control functions (U format).

I format APDUs always contain an ASDU, carry Send and Receive Sequence Numbers, used to perform numbered information transfer;

S format APDUs consist of the APCI only, do not include an ASDU, carry only Receive Sequence Number, used to acknowledge the APDUs in case of no I format APDUs response;

U format APDUs also consist of the APCI only, used for control purposes only, including start/stop of

message transfers and supervision of transport connections.

The use of the control fields is similar to the method defined in the X.25 protocol. The associated control procedures are also copies of those used by X.25.

2.3. Protection against loss and duplication of messages

In fact, the purpose of the APCI and associated procedures is to ensure that Application messages, each consisting of an individual APDU, are not lost or duplicated.

Both sequence numbers are sequentially increased by one for each APDU and each direction. The transmitter increases the Send Sequence Number N(S) and the receiver increases the Receive Sequence Number N(R). The receiving station acknowledges each APDU or a number of APDUs when it returns the Receive Sequence Number up to the number whose APDUs are properly received. The sending station holds the APDU or APDUs in a buffer until it receives back its own Send Sequence Number as a Receive Sequence Number which is a valid acknowledge for all numbers <= the received number. Then it may delete the correctly transmitted APDUs from the buffer. In case of longer data transmission in one direction only, an S format has to be sent in the other direction to acknowledge the APDUs before buffer overflow or time out. This method should be used in both directions. After the establishment of a TCP connection, the send and receive sequence numbers are set to zero.

The mechanism of duplication in fact is to timeout, then close, and then to retransmit. For TCP is a connection-oriented transport, once the TCP connection is established, it is maintained until any sides of the two communication parties perform the terminating operation. So the 104 protocol uses timeout to detect the status of TCP connection to ensure steady, reliable data transport. There are four timeouts defined in the 104 protocol, including:

t0: Time-out of connection establishment t1: Time-out of send or test APDUs t2: Time-out for acknowledges in case of no data messages (t2 < t1)

t3: Time-out for sending test frames in case of a long idle state.

3. IDEA OF ANALYZING WITH FSM

Finite state machines [2] provide a powerful way to describe the dynamic behavior of systems. A common example of such a system is a communication protocol. The IEC 60870-5-104 protocol for instance can be represented by a FSM. FSMs are also used in object-oriented modeling methods such as

ИРКУТСКИЙ ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ ПУТЕЙ СООБЩЕНИЯ

UML. Experts from the software industry advocate use of state machines.

In this paper the following definition of a state machine will be used. A state machine consists of states, events, transitions and actions. Each state has a (possibly empty) state-entry and a state-exit action that is executed upon state entry or state exit respectively. A transition has a source and a target state and is performed when the state machine is in the source state and the event associated with the transition occurs. For a transition t for event e between state A and state B executing transition t (assuming the FSM is in state A, e occurred) would mean: (1) execute the exit action of state A, (2) execute the action associated with t, (3) execute the entry action of state B and (4) set state B as the current state.

There are four steps when we design a FSM:

1) Accurate understanding of problems: It is to use ordinary descriptive language to describe the behavior of a FSM. The interpretation should be precise, not be ambiguous.

2) Abstract description of a FSM: It is to determine the states and events of the system by abstracting from the factual problem. FSM can be represented using a state diagram, an algorithmic state machine, or a state transition table. The most common representation is the state diagram.

3) Optimization of FSM: To optimize a FSM means finding the machine with the minimum number of states that performs the same function.

4) Implementation of FSM: It is to implement the simplest state diagram in computer languages.

4. DESIGN AND IMPLEMENTATION

This paper introduces the FSM to develop the communication software of the controlling station with the object-oriented method to implement the IEC 608705-104 protocol. 4.1. Description of FSM s

A state machine is a graph of states and transi-

tions. Usually a state machine is attached to a class and describes the response of an instance of the class to events that it receives, help to analyze the object's behavior. Usually finite state machines are notated in a graphical form. In Fig.2, the state chart in UML describes the behavior of the application layer object. We'll describe the state chart for the application layer object here:

In the lifecycle of the application layer object, there are eight states: Disconnected, Established connection, STARTDT, STOPDT, Sending I-APDU, Receiving I-APDU, Receiving S-APDU, Sending S-APDU.

An event is something that happens during execution of a system. With a state transition, an occurrence of an event can trigger a state transition. There are three kinds of events, including:

Call event. The receipt of an explicit synchronous call request by an object. In this, it is that the user process calls the application layer's service to transmit an ASDU.

NOTE 1 V(S), V(R), Ack, k, w, t1, t2 used above is defined in the IEC60870-5-104 protocol NOTE 2 I(a, b), S(b) = a sent I-APDU or S-APDU, V(S)^a, V(R) ^b NOTE 3 I(a, S), S(S) = a received I-APDU or S-APDU, ^Ack NOTE 4 Tx = send; Rx = receive

NOTE 5 n = the number of the I-APDUs received continuously

Fig. 2. Statechart diagram for the application layer object

СИСТЕМНЫМ АНАЛИЗ И МЕЖДИСЦИПЛИНАРНЫМ ПОДХОД В ИССЛЕДОВАНИЯХ

Time event. The arrival of an absolute time or the passage of a relative amount of time. It is notated with the keyword after followed by an expression that evaluates to an amount time.

Signal event. The receipt of an explicit, named asynchronous communication among objects. In this, it is the APDU object which is received by the application layer object.

Guard condition is a Boolean expression enclosed in square brackets. The guard condition is evaluated when the trigger event occurs. If the expression evaluates as true, then the transition fires. If the expression evaluates as false, then the transition does not fire. In this, there are the conditions of 'V(S)—Ack<k', 'Ack<V(S)'.

An action is a primitive computation, including calling an operation, creating or destroying an object, sending a signal to another object. In this, it is to send APDU. And some of the states have the entry actions.

So, the behavior of the application layer object has been expressed explicitly by the statechart diagram, and then it is easy to implement it.

4.2. Approach to the FSM implementation

FSMs have become a standard model for representing object behavior. And there are many techniques to generate code for FSMs. Yet, to this day, software engineers design their own simple state machines from the ground up. And each time they face the same challenges - trying to make their code work efficiently while preserving the structure of the FSM to preserve maintainability. To address this issue we present a novel approach to FSM's implementation. In addition to that an object-oriented FSM implementation framework is presented. [2] [3] The new FSM implementation framework explicitly describes all the concepts and associations between these concepts in the FSM, makes the mapping between a FSM design and implementation more direct and consequently easier to use. Therefore, not only can this framework make the software more reusable and flexible, but also can improve the maintenance and robustness.

In Fig.3 a class diagram is shown for the framework's core classes.

This approach encapsulates each action (e.g. exitaction, entryaction, action associated with transition) in a separate class. Actions all implement one interface. Their interface, FSMAction, consists of only one method, executeAction(), that performs the processing associated with the action. Other

FSM elements merely link actions together and invoke them in the proper order. FSMTransition class executes actions related to each transition. FSMState executes actions related to entering and exiting each state. The implementation is to use the Command pattern. [4] Mapping the classes to the terminology of Command pattern, all Actions play the role of Commands. The FSMContext, FSMState, and FSMTransition classes play the role of Invokers, because they execute the Actions. FSMContext invokes the initial action, FSMState invokes entry and exit actions, and FSMTransition invokes an action on transition. Lastly, FSMContext class is the Receiver, because it stores the data that Actions update while they execute. We'll shortly describe the classes here:

FSMContext. This class maintains a reference to the current state. It delegates the processing to the current instance of the FSMState class.

FSMState. This class models the states in the FSM. Each state has a name that can be set as a property in this class. FSMState also provides a method to associate events with transitions. It also provides a dispatch method to trigger transitions for incoming events.

FSMTransition. The transition object has only one method: executeTransition(). This method is called by a FSMState when an event is dispatched that triggers the transition.

FSMAction. This interface has to be implemented by all actions in the FSM. It functions as an implementation of the Command pattern as described in [4].

4.3. The FSM framework configuration tool

States, actions, events and transitions now have explicit representations. This makes the mapping between a FSM design and implementation more direct

Fig. 3. Class diagram for the FSM framework

ИРКУТСКИЙ ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ ПУТЕЙ СООБЩЕНИЯ

and consequently easier to use, thus creating the possibility of making a configuration tool. Such a tool significantly eases the use of our framework. Since developers only have to work with the tool instead of complex source code.

This paper builds a tool that takes a FSM specification in the form of a XML document. XML is suitable for modeling hierarchical data, such as a FSM. The wide support for this language makes it easier to built graphical tools that work on the XML specification of a FSM. Finally, XML parsers are widely available.

In Fig. 4 an XML file is given that can be used to create a FSM. In this file the FSM in Fig. 2 is specified. Several tags like <states> and <transition> are used. The structure of the file is very straightforward.

<?xml version="1.0" encoding="UTF-8"?> <fsm firststate="Disconnected" initac-

tion="initAction.ser"> <states>

<state name="Disconnected"/> <state name="Established connection"/> <state name="STARTDT"/>

</states> <events>

<event name="Connect successfully"/> <event name="User process: Start"/> <event name=" User process: ASDU"/>

</events> <transitions>

<transition sourcestate="Disconnected" targetstate="Established connection" event="Connect successfully"/> <transition sourcestate="Established connection"

targetstate="STARTDT" event="User process: Start" action="TxUAPDUof STARTDTact.ser"/> <transition sourcestate="STARTDT" targetstate="STARTDT" event="Rx: U-APDU of STARTDT con"/>

</transitions>

Fig. 4.

A problem in specifying FSMs using XML is that FSMAction cannot be modeled this way. To re-

solve this issue we developed a mechanism where FSMAction components are instantiated, configured and saved to a file using serialization. The saved files can be referred to from the XML file. When the framework is configured the FSMAction component files are deserialized by the configuration tool and plugged into the FSM framework.

5. CONCLUSION

In this paper we argue for the design and analysis of the communication software of the controlling station in power telecontrol systems. The design method based FSMs has several advantages:

(1) The approach that applies to the implementation of the 104 protocol also applies to the implementation of the other protocol, such as IEC60870-5-101, IEC60870-5-103, DNP3.0 protocol.

(2) The approach makes it easier to automate the development of protocol. The developers only have to compile the FSM, and implement it automatically via the configuration tool.

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

The design method builds the basis for the application, implementation, test, maintenance of the protocol. In conclusion, it can not only make the software more reusable and flexible, but also can improve the maintenance and robustness.

REFERENCES

1. IEC 60870-5-104 : Telecontrol Equipment and Systems 5-104 : Network access for IEC 60870-5101 using standard transport profiles. IEC Standard. 2006.

2. JILLES van Gurp, JAN Bosch. On the implementation of finite state machines // Proceedings of the IASTED International Conference, 3rd Annual IASTED : International Conference Software Engineering and Applications. Scottsdale. Arizona : IASTED, 1999.

3. Paul Adamczyk. Selected Patterns for Implementing Finite State Machines. [On-line]. URL: http://pinky.cs.uiuc.edu/~padamczy/xml/tableofco ntents.html.

4. GAMMA E, HELM R, JOHNSON R. Design patterns-Elements of reusable object oriented software. Boston : Addison Wesley, 1995.

i Надоели баннеры? Вы всегда можете отключить рекламу.