shahab thesis
Post on 05-Apr-2018
223 Views
Preview:
TRANSCRIPT
-
7/31/2019 Shahab Thesis
1/111
DISCRETE EVENT MODELING, SIMULATION ANDCONTROL WITH APPLICATION TO SENSOR BASED
INTELLIGENT MOBILE ROBOTICS
BY
Shahab Sheikh-Bahaei
B.S., Electrical Engineering, Isfahan University of Technology, 1999
THESIS
Submitted in Partial Fulfillment of theRequirements for the Degree of
Master of ScienceElectrical Engineering
The University of New MexicoAlbuquerque, New Mexico
December 2003
-
7/31/2019 Shahab Thesis
2/111
To my parents, to whom I owe all that I am today;
to my wife Nasim, to whom I owe my happy life;
and to my wonderful in-laws.
iii
-
7/31/2019 Shahab Thesis
3/111
ACKNOWLEDGEMENTS
I gratefully acknowledge the advice, comments, corrections, encouragements andsupport of my advisor Professor Mo Jamshidi, Director of Center for AutonomousControl Engineering (ACE) and Regents Professor of Electrical and ComputerEngineering at the University of New Mexico.
I am grateful to the members of my committee, ProfessorThomas Caudell, Directorof Visualization Laboratory at High Performance Computing, Education and ResearchCenter and Associate Professor of Electrical and Computer Engineering and ComputerScience, and Professor Chris Smith, Assistant Professor of Electrical and ComputerEngineering, for being in my committee and for their helpful comments and suggestions.Also my special thanks to the fourth, unofficial member of this committee, Dr. NaderVadiee, Director of the UNM-NASA PURSUE Program, for his advice and supportivecomments. My thanks to my uncle, Professor Mansoor Sheik-Bahae, Professor ofPhysics and Astronomy at the University of New Mexico, ProfessorBernard Zeigler ofthe University of Arizona, and the faculty and staff at the University of New MexicoDepartment of Electrical and Computer Engineering. I am also grateful to my colleaguesand friends at UNM, and thankful to the Center for Autonomous Control Engineering(ACE) for financial support of this work1.
And finally, and the most importantly, I gratefully acknowledge the love and spiritualsupport of my wife, Nasim Sassan. This work definitely could not have been
accomplished without her support and patience.
iv1 This work is partially supported by NASA-Ames Research Center Grant number NAG 2-1457
-
7/31/2019 Shahab Thesis
4/111
Discrete Event Modeling, Simulation and
Control with Application to Sensor Based
Intelligent Mobile Robotics
BY
Shahab Sheikh-Bahaei
ABSTRACT OF THESIS
Submitted in Partial Fulfillment of theRequirements for the Degree of
Master of ScienceElectrical Engineering
The University of New MexicoAlbuquerque, New Mexico
December 2003
-
7/31/2019 Shahab Thesis
5/111
Discrete Event Modeling, Simulation and Control
with Application to Sensor Based Intelligent Mobile Robotics
by
Shahab Sheikh-Bahaei
B.S., Electrical Engineering, Isfahan University of Technology, 1999
M.S., Electrical Engineering, University of New Mexico, 2003
ABSTRACT
This work is focused on modeling, simulation and control of cooperative mobile
robots usingDiscrete Event System Specifications (DEVS), which is a young approach in
modeling and control. Discrete Event approximation of differential equations is also
studied and improved by introducing DEVS-Double Integration method.
Also Fuzzy Logic Control (FLC) and Stochastic Learning Automaton (SLA) are
designed and implemented under DEVS framework. In this work we propose an
Intelligent Discrete Event (I-DEVS) approach to control autonomous agents, i.e. we
introduce a discrete event version of Fuzzy Logic Control via DEVS, which improves the
speed of Fuzzy-Logic Control and makes it more suitable for real-time adaptive control.
vi
-
7/31/2019 Shahab Thesis
6/111
A discrete event simulation environment for modeling and simulation of multi-agent
systems called V-LAB is also partially developed in this research. Finally the simulated
algorithms are implemented on a real commercial robot.
vii
-
7/31/2019 Shahab Thesis
7/111
Contents
LIST OF FIGURES...............................................................................................x
1. Introduction .......................................................................................................... 1
2. DEVS Formalism................................................................................................. 3
2.1 Introduction to Discrete Event Dynamical Systems (DEDS)........................... 3
2.2 Review of DEVS formalism............................................................................. 5
2.2.1 Classic DEVS Atomic Models .............................................................. 5
2.2.2 Classic DEVS Coupled Models............................................................. 7
2.2.3 DEVS Examples .................................................................................... 9
2.3 DEVS&DESS: Combined Discrete Event and Differential Equation Specified Systems..... 13
2.3.1 DEVS Abstraction for Output-Partitioned DEVS&DESS Models ..... 14
2.3.2 DEVS First Order Numerical Integrator ............................................. 17
2.3.3 DEVS Double Integrator ..................................................................... 22
2.4 Discrete Event Control (DEC)........................................................................ 30
2.4.1 Introduction ......................................................................................... 30
2.4.2 Controllability of DEVS Models......................................................... 30
2.5 Intelligent DEVS ............................................................................................ 32
2.5.1 DEVS-Fuzzy Logic ............................................................................. 32
2.5.2 DEVS-SLA.......................................................................................... 38
3. Mobile robotics .................................................................................................. 43
3.1 Introduction .................................................................................................... 43viii
-
7/31/2019 Shahab Thesis
8/111
3.2 Modeling and Controllability of Mobile Robots ............................................ 44
3.3 Motion Control of Mobile Robots .................................................................. 48
3.3.1 Path Planning Methods........................................................................ 49
3.3.2 Obstacle Avoidance............................................................................. 56
3.3.3 Cooperative Robots ............................................................................. 59
3.3.4 Job Evaluation ..................................................................................... 65
4. V-LAB Simulations ........................................................................................ 71
4.1 Simulation Components ................................................................................. 73
4.1.1 Dynamics Model.................................................................................. 73
4.1.2 Collision Model ................................................................................... 74
4.1.3 Terrain Model ...................................................................................... 83
4.1.4 Robot Model ........................................................................................ 84
4.2 Simulation Results.......................................................................................... 85
5. Experiment Results ............................................................................................ 88
6. Conclusions and discussions .............................................................................. 91
7. References .......................................................................................................... 95
ix
-
7/31/2019 Shahab Thesis
9/111
List of Figures
Figure 2.1 A 3-State Machine............................................................................................. 4
Figure 2.2- a) DEVS Behavior,........................................................................................... 7
Figure 2.3. A simple coupled model, composed of three atomic models.......................... 9
Figure 2.4 Graphical notation: (a) external transition......................................................... 9
Figure 2.5. Pulse Generator, an example for a DEVS atomic model ............................... 10
Figure 2.6. A DEVS coupled model example: an integratormade jointly by a Generator
and a Summer............................................................................................................. 11
Figure 2.7- The 3-State Machine in DEVS notation......................................................... 13
Figure 2.8. DEVS representation of DEVS&DESS ......................................................... 16
Figure 2.9-DEVS first order numerical integrator............................................................ 19
Figure 2.10. A DEVS coupled model for Simulation of a free falling mass. ................... 20
Figure 2.11. DEVS implementation of Example 2.5........................................................ 20
Figure 2.12. Simulation of a falling mass using two first order DEVS integrators with
initial velocity v0=20m/s, and initial position x0=100m and Quantum=1. (a) Position
vs. time: DEVS results compared to the exact solution. (b) Position Error vs. time. 21
Figure 2.13 Step responses for the systems of Example2.5 using DEVS integrator. (a)
Step response for system of equation 2.14 (b) Step response for system of equation
2.15 ............................................................................................................................ 22
Figure 2.14. DEVS Double Integrator .............................................................................. 25
Figure 2.15. Determining the time advance value for n-dimensional DEVS double
integrator.................................................................................................................... 26Figure 2.16- Searching the minimum positive root of equation 2.28. .............................. 28
Figure 2.17- Simulation of a falling mass using one DEVS double integrator with initial
velocity v0=20m/s, and initial position x0=100m and Quantum=1. (a) Position vs.
time: DEVS results compared to the exact solution. ................................................. 29
x
-
7/31/2019 Shahab Thesis
10/111
Figure 2.18- Controllability Definitions: (a) weakly controllable (b) strongly controllable
(c) very strongly controllable path............................................................................. 32
Figure 2.19 A typical consequent membership function (CMF) model ........................... 34
Figure 2.20 A DEVS model for a typical fuzzy rule IF x is A OR y is B THEN z is C35
Figure 2.21. Example of using fuzzy-DEVS to control an inverted pendulum................ 37
Figure 2.22- Learning from action: gaining reward while avoiding penalty. ................... 38
Figure 2.23 Schematic of SLA inside the DEVS Environment.......................................... 39
Figure 2.24. Possible results of an example for SLA_DEVS........................................... 41
Figure 2.25- A mobile automaton learns to reach a goal point using SLA. (a) Action
probabilities vs. time (b) trajectory of the automaton (c) x and y vs. time................ 42
Figure 3.1. Robot Functional Block Diagram................................................................... 43
Figure 3.2- A differential-wheeled mobile robot.............................................................. 44
Figure 3.3. Robot Motion Control .................................................................................... 45
Figure 3.4. Kinematic Control .......................................................................................... 47
Figure 3.5. The system of equation 3.7 for a=1 and b=4;................................................. 51
Figure 3.6. Effect of changing b from 4a down to a......................................................... 52
Figure 3.7. Trajectory of the system of equation 3.7 for different initial conditions........ 52
Figure 3.8. Using time-varying a and b as defined in equation 3.8.................................. 53
Figure 3.9. Membership function used in Fuzzy-Logic Obstacle avoidance ................... 58
Figure 3.10. 3D surfaces generated by the proposed fuzzy logic rule base to perform
obstacle avoidance..................................................................................................... 59
Figure 3.11. Robot trying to push round objects to storage area ..................................... 60
Figure 3.12. A DEVS model for cooperative pushing task .............................................. 61
Figure 3.13. Pushing task performed by a single robot .................................................... 63
Figure 3.14. Pushing task by two robots........................................................................... 65
Figure 3.15. Membership functions for Objective Function, Time and Mission Success
Degree........................................................................................................................ 67
Figure 3.16- Cooperative box-pushing task...................................................................... 70
Figure 4.1Distributing simulation layers using DEVS in V- Lab ................................ 72
Figure 4.2. DEVS coupled model in V-LAB for multi-agent ....................................... 73
xi
-
7/31/2019 Shahab Thesis
11/111
Figure 4.3- Dynamic model contains DEVS-double integrators to simulate moving-
obstacles and robots................................................................................................... 74
Figure 4.4. Examples of colliding polygons: case (a) is more likely to occur than case (b)
................................................................................................................................... 75
Figure 4.5. Evaluation of functionP(x) (equation 4.1) at different areas......................... 76
Figure 4.6. Hard Collision ................................................................................................ 78
Figure 4.7- Three masses pushing each other................................................................... 81
Figure 4.8- Terrain Model is responsible for calculating the distance of the nearest
obstacle to each IR-sensor. ........................................................................................ 83
Figure 4.9- A DEVS coupled model for a differential-drive wheel robot with n infra-red
sensors, one compass and one position sensor .......................................................... 84
Figure 4.10. V-Lab components for autonomous multi-agent simulation implemented in
DEVS......................................................................................................................... 86
Figure 4.11- 3D views from V-Lab simulation ............................................................ 86
Figure 4.12- Path planning among unknown obstacles .................................................... 87
Figure 4.13. Cooperative object pushing .......................................................................... 87
Figure 5.1- Pioneer Robot made by ActivMedia Robotics.............................................. 88
Figure 5.2- Path planning: (a)Left and right velocities (b) Trajectory of the robot (c) State
variables of the robot vs. time (d) View from V-Lab showing the final position ofthe robot and its trajectory......................................................................................... 90
Figure 5.3- Path planning while avoiding obstacles ......................................................... 90
Figure 5.4- Object pushing task. (a) V-Lab real-time view (b) Robot pushing a bottle 91
Figure 5.5- Object pushing task by a single robot ............................................................ 91
xii
-
7/31/2019 Shahab Thesis
12/111
1
1. INTRODUCTION
The field of robotics involves several areas such as control engineering, signal
processing, planning, mechanical engineering, applied mathematics, real-time systems,
software engineering, artificial intelligence and machine learning. Robots perform a wide
variety of tasks in the real world. Due to the large degree of flexibility of the robotic
systems and the complexity of possible task domains, it is important to design control
architectures, which can handle complex systems in unstructured environment. Much
research has been done so far by researchers on solving different robotic problems.
The word Robot refers to two classes of autonomous machines: one is known as
Robotic Arm, and the other one Mobile Robot. Mobile robots, move relative to the
environment they are in, exhibiting some degree of autonomy. Wheeled-Robots and
Walking-Robots (legged-robots) are two basic categories of mobile robots. Applications
of mobile robots are in autonomous moving machines such as: cars, trains, carts and
plains, moreover tasks like painting, cleaning, inspection can be performed by mobile
robots, specially in dangerous, boring or difficult situations where human cant work.
Discrete-event modeling and simulation of mobile robots in a virtual environment is
one of the main aspects of this research. Discrete event modeling and simulation has been
introduced recently as a new tool in modeling, simulation and control.
Work on mathematical foundation of discrete event dynamic modeling and simulation
initiated in the 70s by Zeigler, when DEVS (discrete event system specification) was
introduced as an abstract formalism for discrete event modeling[1]. Because of its system
theoretical basis, DEVS is a general formalism for discrete event dynamical system
-
7/31/2019 Shahab Thesis
13/111
Introduction 2
(DEDS). DEVS can be used to specify systems whose input, state and output trajectories
are piecewise constant [2]. Recently, the Control of Discrete Event Systems is receiving
more attention[3],[4],[5]. Discrete-Event Systems (DES) control theory developed by
Ramadge and Wonham[5], has been used to control several different robotic problems
including manufacturing and assembly tasks, the coordination of mobile robotic agents
[6],[7], a grasping task performed under the supervision of a vision system [8], modeling
dexterous manipulation [9]a hybrid discrete event dynamic systems approach to robot
control [10],[11].
On the other hand, soft computing techniques, e.g. fuzzy logic, genetic algorithms
and neural networks are proven to be useful in control of autonomous agents. Fuzzy logic
control provides a human-like decision making methodology, which has been used
widely in the field of robotics and automation [12]. Design and implementation of fuzzy
logic control under DEVS framework is one of the contributions of this work.
The goal of this thesis is to investigate the power of DEVS in modeling, simulation
and control of sensor-based intelligent mobile robots. First we review the DEVS
formalism in Section 2, also DEVS differential equation solvers, DEVS numerical
integration methods, as well as Fuzzy-DEVS and SLA-DEVS are presented in this
section. In Section 3, modeling, control architecture and controllability of mobile robots,
fuzzy logic based obstacle avoidance, and cooperative mobile robots are discussed. In
Section 4, V-LAB a discrete-event-environment in which mobile robots can be
modeled and simulated is introduced. Simulation results are also presented in this section.
In Section 5, real world experiments results with an ActivMedia Pioneer AT2 mobile
robot are presented.
-
7/31/2019 Shahab Thesis
14/111
3
2. DEVS FORMALISM
2.1 Introduction to Discrete Event Dynamical Systems (DEDS)
Classical dynamic system models, i.e. differential equations based models, have been
developed to describe natural physical systems. Differential Equation System
Specifications (DESS) has been used widely for modeling, simulation and control of
various systems. Since late 20th
century computer has been employed as a basic tool to
simulate physical systems by solving differential equations. Since then the concepts of
discrete time, sampling and difference equations are introduced. Discrete-time models
timing is based on equally spaced time intervals called step-size or sample time. The
accuracy of the model depends on the sample time: smaller sample times provide better
accuracy. But the tradeoff is that the calculation time rises with small sample times.
In contrast, widely developments of man-made systems, such as manufacturing
systems of various types need more general models in order to describe different states
and performances of the systems. Discrete Event Dynamic Systems (DEDS) provides an
explanatory framework for such systems. DEDS can be used to model the event-driven
systems common to man-made systems.
A discrete event system is a dynamic system whose behavior is guided by the
occurrence of discrete events. Although only certain events can occur in any given
situation, the time and the intervals in which they appear is known in general.
Example: A classical example of a discrete event system is a 3-state machine that can
be Idle, Working orBroken-Down. The transition diagram is shown in Figure 2.1
-
7/31/2019 Shahab Thesis
15/111
DEVS Formalism 4
Working
Idle
FIX
BRK
DONE
ON
Broken-Down
Figure 2.1 A 3-State Machine
The initial state is Idle. The event ON denotes the turn-on of the machine, while the
event DONE the completion of a task, BRKa break-down and FIX a completion of
repair.
In response to industrial needs for DEDS models, several simulation packages have
been developed [11]. A discrete event system specification, called DEVS formalism has
been helpful in the development of such software. DEVS is a theoretical formalism for
discrete event dynamical systems (DEDS). It can be used to specify systems whose input,
state and output trajectories are piecewise constant [2]. Several software tools have been
developed for the simulation of DEVS models. The most popular are DEVS-Java [13]
and DEVSim++[14]. In this work we use DEVS-Java to implement our DEVS models.
-
7/31/2019 Shahab Thesis
16/111
DEVS Formalism 5
2.2 Review of DEVS formalism
The DEVS formalism specifies discrete event models in a modular hierarchical form.
In this formalism a discrete event model is decomposed into smaller models, each defines
a discrete event model independently.
2.2.1 Classic DEVS Atomic Models
A 7-tuple specifies the lowest level of the model hierarchy called atomic model. The
following is the classic definition for an atomic DEVS[1]:
DEVS=(X, Y, S, ext, int, , ta)
where
X : is the set of inputs,
Y: is the set of outputs,
S: is the set of sequential states,
ext :Q X S is the external state transition function,
where Q={(s,e) | sS, 0 e < ta(s) } is the total state,
e is the elapsed time since last event.
int : S S is the internal state transition function,
: S Y is the output function,
ta : S +{0,} is the time advance function.
The interpretation of the above elements is as follows: at any given time the system is
at some state, s. If no external event occurs it will remain in the same state for a period of
-
7/31/2019 Shahab Thesis
17/111
DEVS Formalism 6
ta(s) seconds, after which an output equal to the value, (s), is generated and the system
state changed to int(s). In the case that ta(s) is equal to infinity, the system will remain in
the same state, s, until an external event occurs. In other words, if no external event
occurs, system will remain in the same state forever. The first case (ta(s)
-
7/31/2019 Shahab Thesis
18/111
DEVS Formalism 7
X
Classic DEVS
atomic model
OutputInput
t0 t1 t2S (b)s3s1
s0s2
e Out1
Out2
Out3
Parallel DEVS
atomic model
In1
In2
ta(s1)
t0 t1 t2
Y
(c)
t1
(a)
Figure 2.2- a) DEVS Behavior,Figure 2.2- a) DEVS Behavior,
b) Graphical notation forClassic andParallelmodelsb) Graphical notation forClassic andParallelmodels
2.2.2 Classic DEVS Coupled Models2.2.2 Classic DEVS Coupled Models
Basically, a DEVS coupledmodel is composed of DEVS components i.e. atomic and
coupled models, by defining a coupling relation between them.
Basically, a DEVS coupledmodel is composed of DEVS components i.e. atomic and
coupled models, by defining a coupling relation between them.
Here is the definition of DEVS coupled models [1]:Here is the definition of DEVS coupled models [1]:
N=(X,Y,D,{Md|dD},EIC,EOC,IC),N=(X,Y,D,{Md|dD},EIC,EOC,IC),
wherewhere
X={(p,v) | pIPorts, vXp } is the set of input ports and values X={(p,v) | pIPorts, vXp } is the set of input ports and values
Y={(p,v) | pOPorts, vYp } is the set of output ports and values Y={(p,v) | pOPorts, vYp } is the set of output ports and values
-
7/31/2019 Shahab Thesis
19/111
DEVS Formalism 8
D is the set of the component names.
Components are DEVS models, for each dD,
Md=( Xd,Yd,S, ext, int, , ta) is a DEVS (2.1)
with Xd={(p,v)|pIPortsd, vXp }
Yd={(p,v)|pOportsd,vYp}
External Input Coupling connects external inputs to component inputs,
EIC { ( (N, ipN), (d, ipa) ) | ipNIPorts, dD, ipdIPortsd}. ( 2.2)
External Output Coupling connects component outputs to external outputs,
EOC { ( (d, opd), (N, opN) ) | opNOPorts, dD, opdOPortsd}. ( 2.3)
Internal Coupling connects component outputs to component inputs,
IC { ( (a, opa), ( b, ipd) ) | a,b D, opa Oportsa, ipb IPortsb }. ( 2.4)
However, no direct feedback loops are allowed, i.e., no output port of a
component may be connected to an input port of the same component.
Figure 2.3 shows a simple example of a coupled model.
-
7/31/2019 Shahab Thesis
20/111
DEVS FormalismFormalism 9
9
Coupled
Coupled
outin
outin A3
outin A2
outin A1
Figure 2.3. A simple coupled model, composed of three atomic modelsFigure 2.3. A simple coupled model, composed of three atomic models
2.2.3 DEVS Examples2.2.3 DEVS Examples
Graphical notation: Our graphical notation for state transitions is shown in Figure
2.4 where (a) represents an external transition. An input event is specified using ?. For
instance input event in?m means that a message (event) m is input at the input port
in. Figure 2.4(b) denotes an internal transition. An output event is specified using !.
A dotted line represents an internal state transition specified by the internal transition
function. A solid line represents a state transition specified by the external transition
function.
Graphical notation: Our graphical notation for state transitions is shown in Figure
2.4 where (a) represents an external transition. An input event is specified using ?. For
instance input event in?m means that a message (event) m is input at the input port
in. Figure 2.4(b) denotes an internal transition. An output event is specified using !.
A dotted line represents an internal state transition specified by the internal transition
function. A solid line represents a state transition specified by the external transition
function.
si
sj
p?m
si
sjp?m
si
sj
(si) = p!m
si
sjp!m
(a) (b)
Figure 2.4 Graphical notation: (a) external transitionFigure 2.4 Graphical notation: (a) external transition
(b) internal transition(b) internal transition
-
7/31/2019 Shahab Thesis
21/111
DEVS Formalismormalism 10
10
Example 2.1. GeneratorExample 2.1. Generator
As an example consider an atomic model with single input and single output. The
model generates output events equal to 1 or 1, and the frequency of the output events is
proportional to the input value (Figure 2.5). Negative outputs occur when the input is
negative.
As an example consider an atomic model with single input and single output. The
model generates output events equal to 1 or 1, and the frequency of the output events is
proportional to the input value (Figure 2.5). Negative outputs occur when the input is
negative.
X= rate
-1
1
Y
YGenerator
Figure 2.5. Pulse Generator, an example for a DEVS atomic modelFigure 2.5. Pulse Generator, an example for a DEVS atomic model
Here is the formal definition of such a model:Here is the formal definition of such a model:
GEN =(X, Y, S, ext, int, , ta),GEN =(X, Y, S, ext, int, , ta),
X=,X=,
Y={-1,1},Y={-1,1},
S={-1,1},S={-1,1},
ext(s,x,e)=sign(x),ext(s,x,e)=sign(x),
int(s,x)=sign(s),int(s,x)=sign(s),
(s)=s,(s)=s,
0
( , )0
if x
ta s x qif x
x
=
=
where the constant q is a real number called quantum.
-
7/31/2019 Shahab Thesis
22/111
DEVS Formalismmalism 11
11
Example 2.2. SummerExample 2.2. Summer
As another example consider an atomic model which sums up the input value with the
current state, and sends the result immediately.
As another example consider an atomic model which sums up the input value with the
current state, and sends the result immediately.
SUM =(X, Y, S, ext, int, , ta),SUM =(X, Y, S, ext, int, , ta),
X=,X=,
Y=,Y=,
S=,S=,
ext(s,x,e)=s+x,ext(s,x,e)=s+x,
int(s,x)=s,int(s,x)=s,
(s)=s,(s)=s,
ta(s,x)=0.ta(s,x)=0.
Example 2.3. A simple First Order Ordinary Differential Equation solverExample 2.3. A simple First Order Ordinary Differential Equation solver
Using the atomic models mentioned in the two previous examples, in a DEVS couple
model, a simple integrator can be made.
Using the atomic models mentioned in the two previous examples, in a DEVS couple
model, a simple integrator can be made.
Figure 2.6. A DEVS coupled model example: an integratormade jointly by a Generatorand a Summer.Figure 2.6. A DEVS coupled model example: an integratormade jointly by a Generatorand a Summer.
1 2 3
1 20 1 2
0
t t t
t ts x dt x dt x dt+ +
t3
t2t1
x2
x1
x0
Time
S
G
X
SGXSummerGenerator
-
7/31/2019 Shahab Thesis
23/111
DEVS Formalism 12
Example 2.4. Consider the 3-state machine discussed in section 2.1 again. This
system can be described by a DEVS atomic model as follows:
M=(X, Y, S, ext, int, , ta),
X={ON, FIX}
Y=S={Idle, Working, Broken-Down},
if (s = "Broken-down" and x = "FIX")
if (s = "Idle" and x = "ON")
" "( , , )
" "ext
Idles x e
Working
=
int
if (s ="Working" and event "DONE" occurs)
if (s ="Working" and event "BRK" occurs)
otherwise
" "
( ) " "
Idle
s Broken Down
s
=
if s="Working"
otherwise
0( , )ta s x
=
(s)=s.
Figure 2.7 shows the state transition diagram for this atomic model. As shown in the
figure, the model has one input port in and one output port out.
-
7/31/2019 Shahab Thesis
24/111
DEVS FormalismFormalism 13
13
outin
out!BRK
in?FIXin?ON
out!DONE
Down
Broken-Working
Idle
Figure 2.7- The 3-State Machine in DEVS notationFigure 2.7- The 3-State Machine in DEVS notation
2.3 DEVS&DESS: Combined Discrete Event and Differential Equation
Specified Systems
2.3 DEVS&DESS: Combined Discrete Event and Differential Equation
Specified Systems
Since DEVS representation applies to a special subclass of dynamical systems, output-
partitioned DEVS&DESS formalism for hybrid system modeling is introduced by Zeigler
et al [1],[2] as an extension of the DEVS formalism for combined discrete/continuous
modeling and simulation. It provides means of specifying systems with interacting
continuous and discrete trajectories.
Since DEVS representation applies to a special subclass of dynamical systems, output-
partitioned DEVS&DESS formalism for hybrid system modeling is introduced by Zeigler
et al [1],[2] as an extension of the DEVS formalism for combined discrete/continuous
modeling and simulation. It provides means of specifying systems with interacting
continuous and discrete trajectories.
Definition: An output-partitioned DEVS&DESS is a structure [2]:Definition: An output-partitioned DEVS&DESS is a structure [2]:
Op-DEVS&DESS=(X, Y, Q, Sc, , , F)Op-DEVS&DESS=(X, Y, Q, Sc, , , F)
wherewhere
X is the set of input values, which is an arbitrary set. X is the set of input values, which is an arbitrary set.
Q is the set of states. Q is the set of states.
S=S1 S 2 Sn = Rn, i.e., is the continuous state space which is an n-
dimensional vector space.
S=S1 S 2 Sn = Rn, i.e., is the continuous state space which is an n-
dimensional vector space.
={1, 2,, n} is a set of rate of change function with i : S X , ={1, 2,, n} is a set of rate of change function with i : S X ,
-
7/31/2019 Shahab Thesis
25/111
DEVS Formalism 14
with{1,... }
ii n
F F
= U ,1 ,{ ,..., }ii i i mF f f= is the set of threshold values for all
dimensions i,
Y= BF is the output value set which is the crossproduct of all Boolean value
sets of the threshold sensors, ,i b iif i b
,,thr f F
: S Y if the output function which is defined by
(s)=(thrf1,b1(s1), thrf1,b2(s2),, thrf1,n(sn) )
i.e. the output is defined by the values of the threshold sensors.
In the above definition, a continuous system with n-dimensional state space
Sc=S1c S2c Snc=Rn
whose continuous behavior can be modeled by a set of first order
differential equations ={1,2,,n} is considered. Moreover, the system is furnished
with a set of threshold sensors, whose state change only at particular fixed threshold
values fi,bi of continuous state variables si, i.e. x=thr fi,b for all sifi,bi (assuming Boolean valued sensors are used).
2.3.1 DEVS Abstraction for Output-Partitioned DEVS&DESS Models
Since an output partitioned DEV&DESS is a piecewise constant input/output
dynamical system, it has a DEVS representation. The transition functions of a DEVS are
derived from an op-DEVS&DESS in the following way [2]:
-
7/31/2019 Shahab Thesis
26/111
DEVS Formalism 15
1t e
For every total state ((s,x),e) and input segment2:X:
The time advance is the time interval to the next output change, i.e., threshold
crossing, provided a constant input x,
1,(( , )) min{ | ( ) ( ( ( ), ) )}s x
tta s x e s s f STRAJ x d = +
+, ( 2.5)
The internal transition function computes the state at the next threshold
crossing occurring at time t1+ta(s,x)
1
( , )
int ,(( , )) ( ( ( ), ) , )ta s x
s xt
s x s f STRAJ x d x = + , ( 2.6)
The external transition function updates the state at the input event x knowing
that the elapsed time since last event is e.
1
1,(( , ), , ) ( ( ( ), ) , )
t e
ext s xts x e x s f STRAJ x d x
+
= + , ( 2.7)
The output function is inherited from the DEVS&DESS
(( , ))s x s = , ( 2.8)
where STRAJs,x(t): :Q is the state trajectory, and : cf Q X S is the
differential equation representing the continuous behavior of the system, similar to is
(Q is the total state).
2 :A describes a motion through the set A that begins at t 1 and ends at t2, and at every t, (t)describes where the motion is at time t. See [13] for more details.
-
7/31/2019 Shahab Thesis
27/111
DEVS Formalismism 16
16
Figure 2.8 illustrates how DEVS representation of DEVS&DESS works. At time t i+1,
when the external event occurs, ext updates the current state from si to si+1, knowing that
the elapsed time is e. Using the new state (si+1), ta predicts when the continuous system
crosses the next threshold fj+1 (orfj again). Finally, int function calculates the new state
si+2 using ta(s,x), if no external event occurs.
Figure 2.8 illustrates how DEVS representation of DEVS&DESS works. At time t i+1,
when the external event occurs, ext updates the current state from si to si+1, knowing that
the elapsed time is e. Using the new state (si+1), ta predicts when the continuous system
crosses the next threshold fj+1 (orfj again). Finally, int function calculates the new state
si+2 using ta(s,x), if no external event occurs.
ti
e
ta(s,x)
int(s,x)
ext((s,x),e,x )
si
si+1
si+2
jf
1jf +
,( ( ), )t
s xf STRAJ x d
ti+1
Figure 2.8. DEVS representation of DEVS&DESSFigure 2.8. DEVS representation of DEVS&DESS
-
7/31/2019 Shahab Thesis
28/111
DEVS Formalism 17
2.3.2 DEVS First Order Numerical Integrator
DEVS representation of op-DEVS&DESS, leads to first order discrete event
numerical integration [14]. Consider a continuous system with n-dimensional state space,
which is described by differential equation x =r r& . For simplicity we assume that is
piecewise constant: ={i|i is constant in [ti,ti+1) , iZ} . The set of threshold values,
Fi={ fi |fi=q.i, iZ, q} (q is called quantum).
The following atomic DEVS is defined:
DEVS_INT=(X, Y, S, ext, int, , ta),
X= n,
Y= n,
S=n,
( , , )ext s e x s e x = + r r r r
, ( 2.9)
1
0
( , )0
i
i
if x
q e xta s xif x
x
=
=
r r
uuurr rr r
ur( 2.10)
int ( , ) ( , )s x s ta s x x = + r r r r r r
, ( 2.11)
( )s =r r
s , ( 2.12)
Input xX is the value of function, which is generated as external event at the
beginning of each segment. The interpretation of the above transition functions is as
follows (see Figure 2.9):
According to equation 2.7,
-
7/31/2019 Shahab Thesis
29/111
DEVS Formalism 18
r1
1
( , , ) ( )t e
extt
s e x s d s e x +
= + = + r r r r
( 2.13)
where t1 is the moment at which the external event occurs.
The time advance function estimates how long it will take for the system to reach the
next threshold value. If the input is zero, obviously, it will never reach the next threshold;
so the time advance returns Infinity, consequently the atomic model goes into passive
phase.
In the case, which the input is non-zero if:
1) No external event has happened (e=0),
Assuming the rate of change is constant and equal tox, its clear thats=t.x+s0. so
the amount of time required for the system to reachs0+q,is ta=q/x.
2) External event has happened (e>0),
This happens when there is an unexpected external event before the previously
estimated time advance ta is over. Is this case the new input value, x i, is used to
recalculate how much time requires to reach the threshold. Again s=t.x+s0,new , but
so,new=s0,old+e.xold. Substituting s=so,old+q, we get: ta= (q-e.xold)/xnew
Note that this time-advance function works only if one external event occurs
between internal events. In the case of multi-external events ta=qremain/|x|, where
qremain is remaining quantum, calculated at each external event: qremain qremain - e.|x|.
Figure 2.9 illustrates how DEVS numerical integrator works. System starts with an
initial state (zero in this example). At time t0 when (t0)= 0the input x0=0 is generated.
The time advance function calculates t' as the next internal transition time, but before that
happens, changes to 1 at time t1, and input x1 is generated.
-
7/31/2019 Shahab Thesis
30/111
DEVS FormalismFormalism 19
19
3
2
1
S6
S5S4
S3
S2S1
S0
3
2
1
0
x3x1
x0
t'
t6t3t2
t6t3t2
t4
x2t5t1t0
t4 t5t1t0
3q
2q
q
2q
q
Y
S3q
X
(t)
Figure 2.9-DEVS first order numerical integratorFigure 2.9-DEVS first order numerical integrator
This external event will cause an external transition by ext from s0 to s1. Then time
advance function estimates the next threshold crossing, t2, at which an internal transition
from s1 to s2 occurs, and so on. Right before each internal transition an output is
generated by output function . Note that at time t4, where = 0, system goes to passive
phase until t5, at which a new non-zero input is generated.
This external event will cause an external transition by ext from s0 to s1. Then time
advance function estimates the next threshold crossing, t2, at which an internal transition
from s1 to s2 occurs, and so on. Right before each internal transition an output is
generated by output function . Note that at time t4, where = 0, system goes to passive
phase until t5, at which a new non-zero input is generated.
As oppose to conventional discrete time numerical integration methods, which divide
the time axis to equal time-steps, DEVS integrator divides the state space to equal
As oppose to conventional discrete time numerical integration methods, which divide
the time axis to equal time-steps, DEVS integrator divides the state space to equal
-
7/31/2019 Shahab Thesis
31/111
DEVS Formalismsm 20
20
segments (q, 2q, 3q, ). The smaller these segmentations, the higher accuracy we get.
Each segment is equal to the quantum.
segments (q, 2q, 3q, ). The smaller these segmentations, the higher accuracy we get.
Each segment is equal to the quantum.
This model can be used for non-piecewise-constant s, which will generate some
error depending on the value of quantum, i.e. smaller quantum produces smaller error.
Its similar to conventional discrete time numerical integrators whose accuracy depends
on the size of the time-step.
This model can be used for non-piecewise-constant s, which will generate some
error depending on the value of quantum, i.e. smaller quantum produces smaller error.
Its similar to conventional discrete time numerical integrators whose accuracy depends
on the size of the time-step.
Example 2.5. Falling MassExample 2.5. Falling Mass
As an example consider a falling mass m with the initial height h0 and initial velocity
v0. A coupled DEVS containing two cascaded integrators is needed, as shown in Figure
2.10.
As an example consider a falling mass m with the initial height h0 and initial velocity
v0. A coupled DEVS containing two cascaded integrators is needed, as shown in Figure
2.10.
Acceleration PositionVelocityntegrator 2ntegrator 1
Mass m
Figure 2.10. A DEVS coupled model for Simulation of a free falling mass.Figure 2.10. A DEVS coupled model for Simulation of a free falling mass.
Figure 2.11 shows the DEVSJAVA Simulation Viewer, implementing the above
model. Results are presented in Figure 2.12a. Figure 2.12b shows the error generated by
these two cascaded numerical integrators (quantum=1).
Figure 2.11 shows the DEVSJAVA Simulation Viewer, implementing the above
model. Results are presented in Figure 2.12a. Figure 2.12b shows the error generated by
these two cascaded numerical integrators (quantum=1).
Figure 2.11. DEVS implementation of Example 2.5Figure 2.11. DEVS implementation of Example 2.5
-
7/31/2019 Shahab Thesis
32/111
DEVS Formalism 21
(b)(a)
Figure 2.12. Simulation of a falling mass using two first order DEVS integrators with initial velocity v0=20m/s, and
initial position x0=100m and Quantum=1. (a) Position vs. time: DEVS results compared to the exact solution. (b)
Position Error vs. time.
Example 2.6. Linear Systems
Linear systems can be simulated using a single DEVS integrator. Consider the
following two LTI systems.
1 1
2 2
0 1 0
2 2 1
x xu
x x
= +
&
&
( 2.14)
1 1
2 2
0 1 0
1 1 1
x xu
x x
= +
&
& ( 2.15)
The step responses are shown in Figure 2.13. More accurate results can be obtained by
choosing smaller quantum.
-
7/31/2019 Shahab Thesis
33/111
DEVS Formalism 22
Figure 2.13 Step responses for the systems of Example2.5 using DEVS integrator. (a) Step response for
system of equation 2.14 (b) Step response for system of equation 2.15
integrator. (a) Step response for
system of equation 2.14 (b) Step response for system of equation 2.15
(a) (b)
2.3.3 DEVS Double Integrator2.3.3 DEVS Double Integrator
2.3.3.1 Introduction and Motivation2.3.3.1 Introduction and Motivation
2.3.3.1 Introduction and Motivation
By double integrator, we mean a DEVS atomic model, which is equivalent to two
consecutive first order integrators, described in Section 2.3.2, i.e. it integrates the input
signal twice in one shot. The motivation behind defining such a model is:
By double integrator, we mean a DEVS atomic model, which is equivalent to two
consecutive first order integrators, described in Section 2.3.2, i.e. it integrates the input
signal twice in one shot. The motivation behind defining such a model is:
1) The equation of free motion of most natural physical systems is of the same general
form [16]:
1) The equation of free motion of most natural physical systems is of the same general
form [16]:
-
7/31/2019 Shahab Thesis
34/111
DEVS Formalism 23
(2.16)2 0nx x+ =&&
This is the equation of an undamped, simple oscillator. For a mechanical system of
mass m and stiffness k,
n
k
m = . (2.17)
For a rotational system with the single degree of freedom and the moment of inertiaJ
and torsional stiffnessK:
n
k
J = . (2.18)
For a simple linearized pendulum with length land gravitation accelerationg:
n
g
l = . (2.19)
For an electrical LC circuit:
1n
LC = . (2.20)
2) Using one atomic model instead of two, is faster (in terms of computational
complexity), more accurate and is easier to implement when you want to use a large
number of these models.
-
7/31/2019 Shahab Thesis
35/111
DEVS Formalism 24
2.3.3.2 Problem Definition
The goal is to define a DEVS atomic model, which integrates the input signal twice,
i.e. the relation between input and output is:
( ) ( )y t t dtdt= (2.21)
For simplicity, we assume that the input signal, , is one-dimensional piecewise
constant as defined in Section 2.3.2. (Later well show how this model can be extended to
n-dimensional integrator). And again each change in the value of , generates an input
event x=. Also the set of threshold values are supposed to be the same as of Section
2.3.2.
We define theDEVS numerical double integratoras follows:
DEVS_DBL_INT=(X, Y, S, ext, int, , ta),
X=,
Y=,
S=SASI, where SA=, is the actual state; and SI= is the intermediate state.
21( , , ) ( , )2
ext A I I s e x s e s e x s e x = + + + ( 2.22)
2
int
1
( , ) ( ( , ) ( , ) , ( , ) )2A I Is x s ta s x s ta s x x s ta s x x = + + + ( 2.23)
( )s s = ( 2.24)
-
7/31/2019 Shahab Thesis
36/111
DEVS Formalism 25
2
2
1
0 0
0 0
( , ) 1min{ 0 | ( )
21
( )}2
I
remainI
I
A I k
A I k
if x s
qif x s
s
ta s xt s s t x t f
s s t x t f if x+
=
0
=
=
= > + + =
+ + =
( 2.25)
wherefkandfk+1 are the two thresholds, such that: fk
-
7/31/2019 Shahab Thesis
37/111
DEVS Formalismalism 26
26
If the input x is zero but the intermediate state sI is not, then we have a single
integrator similar to what we described in Section 2.3.2.
If the input x is zero but the intermediate state sI is not, then we have a single
integrator similar to what we described in Section 2.3.2.
If the input is not zero, then by integrating this signal twice, we get:If the input is not zero, then by integrating this signal twice, we get:
21
2A Ixdt s s t x t= + + ( 2.26)
which could intersect with the next threshold fk+1 and/or the previous one fk. In this
case ta is equal to the time period to the next threshold crossessing.
Figure 2.14is an example to illustrate how this double integrator works.
n-Dimensional State Space
In this case the time advance function is the time within which the norm of change
of actual state is equal to the quantum i.e., 1 ,A i A ids s s+= =q where sA,i and sA,i+1
are the ith
and i+1stactual states, respectively. See Figure 2.15.
uur uuuur uuur
,A is
uuur
, 1A is +
uuuur
dsuur
Origin
q
q
Figure 2.15. Determining the time advance value forn-dimensionalDEVS double integrator
But,
-
7/31/2019 Shahab Thesis
38/111
DEVS Formalism 27
2
, 1 ,
2
, 1 ,
1( , ) ( , )
2
1( , ) ( , )
2
A i A i I
A A i A i I
s s ta s x s ta s x x
ds s s ta s x s ta s x x
+
+
= + +
= = +
uuuur uuur uur r
uuur uuuur uuur uur r ( 2.27)
by equating |ds|=q, the time-advance function ta(s,x) can be found. For simplicity we
use tinstead ofta(s,x) in the following calculations.
2
2 2
2 24 3 2 2
1
2
1 1( ) ( )
2 2
1( )
4
I
I I
I I
ds q
s t xt q
s t xt s t xt q
x t s x t s t q
=
+ =
+ + =
+ +
uur
uur r
uur r uur r
r uur uur uur
2
0=
( 2.28)
In order to find the time-advance value it is required to solve the above incomplete
fourth-order polynomial equation. To analyze this equation consider:
4 3 2 2( ) 0f t at bt ct q= + + = ( 2.29)
where2 21
0, , 04
I Ia x b s x c s= > = = >r uur r uur
.
We are looking for the minimum positive root of equation 2.29.
This can be done using numerical methods. Looking at the derivative off(t) helps
finding the root faster.
-
7/31/2019 Shahab Thesis
39/111
DEVS Formalism 28
3 2 2( ) 4 3 2 (4 3 2 )f t at bt ct t at bt c = + + = + + ( 2.30)
1,2
3
2
3
( ) 0 8
0
where 9 32
b
tf t a
t
b ac
= = =
=
( 2.31)
Figure 2.16 shows different locations of the roots of equation 2.29. Having this
information we can search for the root in a smaller region.
0
0-0 000
0
0 00
b>0 t'1
-
7/31/2019 Shahab Thesis
40/111
DEVS Formalism 29
Example2.7. Falling Mass
Consider the falling mass mentioned in Example 2.4 again. In Example 2.4 two
cascaded single DEVS integrators were used to simulate a falling mass. Here we simulate
the exact same problem using one DEVS double integrator. Figure 2.17a shows the
DEVS result compared to the exact solution. Figure 2.17b depicts the error generated
(quantum=1, the same quantum as in Example 2.4). As seen in the figure this error is
much less than the error generated by two cascade DEVS integrators.
Figure 2.17- Simulation of a falling mass using one DEVS double integrator with initial velocity v0=20m/s, and initial
position x0=100m and Quantum=1. (a) Position vs. time: DEVS results compared to the exact solution.
(b) Position Error vs. time
-
7/31/2019 Shahab Thesis
41/111
DEVS Formalism 30
2.4 Discrete Event Control (DEC)
2.4.1 Introduction
Ramadge and Wonham [5] were the first control theorists to develop an approach to
design discrete event controllers. They modeled the plant as an automaton and used
language theory to design a controller that forces the plant to perform the desired
behavior. In order to connect means of control to the system, they classified events into
two categories: uncontrollable events, which can be observed, but cannot be prevented
from occurring (e.g. obstacle detected) and controllable events that can be enforced to or
prevented from occurring (e.g. stop or move) [5]. This method has been used by several
researchers to control discrete event models [17],[18].
In this framework a system is said to be controllable when you can reach any desired
state of the system, knowing the current state. Consequently, a controller (supervisor)
exists if the system is controllable.
Zeigler[2] reformulated the Ramadge-Wonham approach to controller design within
the DEVS formalism. He showed that if the plant is strongly controllable (defined
below), then the desired path could be mapped to a DEC using a transformation called
Inverse-DEVS.
2.4.2 Controllability of DEVS Models
Controllability in general means being able to reach any desired final state from any
initial state in finite time. A discrete event specified system is said to be controllable if
-
7/31/2019 Shahab Thesis
42/111
DEVS Formalism 31
there exist a controller that can implement a desired state trajectory[2]. Given a discrete
event plant M=(X, Y, S,ext,int,,ta), let ST be a desired state trajectory.
Definition 1 (weak controllability) A path ST is weakly controllable if a series of
internal and external transitions can take each state on the path to the next state on the
path3
. See Figure 2.18a.
Definition 2 (strong controllability) A path is strongly controllable if either an
internal or external transition can take each state on the path to the next state on the path
(Figure 2.18b). More formally, a path ST is strongly controllable if:
Forall si, si+1 such that si+1 follows si in ST, either:
a) int(si) = si+1, or
b) there is a pair (e,x), such thatext(si,e,x)=si+1 , where 0 < e < ta(si) and x is an
input.
Definition 3 (very strongly controllability)A strongly controllable path ST is a very
strongly controllable if:
For all si, si+1 such that si+1 follows si in ST, either:
a) int(si) = si+1, or
b) there is an input x such thatext(si,e,x)=si+1 for all 0 < e < ta(si).
Figure 2.18 illustrates the above three definitions. Filled circles represent states on the
desired path, ST=( s0, s1, , si, si+1, , sf). Thick lines denote internal or external
transitions that eventually lead one state on the path STto the next.
3 See [2]for a more formal definition forweak controllability.
-
7/31/2019 Shahab Thesis
43/111
DEVS Formalism 32
S0
Si
Si+1
Sf
int
(si)
ext
(si,e,x)
weak
weak
S0
Sk
Si+1
Sf
S0
Si+1 S
f
ta(s0) =
ta(si) =
ta=
Figure 2.18- Controllability Definitions: (a) weakly controllable (b) strongly controllable (c) very strongly controllable
path.
controllable (c) very strongly controllable
path.
(a) (b) (c)
2.5 Intelligent DEVS2.5 Intelligent DEVS
2.5.1 DEVS-Fuzzy Logic2.5.1 DEVS-Fuzzy Logic
A fuzzy logic controller consists of three operations: (1) fuzzification, (2) inference
engine, and (3) defuzzification. The input sensory (crisp or numerical) data are fed into
fuzzy logic rule based system where physical quantities are represented into linguistic
variables with appropriate membership functions. These linguistic variables are then used
in the antecedents (IF-Part) of a set of fuzzy IF-THEN rules within an inference engine
to result in a new set of fuzzy linguistic variables or consequent (THEN-Part) [12]
A fuzzy logic controller consists of three operations: (1) fuzzification, (2) inference
engine, and (3) defuzzification. The input sensory (crisp or numerical) data are fed into
fuzzy logic rule based system where physical quantities are represented into linguistic
variables with appropriate membership functions. These linguistic variables are then used
in the antecedents (IF-Part) of a set of fuzzy IF-THEN rules within an inference engine
to result in a new set of fuzzy linguistic variables or consequent (THEN-Part) [12]
A typical so-called Mamdani type rule can be composed as followsA typical so-called Mamdani type rule can be composed as follows
i
1 1 2 2IF is AND is THEN is , for 1, 2,...,i i ii
1 1 2 2IF is AND is THEN is , for 1, 2,...,i i ix A x A y B i = l
where and are the fuzzy sets representing the iiA1iA2
th-antecedent pairs, and are the
fuzzy sets representing the i
iB
th-consequent, and lis the number of rules.
We defineDEVS-Fuzzifieras follows:
ADEVS-Fuzzifieris a DEVS atomic model:
AMF =(X, Y, S, ext, int, , ta, )
where
-
7/31/2019 Shahab Thesis
44/111
DEVS Formalism 33
The input set, X, is usually a set of real numbers, to be fuzzified.
The output set Y = [0,1], since the output of this atomic model is a fuzzy value.
S is a sequence of fuzzified input values: S={si | si = ext(q,si-1,x) }.
ext(q,s,x)=(x), where is the membership function associated with this fuzzifier.
int(s) and (s) are the identity functions.
ta (s) =0 , since there is no time advance in this model.
(x) is the membership function associated with this fuzzifier.
This atomic model represents an antecedent membership function, while a consequent
membership function can be defined as:
CMF=(X, Y, S, ext, int, , ta, )
where
X is a set of fuzzy values, X=[0,1].
Y is a set of fuzzy sets, Y = {y |y is a fuzzy set}.
S is a set of discrete fuzzy sets (membership functions) 4.
ext(q,s,x)= min( ( ), )ii
a x
a
where is the membership function associated with this model. In fact this function
cuts those values of the fuzzy set (ai)/ai whose membership values are greater than x
(see Figure 2.19).
int(s)=s, (s)=s and ta=0.
4 The notation (ai)/ai denotes a discrete fuzzy set (membership function) [48].
-
7/31/2019 Shahab Thesis
45/111
DEVS Formalism 34
In a typical fuzzy rule, connectives are used to make connection between antecedent
pairs. An AND connective takes the minimum, while an OR connective returns the
maximum value of two pairs [12].
YX
Figure 2.19 A typical consequent membership function (CMF) model
Connectives are defined in DEVS as atomic models:
CNTV=(X1, X2, , Xn, Y, S, ext, int, , ta, )
where
X1== Xn =[0,1] are input sets. (A connective can have n inputs.), Y = S = [0,1],
int(s)=s, (s) = s, ta = 0,
ext(q,s,x1,xn) = min(x1,,xn), in case of AND and,
ext(q,s,x1,xn) = max(x1,,xn), in case of OR.
A fuzzy rule can be composed as a coupled model using the above three atomic
models. For instance, consider the following fuzzy rule: IF x is A OR x is B THEN z is
C. Figure 2.20 shows how this fuzzy rule can be composed using two Fuzzifiers, one
Connective and one CMF(consequent membership function).
-
7/31/2019 Shahab Thesis
46/111
DEVS Formalismlism 35
35
CMF
FZ
B
A
z
y
x
OR
Figure 2.20 A DEVS model for a typical fuzzy rule IF x is A OR y is B THEN z is CFigure 2.20 A DEVS model for a typical fuzzy rule IF x is A OR y is B THEN z is C
In order to fully implement a Fuzzy Logic Controller, a Defuzzifieris needed, which
can be defined in the same way. i.e. takes fuzzy sets as input and calculates the
defuzzified value (see [12] for further details about defuzzification methods).
In order to fully implement a Fuzzy Logic Controller, a Defuzzifieris needed, which
can be defined in the same way. i.e. takes fuzzy sets as input and calculates the
defuzzified value (see [12] for further details about defuzzification methods).
DeFZ==(X1, X2, , Xn, Y, S, ext, int, , ta)DeFZ==(X1, X2, , Xn, Y, S, ext, int, , ta)
wherewhere
Inputs of this atomic model are fuzzy sets so X1=X2==Xn ={x | x is a fuzzy set}.Inputs of this atomic model are fuzzy sets so X1=X2==Xn ={x | x is a fuzzy set}.
Output is a real number, Y = ,S = , int(s) = s, (s) = s, ta = 0,Output is a real number, Y = ,S = , int(s) = s, (s) = s, ta = 0,
ext(q,s,x1,xn) = Center_of_Gravity (x1 x2 xn )ext(q,s,x1,xn) = Center_of_Gravity (x1 x2 xn )
Center_of_Gravity(x) is a function which calculates the defuzzified value of fuzzy set
x using center of gravity method [12]:
Center_of_Gravity(x) is a function which calculates the defuzzified value of fuzzy set
x using center of gravity method [12]:
Center_of_Gravity (x) =Center_of_Gravity (x) = ( )
( )
x x dx
x dx
( 2.32)
Note that the time advance function (ta) is zero for all the above models, since we
dont want to have any delay time in any of the models.
Fuzzy-DEVS, i.e. the discrete event implementation of Fuzzy Logic Control, runs
faster than conventional methods. The reason is that the three operations of the fuzzy
-
7/31/2019 Shahab Thesis
47/111
DEVS Formalism 36
system in Fuzzy-DEVS, are activated only when there is an input event. In other words
the DEVS-Fuzzifiers (see Figure 2.20) are activated only when they receive a new input
event. Consecutively, they only generate output events if the new fuzzified value is
different from the previous one. As a result the connective models are activated only
when there is a change in their inputs, and the story continues. This kind of behavior
saves a lot of unnecessary calculations in a large system. However, for small number of
rules the performance is not significantly improved due to change-detection calculations
performed in Fuzzy-DEVS.
In practice, Fuzzy parameters can be tuned in two ways: first, by means of adding
extra input ports to the DEVS models and sending the parameters to them via input ports.
Second, directly changing the parameters internally, or having parameters accessible
from other models.
The first method makes the Fuzzy-DEVS tunable by connecting it to other DEVS
models, such as GA-DEVS and NN-DEVS, while the second method can be used to tune
the parameters by conventional tuning algorithms such as GA and NN.
Example 2.8. As an example consider the problem of controlling an inverted
pendulum. The linearized model is given by the following equation [19]:
[ ]
0 1 0 0 0
0.4 0 0 0 0.97
0 0 0 1 0
0 0 7.97 0 0.8
1 0 0 0
x u
y x
= +
=
&
( 2.33)
-
7/31/2019 Shahab Thesis
48/111
DEVS Formalism 37
where the four states are , ,x & and . The input to the system is force applied to the
cart. This system can be stabilized using a fuzzy logic controller, with the following three
rules:
x&
IF isPOS and& isPOS THEN Force isNEG
IF isNEG and& isNEG THEN Force isPOS
IF isZEROand& isZEROTHEN Force isZERO
where the membership functions POS, NEG and ZERO are defined in Figure 2.21a. Figure 2.21b
shows the DEVS-Fuzzy Logic Controller. The closed-loop system is shown in Figure 2.21c and
the output () of the system is shown in Figure 2.21d.
0 5 10 15 20 25 30 35-0.5
0
0.5
1
Time(sec)
Theta
ZERONEG POS
a) Membership functions for fuzzy-DEVS b) The fuzzy-DEVS controller
c) The close-loop system d) The output of the system ()
Figure 2.21. Example of using fuzzy-DEVS to control an inverted pendulum
-
7/31/2019 Shahab Thesis
49/111
DEVS FormalismFormalism 38
38
2.5.2 DEVS-SLA2.5.2 DEVS-SLA
2.5.2.1 Introduction to Stochastic Learning Automata (SLA)2.5.2.1 Introduction to Stochastic Learning Automata (SLA)
SLA seeks to model the learning-from-action process from intelligent beings. Namely,
reducing the probability of performing actions, which cause to receive penalty (pain) and
increase the probability of performing actions, which are rewarded from the environment
(pleasure).
SLA seeks to model the learning-from-action process from intelligent beings. Namely,
reducing the probability of performing actions, which cause to receive penalty (pain) and
increase the probability of performing actions, which are rewarded from the environment
(pleasure).
According to a famous remark by a psychologist (Benthams Theory of Value),
nature has placed mankind under the governance of two sovereign masters, pain and
pleasure. It is for them alone to point out what we ought to do, as well as to determine
what we shall do. On the one hand, the standard of right and wrong, on the other the
chain of causes and effects, are fastened to their throne[20], i.e. all human behavior is
motivated by and only by a desire to achieve pleasure and avoid pain. This behavior can
be mathematically formulated and used in control of intelligent systems.
According to a famous remark by a psychologist (Benthams Theory of Value),
nature has placed mankind under the governance of two sovereign masters, pain and
pleasure. It is for them alone to point out what we ought to do, as well as to determine
what we shall do. On the one hand, the standard of right and wrong, on the other the
chain of causes and effects, are fastened to their throne[20], i.e. all human behavior is
motivated by and only by a desire to achieve pleasure and avoid pain. This behavior can
be mathematically formulated and used in control of intelligent systems.
Environment
Automaton
ActionPenalty/Reward
Figure 2.22- Learning from action: gaining reward while avoiding penalty.Figure 2.22- Learning from action: gaining reward while avoiding penalty.
The learning process is as follows:The learning process is as follows:
The system (automata) has the option of choosing one action from n pre-defined
actions, each with a probability of being selected:Pi, i=1...n. (Pi = 1).
The system (automata) has the option of choosing one action from n pre-defined
actions, each with a probability of being selected:Pi, i=1...n. (Pi = 1).
-
7/31/2019 Shahab Thesis
50/111
DEVS Formalism 39
After performing the selected action, the result will be evaluated by one or more
teachers (environment), which will assign penalty or reward to the action based on the
desired objectives of the system.
Next, the system will update the probabilities by increasing (decreasing) the probably
of choosing actions that has received reward (penalty).
This process will be repeated until it converges.
This approach can be used to translate the experience of human to the rover domain.
Human like reasoning is achieved in SLA through the use of a teacher, which penalizes
or rewards a particular action taken by the agent or robot (i.e. using a human expert in
place of the teacher).
Figure 2.23 Schematic of SLA inside the DEVS Environment
2.5.2.2 Stochastic Learning Automata by DEVS
Stochastic Learning Automata (SLA) process can be modeled by DEVS as shown in
Figure 2.23. In this figure, n denotes the number of actions and m is the number of
teachers. Pi denotes the probability of the ith action. Here is a brief description of the
-
7/31/2019 Shahab Thesis
51/111
DEVS Formalism 40
atomic models shown in this figure: The Action-chooser-block chooses an action i
(i=1,2n) based on the probability that the action occurs. The agent (or agents in
multi-agent case) will perform the action and send the result(s) to the teacher(s). Each
teacher (denoted by Tj) assigns a reward orpenalty to the result(s). The summer
block sums up all the rewards and penalties assigned by teachers. If +1,-1 represent
reward and penalty respectively then the output of the summer will be an integerK {-
m, -m+1, , m-1 , m}. The next block updates the probabilities (Pis) based onK.
Example 2.9: As an example, consider a DEVS-SLA model with four actions and
three teachers (i.e. n=4,m=3). Figure 2.24 shows a possible scenario of the simulation.
After receiving the start signal, the Action chooser block changes its state to busy and
after a certain amount of time, generates the output (in this example action 3 has been
chosen), and goes back to the passive state. The Agent performs the action as soon as it
receives the message from Action chooser, changing its state to busy. After the action
is performed, the Agent block sends the result to teachers. As soon as the teachers
receive the result from agent, they go to busy state, evaluating the result. In this example
Teacher 1, assigned a penalty and two other teachers assigned a reward. Summer
collects the penalties and rewards assigned by teachers, and sends the result (in this case
+1) to the Update block. This block increases P3 (since the third action got a reward of
+1) and decreases the others.
-
7/31/2019 Shahab Thesis
52/111
DEVS Formalism 41
Figure 2.24. Possible results of an example for SLA_DEVS
Example 2.10: As another example, consider a mobile automaton (robot) with 8
moving actions: 1.North, 2.East, 3.South, 4.West, 5.North-East, 6.South-East, 7.South-
West and 8.North-West. Starting from some initial position (x0, y0), the automaton learns
to reach a goal position (xg, yg). Two teachers are used: one for X direction and one for Y
direction. Figure 2.25 shows the results of SLA-DEVS for an automaton going from
initial position (10,10) to the goal point (60,80).
-
7/31/2019 Shahab Thesis
53/111
DEVS Formalism 42
y
x
y
x
(a)
P8
P6
P7
P5
P4
P3
P2
P1
(b) (c)
Figure 2.25- A mobile automaton learns to reach a goal point using SLA. (a) Action probabilities vs. time (b) trajectory
of the automaton (c) x and y vs. time.
As figure shown the automaton first learns to perform action number 5 (Moving
toward North-East) until it reaches the desired x=60; after that different actions are
performed to reach the desiredy=80.
-
7/31/2019 Shahab Thesis
54/111
43
3. MOBILE ROBOTICS
3.1 Introduction
Mobile robotics involve several different arias of research such as path and motion
planning, sensor and action planning, sensor fusion, vision, machine learning, artificial
intelligence, pattern and image recognition, environment modeling, autonomous
behaviors, control and automation, multi-agent and cooperative systems. In this work we
focus on modeling, simulation and control of mobile robots, using DEVS and V-Lab5
.
Figure 3.1 shows a closed-loop block diagram for sensor-based mobile robots.
Feedback
External Sensors
(vision, infra-reds, sonar, etc)
Internal Sensors
(encoders,
compasses, etc)
OutsInputsRefs
Figure 3.1. Robot Functional Block Diagram
5 V-Lab is discussed in section 4.
-
7/31/2019 Shahab Thesis
55/111
Mobile Robotics 44
3.2 Modeling and Controllability of Mobile Robotsand Controllability of Mobile Robots
The mobile robot under consideration is a so-called unicycle robot with two
differential-drive wheels on the same axle (Figure 3.2). A robot with this kind of wheel
configuration has a non-linear property and also an underlying non-holonomic property
that adds to the complexity of the motion control problem.
The mobile robot under consideration is a so-called unicycle robot with two
differential-drive wheels on the same axle (Figure 3.2). A robot with this kind of wheel
configuration has a non-linear property and also an underlying non-holonomic property
that adds to the complexity of the motion control problem.
lv
2r
w
l
rv
( , )x y
v
Figure 3.2- A differential-wheeled mobile robotFigure 3.2- A differential-wheeled mobile robot
The locomotion system for such a mobile robot constitutes two parallel driving
wheels, the acceleration of each being controlled by an independent motor. Passive
castors ensure the stability of the platform. The reference point of the robot is the
midpoint of the two wheels; its coordinates, with respect to a fixed frame are denoted by
The locomotion system for such a mobile robot constitutes two parallel driving
wheels, the acceleration of each being controlled by an independent motor. Passive
castors ensure the stability of the platform. The reference point of the robot is the
midpoint of the two wheels; its coordinates, with respect to a fixed frame are denoted by
( , )( , )y ; the main direction of the vehicle is the direction of the driving wheels. With
designating the distance between the driving wheels, the dynamic model is [21]:
l
-
7/31/2019 Shahab Thesis
56/111
Mobile Robotics 45
( )
( )
( ) 1 2
1cos
2
1 0 0sin2 0 0
10 0
1 00 0 10
r l
r l
r l
r
l
v v
xv v
y
v v u ul
v
v
+
+ = + +
&
&
&
&
&
( 3.1)
where u and u are the accelerations of two independent motors. Figure 3.3 shows
the closed-loop feedback control block diagram for such a system.
1 2
Position
CurrentVelocity
Position
VelocityTorqueDesired
VelocityDesiredPosition Volt
Figure 3.3. Robot Motion Control
Figure 3.4 shows how we go from dynamics to kinematics6, assuming the desired
velocity is equal to the actual velocity. This assumption makes it a lot easier to control
this system. In real robots usually PID controllers at the low level control, ensure this
assumption providing the desired velocity. By choosing v and as inputs, the 5-
dimensional system will be reduced to the following 3-dimensional system:
r lv
6 Dynamics is A branch of mechanics that deals with forces and their relation primarily to the motion but sometimes
also to the equilibrium of bodies. (Merrian-Webster Dictionary), while kinematics is a branch of dynamics that
deals with aspects of motion apart from considerations of mass and force(Merrian-Webster Dictionary).
-
7/31/2019 Shahab Thesis
57/111
Mobile Robotics 46
( )
( )
( )
1cos
2
1sin
2
1
r l
r l
r l
x v v
y v v
v vl
= +
= +
=
&
&
&
( 3.2)
where | | and,maxr rv v ,max| |l lv v . By choosing1
(2
r lv v v )= + and1
( r lw v vl
= ) , we get
the kinematic model of equation 3.3.
cos
sin
x v
y v
w
==
=
&&
&
( 3.3)
where is the forward velocity and is the angular velocity. Of course and are
bounded with:
v w v w
min maxv v v and min maxw w w
This system is symmetric without drift and controllable from everywhere [21].
Kinematics is purely differential-geometrical issue independent from the dynamics, assuming the velocity to be the
system input [29].
-
7/31/2019 Shahab Thesis
58/111
Mobile Robotics 47
Velocity=Desired Velocity
Position
I G N O R E
Figure 3.4. Kinematic Controlrol
Its easier to control the linear and angular velocities v, w instead of left and right
velocities; however, in a real robot left and right velocities are required to control the
robot.
Its easier to control the linear and angular velocities v, w instead of left and right
velocities; however, in a real robot left and right velocities are required to control the
robot.
The relation between [The relation between [ ]T
r lv v and [ ]T
v w can be expressed by the following matrix
equation.
1 11
2 2 2
1 11
2
r r
l l
l
v vv v
v vw l
l l
= =
w( 3.4)
-
7/31/2019 Shahab Thesis
59/111
Mobile Robotics 48
Controllability
This model is a non-holonomic7
one, which is always controllable, thus the path
planning problem is always well posed [22],[21].Note that non-holonomic mechanical
systems, either in kinematics or dynamic form, cannot be stabilized at a point by smooth
feedback [22]. The alternatives are time-varying or discontinuous stabilizing feedback.
3.3 Motion Control of Mobile Robots
The motion control of mobile robots among obstacles is classified to three possible
motion tasks as follows [21]:
Point-to-point motion (goal searching): The robot is assigned to reach a
desired goal configuration starting from a given initial configuration, while
avoiding collision with obstacles. This task is sometimes calledPath planning
in the literature.
Path following: The robot must reach and follow a geometric path in the
Cartesian space starting from a given initial configuration (on or off the path).
Trajectory tracking: The robot must reach and follow a trajectory in the
Cartesian space (i.e., a geometric path with an associated timing law) starting
from a given initial configuration.
7 A nonholonomic control system is a system with nonholonomic constraint --a kinematic constraint that cannot be
integrated [22]. For a wheeled mobile robot the nonholonomic constraint is: cos sin 0y x =& & .
-
7/31/2019 Shahab Thesis
60/111
Mobile Robotics 49
3.3.1 Path Planning Methods
Path planning (goal searching) involves two questions: first, is there exists a
collision-free admissible path? Second, how can one compute such a path. The
existence of a path depends on the configuration of the obstacles in the environment and
the initial configuration of robot. Thepath-computation problem has been receiving more
attention by researchers. There are several approaches which can be used for path
planning: Regulation of a nonholonomic dynamic wheeled mobile robot with parametric
modeling uncertainty using lyapunov function [23], a so called virtual vehicle approach
for control of mobile robots [24], game theory approaches [25],[26], a bang-bang control
technique [27], a quasi-continuous output feedback method [28], natural algebraic
structure of chained form system together with sliding mode theory [29], optimal path
planning approaches [30], [31], [32], evolutionary control architecture [16] visibility
graphs [33],[34] and other methods [35],[37],[22],[21].
Problem definition: The problem is simply to determine v and w such that the
system of equation 3.3 steers the robot arbitrarily close to a goal configuration (xg,yg,g).
Our solution: We propose the following control law to steer the robot to a goal
configuration (xg,yg,g).
Consider the system of equation 3.3. The following inputs:
-
7/31/2019 Shahab Thesis
61/111
Mobile Robotics 50
cos( )
sin( )
v a
w b
=
= ( 3.5)
where arctan( )g
g
y y
x
=
, steer the system to the goal point (xg,yg) if a and b are
chosen properly.
After reaching the goal point, robot can turn (in place) to reach the angle gi.e.
0
sin( )g
v
w b
=
= ( 3.6)
Without any loss of generality the goal can be assumed to be at the origin, any other
goal can be moved to the origin be a coordinate transformation..
Using the proposed control law, the system becomes:
cos( )cos( )
cos( )sin( )
sin( )
x a
y a
b
=
=
=
&
&
&
( 3.7)
Here is how one can choose a and b to stabilize the system:
b is associated with the angular velocity and a with the linear velocity of the system.
bsin(-) turns the robot toward the goal direction . The bigger the b, the faster it turns.
On the other hand a determines how fast the robot moves forward. Intuitively, robot
should first turn toward the goal direction and then move forward to the goal.
Consequently, ifb is chosen to be larger than a, this controller law should work. After
reaching the goal position let v=0, and robot turns to reach the goal direction.
-
7/31/2019 Shahab Thesis
62/111
Mobile Robotics 51
Figure 3.5 shows the outcome of this controller, for a=1 and b=4 and initial condition
(1,2,/4).
r a=1 and b=4 and initial condition
(1,2,/4).
(rad)
v,w
x,y
Initial Condition :(1, 2, /4)
y
x
b) State variables vs. timea) Trajectory
Figure 3.5. The system of equation 3.7 for a=1 and b=4;Figure 3.5. The system of equation 3.7 for a=1 and b=4;
It can be seen from the trajectory graph that, robot first goes backward and after a
while goes forward. By using the absolute value forv, robot will always go forward.
It can be seen from the trajectory graph that, robot first goes backward and after a
while goes forward. By using the absolute value forv, robot will always go forward.
Figure 3.6shows the result of changing b for the same system, b varies from 4a to a
and a is equal to 1. In
Figure 3.6shows the result of changing b for the same system, b varies from 4a to a
and a is equal to 1. In
Figure 3.6a the initial direction 0 is equal to /4, and inFigure 3.6a the initial direction 0 is equal to /4, and in
Figure 3.6b, 0 is equal to -/4.Figure 3.6b, 0 is equal to -/4.
Figure 3.7depicts the trajectory of the system for 8 different initial positions.Figure 3.7depicts the trajectory of the system for 8 different initial positions.
b=1
b=1.5
b=2
b=4
b=3
b=1
b=1.5
b=2
b=4b=3
a) 0=/4 b) 0=-/4
-
7/31/2019 Shahab Thesis
63/111
Mobile Robotics 52
Figure 3.6. Effect of changing b from 4a down to a.Figure 3.6. Effect of changing b from 4a down to a.
(6, 0, /4)
(6, -5, /4)(0, -5, /4)(-6, -5, /4)
(-6, 0, /4)
(-6, 5, /4)
(0, 5, /4)
(6, 5, /4)
a=1
b=1
Figure 3.7. Trajectory of the system of equation 3.7 for different initial conditionsFigure 3.7. Trajectory of the system of equation 3.7 for different initial conditions
Parameters a and b can be time varying such that as robot approaches the goal it
slows down, too. For example they can be proportional to the robots distance to the goal.
Parameters a and b can be time varying such that as robot approaches the goal it
slows down, too. For example they can be proportional to the robots distance to the goal.
2 2
( )
2 ( )
( ) ( ) ( )g g
a r t
b r t
r t x x y y
=
=
= +
( 3.8)
Figure 3.8 shows the result for the above control strategy. Note that total energy of
the system, is damping (Figure 3.8b) since both angular and linear velocities w,v decay to
zero.
-
7/31/2019 Shahab Thesis
64/111
Mobile Robotics 53
2 21 ( )2
E Mv Iw= +& &
(b) Total Energy(a) Trajectory
(c) State variables
Figure 3.8. Using time-varying a and b as defined in equation 3.8Figure 3.8. Using time-varying a and b as defined in equation 3.8
Stability8
AnalysisStability8
Analysis
Here we analyze the Lyapunov stability of the system. We find condition fora and b
under which the proposed controller makes the system asymptotic stable. Consider the
following positive definite Lyapunov function:
Here we analyze the Lyapunov stability of the system. We find condition fora and b
under which the proposed controller makes the system asymptotic stable. Consider the
following positive definite Lyapunov function:
-
7/31/2019 Shahab Thesis
65/111
Mobile Robotics 54
2( , , , ) 1 cos( )V r t r = + + ( 3.9)
where rand are polar coordinates of the robot. Obviously this function is a positive
definite one. We need to show that
( , , , )0
V r t
t
( 3.16)
This condition is satisfied ifb is chosen such that:
-
7/31/2019 Shahab Thesis
67/111
Mobile Robotics 56
ab
r > ( 3.17)
Finally,
0, 0, 0a
r bb
> > < 0 (where r0 is the desired distance of the robot to the goal, and can be
arbitrarily small), as a result, a and b, satisfying the following inequality, guarantee the
asymptot
top related