Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Cheng A.Real-time systems.Scheduling,analysis,and verification.2002.pdf
Скачиваний:
64
Добавлен:
23.08.2013
Размер:
3.68 Mб
Скачать

HISTORICAL PERSPECTIVE AND RELATED WORK

145

5.6 HISTORICAL PERSPECTIVE AND RELATED WORK

Statecharts generalizes classical FSMs, and Mealy [Mealy, 1955] and Moore [Moore, 1956] finite automata. The semantics of Statecharts is identical to that proposed in a survey paper by Green [Green, 1982] on flowchart drawing techniques from a psychological viewpoint. In this paper, Green showed a state machine with high-level states where transitions can exit a state at any level. Similarly in Statecharts, an event is an interrupt from all low-level states.

[Ward and Mellor, 1985] used data flow diagrams to specify real-time systems. Alan Shaw introduced another formalism for specifying real-time systems called communicating real-time state machines (CRSMs) [Shaw, 1992]. CRSMs are also based on finite-state machines and borrow some concepts from Statecharts though CRSMs are more restricted. Unlike Statecharts, which uses the broadcasting of events as the communication mechanism among states, CRSMs employ a distributed model of concurrency in which communication is achieved via synchronous one-to- one message-passing between components.

A CRSM is a finte-state machine whose transitions are labeled with guarded commands of the form

guard command[timing constraint]

A guard is a Boolean expression over the variables of the CRSM. If it is omitted, the constant true is assumed. A command can be either an internal command or an input/output command. An internal command may be a computation specified in some programming language or an occurrence of some physical event. The I/O notation and semantics are borrowed from Hoare’s Communicating Sequential Processes (CSP) [Hoare, 1978; Hoare, 1985], described in chapter 9.

The Modechart graphical specification language (described in chapter 6) introduced by Mok et al. [Jahanian and Stuart, 1988; Jahanian and Mok, 1994] is another alternative to Statecharts/STATEMATE. Furthermore, Modechart claims to remedy the weaknesses (especially in the initial versions) of the Statecharts language in handling absolute timing specifications.

As discussed earlier, finite-state machines or state transition diagrams can be used to specify systems, but their size and complexity can be prohibitive for practical systems. The developers of Statecharts point out that FSMs cannot be easily translated into code for prototyping, testing, or execution. However, recent developments in program optimization and synthesis provide automated tools for converting an FSM into corresponding high-level code. The optimizing tool developed by Zupan and Cheng [Zupan and Cheng, 1994b; Zupan and Cheng, 1998] can automatically synthesize a rule-based program from a state-transition diagram. This tool is described in chapter 12.

146 VISUAL FORMALISM, STATECHARTS, AND STATEMATE

5.7 SUMMARY

Many computer-based as well as non-computer-based systems can be specified by finite-state machines (FSMs). FSMs can model in detail the behavior of a system, and several algorithms exist to perform the analysis. Unfortunately, classical-state machines such as those employed in the standard, explicit-state CTL model-checking approach [Clarke, Emerson, and Sistla, 1986] lack support for modularity and suffer from exponential-state explosion. The first problem often arises when FSMs are used to model complex systems that contain similar subsystems. The second problem is evident in systems where the addition of a few variables or components can substantially increase the number of states and transitions, and hence the size of the FSM. Furthermore, the inability to specify absolute time and time intervals limits the usability of classical FSMs for the specification of real-time systems.

To tackle the first two problems, we can introduce modular and hierarchical features to classical FSMs. [Harel, 1987] developed a visual formalism called Statecharts to solve these two problems as well as the problem of specifying reactive systems. Reactive systems are complex control-driven mechanisms that interact with discrete occurrences in the environment in which they are embedded.

The reactive behavior of these systems cannot be captured by specifying the corresponding outputs resulting from every possible set of inputs. Instead, this behavior has to be described by specifying the relationship. However, new versions of the tool allow an interface between the Statecharts specification facility and temporal-logic- based model checkers of inputs, outputs, and system state over time under a set of systemand environment-dependent timing and communication constraints.

The Statecharts language provides graphic features (labeled boxes) to denote states (or sets of states) and transitions between states. A transition from one state to another takes place when the associated event(s) and condition(s) are enabled. A state can be decomposed into lower-level states via refinement, and a set of states can be combined into a higher-level state via clustering. This hierarchical specification approach makes it possible for the specifier to zoom-in and zoom-out of a section of the Statecharts specification, thus partially remedying the exponential- state-explosion problem in classical FSMs. Furthermore, AND and OR clustering relations, together with the notions of state exclusivity and orthogonality, can readily support concurrency and independence in system specification. These features dramatically reduce the state-explosion problem by not considering all states in a classical FSM at once.

To develop a comprehensive tool capable not only of system specification, [Harel et al., 1990a] extended the work on Statecharts, which is capable also of behavioral description, to derive high-level languages for structural and functional specifications. The language module-charts is used to describe a structural view with a graphical display of the components of the system. The language activity-charts is used to describe a functional view with a graphical display of the functions of the system. They also added mechanisms that provide a friendly user interface, simulated system executions, dynamic analysis, code generation, and rapid prototyping. The entire specification and development environment is known as STATEMATE.

EXERCISES 147

Other hierarchical FSM-based specification tools include communicating real-time state machines (CRSMs) and Modechart.

EXERCISES

1.Describe the advantages of Statecharts over classical finite-state transition systems.

2.Describe the usage of Statecharts, activity-charts, and module-charts. Which one can describe the lowest-level details in a specified system?

3.What are the advantages of OR-decomposition and AND-decomposition? In what scenarios would their use be appropriate?

4.What is the purpose of the SCL? How does it help in the development of correct application code?

5.Consider the Statecharts for a solution to the two-task mutual exclusion problem in Figures 5.3 and 5.4. Statechart A is basically a classical finite-state machine whereas Statechart B takes advantage of Statecharts’ features. Show the two corresponding Statecharts for a system with three tasks. Describe how Statechart B (for both the two-task and three-task systems) avoids the state-explosion problem found in Statechart A.

6.Construct the Statechart of the behavior of any electronic digital watch. An example is shown in [Harel, 1987].

7.Specify the smart airbag deployment system described in chapter 4 (exercise 6) as a Statechart. Compare the expressiveness and space requirement for the Statechart model and the timed transition graph model.

8.Consider the following high-level specification of the NASA 2001 Mars Odyssey Orbiter [Cass, 2001]. Before and during launch, the orbiter is folded into a protective housing. After launch, the solar panel extends to convert solar energy into electric energy for navigational use. When the orbiter approaches Mars, its engine fires and the orbiter inserts into Mars’ orbit. After braking, the orbiter deploys its high-gain antenna. At any time after launch, if an emergency occurs (expected steps are not executed as observed by a specialized monitoring computer), the orbiter skips the above steps and enters a safe mode and lets mission controllers take over control of the orbiter. Represent the behavior of the orbiter using a Statechart.

CHAPTER 6

REAL-TIME LOGIC, GRAPH-THEORETIC ANALYSIS, AND MODECHART

A real-time system can be specified in one of two ways. The first is to structurally and functionally describe the system by specifying its mechanical, electrical, and electronic components. This type of specification shows how the components of the system work as well as their functions and operations. The second is to describe the behavior of the system in response to actions and events. Here, the specification tells sequences of events allowed by the system. For instance, a structural-functional specification of the real-time anti-lock braking system in an automobile describes the braking system components and sensors, how they are interconnected, and how the actions of each component affects the other. This specification shows, for example, how to connect the wheel sensors to the central decision-making computer that controls the brake mechanism.

On the other hand, a behavioral specification shows only the response of each braking system component in response to an internal or external event, but does not describe how one can build such a system. For instance, this specification shows that when the wheel sensors detect wet road conditions, the decision-making computer will instruct the brake mechanism to pump the brakes at a higher frequency within 100 ms. Since we are interested in the timing properties of the system, a behavioral specification without the complexity of the structural specification often suffices for verifying the satisfaction of many timing constraints. Furthermore, to reduce specification and analysis complexity, we restrict the specification language to handle only timing relations. This is a departure from techniques that employ specification languages capable of describing logical as well as timing relations, such as real-time CTL.

148

Соседние файлы в предмете Электротехника