INTELLIGENT CONTROL SYSTEMS An Introduction With Examples
INTELLIGENT CONTROL SYSTEMS An Introduction With Examples
INTELLIGENT CONTROL SYSTEMS An Introduction With Examples
KATALIN M. HANGOS
Department of Computer Science
University of Veszprem
ROZALIA LAKNER
Department of Computer Science
University of Veszprem
MIKLOS GERZSON
Department of Automation
University of Veszprem
Acknowledgments xiii
Preface xv
1. GETTING STARTED 1
1. Intelligent control: what does it mean? 2
2. Components of intelligent control systems 3
2.1 Software elements 3
2.2 Users 5
3. The structure and use of the book 6
3.1 The structure of the material 6
3.2 Prerequisites and potential readers 7
3.3 Course variants 8
2. KNOWLEDGE REPRESENTATION 11
1. Data and knowledge 12
1.1 Data representation and data items in traditional
databases 12
1.2 Data representation and data items in relational
databases 14
2. Rules 15
2.1 Logical operations 15
2.2 Syntax and semantics of rules 18
2.3 Datalog rule sets 19
2.3.1 The dependence graph of datalog rule
sets 21
3. Objects 22
4. Frames 26
5. Semantic nets 27
3. REASONING AND SEARCH IN RULE-BASED SYSTEMS 31
1. Solving problems by reasoning 31
1.1 The structure of the knowledge base 32
1.2 The reasoning algorithm 33
1.3 Conflict resolution 36
vii
viii INTELLIGENT CONTROL SYSTEMS
Appendices 251
A– A BRIEF OVERVIEW OF COMPUTER 251
CONTROLLED SYSTEMS
1. Basic notions in systems and control theory 251
1.1 Signals and signal spaces 252
1.2 Systems 252
2. State-space models of linear and nonlinear systems 253
2.1 State-space models of LTI systems 254
2.2 State-space models of nonlinear systems 254
2.3 Controllability 255
2.4 Observability 256
2.5 Stability 257
3. Common functions of a computer controlled system 258
3.1 Primary data processing 258
3.2 Process monitoring functions 260
3.3 Process control functions 260
3.4 Functional design requirements 262
4. Real-time software systems 262
4.1 Characteristics of real-time software systems 262
4.2 Elements of real-time software systems 264
4.3 Tasks in a real-time system 264
5. Software elements of computer controlled systems 268
5.1 Characteristic data structures of computer controlled
systems 268
5.1.1 Raw measured data and measured data
files 269
5.1.2 Primary processing data file 270
5.1.3 Events data file 270
5.1.4 Actuator data file 271
5.2 Typical tasks of computer controlled systems 272
5.2.1 Measurement device handling 272
5.2.2 Primary and secondary processing 272
5.2.3 Event handling 272
5.2.4 Controller(s) and actuator handling 273
B– THE COFFEE MACHINE 275
1. System description 275
2. Dynamic model equations 277
2.1 Differential (balance) equations 278
2.2 System variables 279
Acknowledgments
xiii
Preface
Tibor Vámos
Member of the Hungarian Academy of Sciences
Computer and Automation Research Institute
Budapest, 21th June, 2001
Chapter 1
GETTING STARTED
2. COMPONENTS OF INTELLIGENT
CONTROL SYSTEMS
Every object with some kind of intelligence exhibits a quite complex
and sophisticated structure: think of the biological structure of our ner-
vous system controlled by our brain. Similarly, intelligent control systems
have special components which are necessary to carry out control in an
intelligent way. Most of the software elements of an intelligent control
system perform its control function but some special elements serve its
users, who come from various backgrounds and have varying academic
qualifications.
User interface
Developers' interface
1. Knowledge base
The database of a knowledge-based system is called the knowledge
base. There is, however, a substantial difference between a database
with data entirely passive and a knowledge base where the relation-
ships between the individual data elements are much more important.
We shall learn more about the similarities and differences between
data and knowledge bases in Chapter 2.
2. Inference engine
The inference engine of a knowledge-based system is its processing
(program) element. It uses the content of the knowledge base to
derive new knowledge items using the process of reasoning. Reasoning
in rule-based expert systems is the subject of a separate chapter,
Chapter 3.
Getting started 5
2.2 USERS
There are two principally different types of users in any knowledge-
based system and their roles, qualification and user privileges are differ-
ent.
1. Knowledge engineer
A knowledge engineer is a person with a degree in computing, soft-
ware engineering, programming or alike with specialization in intel-
ligent systems. The design, implementation, verification and valida-
tion of a knowledge-based system is done by knowledge engineers.
Ideally, they should have an interdisciplinary background knowing
both knowledge-based systems technology and the application field
in which the knowledge-based system is being used. In the case of
intelligent control systems, a knowledge engineer should be familiar
with the basic notions and principles of computer controlled systems
as well.
Knowledge engineers use the so called developers´ interface which is
designed to work directly with the knowledge base manager of the
knowledge-based system. Through this interface high privilege tasks,
such as changing the structure and content of the knowledge base and
other knowledge base management tasks can be carried out.
2. User
A knowledge-based system is most often used via the so called user
6 INTELLIGENT CONTROL SYSTEMS
KNOWLEDGE REPRESENTATION
Consider a simple record for storing the related data items of raw
measured data in a computer controlled system declared in Pidgin Algol
syntax.
raw-measurement record
identifier: string;
type: character; {’R’,’B’}
value: word; {unscaled, type-dependent}
meas-time: integer array[6];
{ss-mm-hh-dd-mm-yy}
error-code: word; {type-dependent}
end; {raw-measurement}
The example above shows that the relations may call for an action
which is performed automatically by the database manager if need arises.
Knowledge representation 15
2. RULES
Rules are the most widespread form of knowledge representation in
expert systems and other AI tools. Their popularity is explained by
their simplicity and transparency from both a theoretical and a practical
point of view. This implies that rule sets are relatively easy to handle
and investigate.
As we shall see later in Chapter 4, the logical validation of a rule
set, i.e. the check of its consistency and contradiction freeness is a hard
problem from algorithmic viewpoint (the problem is not polynomial but
NP-hard). Rule sets mostly describe black box type heuristic knowledge,
therefore they are difficult to validate against other type of engineering
knowledge, say against process models. There are some methods, how-
ever, based on qualitative process models for partial validation of this
type as it is described later in section 3. of Chapter 7.
This section contains a short summary of logical operations in order
to prepare the ground for describing the syntax and semantics of rules
as well as to introduce a special type of rule sets.
a∧b
a↓ b→ false true
false false false
true false true
a→b
a↓ b→ false true
false true true
true false true
1. commutativity:
(a ∧ b) = (b ∧ a) , (a ∨ b) = (b ∨ a)
2. associativity:
(a ∧ b) ∧ c = a ∧ (b ∧ c) , (a ∨ b) ∨ c = a ∨ (b ∨ c)
3. distributivity:
a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c) , a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)
4. de Morgan identities:
¬(a ∧ b) = ¬a ∨ ¬b , ¬(a ∨ b) = ¬a ∧ ¬b
Knowledge representation 17
With the logical identities above, every logical expression can be trans-
formed into canonical form. There are three types of canonical forms:
The result of any logical operation with any of its operand being un-
known is most often, but not always unknown, i.e. an additional col-
umn and row is added to the operation tables with all the values being
unknown in them.
The following Table 2.3 shows the extended operation table for the
logical or operation. It is seen from the second row and second column of
the table that the logical value true in any of the operands will "improve"
the uncertainty given by the unknown value of the other operand.
18 INTELLIGENT CONTROL SYSTEMS
a∨b
a↓ b→ false true unknown
false false true unknown
true true true true
unknown unknown true unknown
”if ...then...”
1. Predicates
Predicates are elementary logical sentences, their value can be any of
the set
{true, false, unknown}
They usually contain arithmetic relations ( = , 6= , ≤ , > , < ) and
they may contain qualitative or symbolic constants (e.g. low, high,
very small, open etc.).
Simple examples of predicates from an intelligent control system are:
M3: Consider the finite digit realization of real numbers in computer con-
trolled systems for requirement D3.
- The set of entrances of the dependence graph, that is the set of edges
with no inward directed edges are the root predicates of the set. Their
values should be given if we want to compute the value of the other
predicates.
- Directed circles show that the dependence between the values of the
predicates in the circle is not unique: the result of the computation
may depend on the computation order.
If there is no directed circle in the dependence graph of a datalog rule set
then we obtain the same reasoning (evaluation) result regardless of the
computation order.
The following example shows a simple dependence graph.
3. OBJECTS
Object-oriented languages, like C++ are quite common in all applica-
tion areas not only in intelligent software systems [15]. Some of their
properties, however, are excellent for knowledge based systems therefore
this section contains a brief summary of object-oriented software systems
from the viewpoint of intelligent control applications.
The things or items in the focus of our attention are abstract objects.
Objects can be classified into abstract classes according to the properties
Knowledge representation 23
[s 2 ]
p1 p3
[s 1 ]
[s 1 ] [s 2 ]
p2 p4
they have in common. The common properties are attributes of the class
while the objects as entities of a class may have their own individual
properties.
This understanding of a class makes it possible to use a class as a
general knowledge element, which has both passive (data-like) and active
(procedural) attributes associated with it. This way the description does
not only contain the description of the knowledge element itself but also
that of its behaviour. Any concrete object then belongs to a class as its
entity.
Classes form so called class hierarchies, where sub-classes inherit their
data and procedural attributes from their parent class or super-class.
The class hierarchies are organized in such a way that the parent class
of a given class is unique, therefore the hierarchy structure is given by a
tree (a graph with no circles).
The descriptions of classes are put into the declaration part of a pro-
gram.
Observe, that the equipments belonging to the tube are described in the
form of attributes, and these are objects of different types: "val" being
a valve, and "T" and "v" measurement-devices.
There is only one procedure defined for opening the valve (the own
valve of the tube!) named "open-valve".
tube-two.open(err-code-2);
Knowledge representation 25
Then this valve will be open, but the valve attached to "tube-one"
remains in its previous state.
The following simple example shows a possible class hierarchy for the
coffee machine, which is described in Appendix B.
Consider again the tube example described above in Example 2.5, but
now with different tubes. Assume, we have a basic tube type with only
one valve attached to it, and an "advanced" tube type, where measure-
ment devices are also present. In order to be able to describe instances
of both types sharing common attributes and behaviour, we construct
the following class hierarchy in the declaration part of our program.
4. FRAMES
Frames [16] are knowledge structures with special pre-defined knowl-
edge elements connected by semantic relationships.
Frames can be seen as extensions of records with standard active ele-
ments [17]. On the other hand, frames are similar to objects in the sense
that instances can be generated from them and they can also form frame
hierarchies with inheritance. The properties of frames above explain why
they are convenient for knowledge representation.
Frames as elementary knowledge structures have the following stan-
dard parts.
- Slots
Slots play the same role in a frame as fields in a record. The attributes
of a slot are its identifier (or name), type and value. In order to make
knowledge representation easier, the type declaration for slots is more
flexible and can be changed during run-time.
The following simple example, a part of a declaration in a frame-based
environment, illustrates the flexibility of the type declaration.
measured-data frame;
value: real or byte;
status: byte;
end {measured-data};
- Daemons
Daemons are standard built-in procedures provided for each slot.
They are automatically invoked when a predefined change in the value
of the slot is taking place.
The usual daemons are as follows.
– if added contains the actions to be performed when the slot gets
its first non-nil value;
– if removed is the procedure to be executed when the value of the
slot is deleted (becomes nil);
– if needed describes the steps to be performed when the value of
the slot is read (retrieved);
– if changed is the daemon which is invoked when the value of the
slot is changed.
The use of frames resembles the use of objects. The main difference is
that the number and role of the procedures, defined for a frame are fixed
Knowledge representation 27
5. SEMANTIC NETS
Semantic nets are graphic tools for describing semantic relationships
between knowledge items in a knowledge base. The properties and rela-
tionships of the knowledge objects and classes are described by a directed
graph. The vertices of the graph correspond to the objects and their at-
tributes or properties: the labelled edges depict the relationships between
the vertices.
Most of the relationships in a semantic net fall into pre-defined cate-
gories. The most common relationships are as follows.
- is a
which means that objectA is an instance of objectB if the relationship
objectA is a objectB
holds.
- part of
meaning that objectA is a part of or an attribute of objectB when
holds.
28 INTELLIGENT CONTROL SYSTEMS
Observe, that the relationships above are necessary and sufficient to de-
scribe the relationships in an object-oriented knowledge base. Other
knowledge representation methods, such as frames, may call for other
pre-defined relationship categories.
The real semantic relationships are strongly problem or knowledge
base dependent, therefore cannot be given in advance.
It is important to note that semantic relationships can also be de-
scribed by binary relations. Thus the following expressions are equivalent
but they are in different syntactical forms:
M ike is a teacher
In summary: semantic nets are mainly used for knowledge base verifi-
cation, validation and diagnostic purposes.
coffee-machine tube
temperature- flow-
v TI ηI
sensor sensor
part_of relation
is_a relation
Fig. 2.3 shows part of the semantic net that describes the objects and
their connections in a model of the coffee machine shown in Fig. B.1 in
Appendix B.
Chapter 3
The basic methods of reasoning are described and the close connection
between reasoning and search is explained in the following sections of this
chapter:
- Solving problems by reasoning [18] - [21]
- Forward chaining [20], [21], [4]-[8]
- Backward chaining [20], [21], [4]-[8]
- Search methods and heuristics [4]-[8]
The syntax and semantics of rules have already been discussed in section
2.2 in Chapter 2.
At any given time the state of the knowledge base is the value of all
the predicates, which can be represented by a state vector.
p1
.
a= .
.
pnP
where
pi = {t(true), f (f alse), u(unknown)} and
nP is the number of the predicates.
The set of all states of the knowledge base that can be reached from
the initial state (or from a set of possible initial states) by any sequence
of actions, including the initial and terminal states are contained in the
state-space.
The rules consist of a condition or premise, which tests the logical
value of a set of facts at every stage of the reasoning process followed by
an action or consequence describing what to do when the rule fires.
Both the condition and the consequence part of a rule represent state-
ments which consist of disjunctions or conjunctions of facts. For the sake
of simplicity datalog rules are used in this chapter where the condition
Reasoning and search in rule-based systems 33
- modifying the facts by the selected rule (the logical value of the pred-
icates in the action (conclusion) part of the rule is set to true)
The selected rule is fired by the inference engine and the action asso-
ciated with it is executed.
Rules ...
Modus ponens can be used in two ways. Reasoning can be started with
the facts in the knowledge base, in which case modus ponens generates
new conclusions that in the next turn allow more inferences to be made.
This is called forward reasoning. Alternatively, reasoning can be started
with something to be proved. In this case we look for an implication with
its consequence part containing the predicate to be proved. Thereafter
we prove the predicates in the condition part of this implication. This is
called backward reasoning, because it uses modus ponens backward. In
case of both directions a reasoning path, that is a chain of rules can be
constructed between the facts and the goal state.
This reasoning chain can be seen as a path in the state-space, a
sequence of rules leading from one state to another. Problem solving
(reaching any goal state from the initial state) is performed by applying
the rules one after the other expounded on the state-space. This view
on reasoning can be illustrated on the state-space of the knowledge base
where the actual state is moved by the rules during reasoning. These
movements are performed by only one co-ordinate direction at a time
instance in case of datalog rules.
The sequences of reasoning steps correspond to a graph traversal from
an initial state to one or more possible, acceptable or optimal goal states.
Reasoning and search in rule-based systems 35
p2
t
a4
u r3
a2 a3
r2
f p3
u t
r1
u
a1
r3
t
p1
a0
(r1 ) : if p1 = t then p2 = t
(r2 ) : if p2 = t then p3 = t
(r3 ) : if p3 = u then p1 = u
At any given time there can be many applicable rules matching the
facts and the result of reasoning could depend on the order of their
application. This situation is called a conflict and it is represented by a
branch of the search tree in the state-space. The number of branches is
equal to the number of applicable rules in a state. Choosing which rule
to apply next is called a conflict resolution.
A directed search graph in the state-space is defined by the rule set
and the initial state. In this graph each node represents a state of the
state-space and each arc represents an action changing the state to an-
other. This search graph in the state-space is not given explicitly in the
beginning of the reasoning process, but is exhibited gradually as the rules
take a node in the state-space as input and produce its successors. So the
graph is given in an implicit way, and it is generated during reasoning
(it is generated on the fly).
Fig. 3.3 shows that the search graph in the state-space can be trans-
formed into a two-dimensional graph preserving the adjacency relations.
It is emphasized again that only a local part of the graph can be seen
at a given state, namely the nodes which have been traversed earlier and
the branches of the node. With this local information we need to decide
where the goal node may be, which way we prefer to reach it and how
to traverse the graph.
r1 r3
a2 a1
r2 r3
a3 a4
idea to solve the problems by testing every possible way of solution be-
cause of the combinatorical explosion. Even for most of the real practical
problems, there is no need to produce all possible solutions, the aim is
to obtain a "good enough" solution in a "short enough" time.
Conflict resolution aims at choosing which rule to apply next from
the applicable ones. It is the most important algorithm of the infer-
ence engine. It almost always contains heuristic knowledge, that is extra
knowledge beyond the state-space, which can be regarded as metaknowl-
edge about the structure of the rule-base.
The notion of heuristics has no exact definition, but all heuristic pro-
cedures exhibit two significant properties:
- A "good enough" solution is found in most cases, but the optimal
solution or any solution is not guaranteed.
- Heuristic procedures considerably improve the efficiency of problem
solving by reducing the number of attempts to reach the solution.
The function of heuristics is to determine the order in which to apply
rules during reasoning. Heuristics may be very simple or quite complex.
A good heuristics can be characterized by the following properties:
- It is used and computed efficiently.
- It is a good estimate, but it does not overestimate the effective costs.
The most widely used methods of conflict resolution are as follows:
- using the first applicable rule (when the rules are placed in order of
importance),
- assigning priority to rules,
- using other heuristic methods.
38 INTELLIGENT CONTROL SYSTEMS
2. FORWARD REASONING
The simplest reasoning method is forward reasoning, forward chaining
or data-driven chaining. It is used to infer solutions from knowledge that
exists in the knowledge base.
Question:
Is ag a consequence of a0 ?
(Can ag be derived from a0 by the rules?)
The above problem is a decision problem where the whole search tree
must be traversed in the worst case to get an answer to the question.
As the size of the tree (the number of nodes) increases the number of
computational steps exponentially, the problem is NP-complete.
Reasoning and search in rule-based systems 39
Facts
Goals
Forward Reasoning
Given:
- the initial state of fact-base (a0 )
- the rule-base
Compute:
all the possible consequences of the initial state(s).
This is a search problem, where again, the NP-completeness follows
from the problem specification.
In forward chaining the search graph in the state-space is built from
the initial state a0 . During the traversal of the graph the condition parts
of rules are matched to the fact-base and one of the applicable rules is
executed, that is, the facts in the consequence part of the selected rule
40 INTELLIGENT CONTROL SYSTEMS
are added to or some facts are deleted from the fact-base. With the
application of the rule we can get to the next state. If this state is one
of the goal states of the Forward Reasoning with Defined Goal
problem, then the algorithm terminates.
If there is no more applicable rule and the terminal state is not in
the goal state set ag , then the algorithm must go back to a state with
more applicable rules and should use the next one. The terminal state is
observed before stepping back in the case of the Forward Reasoning
with Defined Goal problem, where there is no goal state specified.
This "going back" described above is called backtrack . The backtrack
mechanism will try all of the possible rules selecting the first alterna-
tive at each state and backtracking to the next alternative when it has
pursued all of the paths from the first choice.
The backtrack mechanism that can be applied to the reasoning graph
in Fig. 3.2 is illustrated in Fig. 3.5
a0
r1 r3
a2 a1
r2 r3
a3 a4
Figure 3.5. The backtrack mechanism on the reasoning graph in Fig. 3.2
For example:
– the composition of organic compounds is determined using knowl-
edge gained from different measurements.
– predictions are computed from measured data in a real-time ex-
pert system
A A A
E E E
G G G
H H H
C C
B B D B
1. 2.
backtrack
3.
add D A A
E E
4. G G
H H
C C
D B D B
5.
F and B Z F and B Z
G and H ¬C
C and D F C and D F
backtrack
add F 6.
7.
A A
F E F E
G G
H H
C C
D B D B
Z
match
add Z
F and B Z 8.
G and H ¬C
{A, B, C, E, G, H}
r2 r4
{A, B, C, E, G, H} {A, B, C, D, E, G, H}
r4 r2 r3
r1
{A, B, C, D , E, F , G, H, Z}
Figure 3.7. The inference chain produced by the example in Fig. 3.6
44 INTELLIGENT CONTROL SYSTEMS
3. BACKWARD REASONING
Backward reasoning is applied to infer the causes of a situation, that
is the possible facts which lead to a goal state driven by the rules.
Before explaining the backward reasoning technique in detail, a new
problem solving method is discussed in this chapter in order to make it
easier to understand the method of backward reasoning.
a0
a1 a2 a3
a4 a5 a6 a7 a8
There are two hyperarcs from node a0 , one from a1 and two from a3 .
The hyperarcs from a0 to a1 and from a3 to a6 only contain one common
directed arc, but the hyperarcs from a0 to a2 and a3 , from a1 to a4 and
a5 , and from a3 to a7 and a8 consist of two common arcs.
Node a0 has three children nodes (a1 , a2 and a3 ) and there is a nar-
rower, so called AND connection between a2 and a3 because they belong
to the same hyperarc. Node a1 is connected to them with an OR con-
nection.
The nodes of the AND-OR graph connected to each other with AND
connections represent subproblems of which all should be solved. But in
case of an OR connection it is enough to solve one subproblem.
A solution in an AND-OR graph is called hyperpath, which is a sub-
graph from the initial node to the set of goal nodes. A possible solution
graph is shown in bold in Fig. 3.8.
Goals
Facts
Question:
Can a0 be a reason of ag ?
(Can ag be derived from a0 by the rules?)
This is a decision task where in the worst case, the whole search tree
must be traversed. As the size of the tree (the number of nodes) increases,
the number of necessary computation steps increases exponentially, thus
the problem is NP-complete.
The search variant of the problem is obtained when no other state is
given.
Backward Reasoning
Given:
- the rule-base
Reasoning and search in rule-based systems 47
Compute:
all of the possible reasons of ag
- Problem data are not given but must be generated, retrieved or found
during problem solving.
Example:
A A A
C C C
G G G
H H H
B B B
A
C
2. 4.
G
H
want Z need F want F need H
need E B
H and E F H and E F 3. 5.
1.
F and B Z F and B Z
6. want E
C and D F C and D F backtrack no match
A D A D
H and E F
need B F and B Z
C and D F
13. A 7. A
C C A D
G need C G
H 8. H
D
B B
F
have Z
14.
A A
C C
need D
G G
9. H
Z H
D
B B
F
want D
H and E F
F and B Z A
C
12. C and D F need A
G
A D 10. H
have D B
have F
other subgoal 11.
A
C
G
H
D
B
F
r2
F B
r1 r3
H E C D
r4
Figure 3.11. The AND-OR graph produced by the example in Fig. 3.10
4. BIDIRECTIONAL REASONING
In every special case, the nature of the actual problem determines
which reasoning technique is to be applied. However, there may be prob-
lems where neither forward chaining nor backward chaining is efficient.
If we assume, however, that they operate efficiently at an early stage,
it’s a good idea to use bidirectional reasoning - a combination of back-
ward and forward reasoning. In this reasoning method, the path of rules
leading from the start to the goal state are searched from two directions,
from both the start and the goal state at the same time, as it is shown
in Fig. 3.12. The bidirectional reasoning procedure terminates when the
reasoning "bridge" seen in the Figure is built up.
F
a G
c o
t a
s l
s
Forward Backward
5. SEARCH METHODS
As it was mentioned earlier, reasoning problems are solved by search
on the reasoning graph in the state-space. Search in itself is a general
problem solving method or mechanism. Search is used in order to get
from the initial state to one or more possible goal states during problem
solving. The solution is described by a path, which consists of rules or
transitions executed one after the other, starting at the initial state and
ending in the goal state.
We have also seen that the inference engine often gets to a decision
position during reasoning or search when it applies conflict resolution
techniques. A search strategy is used during search for decision making.
It is often supported by concrete knowledge about the task to be solved,
called heuristics.
52 INTELLIGENT CONTROL SYSTEMS
Search strategies can be divided into two groups from the viewpoint of
the application of heuristics:
- uninformed control strategies
In an uninformed control strategy, all of the paths are traversed in a
systematic way. There is no information about the "goodness" of the
path or a node examined in a nongoal state. The algorithm can only
distinguish a goal state from a nongoal state. An uninformed search
strategy is also called blind search strategy.
- informed control strategies
Here the specific knowledge about the given problem is also used.
The informed control strategy is called heuristic control strategy or
heuristic search.
The general and some important special search methods are introduced
and discussed in the following sections.
3. If n is a goal node stop and return it and the path from the initial
node to n.
L is called the list of open nodes (the nodes which are expanded but
not examined). The methods of selection from this list define different
search algorithms. In practice the values of a function (the so called
evaluation function) are often used for choosing an open node from a
list.
1.
2. 10.
3. 9. 11.
4. 7. 12.
5. 6. 8. 13. 14.
15.
goal
1.
2. 3. 4.
5. 6. 7. 8. 9.
- local maxima: the search has found a local maximum, but has not
found the global maximum
- plateaus: the search has reached a node, and around it the evaluation
function is essentially flat
- ridges: the search has reached a node where the values of the succes-
sors are lower, but a node with higher value can only be reached by
the combination of several steps
56 INTELLIGENT CONTROL SYSTEMS
1. 0
2. 4 2 3
3. 5 4
5 4. 6
5. 6
nongoal
Figure 3.15. The hill climbing search (the value of the heuristic function is denoted
by the underlined numbers)
5.5 A* SEARCH
A* search is a well-known and efficient heuristic search method. In
this method a heuristic function f (n) is used to estimate the cost of the
cheapest solution through the node n.
f (n) = g(n) + h(n)
The heuristic function is the sum of the cost of the path from the initial
node to the current node denoted by g(n) and the estimated cost from
the current node to the goal denoted by h(n):
actual estimate
|start{z → } n
|
→ goal
{z }
g(n) h(n)
| {z }
f (n)
As Fig. 3.16 shows A* search always expands one of the nodes with
the lowest cost. It can be implemented by ordering the open nodes in list
L according to f (n) and always choosing the node with the lowest cost
in L in step 2. of procedure in section 5.1 of this Chapter.
Reasoning and search in rule-based systems 57
1. 15
5 3 3
13 2. 11 4. 12
2 4 3
3. 10 oo 5. 9
4 5
5
8 6. 4 6
5
7. 0
goal
Figure 3.16. The A* search (the value of the heuristic function is denoted by the
underlined numbers and the numbers labeling the arcs denote their costs)
property of the rule-base when they are taken into account during veri-
fication.
The verification of completeness and contradiction freeness of rule-
based knowledge bases is described and analyzed in this chapter using
the notions and techniques of theoretical computer science [28].
We shall consider the following important verification properties sep-
arately in the following sections:
- contradiction freeness
- completeness
In both cases, the notion of the property is followed by the description
of its verification procedure as a standard algorithmic decision problem.
It is important to note that the abstract data structure (3.1) intro-
duced in Chapter 3 will be used here to describe the structure of a datalog
rule set:
1. CONTRADICTION FREENESS
One of the most important requirements for knowledge bases is that
their content should not have any contradiction neither formal (syntacti-
cal) nor semantical. Syntactical or formal contradictions are investigated
by the verification process of the knowledge base that examines contra-
diction freeness.
uniquely determined by the rule-base using the rules for forward chain
reasoning.
Question:
Is the rule-base contradiction free?
Solution:
From the definition above it follows that we need to compute the value
of each non-root predicate under every possible circumstance, that is
with every possible set of the root predicate values and in every possible
way. Therefore, the following substeps should be performed to check the
contradiction freeness of the given rule-base.
2. Construct the set of all possible values for the root predicates (to be
stored in the set Srp )
Here we have to consider all the three possible values true, false and
unknown for every root predicate. From the viewpoint of reasoning,
however, the values false and unknown are equivalent, therefore the
number of the elements in this set is 2nrp . This implies that this step
is not polynomial.
3. For every element in Srp perform forward chaining and compute the
value of the non-root predicates in every possible way
that is by applying the rules in every possible order. This step requires
to solve a Forward Chaining search problem (see section 2. of
Chapter 3) for every possible value of the root predicates. Therefore
this step is usually NP-complete .
62 INTELLIGENT CONTROL SYSTEMS
4. Finally, check that the computed values for each of the non-root pred-
icates are the same. If yes then the answer to our original question is
yes, otherwise no.
P = {p1 , p2 , p3 , p4 , p5 } (4.2)
(r01 ) : p5 → ¬p4 ;
(r02 ) : p4 → ¬p5 ;
(r1 ) : (p1 ∧ p2 ) → p4 ;
(r2 ) : (p3 ∧ p1 ) → p5 ;
(r3 ) : (p1 ∧ p2 ) → p3 ;
Proot = {p1 , p2 }
p1 = true , p2 = true
Verification and validation of rule-bases 63
Compute:
the whole set of possible reasoning trees to generate all possible values
of the non-root predicates.
64 INTELLIGENT CONTROL SYSTEMS
Solution:
By comparing the problem statement above to that of Testing Con-
tradiction Freeness it can be seen that the Analyzing Contra-
diction Freeness problem is NP -hard both from the viewpoint of time
and space.
2. COMPLETENESS
Completeness is a dual problem of contradiction freeness in a certain
sense because here one is interested in whether the knowledge in the
knowledge base is enough to solve the given problem.
Testing Completeness
Given:
Question:
Is the rule-base complete?
Solution:
From the definition it is seen that now we do not need to compute the
value of each of the predicates in every possible way but we need to
find out if every non-root predicate is present in the reasoning tree in all
cases. Therefore, completeness can be tested by the following steps.
1. Determine the set of root predicates
by analyzing the dependence graph of the datalog rule set, for exam-
ple. This is a polynomial step.
Verification and validation of rule-bases 65
2. Construct the set of all possible values for the root predicates (to be
stored in the set Srp )
The number of the elements in this set is 2nrp , therefore, this step is
not polynomial.
3. For every element in Srp perform forward chaining and generate a
reasoning tree
until either all non-root predicates appear at least once or all the
rules have been applied in every possible order. This step requires the
solution of a Forward Chaining search problem (see section 2. in
Chapter 3) for every possible value of the root predicates. Therefore,
this step is usually NP-complete.
4. Finally, check that each of the non-root predicates gets at least one
value in every possible case. If yes, then the answer to our original
question is yes, otherwise no.
Consider a simple rule set defined on the same set of predicates (4.2) as
in Example 4.1. The "virtual" rule pair (r01 ) and (r02 ) is also associated
with the set of predicates.
Let the implication form of the datalog rule set be the same as the
rules (r1 )-(r3 ).
Let us have the following values for the root predicates:
p1 = true , p2 = false
Then we have no applicable rule from the rule set therefore the non-root
predicates p3 , p4 and p5 are undetermined in this case.
Analyzing Completeness
Given:
- A rule-based knowledge base with its abstract data structure (4.1)
Compute:
the whole set of possible reasoning trees to generate all possible values
of the non-root predicates.
Solution:
By comparing the problem statement above to that of Testing Com-
pleteness it can be seen that the Analyzing Completeness problem
is NP-hard both from the viewpoint of time and space.
3. FURTHER PROBLEMS
This section contains important extensions and consequences of the
contradiction freeness and completeness sections before.
4. DECOMPOSITION OF KNOWLEDGE
BASES
The NP-hard ness of both the testing of contradiction freeness and
completeness even in the simplest case of rule-based knowledge bases
requires an attempt to constrain the size of the knowledge base part to
verify, that is both the number of predicates and the number of rules
[30]. This can be done by decomposing the knowledge base into parts
which are internally strongly dependent but "loosely dependent" on the
knowledge belonging to other parts.
This way one can create a hierarchical decomposition structure of a
rule-base by partitioning the predicates into classes and associating the
rules which only depend on predicates of a given class to that class.
The rules with predicates in more than one class become member of the
higher, inter-class knowledge representation level.
The problems and challenges of decomposing knowledge bases are ex-
plained here using the knowledge bases of the most simple structure as
an example: rule-based knowledge bases. Decomposition techniques use
68 INTELLIGENT CONTROL SYSTEMS
The tools are arranged and introduced in the order of their level of
conceptual complexity.
symbolic atom
atom
numeric atom
expression
empty list
list
constructed list
(+ (∗ 2 3) (−4 1))
with depth 2. The syntax tree of this list is shown in Fig. 5.2.
72 INTELLIGENT CONTROL SYSTEMS
(+ (∗ 2 3) (- 4 1))
+ (∗ 2 3) (- 4 1)
∗ 2 3 - 4 1
The CONS primitive attaches the expression given as its first argument
at the front of the list given in its second argument.
* (cons ’x ’(y z))
(X Y Z)
* (cons ’(a b) ’(c d))
((A B) C D)
The parts of a list decomposed by the FIRST and REST primitives can
be used for reconstructing the original list by CONS as it is shown in Fig.
5.3.
FIRST X
(X Y Z) CONS (X Y Z)
REST (Y Z)
2.5
* (/ 9 3 3)
1
* (/ 7 3)
7/3
* (sqrt -9)
#C(0.0 3.0)
* (min (+ 1 1) (* 2 2) 3)
2
1.3.5 PREDICATES
The procedure that returns a true or false logical value is called predi-
cate. For the notation of the false value, the special symbol NIL is always
used and the true value is often denoted by the special symbol T. In gen-
eral, anything other than NIL denotes a logical true value.
One group of predicates examines the equality of two expressions.
For example, numerical equality is determined by the = predicate, the
equality of symbols is determined by the EQ predicate and the equality of
expressions is determined by the EQUAL predicate. The following simple
examples illustrates the use of the primitives above:
* (= (+ 1 2) 3.0)
T
* (= ’a 5)
ERROR (about that "a" is not a number)
* (eq ’b (first ’(b c)))
T
* (equal (+ 2 2) 4)
T
* (equal ’a 5)
NIL
* (equal (list ’a (first ’(2 3))) ’(a 2))
T
The MEMBER predicate tests whether its first argument is a top-level
element of the list in its second argument. If the first argument is not
found in the list, NIL is returned, otherwise the tail of the list beginning
with the first argument is returned, as it can be seen in the examples
below.
78 INTELLIGENT CONTROL SYSTEMS
- In a WHEN primitive the else form is omitted. If the value of the test
is NIL then nothing is done and the value of the WHEN form is NIL.
Otherwise the return value is the value of the last argument.
- In an UNLESS primitive the then form is omitted. If the value of the
test is non-NIL then nothing is done and the value of the UNLESS form
is NIL. Otherwise the return value is the value of the last argument.
NOT-NUMBER
* (number-check (* 1 -2 3))
NEGATIVE
Table 5.1. Operation table of the "equivalence" and the "implication" operator
a≡b a→b
a↓ b→ nil t a↓ b→ nil t
nil t nil nil t t
t nil t t nil t
Solution: The truth tables given in Table 5.1 show that the equivalence
of two expressions is t if both of them are nil or both of them are t, and
their implication is t when the condition part is nil or the consequent
part is t. The equivalent Lisp description of the sentence above is as
follows:
* (defun equivalence (a b)
(or (and a b) (and (not a) (not b))))
EQUIVALENCE
* (defun implication (a b)
(or (not a) b))
IMPLICATION
The use of the function above is illustrated by the following simple lines:
* (equivalence ’(nil t))
NIL
Tools for representation and reasoning 83
P0 (x) = a0
P1 (x) = a0 x + a1
P2 (x) = (a0 x + a1 )x + a2
.
.
2.1.1 FACTS
The simplest form of Prolog predicates are the so called facts. Facts
correspond to records in a relational database. They represent the state-
ments or relations that are assumed to be true. Let us consider the facts
below, for example:
86 INTELLIGENT CONTROL SYSTEMS
- and zero or more arguments such as doll, ann, john, peter, 10,
[15,18,27,49,70], X, name(ann) and birthday(1990,may,12).
The syntactical end of facts and all Prolog clauses are denoted by a
period.
The arguments can be any of the following Prolog terms:
- atoms such as doll, ann, john, peter and may represent indivisible
specific part of the world and begin with lower case letter
The other symbols used in the facts above "(", ")", "." and "," are
delimiters.
Tools for representation and reasoning 87
2.1.2 RULES
Rules represent things that are true depending on some conditions,
for example:
A rule consists of a head and a body. For example the head of the
first rule is likes(ann,X) and the body is toy(X), plays(ann,X). The
head of a rule is a predicate definition and the body is a set of conditions
combined with a conjunction. The head and the body of a rule are
separated by ": −" symbol which can be read as "if", and the parts of
the body is separated by "," symbol which denotes logical "and".
Facts and rules are collectively called clauses, which essentially de-
scribe sentences. The order of clauses with different heads is optional
in Prolog programs. Clauses with the same head are generally grouped
into procedures and are tested in the order they appear in the program,
from top to bottom.
2.1.3 QUESTIONS
The question or goal is used in Prolog programs to find out if something
is true, for example:
A : − B1 , . . ., Bn .
objects and other lists. There is a special list, the empty list, which is
denoted by a pair of square brackets: [].
A list is a recursive data structure. As in the Lisp language, lists in
Prolog also consist of two parts: the head, which is the first element, and
the tail which must be a list, too, containing the remainder part of the
list. For example,
In Prolog, the head and the tail of a list can be selected by pattern
matching the actual list with the notation [X|Y], where the head of the
list is bounded to X and the tail of the list is bounded to Y. For example,
?- likes(ann,What).
Tools for representation and reasoning 91
Prolog tries to prove the question by looking for facts which match
this goal, or rules whose heads match this goal and whose body can be
proved. Evaluation steps:
1. The clause
is found and matched with the goal. The unifier is the substitution
What|X, and the body of the rule becomes a new goal. So we have two
new subgoals: toy(What) and plays(ann,What).
2. Now, to evaluate the first subgoal, the system finds the fact
toy(car).
toy(doll).
Goal: likes(ann,What)
What|X
likes(ann,X)
2.2.2 UNIFICATION
Parameters are passed on using bidirectional pattern matching or uni-
fication in Prolog. During unification the subgoal and the head of the
clause must have the same uniform structure with substitutions of vari-
ables.
The conditions of unification are the following:
- the predicates have the same name
- the predicates have the same number of arguments
- the arguments are unifiable as follows
– a variable and any term is always unifiable
– two primitive terms (atom or number) only unify if they are iden-
tical
– two structures unify if they have the same functor and the argu-
ments are unifiable one after the other
Let us examine some examples to illustrate the condition of unification:
Case1 : p(1, b, d)
q(2, B, B, D)
The predicates are not unifiable as the names of the predicates are not
equivalent.
Case2 : p(1, b, d)
p(2, B, B, D)
The matching is not successful as the argument numbers are different.
Tools for representation and reasoning 93
Case3 : p(1, b, d)
p(2, B, B)
The names and the argument numbers of the predicates are the same, but
the first arguments are not unifiable, because both of them are numbers
with different values.
Case4 : p(1, b, d)
p(1, B, B)
The first and the second arguments are unifiable with the binding B|b,
but the third arguments (d and B|b) cannot be matched.
Case5 : p(1, b, d)
p(1, B, D)
The unification is successful with the matching list: B|b, D|d.
The role of unification is dual:
- the clause applicable to the subgoal is selected by pattern matching
2.2.3 BACKTRACKING
As you can see in section 2.2.1 of this Chapter in step 3, when a
subgoal fails in Prolog, the system backtracks to a previous subgoal to
find an alternative possibility for the solution.
Backtracking has the following preconditions:
- the solution of a subgoal is not successful
G 1, G2, G3
backtrack
unification
C :- P 1 , P 2 , P 3 .
next clause
- a clause fails,
CALL EXIT
FAIL REDO
The state of the Prolog inference engine and its actions in the four states
above are the following:
- call: Prolog begins searching for clauses that unify with the subgoal.
- exit: The subgoal is satisfied and the appropriate variables are bound.
- fail: This state indicates that no more clauses match the subgoal.
Tools for representation and reasoning 95
Let us see the execution steps of the simple Prolog example 5.3:
?- likes(ann,What).
CALL: likes(ann,What)
CALL: toy(What)
EXIT: toy(car)
CALL: plays(ann,car)
FAIL: plays(ann,car)
REDO: toy(What)
EXIT: toy(doll)
CALL: plays(ann,doll)
EXIT: plays(ann,doll)
EXIT: likes(ann,doll)
What=doll
2.2.6 RECURSION
In almost any Prolog program you can find recursive clauses - clauses
that call themselves. In a recursive clause the predicate symbol of the
head occurs as a predicate symbol in the body, too.
In any language, a recursive definition consists of at least two parts:
?- read(X).
ann.
X=ann
?- read(Hour:Min).
8:10.
Hour=8
Min=10
Y=car;
X=ann
Y=doll;
no
?- retract(plays(john,car)).
yes
?- plays(john,X).
no
As you have seen in the examples in the previous sections, there are
no global variables in Prolog, the form of the Prolog database is used for
those, too. Information can be stored in facts and can be manipulated
with asserta, assert and retract.
X=[a,b]
Y=[];
no
?- concat(moon,flower,X).
X=moonflower
?- concat(life,X,lifetime).
X=time
G 1, G 2, G3 G 1, G2, G3
backtrack
unification
C :- P 1 , P 2 , P 3 . C :- P 1 , P 2 , !, P 3 .
FAIL FAIL
next clause
equivalence(X,X).
?- equivalence(false,true).
no
?- equivalence(false,false).
yes
implication(false, ) :- !.
implication( ,true).
?- implication(false,true).
yes
?- implication(false,false).
yes
b e
d
a f
c g
1. Define the Prolog description of the directed graph in Fig. 5.8 and
examine the behaviour of the program.
2. Change the direction of the arc b→d in the graph to d→b and examine
the behaviour of the program again. Modify the Prolog definitions in
order to be able to handle the altered graph.
Solution:
?- path(a,f).
yes
?- path(f,a).
no
?- path(c,X).
X=d;
X=g;
X=f;
X=f;
no
path(X,Y,Nodes) :-
arc(X,Y),
not(member(Y,Nodes)).
path(X,Y,Nodes) :-
arc(X,Z),
not(member(Z,Nodes)),
path(Z,Y,[Z|Nodes]).
The clause member is used for examining whether its first argument
is an element of the list in its second argument.
?- path(X,d,[]).
X=c;
X=a;
X=b;
X=a;
X=d;
no
but the special, domain specific knowledge is missing from the knowledge
base. The basic components of an expert system shell are shown in Fig.
5.9 in the dotted box.
User
User
interface
Inference
engine
Knowledge
base
Knowledge
Knowledge Developer's
acquisition
engineer interface
subsystem
- knowledge base
As it has been discussed before in detail in Chapter 2, the knowledge
base stores the factual and heuristic knowledge in any expert system
and is one of the standard components.
- inference engine
The inference engine is also a standard element in an expert system.
It manipulates the symbolic information and knowledge in the knowl-
edge base to perform reasoning when solving a problem. Chapter 3
deals with reasoning in details.
Tools for representation and reasoning 105
- user interface
The user interface is a standard component in almost any software
system. It allows the user to interact with the system in an easy
"user-friendly" way.
- explanation subsystem
The explanation subsystem is a service utility which explains the sys-
tem’s actions upon the request of the user.
- developers’ interface
A software developers’ interface can be found in almost any software
system as a standard component. In the case of expert systems, it
allows the knowledge engineer to interact with the knowledge acqui-
sition subsystem.
- explanative reasoning
which provides an answer to the questions:
"Why?" and "How?"
Besides the result of reasoning, the explanation function gives
information to the user about the way the result has been found.
Consequently, these functions are closely related to the tracing
functions provided by the knowledge acquisition subsystem.
The answer to the question "Why?" consists of the knowledge
elements used for deriving the reasoning result. The full tracing
information about the actual reasoning steps is in the answer to
the question "How?".
- hypothetical reasoning
which gives an answer to questions of the type
"What would happen if eq-expr were true?"
where eq-expr is a value assignment statement, like ”X = 2”
with X being a variable.
Hypothetical reasoning involves a conditional assignment present
in eq-expr and the derivation of its consequences by reasoning
and/or simulation. It is important to note that the assignment
and its consequences can be withdrawn if the user is not satisfied
with it.
The presence of the hypothetical reasoning function assumes the
existence of an inference engine with a conditional reasoning fa-
cility and a simulator in the case of real-time expert systems.
- counterfactual reasoning
This service function searches for counter-examples of a logical
statement within the actual content of the knowledge base.
- knowledge extraction
to collect information from the knowledge base that satisfies the
criteria defined by the knowledge engineer (the extraction filter).
The result of the extraction may be used for verification and/or
validation purposes or may be exported to another knowledge or
database.
- automatic logging or book-keeping of the changes to the knowl-
edge base,
which is useful for tracing and maintenance purposes. This func-
tion can also be useful for repairing the knowledge base when com-
bined with hypothetical reasoning and consequence withdrawal in
the case of any consistency problems.
- tracing facilities
These group of service functions includes general functions, such
as
– specification and handling of breakpoints for the reasoning
process
– automatic monitoring and reporting of the change in the val-
ues of the knowledge elements during reasoning (also com-
bined by breakpoint generation)
implemented in an expert system environment.
3. Interface functions and services
According to the interfaces an expert system may have, the following
function groups are available:
- user and developer interfaces
- operating system interface
- real-time data exchange interface (if applicable)
This interface function group plays a central role in real-time ex-
pert systems, which are the subject of Chapter 6.
It is important to note that a specific implementation of the general
functions and services of an expert system shell can be observed on the
example of the G2 real-time expert system shell in Chapter 10.
Chapter 6
raw primary
measured actuator KNOWLEDGE
measured processing events
data data BASE
data data
knowledge base
database handling
handling
interface
The passive elements, that is the data files in a database and the
knowledge base are denoted by squares. The active elements including
tasks or processes and the data- or knowledge base manager are de-
picted in rounded dashed squares. Data exchange between the active
and passive elements is shown by arrows, and the synchronization and
communication between active elements by dashed arrows.
The components of the expert system part located on the right side of
the figure form the so called intelligent subsystem, the other components
on the left side responsible for the real-time control behaviour are called
real-time subsystem. The interface denoted by bold double line in the
middle clearly separates and connects the two subsystems.
Real-time expert systems 111
In the remaining part of this section the most important real-time and
intelligent components are briefly introduced and described.
not be able to process all of data but it should store all the received
signal changes for possible processing later.
5. priority handling
One way a real-time system (and everyone) cops with overload is that
the most important tasks are done first at the price of neglecting the
others. This policy requires priorities to be set for every possible task
or process in a real-time system and a mechanism to handle priorities
and control system behaviour according to these. Usually there is
a combination of fixed and time-varying priorities in each real-time
system.
6. "nice degradation"
There can be cases when the overload persists, then the system should
restrict its activity to the most important actions with the highest pri-
ority. Such a case is clearly a degradation of system performance from
the viewpoint of its users. It is usually required that such an unavoid-
able degradation should be "nice" in the sense that it should allow
the user to perform the most basic tasks to get information about the
system itself and about the signals. Careful software design is essen-
tial for the implementation of a nice degradation. One way to achieve
this goal for example is the application of advanced conditional and
time varying priorities.
- knowledge base
- inference engine
Notice that the connections between these non-service elements and the
real-time subsystem are also shown in Fig. 6.1. Observe that the intelli-
gent subsystem only reads but does not write in the real-time database
files. The result of reasoning is communicated to the real-time processes
via task-task communication messages.
2. SYNCHRONIZATION AND
COMMUNICATION BETWEEN
REAL-TIME AND INTELLIGENT
SUBSYSTEMS
As a consequence of the separation and relative autonomy of the in-
telligent and real-time software elements, there is a need to organize
their cooperation. The synchronization and communication between the
real-time and intelligent subsystems are implemented as functions of the
interface element (see in Fig. 6.1). The figure shows that both data
(knowledge) exchange and synchronization are taking place between the
two subsystems.
This section is devoted to the synchronization and communication
between the active elements, that is processes or tasks of the two sub-
systems. More precisely we shall investigate the possible ways real-time
processes, primary processing and controllers communicate their request
for reasoning to the inference engine and the engine’s response.
used. The fully synchronized types, that is the "handshake" and "mes-
sage exchange", can be implemented in a loose way by using two one-way
primitives of the appropriate type.
For communication purposes between the real-time processes and the
inference engine, most often only the "send message" primitive is needed
and is used in the interface of real-time expert systems. The messages are
collected into separate message queues for each communicating pair and
communication direction. This way we may have a queue of messages,
i.e. reasoning requests, from primary processing to the inference engine,
another one for the reasoning result messages from the inference engine
to a particular controller etc. (compare with the dashed arrows in Fig.
6.1). The messages in a queue have a time stamp indicating the time
of the request for reasoning results and are usually processed in a FIFO
(first in first out) order.
The real-time processes are implemented in such a way that they are
able to wait for a message but it is not a standard feature of an inference
engine. Therefore inference engines in a real-time expert system should be
implemented in a way to be able to handle message queues appropriately.
inference engine and the event handling or archive process in the real-
time subsystem. The inference engine will normally wait for the signal
value it requested (i.e. this is a message exchange type connection), thus
this process-process connection is an exception to the loose data transfer
concept applied in real-time expert systems between their real-time and
intelligent subsystems.
With the tools and techniques above for data exchange between the
real-time and intelligent subsystems, it is relatively easy to implement
the reset function of the reasoning process. If a process in the real-time
subsystem requires the interruption of the current reasoning process in
order to process an urgent reasoning request, then the following sub-steps
have to be carried out.
1. store the interrupted reasoning request message in its original queue
by putting it back to be the first message to be processed,
2. erase the fact base and marks, that is fill the values with nil or un-
known,
3. perform preprocessing for the new urgent reasoning request message
in the usual way.
KNOWLEDGE BASE
nections between the active and passive elements are shown by arrows. It
is important to notice and remember that there is no direct communica-
tion and synchronization between the inference engines, that is, between
the active elements.
The management of the blackboard is a key issue in a blackboard ar-
chitecture, because there is no central control of any kind to coordinate
the parallel activity of the inference engines. A traditional knowledge
base manager is not suitable for this purpose because its locks the entire
knowledge base for the complete duration of a reasoning process, which
is against the basic philosophy of the blackboard architecture.
We may apply a sophisticated extended database manager of a rela-
tional type to act as a blackboard knowledge base manager. There is a
tradeoff, however, between its efficiency and its consistency management
capabilities. If there are highly related knowledge elements and/or a non-
decomposable blackboard knowledge base, the blackboard manager will
either be inefficient because it is taking care of all the consequences of
a change on the blackboard to ensure its consistency, or the blackboard
will be inconsistent from time-to-time. This means that the management
of the blackboard determines how its consistency can be maintained.
4. SOFTWARE ENGINEERING OF
REAL-TIME EXPERT SYSTEMS
The basic approach, principles and methods of software engineering
[53] does apply to real-time expert systems with some slight extensions
and special features, which are consequences of both the real-time and
the intelligent nature of this type of software systems. This section sum-
122 INTELLIGENT CONTROL SYSTEMS
Task analysis
Task specification
Operation
Documenting
Implementation
Testing
(coding)
The common basic stages are shown in bold rectangles. These are ex-
tended by special sub-stages that reflect the needs of a real-time expert
system and are denoted by dashed rectangles. The main flow of infor-
Real-time expert systems 123
2. Software design
Software design is a major document that describes the software in
such detail that it can almost automatically be coded, even by indi-
vidual technicians. Software design uses the terminology of software
engineering, it can only be understood with background knowledge
in computers and computing. This should include fundamentals of
knowledge representation and reasoning in knowledge-based systems,
such as real-time expert systems.
There are computer-aided software engineering (CASE) tools avail-
able to be used in the lifecycle of a software, starting with software
design stage in the case of common, i.e. non-intelligent software sys-
tems. Unfortunately, they cannot efficiently cope with the special
features of real-time expert systems because of the great variety and
experimental nature of the concepts, tools and techniques there.
Instead, individually made tools, the so called design prototypes are
used to support software design and to test design alternatives in the
software engineering of real-time expert systems.
3. Implementation (coding)
Coding is a relatively mechanical technical step in the implementation
of a conventional software system. Part of coding can automatically
124 INTELLIGENT CONTROL SYSTEMS
be done by the CASE tools mentioned before, using the formal soft-
ware specification. The database is also constructed in this step, and
the necessary data transfer is also carried out.
The implementation (coding) of a real-time expert system is far more
complicated and involves many more creative elements. This is partly
because the knowledge needs to be elicited and validated to fill the
relationship part and the factual part of the knowledge base in this
stage. Expert system shells offer advanced tools and pre-fabricated
elements to implement specific expert systems, provided one manages
to find an expert system shell that fits the purpose.
Besides the elements of the final software, special testing tools for
testing and monitoring purposes are usually also coded here.
4. Testing
The main purpose of testing is to check if the completed software
meets the criteria laid out in task specification (stage 1). Besides of
user-oriented testing, all the algorithms and data elements need to
be thoroughly verified and validated in all possible circumstances to
ensure that the system operates properly. Exhaustive testing is clearly
not possible for
- neither the intelligent subsystem because it is computationally hard
to verify and validate the reasoning and the knowledge,
- nor the real-time subsystem because of the high number of possible
signal values and their timing combination that causes different
real-time circumstances.
Therefore a special test plan needs to be set up well in advance to
ensure the proper partial testing of the most important functions and
the testing of the entire system under the most frequently occurring
circumstances.
5. Documenting
Documenting is a standard but not very popular stage in a software
lifecycle. There is nothing special in the documentation of a real-time
expert system, it will simply reflect the strong relationships between
the elements and therefore will be strongly inter-related.
Advanced tools, such as CASE tools and expert system shells sup-
port documentation, sometimes even self-documentation is possible
(compare with the service debugging tools of an expert system shell
in section 3. of Chapter 5).
6. Operation
Before a software system is put into operation, users and operating
Real-time expert systems 125
thus special testing tools are needed to test the interface and the op-
eration of the real-time expert system under different time-varying
real-time conditions.
The need for special testing tools is explained by the fact that it is
quite difficult to test any real-time system properly, and this situation
is even worse if intelligent elements are present.
Special test tools usually include
- programmable test signal generators that imitate the behaviour
of the real plant of the real-time subsystem,
- interface monitors that monitor the status of message queues
- a test archive process, which logs every change in the intelligent
subsystem, for example using special event messages.
3. Testing plan
As it has been explained before, an exhaustive test is not feasible
for real-time expert system, therefore, a testing plan prepared well in
advance is a must. The following situations in a test plan should be
treated with special care:
- normal operation with various extreme loads (extreme high and
extreme low) and their transients,
- abnormal and faulty operation modes, such as time-outs, missing
or faulty elements, non-available resources, reset requests, missing
data, corrupted data etc. and their transients such as start-up,
shut-down, going to degradated mode, restoring normal behaviour
from degradated mode etc.
- conflicting data and/or knowledge elements
- test mode operation (with the special testing tools operating on-
line)
QUALITATIVE REASONING
All three methods above use sign and/or interval calculus for qualitative
reasoning which will be discussed in a separate section first.
The origin of any qualitative model of the types above is the nonlinear
state-space model of lumped or concentrated parameter system models
the general form of which is the following:
dx
= f (x, u) , x(0) = x0 (7.1)
dt
y = g(x, u) (7.2)
127
128 INTELLIGENT CONTROL SYSTEMS
LS = { a1 = −∞ , a2 = 0 , a3 = ∞}
a ⊕S b + 0 − ?
+ + + ? ?
0 + 0 − ?
− ? − − ?
? ? ? ? ?
130 INTELLIGENT CONTROL SYSTEMS
a ⊗S b + 0 − ?
+ + 0 − ?
0 0 0 0 0
− − 0 + ?
? ? 0 ? ?
LOM = { a1 = −∞ , a2 = −A , a3 = 0 , a3 = A , a4 = ∞} (7.11)
where A > 0 is a constant. With the points above the following elemen-
tary (that is non-divisible) intervals are formed in the order of magnitude
interval universe:
UOM = { LN , SN , 0 , SP , LP } (7.12)
with
It can be seen that the above universe is just a little bit more fine that
the sign universe in Eq. (7.6).
Like logical and sign operations, interval operations are also defined
using operation tables. The table 7.3 below shows an example of this,
being the operation table of addition over the order of magnitude interval
universe. If the result of a particular operation can only be covered by
more than one adjoint elementary interval from the universe (7.12), then
a pseudo-interval showing the endpoint-intervals of the covering interval
is shown in the table, for example
It is obvious from the table that the interval addition over the order
of magnitude interval universe is commutative because the table is sym-
metric. The growing uncertainty property is also clear if we compare the
width of the original and the resulting intervals, for example
LP ⊕OM LN = [LN, LP ]
132 INTELLIGENT CONTROL SYSTEMS
a ⊕OM b LN SN 0 SP LP
LN LN LN LN [LN, SN ] [LN, LP ]
SN LN [LN, SN ] SN [SN, SP ] [SP, LP ]
0 LN SN 0 SP LP
SP [LN, SN ] [SN, SP ] SP [SP, LP ] LP
LP [LN, LP ] [SP, LP ] LP LP LP
It is important to note that the any of the interval algebras has the
following important properties.
1. growing uncertainty with additions and also with multiplication
This causes all of the other elementary or composite algebraic opera-
tions to possess a growing uncertainty property.
2. the usual algebraic properties of addition and multiplication, i.e. com-
mutativity and associativity, but not distributivity
This means that the evaluation of algebraically equivalent expressions
does not necessarily give the same result. It can be shown that the
form with the minimum number of addition gives the best, that is,
the narrowest result.
2. QUALITATIVE SIMULATION
Qualitative simulation operates on the finest qualitative models, the
so called constraint type qualitative differential equation models (QDEs)
[60], [65]. The solution of a constraint type QDE is generated by a
combinatorial algorithm, by qualitative simulation.
with
dq(t)
inc, if dt >0
dq(t)
Qdir = dec, if <0 (7.17)
dt
dq(t)
std, if dt =0
CV = { (x1 , y1 ), . . . , (xn , yn )}
f (xi ) = yi , i = 1, . . . , n
and f is monotonous.
Figure 7.1 shows an example when the qualitative function is given
by three corresponding values denoted by bold dots. Two possible
member functions are also shown, both of them are monotonously
increasing.
- envelopes
We may specify two envelope functions (f` and fu ) which encap-
sulate the set of member functions in a qualitative function FQ .
Here again it is required that both the envelope and the mem-
ber functions be monotonous. Formally speaking any real-valued
function f is a member of the set FQ (f ∈ FQ ) specified by the
envelope functions f` and fu if
4. Qualitative time
The notion of time is also extended in qualitative simulation. Time
is measured using the so called qualitative time set consisting of dis-
tinguished time points ti . Any point in real time when any of the
qualitative variables Q(j) (t) changes its qualitative value generates a
distinguished time point ti .
The above concepts are illustrated with the example of the batch water
heater (coffee machine) introduced in Appendix B.
Qualitative reasoning 137
Example 7.1 The constraint type QDE model of the batch water
heater in Appendix B
The QDE model equations are derived from the model equations (B.1)-
(B.2) through the following steps:
1. Qualitative variables
The following time-dependent signals are considered:
h level in the tank with the landmark set
Lh = {0, hl , hu , hm } (7.20)
3. Qualitative state
The qualitative state of the system S consists of the following quali-
tative variables:
which means that we switch the heating and the inlet flow on and close
the outlet. The qualitative direction of the input variables above is fixed
to "std".
The constraints (7.23) and (7.24) are used to compute the qualitative
direction of the variables h and T . With all the parameters being positive
constant we finally obtain:
S(t0 ) = {< 0, inc >, < TI , inc >, < 1, std >, < 1, std >, < 0, std >}
(7.26)
(P −transition)−(I−transition)−(P −transition)−(I−transition) . . .
In each step the following substeps are performed both in the case of
P- and I-transitions.
Br1 Examine each of the system variables separately for its possible change
in qualitative value and generate branches accordingly.
Br2 For a given changing variable generate all the next possible qualita-
tive values using the continuity assumption and generate branches
accordingly. The next possible qualitative values are given in a table
separately for P-transition (see Table 7.4) and I-transition (see Table
7.5).
Bo For a given changing variable evaluate the right-hand side of the con-
straint type QDEs with the new qualitative magnitudes to obtain the
possible qualitative directions of all the variables. Use these qualitative
directions to cut these branches that contradict to the model equations.
and the model equations are used for "constraining" these branches, that
is for bounding in substep "Bo".
It can be seen from the transition tables 7.4 and 7.5 that the next state
is not unique in the general case therefore the qualitative simulation
algorithm is not polynomial in the number of qualitative time steps.
Furthermore the branching substep "Br1" generates at least as many
branches as many system variables we have therefore the algorithm is
not polynomial in the number of system variables either.
142 INTELLIGENT CONTROL SYSTEMS
for the entire simulation. This means that we regard them as constants.
The augmentation of the initial qualitative state of the batch water
heater is given in an earlier example, Example 7.2, but now we only need
to consider the level and the temperature as state variables. Therefore
the initial qualitative state of the system is a special case of Eq. (7.26):
....
S P1 (t i ,t i+1 )
S(t i ) ....
P2
S (t i ,t i+1 )
....
P3I2
S (t i+1 )
....
P3 P3I3
S (t i ,t i+1 ) S (t i+1 )
....
S P3I4 (t i+1 )
....
P3I8
S (t i+1 )
P-transition
From the P-transition table 7.4 we find that the only possible transition
is P 4 for both of the state variables with the given initial state (7.27).
Therefore the next qualitative state S P 4 (t0 , t1 ) is unique:
S P 4 (t0 , t1 ) = { < (0, hl ), inc > , < (TI , Top ), inc > } (7.28)
I-transition
Now we examine the next possible values separately for the two vari-
ables from the I-transition table 7.5. There are four possibilities for each
variable: I2, I3, I4 and I8.
Thereafter the constraints (7.23) and (7.24) are used to compute the
qualitative direction of the variables h and T . Eq. (7.23) implies that
hdir = inc for the entire simulation, therefore only transitions I2 and
I4 remain possible for h. The qualitative direction of the temperature
is not constrained by Eq. (7.24) because the sign of the right hand side
depends on the actual magnitude of the parameters.
144 INTELLIGENT CONTROL SYSTEMS
Thus we have 4 possibilities for the value of the next qualitative state
as follows:
S P 4P 4I2I4 (t1 ) = { < hl , inc > , < (TI , Top ), inc > }
S P 4P 4I4I2 (t1 ) = { < (0, hl ), inc > , < Top , inc > }
S P 4P 4I4I3 (t1 ) = { < (0, hl ), inc > , < Top , std > }
S P 4P 4I4I8 (t1 ) = { < (0, hl ), inc > , < T ∗, std > }
Note that only the first of the above states corresponds to a normal
or expected behaviour and is thus desirable. The second possible state
occurs, for example, when the heating is too strong compared to the
inlet flow and allows a small amount of water to boil before the amount
is enough.
Having finished the first two steps of the qualitative simulation algo-
rithm, the resulting states can be arranged in the behaviour tree shown in
Fig. 7.4. It is clear that branching only occurs in the second I-transition
step and the constraints cut some of the branches.
. . . . (normal case)
S P4P4I2I4 (t 1 )
S P2P2I4I3 (t 1 )
S P2P2I4I8 (t 1 )
3. QUALITATIVE PHYSICS
Qualitative physics works with sign-valued variables and qualitative
differential and algebraic equations based thereon. Fist we examine these
qualitative model equations and their solutions and then discuss their use
in intelligent control systems.
3.1 CONFLUENCES
The notion of confluences as a kind of qualitative models has been
introduced into AI by de Kleer and Brown [61] in their theory called
"Qualitative Physics". Confluences can be seen as sign versions of the
(lumped) nonlinear state equations (7.1)-(7.2).
+ ∼ ⊕S , ∗ ∼ ⊗S etc.
The concepts above are illustrated on the example of the batch water
heater (coffee machine) introduced in Appendix B.
146 INTELLIGENT CONTROL SYSTEMS
2. sign constants
The sign of all parameters is strictly positive, i.e. all sign constants
are "+".
3. confluences
δh = [ηI ] ªS [ηO ] (7.29)
δT = [TI − T ] ⊗S [ηI ] ⊕S [κ] (7.30)
δh [ηI ] [ηO ]
0 0 0
− 0 +
+ + 0
? + +
The truth table of the other confluence (7.30) has more columns on
the right-hand side because we have more variables there. Observe that
a composite qualitative variable [TI − T ] is present in the first right hand
column of Table 7.7.
1. Sensor validation
If the truth table of a confluence is stored in advance then it is possible
to check the value of the related sensors against the corresponding
row of the table in a quick and effective way. A sensor fault for the
group of related sensors is detected if there is a contradiction between
the right-hand side of the corresponding row in the table and the
measured qualitative value of the left-hand side sensor.
or
This way rule sets can be generated from the truth table of a confluence
and they are complete and contradiction-free by construction.
Note that in some cases if-and-only-if type bidirectional rules or
rule-pairs can be generated from a row in a truth table. This is
possible if the left-hand side of that row is unique among the left-
hand side values.
148 INTELLIGENT CONTROL SYSTEMS
For example, let us assume that the last row is missing from table
7.6. The omission is needed to make the values of the left-hand side
unique, leaving out "?", which is the union of "+", "0" and "−".
Then each row in this new 3-row generates a bidirectional rule-pair.
The second row is interpreted as a rule (7.31) and its counterpart in
the form:
if (h = decreasing) then (ηI = closed) and (ηO = open) (7.32)
Sometimes, the set U is called the entrance and Y the exit of graph
S.
Directed paths in a system structure graph can be used to describe the
effect of a variable on other variables. A sequence (v1 , · · · , vn ) , vi ∈ V ,
forming a directed path in S, is an input path if v1 ∈ U .
We may may put the sign of the corresponding matrix elements ({A},
{B}, {C}, {D}) as the weights wij . We arrive at a special weighted
directed graph representation of the process structure, which is called
the signed directed graph (SDG) model of the process system.
150 INTELLIGENT CONTROL SYSTEMS
The state-space model of the batch water heater consists of the state
equations (B.1)-(B.2) and the trivial output equation
y = x = [h T ]T
We can then linearize the state equations taking into account that our
input variables are u = [κ, ηI , ηO ]T .
ηO
−
+
h h
+
? ηI
−
+
T T
+
− κ
PETRI NETS
Petri nets are the abstract formal models of information streams. They
were named after C. A. Petri, a German mathematician, who developed
the method for modelling communication of automata [73].
Petri nets allow both the mathematical and the graph representation of
a discrete event system to be modelled, where the signals of the system
have discrete range space and time is also discrete. Petri nets can be
used for describing a controlled or open-loop system, for modelling the
events occurring in it and for analyzing the resulted model. During
the modelling and analysis process we can get information about the
structure and dynamic behaviour of the modelled system.
Petri nets emphasize the possible states and the events occurring in
the investigated system. One of the major strengths of Petri nets is
in the modelling of parallel events. This is why Petri nets are popular
and widely used discrete dynamic modelling tools in intelligent control
applications [74], [75], [76], [77].
This chapter discusses the following topics:
- the notion of Petri nets,
- the dynamical behaviour of Petri nets,
- the analysis of Petri net properties.
We mainly focus on the modelling problems and questions related to
the analysis of Petri nets. The analysis techniques need software support
even with low complexity systems.
p ready
t drain p tank
p pump
p ready
t drain p tank
p pump
The fact that a place contains more than one token can have quite
different meanings. In the following example, we use tokens as a quantity
indicators (measures).
Petri nets 157
p pumpA t drain_pA
p tank
p ready
t drain_pB
p pumpB
Let us model the feeding part of the process system described in Ex-
ample 8.1 the introduction of this chapter. We have to feed the reactor
with a mixture containing reagents A and B in ratio 1:1. The graph of
this net can be seen on Fig. 8.4. Place prA refers to the back storage tank
of component A and place prB to the back storage tank of component
B. Assume we have a large amount of material in both tanks, so there
are several tokens in both places referring to the tanks. Places pA and
pB represent daily storage tanks for adding the reagents to the reactor.
If we assume that one token refers to the amount of reagents A and B
to be added into the reactor for one charge then the maximum number
of tokens on these places is equal to 1.
The place pf illed refers to the state of the reactor. It contains a to-
ken when both reagent A and reagent B are filled. Transitions taddA
and taddB refer to the filling up of the daily tanks and transition tf ill
represents the reactor filling up process.
p rA t addA pA
t fill p filled
p rB t addB pB
a,
b,
c,
There is only one transition in the initial state, transition theat , which
is enabled (c.f. Fig. 8.5.a). Firing transition theat removes the token
from its input place (place pf illed ) and adds this token to its output
place (place preact ) (c.f. Fig. 8.5.b). In the next step, transition tcool is
the only enabled transition. Following the rule for firing transitions we
get to the state in Fig. 8.5.c.
In the resulting state there is no enabled transition in the net so the
execution of the net starting from the given initial state is over.
Let us once more investigate the adding part in Example 8.3. Let us
assume that we have to add one portion of reagent A and two portions
of reagent B to the mixture. The reactor is ready for heating up if the
feeding is done, i.e. all the necessary components have been added. The
modified Petri net of the feeding part can be seen in Fig. 8.6.
p rA t addA pA
a,
2
t fill p filled
p rB t addB pB
p rA t addA pA
b,
2
t fill p filled
p rB t addB pB
In this figure the arc between place pA and transition tf ill is the same
as earlier, while the arc between place pB and transition tf ill is coloured
by a weight with a value of 2. This weight means that transition tf ill
is enabled if its input place pB contains at least two tokens. Firing
transition tf ill removes one token from place pA , two from place pB and
adds one to place pf illed as it is shown in Fig. 8.6.b.
Petri nets 161
The connection of the feeding and reaction parts of our process system
in Example 8.1 results in the Petri net shown in Fig 8.7.
pA
2
t fill p filled t heat p react t cool p ready
pB
Figure 8.7. The feeding and reaction parts of the process example
where
The marking function gives the distribution of tokens in a given net state:
M : P → N
Note that a Petri net is said to be ordinary if all of its arc weights are
equal to 1.
In this initial state the transition tf ill is the only enabled transition.
After its firing the new marking can be given by the following equations:
M1 (pf illed ) = M0 (pf illed ) − w(pf illed , tf ill ) + w(tf ill , pf illed )
M1 (pf illed ) = 0 − 0 + 1 = 1 (8.10)
1.3.2 SELF-LOOP
If a place is an input and output place of the same transition then this
place-transition pair is called a self-loop. If the weights are the same in
both cases then the firing of the transition does not change the marking
value on that place. It can be proved that if the place belonging to
166 INTELLIGENT CONTROL SYSTEMS
the loop cannot be found in the input set of any other transition and
the transition has no other input place then once the transition becomes
enabled it remains enabled throughout the execution of the net. A Petri
net without self-loop is said to be pure.
The following example gives a process system illustration.
...
t arrive p buffer
...
t proc2
A sink transition can represent the shipping of the product into the
depository or the intermediates into another unit. Its Petri net model
can be seen in Fig. 8.9.
In general, these transitions are used when modelling a subsystem of
complex process systems.
The self-loop can refer to a continuous operation of a device, e.g. of a
stirrer, which is a precondition of every process step (c.f. Fig. 8.10).
t proc1
...
p buffer t shipping
...
t proc2
t step_i
... ...
p next_state
p stirrer
A Petri net of this type is called an infinite capacity net. However, real
discrete event systems are different.
In Example 8.3 the reactor cannot contain more than one token, be-
cause the presence of one token means that the reactor is full. This
means we have to add an upper limit for the number of tokens for every
place. Such a Petri net is referred to as a finite capacity net. For a finite
capacity net we have to add a new function, K, which is the capacity
function to the formal definition:
K : P → N+ , (8.18)
and after the firing of tj the marking in its output places does not exceed
their upper limits:
This modified rule is called a strict transition rule whereas the former
rule for an infinite capacity net is the (weak) transition rule.
1.3.4 PARALLELISM
One of the most important modelling feature of Petri nets is the han-
dling of parallelism. If the steps of an operating procedure take place in
a sequence of elementary steps, i.e. the system has a serial nature then
the model is easily understandable. But real systems almost always con-
tain serial and parallel steps, this is even true for simpler discrete event
systems. In the case of parallel steps one of the most important task is
timing.
There are two different types of parallelism: concurrency and conflict.
In the case of concurrency, two (or more) events take place in parallel.
They can occur at the same time because they are causally independent.
This means that one transition may fire before, after or in parallel with
the other as it can be seen in the following example.
Let us amplify Example 8.3 with the start of the stirrer (see Fig. 8.11).
As it can be seen transitions tf ill and tstir start can fire independently
of each other in any order.
In the other case, the events in parallel are not causally independent,
i.e. they have at least one common precondition. This means that only
one of these transitions can fire because after the firing of the first one,
the other transition(s) is/are not enabled. The events or the transitions
referring to them in the net are in conflict.
Petri nets 169
pA
...
...
p filled
t fill
...
pB
...
p stir_on
...
t stir_start
p stir_off
pA
...
t fill_A
...
p pump p filled
2
t fill_B
...
pB
p filter_A
t filt_A
... ...
p ready p filtrate
t filt_B
p filter_B
The situation where conflict and concurrency are mixed is called con-
fusion. There are two types of confusion: symmetric and asymmetric
confusion.
Petri nets 171
p1
p5
... p4
t1 t2
...
p2
p3 t3
...
t2 p2
...
p3 ... t1
t3
p1
p4
a, b,
p ready
t drain p tank
p pump
p ready
...
p pump
p ready p ready
p pump p pump
a, b,
...
p tank2_empty
t fill p filled
p rB ta d d B pB
... ...
Definition 8.2. Let M0 be the initial state in a given Petri net. De-
note R(M0 ) the set of reachable markings starting from M0 , that is the
reachability set belonging to M0 . Then
1. M0 ∈ R(M0 );
2. if M 0 ∈ R(M0 ) and there is transition tj which is enabled in M 0 and
firing of tj changes the net state into M 00 then M 00 ∈ R(M0 ).
Simple analysis shows that the reachability set of the Petri net in
Example 8.4 is the following:
R(M0 ) = { (1, 0, 0), (0, 1, 0), (0, 0, 1) }
178 INTELLIGENT CONTROL SYSTEMS
2.1.2 CONSERVATION
The conservation property is related to the changes in the sum of
tokens in a Petri net during execution. A Petri net is strictly conservative
if the number of tokens is the same in all markings starting from an initial
marking.
Strict conservation is a very strong property. It can be useful in the
case of modelling resource allocation systems where tokens may represent
the resources. It is a very natural requirement for these systems that
these tokens are neither created nor destroyed.
It is possible to assign conservation weights to places and check the
sum based on the linear combination of tokens computed using the place
weights. In this case the weighted sum for all reachable markings should
be constant for a conservative Petri net.
180 INTELLIGENT CONTROL SYSTEMS
2.1.3 LIVENESS
Liveness addresses the question whether it is always possible to ac-
tivate a specific transition or the system can reach a state where this
transition is "dead". As a generalization of this problem we can inves-
tigate whether the system can reach a state where there is no enabled
transition at all. This state is called a dead-lock. A system can get into a
dead-lock when the operating procedure is over but it could also happen
that the process stops before the final state. A dead-lock is very danger-
ous in the latter case because it refers to a state where the operator has
no possibility to intervene, that is, the system is out of control.
(1, 0)
t1
p1 t1 p2
(0, 1)
a, b,
Starting from the initial state M0 = (1, 0) it is very easy to get to the
reachability set of the net: R(M0 ) = {(1, 0), (0, 1)}. The reachability
tree can be seen in Fig. 8.21.b. The last node on the tree refers to a
terminal node because there is no enabled transition in this marking.
A slight modification of the net does not change the reachability set
but gives an infinite reachability tree (see Fig. 8.22.)
Applying the concept of duplicate nodes, the tree can be reduced to
a finite tree (Fig. 8.23).
The last node is a duplicate node, i.e. it refers to a repeated marking
in this case.
Let us modify the net again (see Fig. 8.24).
Starting from the initial state M0 = (1, 0, 0) both the reachability set
and tree will be infinite (see Fig. 8.25).
There are no duplicate nodes in the tree but the comparison of the
markings labelled by (*) shows that the third marking covers the initial
marking while the fifth covers the previous two labelled.
ω ± a = ω, a < ω, ω ≤ ω.
Petri nets 183
(1, 0)
t1
t1
(0, 1)
t2
(1, 0)
p1 p2
t1
t2 (0, 1)
t2
...
a, b,
t1 (1, 0)
t1
(0, 1)
p1 p2 t2
(1, 0)
a, b,
1. Let the initial marking be the root of the tree. Let L be the list of
new nodes. Add the root to list L.
2. If L is empty then the algorithm stops, the reachability tree is ready.
Otherwise let x be the first node from the list, let Mx be the marking
associated with it and remove x from the list.
184 INTELLIGENT CONTROL SYSTEMS
t1
p3
p1 p2
t2
(1, 0, 0)*
t1
(0, 1, 1)
R = {(1, 0, 0), (1, 0, i ), (0, 1, i ) | i = 1, 2, ...}
t2
(1, 0, 1)*
t1
(0, 1, 2)
t2
(1, 0, 2)*
t1
...
a, b,
3. If another node exists in the tree, say y, which has the same associated
marking with it (Mx = My ) then x is a duplicate node. It will be a
terminal node of the tree with the remark duplication.
Petri nets 185
(1, 0, 0)
t1
p3 t1
(0, 1, 1)
t2
p1 p2
(1, 0, ω)
t2
hij = h+ −
ij − hij (8.21)
where
hij an entry of incidence matrix H = [hij ] ;
h+
ij = w(ti , pj ) is the weight of the arc from transition i to place j ;
h−
ij = w(pj , ti ) is the weight of the arc from place j to transition i.
p1
t1
p2 p4
t2
p3
Note that there can be no place invariant to a given Petri net when
the equation above does not have any nontrivial solution.
The transition invariant is a set of transitions. When every transition
in the invariant fires starting from an initial state the system returns to
the same initial state. This leads to the following formal definition.
Petri nets 189
Fuzzy control systems are able to describe and handle symbolic as well
as uncertain information together with rule-based reasoning [81]-[82].
The sections of this chapter cover the following topics:
- Introduction to fuzziness and to fuzzy control
1. INTRODUCTION
Before we turn to the main subject of the chapter we first discuss the
notion of fuzzyness and then introduce the notion of fuzzy controllers.
2. FUZZY SETS
2.1 DEFINITION OF FUZZY SETS
Classical set theory considers the elements of a set as a whole. The
elements are often called the members of the set. The universe from
which they are selected can be given. It can be decided about every item
of the universe whether it belongs to the given set or to its environment,
i.e. to the other part of the universe. There is no restriction on the size
of the set. There are methods in mathematics to define and handle sets
with zero or an infinite number of elements. We usually refer to classical
sets as crisp sets in fuzzy set theory.
Fuzzy control systems 193
Let us have the following relation between the input variable u and
output variable y:
y = u2
Assuming that the input can only have positive integer values the
results can be given in a tabular form as follows:
u 1 2 3 4 ...
y 1 4 9 16 ...
In the case of finite sets the elements can be listed but it does not
work for sets with many or an infinite number of elements. These can
be described by means of a predicate and this predicate is evaluated in
the universe.
194 INTELLIGENT CONTROL SYSTEMS
1
degree of membership
0
(1,1) (2,4) (3,9) (4,16) (5,25) (6,36)
For fuzzy sets, the concept of universe is similar as it was for classical
sets. It contains all the items that can come into consideration but the
border between the set and its environment is not given clearly.
u 1 2 3 4 5 6
y 1 4 9 16 25 36
µ 0 0 0.2 0.6 1 1
u 1 2 3 4 5 6
y 1 4 9 16 25 36
µ 0.1 0.4 0.9 0.8 0.1 0
u 1 2 3 4 5 6
y 1 4 9 16 25 36
µ 1 0.4 0 0 0 0
u 1 2 3 4 5 6
y 1 4 9 16 25 36
µ 0 0 0 0 0 0.5
196 INTELLIGENT CONTROL SYSTEMS
0
(1,1) (2,4) (3,9) (4,16) (5,25) (6,36)
(u,y)
0, x < x`
x−x` ,
xc −x` x` ≤ x ≤ xc
`∧ (x` , xc , xr , x) =
1 − x−xc , xc ≤ x ≤ xr
xr −xc
0, x > xr
198 INTELLIGENT CONTROL SYSTEMS
1
degree of membership
1
degree of membership
age
the discrete input data into the appropriate membership function and
calculate membership values.
Summarizing the notion of fuzzy sets we can state that a fuzzy set A
is a set of ordered pairs over the universe U
omitting the universe. In the next examples of this chapter this latter
notation will be used.
There is a distinction between a fuzzy membership function and a
probability distribution function in the sense of mathematical statistics.
Returning to the ’driving fast’ problem the probability function gives
the most probable speed of the observed cars, say 85 km/h while the
membership function of the fast drivers fuzzy set assigns 1 either to the
speed 100 km/h or 150 km/h although the probability of the latter is
low. The fuzzy membership function determines the possibility of an
event. In general we can say that if an event is highly probable it must
also be possible but a possible event is not necessarily highly probable.
A ∩ B = {10};
¬A = {11, 12, . . . , ∞}
A ∪ B = A or B , A max B;
A ∩ B = A and B , A min B;
¬A = notA , 1 − A.
The set of cars with not low consumption is the complement of the
fuzzy set LC
0.8
0.6
0.4
0.2
0
1.0 1.2 1.4 1.6 1.8 2.0
0.8
0.6
0.4
0.2
0
1.0 1.2 1.4 1.6 1.8 2.0
commutativity a or b = b or a
a and b = b and a
associativity (a or b) or c = a or (b or c)
(a and b) and c = a and (b and c)
distributivity a or (b and c) = (a or b) and (b or c)
a and (b or c) = (a and b) or (b and c)
DeMorgan not (a and b) = ( not a) or ( not b)
not (a or b) = ( not a) and ( not b)
absorption (a and b) or a = a
(a or b) and a = a
idempotency a or a = a
a and a = a
exclusion a or ¬a 6= 1
(not satisfied) a and ¬a 6= ∅
Fuzzy control systems 205
0.8
0.6
0.4
0.2
0
1.0 1.2 1.4 1.6 1.8 2.0
The fuzzy set of cars with low consumption and not low consumption
is
One can find several other fuzzy operators which are based on the ex-
tension of the operations or and and through relatively simple algebraic
transformations defined in literature [81].
Modifier about
Let us assume an operating procedure containing the step:
Fuzzy control systems 207
'about 50 o C'
'close to 50 o C'
0
47 o C 48 o C 49 o C 50 o C 51 o C 52 o C 53 o C
Modifier below
As the next case assume a step:
If there is no other constraint then the resulting fuzzy set can be seen
in Fig. 9.10.
Combination of Modifiers
Using the modifiers very and below we can form the fuzzy set very below
50◦ C, which refers to the operating step:
1
degree of membership
'below 50 o C'
0
35 o C 40 o C 45 o C 50 o C 55 o C 60 o C 65 o C
1
degree of membership
high temperature
1
degree of membership
'below 50 o C'
0
35 o C 40 o C 45 o C 50 o C 55 o C 60 o C 65 o C
R1 s1 s2
p 0.3 0.9
R2 q
s1 0.9
s2 0.7
This example contains relations between two fuzzy sets. In the follow-
ing we formally define binary relations. These can easily be generalized
for arbitrarily number of sets.
W =U ◦V (9.7)
A −→ B , A×B (9.11)
where × is an outer product of the matrices using the fuzzy logical oper-
ator and.
The outer and product of matrices can be computed as follows. Let
the fuzzy set A be represented by a column vector where each element
is equal to the defined value of the membership function. Let the fuzzy
set B be represented in a similar way but as a row vector. Then their
product is
a1 a1 ∧ b1 a1 ∧ b2 . . . a1 ∧ bm
a2 £ ¤
a2 ∧ b1 a2 ∧ b2 . . . a2 ∧ bm
.. × b1 b2 . . . b m = .. .. (9.12)
. . .
an an ∧ b1 an ∧ b2 . . . an ∧ bm
In this example let matrices A and B be equal to the fuzzy set of large
positive error signal (lpe) and positive control signal (pcs), respectively.
0
0
£ ¤
lpe =
0
pcs = 0 0.2 1 (9.13)
0.6
1
Again, recall that and is computed using the minimum of the degrees.
Then the outer and product of these two vectors is as follows.
0 0∧0 0 ∧ 0.2 0∧1 0 0 0
0 0∧1 0
£ ¤ 0∧0 0 ∧ 0.2 0 0
0 × 0 0.2 1 = 0 ∧ 0 0 ∧ 0.2
0 ∧ 1 = 0 0 0
0.6 0.6 ∧ 0 0.6 ∧ 0.2 0.6 ∧ 1 0 0.2 0.6
1 1∧0 1 ∧ 0.2 1∧1 0 0.2 1
(9.14)
214 INTELLIGENT CONTROL SYSTEMS
The outer and product is also known as outer min product. This
name refers to the characteristic of logical operator on fuzzy sets. This
operation has a great role in fuzzy control because it can be found in
rules of most controllers.
A0 , A −→ B
(9.15)
B0
This means that if there is a rule A −→ B in the rule-base and a fact
A0 which is ’similar’ to A becomes true, the conclusion fact B 0 , which is
almost the same as B, will also be true.
In the case of fuzzy controllers the statements in the conditional part
are fuzzy sets and the similarity originates from the application of lin-
guistic modifiers. The rules in modus ponens refer to relations between
two fuzzy sets. So by applying the generalized modus ponens we can
infer based on a relation and a fuzzy set to an another fuzzy set as it can
be seen in the following definition.
A◦R=B (9.16)
Let relation R be defined between the fuzzy sets lpe (large positive er-
ror) and pcs (positive control signal) of Example 9.7. Then this relation
is an implication between these sets
Let us apply the linguistic variable somewhat on the fuzzy set lpe:
£ ¤1 £ ¤
somewhat lpe = 0 0 0 0.6 1 2 = 0 0 0 0.77 1 (9.19)
i.e. for the determination of the necessary control action. The defuzzifier
unit converts the determined fuzzy control action back into crisp value.
As a last step the tuning and amplifying of the signal can be done by
the postprocessing unit.
Reference controlled
input e Pre- Post- u output
processing Rule-base Defuzzifier processing Process
unit unit
Although this does not show from the figure, fuzzy controllers are very
convenient tools for multi input - multi output process control, too.
This section describes the design steps and elements of fuzzy con-
trollers.
signals and the outputs of the controlled system, i.e. the error signals
and the derivatives and integrals of the errors.
For proper selection we need some information about the nature of the
system to be controlled. This information is related to system dynamics,
stability, nonlinearity, time dependency of system parameters, etc. The
type of controller can be selected on the basis of these data and the
control goal.
As it was mentioned earlier, it is very easy to implement a fuzzy con-
troller for MIMO systems. This fact enables us not only take the error
signal and its changes into account, but also other signals, e.g. state vari-
ables and noises. Note that the increasing number of variables causes the
rule-base to rapidly grow more complex. This is why it is useful to keep
the number of variables on a reasonable level or to decompose the con-
troller into subcontrollers, which are connected to each other either in a
parallel or in a hierarchical manner.
The controlled input signal of the system can either be the absolute
value or the incremental value of the control signal, similarly to crisp
digital controllers. In the first case, the new position of the controller
device is the result of the inference on the rule-base, while in the latter
case the result is a change to the previous value.
the case of nonlinear systems. The rule of thumb is to select three mem-
bership functions or in special cases two or five functions. In the case
of three membership functions, the linguistic variables small, medium
and large are used in general, while in the case of five functions modifier
very is added to have very small and very large, too. If the universe is
symmetric to the zero value then the linguistic variables negative, zero
and positive (and large negative/positive) are used in general.
The other question is whether to use continuous or discrete mem-
bership functions. There are several shapes for continuous membership
functions as it was mentioned in section 2. of this chapter. Continuous
membership functions describe the changes of variables better but more
time is needed for inferencing. The discrete membership functions are
given as vectors. Inferencing is easier in this case but the number of
vector elements influences the accuracy.
If we have any a priori knowledge about the shape of membership
functions we can use it. In other cases we can select from the ones
mentioned ones in section 2. of this chapter.
Nowadays, a scalar rather than a fuzzy set is used frequently as an
input value of a fuzzy controller, which is an output signal of the system
or an error signal being the difference of the reference value and the
output signal. The scalar controller input is called a singleton and it
can be considered as a special fuzzy set where the grade of membership
can either be equal to 1 or to 0. The main advantages of application of
singletons are as follows:
- inferencing is simpler;
- it makes the writing of rules more intuitive.
To summarize the selection of membership functions we recommend
the use of the following steps as a rule of thumb:
- Let the number of membership functions be 3. As first approximation
three sets are enough to cover the lower, medium and upper zones of
the variables. Later on we can add more sets based on operational
experiences.
- Select a triangular shape for each membership function. These trian-
gles should be symmetrical and similar for each variable. The leftmost
and the rightmost should be shouldered ramps (see Fig. 9.4).
- The base of these triangles should be so wide that it allows each value
of the universe to be a member of two sets at least. If there is a gap
between two sets then there is no rule for the values in the gap. If a
given value is a member of more than one set then the application of
more rules makes control smoother and more flexible.
Fuzzy control systems 219
∆e
LN SN ZERO SP LP
LN ln ln sn sn nc
SN ln sn sn nc sp
e ZERO sn sn nc sp sp
SP sn nc sp sp lp
LP nc sp sp lp lp
if Xi then Ui , where i = 1, . . . , n.
The controller is complete if
In order to compare between rule Ri with the other part of the rule-base
rule Ri is transformed into a matrix, which is the outer product of its
input and output parts.
The operation in can be done easily by comparing matrices. If the
elements of matrix R0 in Eq. (9.25) are greater or equal to the elements
of matrix Ri then rule Ri is redundant.
These rules can be derived from the table defined in section 3.1.3 of
this chapter but for the sake of simplicity we assume that the other rules
there have no contribution to the final value of the control signal, that
is, the manipulated input variable of the system.
224 INTELLIGENT CONTROL SYSTEMS
1 1 1
0 0 0
1 1 1 1
0 0 0 0
1 1 1
0 0 0
e ∆e u
where µ(xj ) is the membership grade of the j-th term at the value xj
of the discrete universe.
3. Selecting the maximum value
One of the simplest defuzzification methods is to select the term with
the maximum membership grade. The variations of this method se-
lect the leftmost maximum (called first of maxima or FOM ) or the
rightmost maximum (last of maxima or LOM ).
4. Height
For singleton type outputs the steps of inference and defuzzification
can be combined as follows.
l
X
αj · sj
j=1
u= l
(9.29)
X
αj
j=1
where si is the value of the j-th singleton and αj is its weight in the
given rule.
Chapter 10
- Knowledge representation in G2
1. KNOWLEDGE REPRESENTATION IN G2
The application development in G2 is assisted by a well-structured
natural language in a high-level, intuitive and graphic-oriented develop-
ment environment. This environment promotes rapid prototyping with
the help of predefined knowledge base elements and refining to an ade-
quate full-sized real-time system.
The initial step in G2 adaptation is to define the class of each object
that appears in the application: what it looks like, what its typical
attributes are and how they can be connected to other objects. There-
after a concrete model is planned by placing objects in one (or more)
workspace(s) and connecting them to show their relationships. The re-
sult is a schematic diagram of the application like the one in Fig. 10.1
of the coffee machine (bath water heater system).
Every object in the schematic diagram has a table with its proper-
ties. These attribute tables are automatically generated by G2 from the
definition of the class of the object.
G2: An example of a real-timeexpert system 229
There are two specific object types that represent changeable data:
variables and parameters. A variable has a validity interval associated
with it. Whenever G2 needs the value of a variable after its validity has
expired, it automatically gets it from the data source or data server of
the variable. This data server may be the G2 inference engine, the G2
simulator or an external data source like a sensor, an external database
or a user. A parameter differs from a variable in that it must always
have value. This means a parameter needs to have an initial value. Its
value can be changed by rules, formulas or procedures.
Rules represent the expert’s knowledge. They describe how to reason
and respond to a given set of conditions. They are used to conclude
the value of some variables by the real-time inference engine, to show
how G2 responds and what it concludes from changing conditions within
the application. They can be event-driven (through forward chaining)
to automatically respond whenever a new data item arrives, and can be
data-driven (through backward chaining) to automatically invoke other
rules, procedures or formulas. A natural language context-sensitive edi-
tor is used for entering the rules and other text. It is good to make rules
as generic as possible in order to use them as little as possible.
A complex sequence of actions can be performed in a cycle by accident
until certain conditions come true. Such sequences are best represented
by G2 procedures. Like rules, procedures may ask G2 to execute some
task and unlike rules, they do not response to conditions but define
an instruction sequence. They resemble to procedures found in several
structured programming languages.
Some variables and parameters can receive values from the G2 simu-
lator. In this case the developer needs to create simulation formulas that
tell G2 how to find the simulated values. These formulas can be algebraic,
difference and first-order differential equations. Simulation formulas are
used for defining complex, high-order models and these models may be
either linear or non-linear. The G2 simulator can be used for modeling
and simulating data that cannot be measured. It is possible to compare
data from an external data source with the simulated values in order to
diagnose the failure of an operation and to test the application while it’s
being developed.
While some objects and connections are permanent in an application,
there may be transient objects and connections, too. These are generated
and deleted by certain actions which are contained, for example, by rules
and procedures. The transient objects and connections aren’t saved in
the knowledge base.
230 INTELLIGENT CONTROL SYSTEMS
2.2 WORKSPACES
Workspaces are rectangular areas that contain all types of items (ob-
jects, connections, rules, and so on) except workspaces in an application.
The knowledge base elements are placed in any number of workspaces,
which may be top-level workspaces and subworkspaces. A subworkspace
is a workspace that is associated with an object, object definition or
connection definition. It may have some subworkspaces of its own, too.
This hierarchy of workspaces makes it possible to organize the knowl-
edge hierarchically. In addition, it is possible to activate and deactivate
a workspace (and all of its items) selectively. The rules, objects and
any items of a deactivated workspace are ignored by the inference engine
until the workspace is reactivated again.
- inferring the value from the rules in the G2 inference engine using
backward chaining
Variables can also have specific formulas and simulation formulas which
G2 can use to calculate their values.
G2 never needs to search for a value of a parameter as it is guaranteed
to always have a current value and unlike a variable, a parameter must
have an initial value. Its value can be changed by rules, procedures,
formulas or simulation formulas.
2.5 RULES
The expert’s knowledge that describes how G2 should respond and
answer to various conditions in an application is stored in rules. As
described in section 2.2 of Chapter 2, a general rule in G2 has two parts:
an antecedent or condition representing the conditions, and a consequent
or consequence specifying what to do when the antecedent of the rule is
true. The consequent of any rule contains actions, like conclude, change,
start, and so on. Rules are invoked by G2’s inference mechanism. The
logical expression in the condition part is evaluated first. When one or
more variables in the antecedent part do not have current values, G2 tries
to get them from its data source or data server. If the antecedent part
of the examined rule is true, G2 executes the actions in the consequent
part.
From the operational point of view, rules can be grouped into five
main categories in G2:
- if rules are common rules
for any valve V
if the state of V = 1
then change the center stripe-color of every flow-pipe
connected to V to sky-blue
236 INTELLIGENT CONTROL SYSTEMS
- initial rules are invoked only when the knowledge base starts or
restarts
initially for any container-or-vessel CV
if the inventory of CV > 0
then conclude that the temperature of CV = 15
- whenever rules are driven only by events, for example when a vari-
able or parameter receives a value
whenever auto-manual-state receives a value and
when the value of auto-manual-state is auto
then start auto()
The rules that contain the word any in the examples above are generic
rules, which can be applied to more than one item in an application.
An attribute table of a rule is illustrated in Fig. 10.5. Some of the
interesting attributes:
- focal objects and focal classes - denote the specific objects and
classes associated with the rule
2.6 PROCEDURES
A procedure is a series of operations or commands executed in sequence
by G2. Procedures may be practically used in the following:
- sequential processing
- scheduled events
- complex control algorithms
- calculations containing actions
- same operations on different data values or on many occasions
- name, arguments and returns values (if any) of the procedure are
defined in procedure header
- local variables with their types and initial values are specified in local
declarations
2.7 FUNCTIONS
Functions are predefined, named sequences of operations. A function
is called when its name and arguments (if any) appear as part of an ex-
pression and it returns a value. For example, the following are arithmetic
function calls that return a number:
sqrt(x+y)
max(x,y,z)
abs(x)
G2: An example of a real-timeexpert system 239
- It has a multiple text editor, which is used to enter and edit texts.
- It has several tools for building, modifying and using large and com-
plex knowledge bases.
Beyond it, every item has an attribute table which defines its proper-
ties. The attribute values can be defined and changed in the attribute
table before the application starts running and even dynamically, during
running.
4.1.2 G2 GRAMMAR
As we can see from the description of rules and procedures in sections
2.5 and 2.6 of this Chapter, G2 grammar is structured like the English
language. It is important that this language can refer to items in several
ways:
- by name:
coffee-machine
- by class name:
the vessel
- as the instance of a class that is nearest to another item on a schematic
diagram
the level-icon nearest to coffee-machine
- as the instance of a class that is connected or related to another item
or class of items
the valve connected at the output of coffee-machine
- a set of items is referred to using the for prefix, any and a class name:
for any valve
G2 grammar enables the use of generic rules and formulas:
initially for any valve V
unconditionally conclude that the state of V = 0
- the icon view box shows what the icon looks like
- the icon size display shows the size of an icon in terms of workspace
units
- the cursor location display gives the exact location of the mouse
pointer in terms of coordinates
244 INTELLIGENT CONTROL SYSTEMS
- the layer pad shows the layers of an icon. Layers can be added,
deleted, grouped together, assigned with region labels and colors, etc.
A heavy border indicates layer which is currently being edited.
- cloning items helps the creation of similar items easily. This makes
it possible to build a large knowledge base quickly.
- describing variables (as in Fig. 10.10) specifies the data server corre-
sponding to the variable and the rules according to which the variable
receives values.
4.2.1 DISPLAYS
Displays are devices that show the user the values of a variable or
expression. G2 provides five types of displays:
- a readout table is a box that shows a variable, parameter or expression
and its value.
- a chart plots the values of one or more numeric expressions over time.
- a meter shows the value of an arithmetic expression as a vertical bar
along a numeric scale.
- a dial shows the value of an arithmetic expression as a pointer that
rotates along a circular numeric scale.
248 INTELLIGENT CONTROL SYSTEMS
The message table and the message board are two workspaces where
messages may appear. Messages generated by an inform action in rules
generally appear on the message board or in any workspace. G2 writes its
messages in the logbook about system conditions, errors and warnings.
250 INTELLIGENT CONTROL SYSTEMS
x : R → Rn
then the value of this signal at any given time instance t, x(t) is a vector.
Sometimes the value of a signal at a given time instance can be a space-
dependent function.
The set of all possible time-dependent functions which can be realiza-
tions of a signal form a signal space X associated with the signal x.
1.2 SYSTEMS
We understand the system to be part of the real word with a boundary
between it and its environment. The system interacts with its environ-
ment only through its boundary. The effects of the environment on the
system are described by time dependent input functions u(t) from a given
set of possible inputs u ∈ U , while the effect of the system on its en-
vironment is described by the output functions y(t) taken from a set of
possible outputs y ∈ Y. The schematic signal flow diagram of a system
S with its input and output signals is shown in Fig. A.1.
SYSTEM
u(t) y(t)
S
inputs outputs
states x(t)
We can look at the signals of a system as the input causing its time
dependent behaviour that we can observe in its output.
There are systems which have especially interesting properties and are
easy to handle from the viewpoint of their analysis and control.
- linearity
The first property of special interest is linearity. A system S is called
Appendix A: COMPUTER CONTROLLED SYSTEMS 253
S[c1 u1 + c2 u2 ] = c1 y1 + c2 y2 (A.1)
2.3 CONTROLLABILITY
Conditions to check controllability will be given for LTI systems with
finite dimensional representations in the form
ẋ = Ax + Bu
(A.8)
y = Cx
State controllability
Given:
The state-space representation form with its parameters as in Eq. (A.8)
and the initial x(t1 ) and final x(t2 ) 6= x(t1 ) states respectively.
Question:
Is it possible to drive the system from x(t1 ) to x(t2 ) in finite time?
•
For LTI systems there is a necessary and sufficient condition for state
controllability which is stated in the following theorem.
2.4 OBSERVABILITY
The notion of observability originates from the fact that the states of a
system are assumed not to be directly measurable. We can only measure
directly the input and output signals and then compute or estimate the
value of the state variables. This cannot be done in all cases, only when
the observability property holds.
A system is called (state) observable if we can compute the value
of the state variables at a given time instance, say at t = t0 from a
finite measurement record of the input and output variables and from
the system model. The problem statement for state observability is again
given in the form of a problem statement.
State observability
Given:
The state-space representation form with its parameters as in Eq. (A.8)
and finite measurement records for the input and output variables in the
form of
{u(t) | t0 ≤ t ≤ T } , {y(t) | t0 ≤ t ≤ T }
respectively.
Question:
Is it possible to compute the value of the state variable at t = t0 , that is
to determine x(t0 )?
•
For LTI systems there is a necessary and sufficient condition for state
observability, which is stated below.
2.5 STABILITY
Stability characterizes how a given system reacts to disturbances.
There are two basically different stability notions:
- bounded-input bounded-output (BIBO) stability
describes what happens if the system receives a bounded input signal.
The system may respond with a bounded output signal to any bounded
input signal, in which case we call it a BIBO stable system.
- asymptotic stability
tells us what happens if we move the system from its equilibrium or
steady-state and then leave it alone.
If the perturbed system goes back to its original steady state after a
long time (i.e. asymptotically) then we call the system asymptotically
stable.
Both asymptotic and BIBO stability are system properties for LTI
systems, where asymptotic stability implies BIBO stability. The problem
statement for asymptotic stability in the case of LTI systems is given
below.
Asymptotic stability
Given:
The state equation of the state-space representation form as in Eq. (A.8
but with zero input, i.e. u(t) ≡ 0 and with nonzero initial condition:
ẋ = Ax , x(0) = x0 6= 0
Question:
Will x(t) go to zero in the limit i.e.
lim x(t) = 0 ?
t→∞
3. COMMON FUNCTIONS OF A
COMPUTER CONTROLLED SYSTEM
Although the software architecture of computer controlled systems
may vary widely with the application for which they are designed, there
are characteristic software components present in each of them [93]. In
order to investigate these we first need to briefly review the common
functions of computer controlled systems and then have a look at the
common features of real-time software systems.
Almost any computer controlled system has two data sources and sev-
eral targets in its environment:
- the plant or process to be controlled,
- the users of various kinds (engineers, operating personnel etc.)
- scaling
Scaling is one of the most important primary processing steps from
the users’ point of view. With the help of equipment scaling and
calibration data, a raw value is transformed into a scaled value in
engineering units.
- limit checking
Most measurement devices have a measurement range associated
with them and there is a signal in their status information when the
raw measured value is found to be outside this range. These limits
are considered as "hard" limits.
The underlying technology usually determines narrower range(s), so
called "soft limits" within which a particular measured value should
be. Most often two sets of upper and lower limits are considered:
the warning limits and the error limits. The upper and lower limit
values are a’priori given static data, which are stored within the set
of primary processing data.
Limit checking is then usually performed by a simple arithmetic com-
parison of measured data and limits.
- filtering
The aim of the filtering sub-step in primary or secondary processing
is to remove outing values and reduce the variation in measured data
by using simple on-line methods.
The removal of outlying values is performed by limit checking and
data removal or substitution. Simple signal filtering methods such as
weighted averaging, averaging with exponential filtering or 1st order
linear filters with constant coefficients are used here.
The necessary parameters and filter coefficients are stored in primary
processing data.
- averaging
A set of time-dependent measured data sequences is averaged for
different reasons. Averaging is used as a simple signal filtering method
(see above), but there are averages over a longer operation period, say
over a shift, day or month, which are used for monitoring purposes.
260 INTELLIGENT CONTROL SYSTEMS
- alarm generation
As a result of limit checking and the detection of missing or invalid
data and outlying values, various warning and error messages are
generated. These messages are presented to system operator(s) and
are also stored as events by the computer controlled system itself.
Some alarm messages require actions from operator(s), for example
manual acknowledgement of the message.
- logsheet generation
A logsheet is a pre-arranged condensed set of information for a given
operational or maintenance purpose, produced periodically in each
prescribed time interval (say daily) or upon request. A logsheet usu-
ally contains complex data such as averages, filtered data or trends.
Various statistics, such as histograms of data values are also often
included.
they produce signals which influence the plant. These signal values are
stored in the set of actuator data. and usually computed from the set of
measured data.
Besides the active control or regulation sub-function, process control
functions most often include preparatory or auxiliary functions for con-
trol, such as filtering, identification or diagnosis.
- state filtering
A big group of controllers, for example LQRs or pole placement con-
trollers, apply state feedback to the system, that is they use the value
of present state signals to compute control input. As state signals are
not directly measurable and we only have measured data available,
which is corrupted by measurement noise, we need to perform state
filtering to obtain an estimate of the state signal values. The most
famous state filtering method is the Kalman filter.
- identification
Control methods require a complete dynamic model of a system
including the value of its parameters. These system parameters are
usually not precisely known and may also vary in time. Therefore we
need to apply identification methods to determine system parameters
from system structure and measured data.
- diagnosis
Diagnosis aims to discover, detect and isolate plant faults and mal-
function from the measured data and from model of the "healthy" and
"non-healthy" plant in different faulty modes. It provides advanced
information for the operators on the state of the plant and also guides
the operation of controllers.
262 INTELLIGENT CONTROL SYSTEMS
- real-time clock
A real-time software system should have an independent central el-
ement, a clock, which operates independently of the load and cir-
cumstances. All time-dependent functions and services use the value
given by the system clock.
- handling time
The presence of the clock makes it possible to handle timed tasks, such
as periodic tasks or tasks to be performed at a given time instance.
- event handling
The behaviour of the environment - that is, the system to be con-
trolled - and the users constitute events that influence the computer
controlled system. An event describes a specific change that occurred
at a specific time instance in the abstract form of a
pair.
- priority handling
In real circumstances, the load of a computer controlled system, which
can be measured by the number of signal changes, varies widely in
time. At the same time, computer controlled systems are usually
designed for an average load. consequently, the system is highly over-
loaded from time-to-time. In such situation, the system should focus
on the most important tasks and omit or delay tasks of secondary
importance.
Priority handling is a technique to ensure the nice degradation of
system performance by defining priority classes, allocating a priority
to each task and executing them in the order of priority.
264 INTELLIGENT CONTROL SYSTEMS
The task states and state transitions are depicted in Fig. A.2 in
the form of a state transition diagram borrowed from the theory of
discrete automata.
turn on
Existent Ready
turn off
suspend
Nonexistent Active
2. Task-task interfaces
The organization and functions of task-task interfaces are also stan-
dardized in their form and primitives. There are two types of task-task
interfaces: the synchronization interface only deals with the timing
and synchronizing of task execution, while the communication type
interface allows the exchange of data structures together with syn-
chronization.
- synchronization
There are two types of synchronization between two tasks: the
one-way go and the two-way randezvous.
The usual way of implementing synchronization interfaces is to
use system flags, one for the go and two for the randezvous type
connection. The necessary communication primitives for imple-
menting a synchronization interface are
– set-flag
– wait-for-flag
266 INTELLIGENT CONTROL SYSTEMS
- communication
Similarly to synchronization connections, two types of commu-
nication connections exist: the one-way send and the two-way
send-and receive connection. They can be implemented using
3. Scheduler
As we have seen before, the scheduler is a special high priority task
in a real-time system dealing with task states and state transitions.
Besides this, the scheduler has other duties in a real-time software
system. These are the following.
- management of timing
4. Operation of tasks
Tasks in a real-time system usually perform a sequence of synchro-
nization or communication operations together with algorithmic data
processing operations.
initialization;
loop: wait-for-flag(flag1); { waiting for task starting }
get-message-or-data; { real operation starts }
process data;
put-message-or-data; { real operation ends }
set-flag(flag2); { signalizing the ready state }
goto loop;
tasks with a high priority and delay or even omit the less important
tasks.
raw primary
measured actuator
measured processing events
data data
data data
measurement primary
device handling event handling controller(s)
processing
CLOCK
instance when the value was last updated thus providing information
on the change of the value and on its validity.
- event type
This is a unique identifier of the event category (such as warning
limit exceeded, equipment off-line, operator intervention etc.) the
particular event belongs to.
- sender
The identifier of the task in the computer control system that has
generated the particular event message.
event message. These messages are sent to the event handling tasks via
a one-way send communication primitive.
The event handling task handles and administers received event mes-
sages, puts them into the event circular file in the correct time order and
takes care of their archiving. It also supports the logsheet and alarm re-
port functions in retrieving events of prescribed types, over any desired
time interval or according to other user defined filtering viewpoint.
1. SYSTEM DESCRIPTION
The description of a system to be modelled is prepared in the fol-
lowing way. First, we specify system boundaries, which separate the
system from its environment and describe the processes and interactions
considered within the system and between the system and its environ-
ment. Then the input and output signals are described, together with
the operating region of interest. We usually put the main elements of a
system description on a so called flowsheet, which is a schematic picture
of the system to be modelled with its boundaries, main sub-systems and
signals.
275
276 INTELLIGENT CONTROL SYSTEMS
The modelling goal which, influences the precision and the type of the
model to be used is also usually briefly described.
Modelling goal
We want to have a model of the coffee machine for diagnosis and control.
This implies that a dynamic model with moderate complexity and pre-
cision is needed to describe the dominant time constants of the system.
In particular we want to examine different operating procedures, that
is sequential and perhaps parallel operator actions, which lead to optimal
coffee making in terms of time and energy, for example.
Appendix B: THE COFFEE MACHINE 277
ηI
v, T I
h, T
ηo
v, T
Operating region
The above modelling goal implies that we only consider such system
states when we have water in the coffee machine, that is when it is not
empty or not overheated containing only vapour.
Modelling assumptions
h(0) = h0 , T (0) = T0
Mathematical properties
The model equations above form a set of nonlinear ordinary differential
equations with suitable initial conditions.
Appendix B: THE COFFEE MACHINE 279
x = [ h , T ]T
uP = [ ηI , ηO , κ ]T
The potential input variables influence the behaviour of the coffee ma-
chine, but the actual measurement and actuator devices determine whether
they will be actuator or disturbance variable.
The process instrumentation diagram, which is an extension to the
process flowsheet, contains the measurement devices and actuators avail-
able in the processing unit. From this we can determine which variables
will contain the set of output, actuator and disturbance variables.
An output variable can be any variable which is directly measurable
and contains information about the state variables of the process. In the
case of the coffee machine, we may assume that we have both level and
temperature sensors to measure both of the state variables. This way
the output variable vector is as follows:
y = x = [ h , T ]T
u = uP = [ ηI , ηO , κ ]T
[29] Kim, S. (1988) Checking a Rule Base with Certainty Factor for In-
completeness and Inconsistency. In: Uncertainty and Intelligent Sys-
tems, Lecture Notes in Computer Science No. 313, Springer-Verlag,
New York.
[31] Guy, L., Steele, Jr. (1990) Common Lisp: The Language (2nd edi-
tion), Digital Press.
[33] Graham, P. (1995) ANSI Common Lisp. In: Series in Artificial In-
telligence, Prentice-Hall International, Inc.
[36] Sterling, L., Shapiro, E. (1994) The Art of Prolog: Advanced Pro-
gramming Techniques. In: MIT Press Series in Logic Programming,
MIT Press.
[63] Moore, R. E.. (1966) Interval Analysis, Prentice Hall Series in Au-
tomatic Computation.
[72] Gál, I.P., Hangos, K.M. (1998) SDG Model-based Structures for
Fault Detection. In: Preprints IFAC Workshop on On-line Fault
Detection and Supervision in Chemical Process Industries, Lyon
(France), Vol. 1. p. 6.
289