Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Lecture9a_FSM.doc
Скачиваний:
3
Добавлен:
19.11.2019
Размер:
5.49 Mб
Скачать

Harel statechart (диаграммы Harel).

Harel statecharts are gaining widespread usage since a variant has become part of the Unified Modeling Language. The diagram type allows the modeling of superstates, orthogonal regions, and activities as part of a state.

Диаграммы Harel находят широкое распространение, поскольку это вариант является частью унифицированного языка моделирования. Это тип диаграмм позволяет проводить моделирование супер-состояний, ортогональных областей и деятельности как части состояния.

Classic state diagrams require the creation of distinct nodes for every valid combination of parameters that define the state. This can lead to a very large number of nodes and transitions between nodes for all but the simplest of systems (state and transition explosion). This complexity reduces the readability of the state diagram.

Классические диаграммы требуют создания четких узлов для каждой действующей комбинации параметров, определяющих состояние. Это может приводить к большому числу узлов и переходов почти для всех систем, кроме самых простых («взрыв состояний и переходов»). Такая сложность снижает читаемость диаграмм состояний.

With Harel statecharts it is possible to model multiple cross-functional state diagrams within the statechart. Each of these cross-functional state machines can transition internally without affecting the other state machines in the statechart. The current state of each cross-functional state machine in the statechart defines the state of the system. The Harel statechart is equivalent to a state diagram but it improves the readability of the resulting diagram.

С помощью диаграмм Harel возможно моделирование диаграмм состояния с пересекающимися функциями внутри этой диаграммы. Каждый из этих конечных автоматов может осуществлять переход внутри себя без воздействия на другие конечные автоматы диаграммы. Текущее состояние каждого автомата с пересекающимися функциями на диаграмме определяет состояние системы. Диаграмма Harel эквивалентна диаграмме состояний, но при этом она улучшает понимание результирующей диаграммы.

Mealy and Moore models are the basic models of state machines.

A state machine which uses only Entry Actions, so that its output depends on the state, is called a Moore model. A state machine which uses only Input Actions, so that the output depends on the state and also on inputs, is called a Mealy model. The models selected will influence a design but there are no general indications as to which model is better. Choice of a model depends on the application, execution means (for instance, hardware systems are usually best realised as Moore models) and personal preferences of a designer or programmer. In practise, mixed models are often used with several action types.

A classic form of a state diagram for a finite state machine is a directed graph with the following elements (классической формой диаграммы состояния для конечных автоматов является направленный граф, включающий следующие элементы):

  • States C: a finite set of vertices normally represented by circles and labelled with unique designator symbols or words written inside them (C состояния: конечный набор вершин, обычно обозначаемых кружками, которые помечаются уникальными обозначениями или с помощью слов внутри символа);

  • Input symbols A: a finite collection of input symbols or designators (входные символы Aконечная совокупность входных символов или условных обозначений);

  • Output symbols B: a finite collection of output symbols or designators (выходные символы Y - конечная совокупность выходных символов или условных обозначений);

  • The output function ω represents the mapping of input symbols into output symbols, denoted mathematically as ω : A × C→ B (выходная функция ω, представляющая собой отображение входных символов в выходные в математическом смысле ω : X × QY);

  • Edges δ: represent the "transitions" between two states as caused by the input (identified by their symbols drawn on the "edges"). An 'edge' is usually drawn as an arrow directed from the present-state toward the next-state. This mapping describes the state transitions that is to occur on input of a particular symbol. This is written mathematically as δ: A × CB (ребра δ: представляют собой «переходы» между 2-мя состояниями, которые вызываются входным сигналом (обозначается их отличительным символом, нанесенным на «ребра»). Ребро обычно изображается как стрела, направленная из текущего состояния в следующее. Данное отображение описывает переход состояний, происходящих на входе отдельного символа. Это записывается математически как δ : A × CB);

  • Start state C0: (not shown in the examples below). The start state C0 ∈ C is usually represented by an arrow with no origin pointing to the state. In older texts, the start state is not shown and must be inferred from the text (начальное состояние, исходное состояние q0 (не показано в нижеприведенных примерах. начальное состояние C0 C обычно обозначается стрелкой без указания его происхождения и направленной на состояние. В старых научных источниках начальное состояние не показывается и должно определяться по тексту);

  • Accepting state(s) F: If used, for example for accepting automata, F ∈ Q is the accepting state. It is usually drawn as a double circle. Sometimes the accept state(s) function as "Final" (halt, trapped) states (поглощающее состояние(я) F: при его использовании, например, в качестве принимающего автомата, F C является поглощающим состоянием. Для его обозначения обычно используется двойной круг. Иногда функция поглощающего состояния(ий) – «окончательное» состояние (остановка, захват).

Another possible representation is the State transition table (другой возможной формой представления является таблица смены состояний).

Fig. Moore model

Fig. Mealy model

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]