System modeling and simulation an introduction 1st Edition Frank L. Severance instant download
System modeling and simulation an introduction 1st Edition Frank L. Severance instant download
https://ebookgate.com/product/system-modeling-and-simulation-an-
introduction-1st-edition-frank-l-severance/
https://ebookgate.com/product/introduction-to-digital-systems-
modeling-synthesis-and-simulation-using-vhdl-1st-edition-mohammed-
ferdjallah/
ebookgate.com
https://ebookgate.com/product/electromagnetic-modeling-and-
simulation-1st-edition-levent-sevgi/
ebookgate.com
https://ebookgate.com/product/introduction-to-law-and-the-legal-
system-11th-edition-frank-august-schubert/
ebookgate.com
https://ebookgate.com/product/introduction-to-law-and-the-legal-
system-tenth-edition-frank-august-schubert/
ebookgate.com
solid fuels combustion and gasification modeling
simulation and equipment operation 1st Edition Marcio L.
De Souza-Santos
https://ebookgate.com/product/solid-fuels-combustion-and-gasification-
modeling-simulation-and-equipment-operation-1st-edition-marcio-l-de-
souza-santos/
ebookgate.com
https://ebookgate.com/product/modeling-and-simulation-in-python-allen-
b-downey/
ebookgate.com
https://ebookgate.com/product/underwater-acoustic-modeling-and-
simulation-3rd-ed-edition-etter/
ebookgate.com
https://ebookgate.com/product/underwater-acoustic-modeling-and-
simulation-4th-ed-edition-etter/
ebookgate.com
https://ebookgate.com/product/chromatographic-processes-modeling-
simulation-and-design-1st-edition-roger-marc-nicoud/
ebookgate.com
SYSTEM MODELING
and SIMULATION
This page intentionally left blank
SYSTEM MODELING
and SIMULATION
An Introduction
Frank L. Severance, Ph.D.
Professor of Electrical and Computer Engineering
Western Michigan University
All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under
the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright
Licensing Agency, 90 Tottenham Court Road, London W1P 9HE, UK, without the permission in writing of the
Publisher.
Q295.S48 2001
003'.3–dc21
Preface ix
J DESCRIBING SYSTEMS
DYNAMICAL SYSTEMS 32
STOCHASTIC GENERATORS 84
282
ft
2 MARKOV PROCESSES 334
APPENDICES 476
INDEX 500
PREFACE
It is unlikely that this book would have been written 100 years ago. Even though there
was a considerable amount of modeling going on at the time and the concept of signals
was well understood, invariably the models that were used to describe systems tended to be
simplified (usually assuming a linear response mechanism), with deterministic inputs.
Systems were often considered in isolation, and the inter-relationships between them were
ignored. Typically, the solutions to these idealized problems were highly mathematical and
of limited value, but little else was possible at the time. However, since system linearity
and deterministic signals are rather unrealistic restrictions, in this text we shall strive for
more. The basic reason that we can accomplish more nowadays is that we have special help
from the digital computer. This wonderful machine enables us to solve complicated
problems quickly and accurately with a reasonable amount of precision.
For instance, consider a fairly elementary view of the so-called carbon cycle with the
causal diagram shown on the next page. Every child in school knows the importance of
this cycle of life and understands it at the conceptual level. However, "the devil is in the
details", as they say. Without a rigorous understanding of the quantitative (mathematical)
stimulus/response relationships, it will be impossible to actually use this system in any
practical sense. For instance, is global warming a fact or a fiction? Only accurate modeling
followed by realistic simulation will be able to answer that question.
It is evident from the diagram that animal respiration, plant respiration, and plant and
animal decay all contribute to the carbon dioxide in the atmosphere. Photosynthesis affects
the number of plants, which in turn affects the number of animals. Clearly, there are
feedback loops, so that as one increases, the other decreases, which affects the first, and so
on. Thus, even a qualitative model seems meaningful and might even lead to a degree of
understanding at a superficial level of analysis. However, the apparent simplicity of the
diagram is misleading. It is rare that the input—output relationship is simple, and usually
each signal has a set of difference or differential equations that model the behavior. Also,
the system input is usually non-deterministic, so it must be described by a random process.
Even so, if these were linear relationships, there is a great body of theory by which closed-
form mathematical solutions could, in principle, be derived.
We should be so lucky! Realistic systems are usually nonlinear, and realistic signals
are noisy. Engineered systems especially are often discrete rather than continuous. They
are often sampled so that time itself is discrete or mixed, leading to a system with multiple
PREFACE
/'^'^atmospheric
carbon dioxide
time bases. While this reality is nothing new and people have known this for some time, it
is only recently that the computer could be employed to the degree necessary to perform
the required simulations. This allows us to achieve realistic modeling so that predictable
simulations can be performed to analyze existing systems and engineer new ones to a
degree that classical theory was incapable of.
It is the philosophy of this text that no specific software package be espoused or used.
The idea is that students should be developers new tools rather than simply users of
existing ones. All efforts are aimed at understanding of first principles rather than simply
rinding an answer. The use of a Basic-like pseudocode affords straightforward implemen-
tation of me many procedures and algorithms given throughout the text using any standard
procedural language such as C or Basic. Also, all algorithms are given in detail and
operational programs are available on the book's Website in Visual Basic.
This book forms the basis of a first course in System Modeling and Simulation in
which the principles of time-driven and event-driven models are both emphasized. It is
suitable for the standard senior/first-year graduate course in simulation and modeling that
is popular in so many modern university science and engineering programs. There is ample
material for either a single-semester course of 4 credits emphasizing simulation and
modeling techniques or two 3-credit courses where the text is supplemented with
methodological material. If two semesters are available, a major project integrating the
key course concepts is especially effective. If less time is available, it will likely be that a
choice is necessary - either event-driven or time-driven models. An effective 3-credit
PREFACE xi
course stressing event-driven models can be formed by using Chapter 1, the first half of
Chapter 3, and Chapters 7-9, along with methodological issues and a project. If time-
driven models are to be emphasized, Chapters 1—6 and 10 will handle both deterministic
and non-deterministic input signals. If it is possible to ignore stochastic signals and Petri
nets, a course in both time-driven and event-driven models is possible by using Chapters 1
and 2, the first half of Chapter 3, Chapter 4, and Chapters 8-10.
ACKNOWLEDGEMENTS
As with any project of this nature, many acknowledgments are in order. My students
have been patient with a text in progress. Without their suggestions, corrections, and
solutions to problems and examples, this book would have been impossible. Even more
importantly, without their impatience, I would never have finished. I thank my students,
one and all!
Frank L. Severance
Kalamazoo, Michigan
This page intentionally left blank
CHAPTER 1
Describing Systems
problem, but in the quest for total understanding no atomic-level decomposition for any
physically real system has ever been achieved!
The power of the systems approach and its wide acceptance are due primarily to the
fact that it works. Engineering practice, combined with the large number of mathematically
powerful tools, has made it a mainstay of science, commerce, and (many believe) western
culture in general. Unfortunately, this need for practical results comes at a price. The price
is that universal truth, just like atomic truth, is not achievable. There is always a restricted
range or zone over which the system model is functional, while outside this application
domain the model fails. For instance, even the most elegant model of a human being's
circulatory system is doomed to failure after death. Similarly, a control system in an
automobile going at 25 miles per hour is going to perform differently than one going at
100 miles per hour. This problem can be solved by treating each zone separately. Still there
is a continuity problem at the zone interfaces, and, in principle, there needs to be an infinite
number of zones. Again, good results make for acceptance, even though there is no
universal theory.
Therefore, we shall start at the beginning, and at the fundamental question about just
what constitutes a system. In forming a definition, it is first necessary to realize that
systems are human creations. Nature is actually monolithic, and it is we, as human beings,
who either view various natural components as systems or design our own mechanisms to
be engineered systems. We usually view a system as a "black box", as illustrated in Figure
1.1. It is apparent from this diagram that a system is an entity completely isolated from its
environment except for an entry point called the input and an exit point called the output.
More specifically, we list the following system properties.
P1. All environmental influences on a system can be reduced to a vector of m real
variables that vary with time, x(t) = [x1(t), . . . , xm(t)]. In general, x(t) is called the
input and the components xi(t) are input signals.
P2. All system effects can be summarized by a vector of n real variables that vary
with time, z(t) = [z 1 (t), . . . , zn(t)]. In general, z(t) is called the output and the
components zi(t) are output signals.
P3. If the output signals are algebraic functions of only the current input, the system
is said to be of zeroth order, since there can be no system dynamics. Accordingly,
there is a state vector y(t) = [v1](t), • • • yp(t)], and the system can be written as
input output
System
state
y(t)
environment
1.1
for suitable functions f1 and f2. Since the state y(t) is given explicitly, an
equivalent algebraic input—output relationship can be found. That is, for a suitable
function g,
(1.2)
P4. If the input signal depends dynamically on the output, there must also be system
memory. For instance, suppose that the system samples a signal every
t = 0, 1,2, . . . seconds and that the output z(t) depends on input x(t — 1). It
follows that there must be two memory elements present in order to recall
x(t — 1) and x(t — 2) as needed. Each such implied memory element increases the
number of system state variables by one. Thus, the state and output equations
comparable to Equations (1.1) and (1.2) are dynamic in that f1 and f2 now depend
on time delays, advances, derivatives and integrals. This is illustrated diagram-
matically in Figure 1.2.
input output
xo
o VW
EXAMPLE 1.1
Consider the electrical resistive network shown in Figure 1.3, where the system is
driven by an external voltage source vs(t). The output is taken as the voltage vR(t)
across the second resistor R2.
Since there is a Single Input and a Single Output, this system is called SISO.
The input—output identification with physical variables gives
x(t) = vs(t),
,;
z(f) = vR(t).
(1.3)
Since the network is a simple voltage divider circuit, the input—output relationship
is clearly not dynamic, and is therefore of order zero:
:«• (1.4)
In order to find the state and output equations, it is first necessary to define the
state variable. For instance, one might simply choose the state to be the output,
y(t) = z(t). Or, choosing the current as the state variable, i.e., y(t) = i(t), the state
equation is y(t) = x(t)/(R1 + R2) and the output equation is z(t) = R2y(t).
Clearly, the state is not unique, and it is therefore usually chosen to be
intuitively meaningful to the problem at hand. O
EXAMPLE 1.2
Consider the resistor—capacitor network shown in Figure 1.4. Since the capacitor
is an energy storage element, the equations describing the system are dynamic.
As in Example 1.1, let us take the input to be the source voltage vs(t) and the
output as the voltage across the capacitor, vc(t). Thus, Equations (1.3) still hold.
Also, elementary physics gives RCdvc/dt + vc = vs. By defining the state to be
the output, the state and output relationships corresponding to Equations (1.1) are
: 1
^MO-XOL (15)
1.1 The Nature of Systems
As will be customary throughout this text, dotted variables denote time deriva-
tives. Thus,
Electrical circuits form wonderful systems in the technical sense, since their voltage-
current effects are confined to the wire and components carrying the charge. The effects of
electrical and magnetic radiation on the environment can often be ignored, and all system
properties are satisfied. However, we must be careful! Current traveling through a wire
does affect the environment, especially at high frequencies. This is the basis of antenna
operation. Accordingly, a new model would need to be made. Again, the input—output
signals are based on abstractions over a certain range of operations.
One of the most popular system applications is that of control. Here we wish to cause
a subsystem, which we call a plant, to behave in some prescribed manner. In order to do
this, we design a controller subsystem to interpret desirable goals in the form of a
reference signal into plant inputs. This construction, shown in Figure 1.5, is called an
open-loop control system.
Of course, there is usually more input to the plant than just that provided by the
controller. Environmental influences in the form of noise or a more overt signal usually
cause the output to deviate from the desired response. In order to counteract this, an
explicit feedback loop is often used so that the controller can make decisions on the basis
of the reference input and the actual state of the plant. This situation, shown in Figure 1.6,
is called a feedback control or closed-loop control system.
The design of feedback control systems is a major engineering activity and is a
discipline in its own right. Therefore, we leave this to control engineers so that we can
concentrate on the activity at hand: modeling and simulating system behavior. Actually, we
als j : response
r ' >
! 2(0
Controller Plant
k ^ ^ ^
disturbance
goals response
r ^ r ^
u,(0
Controller Plant
^ ^ L. ^
will still need to analyze control systems, but we will usually just assume that others have
already designed the controllers.
The electrical circuit systems described in Examples 1.1 and 1.2 are cases of
continuous time-driven models. Time-driven models are those in which the input is
specified for all values of time. In this specific case, time t is continuous since the
differential equation can be solved to give an explicit expression for the output:
t>c(0 = M'o) KL
(1.6)
7^Jtfn
Where vc(t0)is the initial voltage accross the capacitor at time t = t0. Thus, as time
"marches on", successive output values can be found by simply applying Equation (1.6).
In many systems, time actually seems to march as if to a drum; system events occur
only at regular time intervals. In these so-called discrete-time-based systems, the only
times of interest are tk = t0 + hk for k = 0, 1, . . . . As k takes on successive non-negative
integer values, tk begins at initial time t0 and the system signal remains unchanged until h
units later, when the next drum beat occurs. The constant length of the time interval
tk+1 = tk = h is the step size of the sampling interval.
The input signal at the critical event times is now x(tk) = x(t 0 4+hk). However, for
convenience, we write this as x(tk) = x(k), in which the functional form of the function x is
not the same. Even so, we consider the variables t and k as meaning "continuous time"
and "discrete time", respectively. The context should remove any ambiguity.
EXAMPLE 1.3
Consider a continuous signal x(t) = COS(TT/), which is defined only at discrete
times tk = 3 +\k. Clearly the interval length is h = | and the initial time is
1.1 The Nature of Systems
— 3. Also,
x(tk} = cos[n(3 + ±
= — cos(| nk]
0, k = odd,
(1.7)
Thus, we write
k = odd,
(1.8)
and observe the significant differences between the discrete form of x(k) given in
Equation (1.8) and the original continuous form x(t) = cos(nt). O
EXAMPLE 1.4
Consider a factory conveyor system in which boxes arrive at the rate of one box
each 10 seconds. Each box is one of the following weights: 5, 10, or 15 kg.
However, there are twice as many 5 kg boxes and 15 kg boxes as 10 kg boxes. A
graphic of this system is given in Figure 1.7. How do we model and simulate this?
Solution
From the description, the weight distribution of the boxes is
w Pr[W = w]
5 0.4
10 0.2
15 0.4
1.0
conveyor
arrived boxes
incoming boxes
where W is a "weight" random variable that can take on one of the three discrete
values W e {5, 10,15}. The notation Pr[W = w] is read "the probability that the
random variable W is w". The set {5,10,15} is called the sample space of W, and
is the set of all possible weights.
According to the description, these boxes arrive every 10 seconds, so
t = 10k gives the continuous time measured in successive k-values, assuming
the initial time is zero. However, how do we describe the system output? The
problem statement was rather vague on this point. Should it be the number of
boxes that have arrived up to time t? Perhaps, but this is rather uninteresting.
Figure 1.8 graphs N(t) = number of boxes that have arrived up to and including
time t as a function of time t.
A more interesting problem would be the weight of the boxes as they arrive.
Unlike N(t), the weight is a non-deterministic variable, and we can only hope to
simulate the behavior of this variable W(k) = weight of the kth event. This can be
accomplished by using the RND function, which is a hypothetical random
number generator that provides uniformly random distributed variates such that
10 20 30 40
0 < RND < 1. The following routine provides output w(l), w(2), . . . , w(n),
which is the weight of the first n boxes:
for k=l to n
r=10*RND
if r<4 then w(k)=5
if 4 ^ r<6 then w(k)=10
if r ^ 6 then w(k)=15
next k
While this routine simulates the action, useful results must be statistically
analyzed since the input was non-deterministic in nature. After a sufficiently
large simulation run, frequencies of each type of box arrival can be tallied and
graphed. Figure 1.9 shows a run of 100 simulated arrivals compared against the
ideal as defined by the problem statement. O
The system described in Example 1.4 has just a single state variable. By
knowing w(k), we know all there is to know about the system. For instance, we need
not know any history in order to compute the output since only the kth signal is important.
To see the significance of the state concept as exemplified by memory, consider one further
example.
EXAMPLE 1.5
Consider a factory system with two conveyors: one brings in boxes as described
in Example 1.4, but this time arriving boxes are placed on a short conveyor that
holds exactly 3 boxes. Arriving boxes displace those on the conveyor, which
presumably just fall off! In this case, we do not care about the individual box
weight, rather we care about the total weight on the conveyor of interest. Thus,
the input x(k) in this example can be simulated by the output of Example 1.4.
However, in order to determine the output g(k), the system must remember the
two previous inputs as well. Characterize this system.
Solution
Since the system input is a random variable, the output must be non-deterministic
as well. At the same time, after the conveyor has been loaded, two of the three
spots are known. Thus,
z(k} = (1.9)
x(k) + x(k-l)+x(k- 2), k > 2.
Mathematically Equation (1.9) is a second-order difference equation, z(k) =
x(k) + x(k — 1) +x(k — 2), subject to the two initial conditions z(l) = x(l) and
z(2) = x(l) + x(2). This corresponds to the two memory elements required. A
complete simulation of this model is shown in Listing 1.1. The first four
statements inside the loop are identical to the single-conveyor system described
in Example 1.4. The last three statements describe the second conveyor of this
example. O
for k=l to n
r=10*RND
if r<4 then x(k)=5
if 4 ^ r<6 then x(k)=10
if r ^ 6 then x(k)=15
if k=l then z(k)=x(l)
if k=2 then z(k)=x(1)+x (2)
if k>2 then z(k)=x(k)+x(k-1)+x(k-2)
next k
LISTING 1.1 Simulation of the two-conveyor system, Example 1.5.
From the sequence thus generated, answers to the P n (t) and FT(t) questions can be
found.
Chapter 1: Describing Systems
EXAMPLE 1.6
A(t)
•1 p
V
'o=0 f
J *3 4
t 0 =o
for k=l to n
t k =t k _ x +RND
next k
for t=0 to t n step h
for k=l to n
if tk-i ^ t<t k then N=k
next k
print t, N
next t
LISTING 1.2 Simulation for Example1.6.
Even more importantly, the inputs that drive these systems must often be characterized by
their basically stochastic nature. However, even though this input may appear random,
more often than not the input distribution is a random process with well-defined statistical
parameters. Thus, we use a probabilistic approach.
For example, one of the central problems encountered in telephony is that of message
traffic. Engineers need to know the state of the telephone communications network (that is,
the number of callers being serviced) at all times. Over a period of time, callers initiate
service (enter the system) and hang up (depart the system). The number of callers in the
system (arrivals minus departures) describes the state. Thus, if the state is known,
questions such as "over a period of time, just how many phone calls can be expected?"
and "how many messages will be terminated in so many minutes?" can be addressed. The
answer to these questions is not precisely predictable, but, at the same time, average or
expected values can be determined. Thus, while not deterministic, the state is statistically
remarkably regular and is true regardless of message rate. That is, even though an operator
in New York City will experience far more traffic than one in Kalamazoo, Michigan,
relatively speaking their probability distributions are nearly identical.
1.3
Models are characterized by their system behavior and the type of input accepted by
the system. Once both the input and system behavior is known, the output can be found.
This is known as the analysis problem. For instance, a model might be a simple function
machine that doubles the input and adds one as follows:
f: z=2x+l
Such a model, which simply algebraically transforms the input, is a zeroth-order, time-
independent system, since there are no states and the formula relating input and output is
independent of time. Regardless of what the input type is and regardless of the historical
record, the transformation f is always the same.
14 Chapter 1: Describing Systems
Since the above system is a zeroth-order model, a natural question is just what
constitutes a first- or second-order model. Higher-order models all implicitly involve time.
For instance, the input—output relationship defined by z(k) + 4z(k — 1) = x(k) charac-
terizes a first-order discrete system, because the output at any discrete time k depends
not only on the input but on the output at the previous time as well. Thus, there is an
implied memory or system state. Similarly, the input—output relationship defined by
z(k) + 4z(k — 1) + 3z(k — 2) = x(k) is a second-order system, since the history required is
two epochs.
There are two subtle problems raised in defining higher-order systems like this. First,
if it is necessary to always know the history, how does one start? That is, the output z(n) for
an nth-order system is easy to find if one already knows z(0), z(l), . . . , z(n — 1). There-
fore, these initial states need to be given a priori. This is a good news-bad news sort of
question. It turns out that if the system is linear and stable, the initial conditions become
irrelevant in the long run or steady state. Of course, the bad news is that not all systems are
linear or stable; indeed, sensitivity to initial conditions tends to be a hallmark of nonlinear
systems, which may even be chaotic.
The other subtlety is the nature of time. The discrete-time structure implied by the
variable k above is akin to that of a drum beating out a regular rhythm. In this case, time
"starts" at k = 0 and just keeps going and going until it "ends" at time k = n. This is a
useful concept for models such as a game of chess where z(k) represents the state of a
match on the kth move. Time k has little or no relationship to chronological time t. In
contrast, real or chronological time tends to be continuous, and is most familiar to us as
humans in that we age over time and time seems to be infinitely divisible. The variable t is
commonly used to denote chronological time, and dynamical systems describing contin-
uous-time phenomena are represented by differential equations rather than the difference
equations of the discrete-time case. In this case, the differential equation
z + 4z + 3z = x(t) is a second-order system, because we recognize that it requires two
initial conditions to define a unique solution. In general, an nth-order linear differential
equation will define an nth-order system, and there will be n states, each of which will
require an initial condition z(0), z(0), . . . , z(n–1)(0).
Whether by algebraic, difference, or differential equations, continuous and discrete
models as described above are called regular, since time marches on as to a drum beat.
Assuming that the inter-event time is a constant d time unit for each cycle, the frequency of
the beat is f = 1/6 cycles per time unit. In the limiting case of continuous time, this
frequency is infinity, and the inter-event time interval is zero. However, not all models are
regular.
As we have seen earlier, some models are defined by their inter-event (often
called inter-arrival) times. Such systems lie dormant between beats, and only change
state on receipt of a new event; thus they are event-driven models. Event-driven models
are characterized by difference equations involving time rather than output variables.
By denoting the time at which the kth event occurs by tk, the system defined by
*k+\ ~ h = k2 has ever-increasing inter-event intervals. Similarly, the system defined
by tk+1 — tk = 2 is regular, since the inter-event time is constant and the system
defined by tk+l — tk = RND, where RND is a random number uniformly distributed on
the interval [0,1], is stochastic. Stochastic systems are especially rich, and will be
considered in detail later.
1.4 Simulation Diagrams 15
All this is illustrated in Figure 1.11. Within connected arcs, an across signal is always
the same. For instance in Figure 1.11 (a), even though the paths split, the values along each
path are the same and x(t) = y(t) = z(t). In contrast, in Figure l.11(b), as the through
signal tk comes to the junction, some of the messages (or people, boxes, events, or
whatever) go up and the rest go down. This requires some sort of distributor D to select
which object goes where. There are a number of choices here, but in the end the number
that enter a node is the sum of those going up and those going down. However, our
description gives times, not objects. Thus we consider the each explicit listing of each time
sequence, [tk] = [t1, t2 • • • , tm+n], [rk] = [r1, r2, • • •, rm] and [sk] = [s1, s2, . . . , sn], where
each vectored sequence is listed in ascending order by convention. It follows from this that
[tk] = [rk] U [sk], where the operation U is called the merge union.
EXAMPLE 1.7
Consider the system below, in which two through signals are combined at a
collector junction C. Find and graph each signal as a function of chronological
time.
[rj-[0.2. 2.4.6.1]
*J-[1.5,4.1,5.5, 8.6J
Solution
The merge union of sequences rk and sk is [tk] = [0.2, 1.5,2.4,4.1, 5.5,6.1, 8.6].
Each graph is shown in Figures 1.12-1.14. Notice that each graph is actually an
integral function of time, k = k(t), and that there is no direct relationship between
tk, which is simply the kth component of the vector [tk], and /, which is continuous
time. O
The names across and through signals are motivated by voltage and current as
encountered in electrical circuits. Voltage is a potential difference between two points. As
such, any two points in the same wire not separated by a component (such as a resistor or
capacitor) are electrically equivalent. Thus, within the same or connected arcs, a voltage
signal is the same. From an electrical perspective, the way by which voltage is measured is
across an element between two points. This contrasts with current, which is a through
signal. Current is an absolute (charge per unit time) rather than a relative difference, and
thus conservation principles apply. It is much like water in a plumbing system: what goes
1.4 Simulation Diagrams 17
y(0
-KD -KD
xfl)
O
z(0
-K) -K3
in must come out. In measuring current, it is necessary not to measure between two points,
but at a single point. Thus we speak of current through a point or, in the more general
sense, a through signal.
The nature of a dynamic system is that it will evolve over time, and, therefore,
interesting results tend to be state-versus-time graphs. In cases where the signal is discrete,
some correlation is also made with continuous time as well. For instance, in studying
queuing systems in which customers line up at a service counter, the input signals are often
characterized by inter-arrival times. As an example, the mathematical statement
tk — t k _ 1 = RND can be interpreted as "the inter-arrival time between two successive
events is a random number uniformly distributed on the interval [0, 1]". A useful
simulation to this model will be able to find N(t), the number of events that have occurred
up to time t. How to go from a statement regarding signals in one form to another is
important.
v.- 3
0)
.a
f 2
I1
0)
4
time, rk
FIGURE 1.12 Graph of [rk], Example 1.7.
18 Chapter 1: Describing Systems
2
I
4 6 10
time, sk
FIGURE 1.13 Graph of [sk], Example 1.7.
8 :
0 2 4 6
time, tk
FIGURE 1.14 Graph of [tk], Example 1.7.
Two other important classes of contrasting signals are those that use continuous time
versus those that use discrete time. Continuous time is the time that we as human beings
are used to. Given any two time instants [t1, t2], we can always conceptualize another time
instant t in between: t1, < t < t2. In this so-called chronological time, even time concepts
such as t = >/2 seconds are not unreasonable. However, not all systems are dynamic with
respect to chronological time. Biological systems are dynamic in that they change over
time, but different organisms see their physiological times quite differently. For that matter.
1.4 Simulation Diagrams 19
not all systems are even dynamic. In modeling a chess game, the only time that makes
sense is the number of moves into the game. How long it takes to decide on the move is
rather irrelevant. This, of course, is an example of discrete time. There are consecutive
times instants, and in between any two consecutive moments there is nothing.
Just as there is a relationship between chronological time and physiological time, there
are often relationships between continuous time and discrete time. In an engineered system
involving microprocessors that acquire, process, and control signals, it is common to
sample the continuous signal presented by the world. This sampled signal is stored and
processed by a computer using the sampled value. Presumably, the cost of losing
information is compensated by the power and versatility of the computer in processing.
However, if control is required, the discrete signal must be converted back into a
continuous signal and put back into the continuous world from which it came. This
process is called desampling. Sampled signals are called regular discrete signals, since
their instances are chronologically similar to a drum beat - they are periodic and
predictable.
In contrast to regularly sampled signals, there are event-driven discrete signals where
the signal itself is predictable, but the time at which it occurs is not. For example, the
signal N(t) that is "the number of customers waiting in line for tickets to a football game"
has a predictable state (consecutive integers as arrivals come), but the times at which
arrivals occur is random. Assuming that the times for consecutive arrival are tk,
N(t k + 1 ) = N(tk) + 1. However, tk+1 — tk= RND is not a regular sampled signal, since
the next continuous time of occurrence is not predictable. Even so, from the system's point
of view, nothing happens between event occurrences, so it is both discrete and regular.
Here the event instances occur at discretized time k, but the exact time of the next
occurrence is not predictable, even though we know that the next event will bump up the
event counter by one. In short, sampling only makes sense from the external continuous
time's view. From an internal view, it is just discrete time, and there is no worry about any
reference to an external view.
There are other contrasting signal types as well, the most notable being deterministic
versus random signals. Random signals are extremely important, since it is impossible to
model all aspects of a system. Unless we know all there is to know about every process that
impinges on a system, there will be some cause—effect relationships that are unaccounted
for. The logical means of dealing with this uncertainty is by incorporating some random
error into the system. Of course this isn't as trivial as it might seem at first. Suppose we
incorporate a set of effects into our model, but we know there are still others unaccounted
for. Rather than search endlessly for the remaining (as if there are only a finite set of effects
anyway!), we statistically analyze the residuals and simply deal with them as averages
using a set of simulation runs. In this way, the effects that we do know will be validated
and our model is useful, even if it is only for a limited reality. Of course, all models are
only of limited value, since our knowledge is of limited extent. In any case, random signals
and statistical methods are essential to good system modeling.
As signals meander throughout a modeling schematic, they encounter different
components, which act as transformers. There are a number of specific transformers,
but in general there are only four basic types, each of which will be developed further in
this text. They are algebraic, memory, type converter, and data flow. If we were to be
extremely pedantic, all transformers could be developed axiomatically. That is, beginning
20 Chapter 1: Describing Systems
Transform
Block
with only an adder and subtracter, all algebraic transformers could be produced. By
including a memory unit in our list of primitives, the memory types could all be created.
This could continue up the ladder until all transformer types are characterized. This will
not be done here; rather, we will build them throughout the text as necessary.
Consider the generic transformer shown in Figure 1.15. Note that there can be
several inputs, but there is only a single output. If a multiple-output unit is required,
it can always be created by combining several single-output transformers within a
single module.
The simplest of these is the data flow transformer, which essentially acts like a
function machine. The data flow transformer changes the input into an output according to
some well-defined formula that depends on only the input and perhaps time. For example,
z = x1 + 3x2 — x3 + sin x4 is a time-independent, nonlinear algebraic transform, since the
formula is obviously nonlinear and there is no explicit mention of time in the equation.
Usually the formulas aren't so involved. More typical algebraic transforms include
summation and multiplication blocks.
One step up from the algebraic block are blocks that require memory. These are
called memory transformers, since they apply the historical record and must therefore
also require state descriptions. This permits difference and differential equations along
with integrators and integral equations. For instance, the transform z(k) = z(k— 1) +
2xl(k) + 2x3(k — 2) + sink is a linear, time-dependent, second-order memory transform,
since the output depends on only previous values of both the input and output along
with a nonlinear reference to discrete time k.
There are a number of very useful memory transformers, including delays, accumu-
lators and filters. In their purest form, there are only a memory unit and algebraic
transformers from which to build the larger memory transformer family. These, plus
ubiquitous time, can make the set much richer.
1.4 Simulation Diagrams 21
EXAMPLE 1.8
Consider the transformer defined by the following input—output difference
equation: z(k) = z(k — 1) + 2x l (k) + 2x^(k — 2) + sin k. Create, using only
memory units, algebraic transformers, and a ubiquitous time reference, a
system representation.
Solution
In the spirit of academic exercises, it is always possible to create a larger module
from an encapsulation of primitive elements such as +, *, and M (memory). Of
course if there is memory, there also must be initial conditions so as to begin the
simulation. Such a diagram is given in Figure 1.16. O
There is no primitive to explicitly handle derivatives and integrals. Even so, since they
arise so often, it is customary to handle them by encapsulated modules. Later, we will
show difference equation techniques with which to handle these as well.
Type converter transformers change continuous signals to discrete and vice versa. This
is usually done by means of sampling and desampling, but there are also other means.
Regardless of technique, the important thing is to know what type of signal is being used at
each stage of the model. Purely continuous and purely discrete systems are the exception -
most systems are hybrid.
The sampled signal is relatively straightforward. The value of a continuous signal is
sampled every tk=hk +t0 seconds and retained as a function of discrete time k. These
sampled values can then be manipulated using a computer for integral k. On the other
hand, in desampling there are many options. The simplest is the so-called zero-order hold
(ZOH), where the sampled value is simply held constant until the next sample is taken. For
speedy real-time computing systems where sampling frequencies are on the order of
t I
A
milliseconds, this is rarely a problem. But, for very long sampling intervals (equivalently,
very small sampling frequencies), some means of anticipating the continuous signal value
is usefid. For instance, the Dow Jones Industrial Averages are posted on a daily basis, but it
would be of obvious benefit to estimate the trading behavior throughout the day as well.
Thinking of the opening Dow posting as the sampled signal, the desampler would be a
formula for estimating the actual average for any time of day. This is illustrated in Figure
1.17, where we see a continuous signal x(t) entering a sampler. The sampler transforms x(t)
into the sampled signal x(k). The sampled signal enters a desampler, creating another
continuous signal x*(t), which is only approximately x(t). Even though the signals are
given the same name, the continuous, sampled, and desampled signals are not defined by
hnctions of the same form. For example, recall Example 1.3.
The final transformation type is a data flow. Data flow transformations are usually
used in event-driven rather than time-driven systems. Thinking of signals as discrete
messages rather than continuous hnctional values, signal arcs are more like pipelines
carrying each message to one destination or another. Data flow transformations usually
execute flow control. In this model, messages might queue up in a transformation box and
form a first-in-first-out (FIFO) queue or maybe a last-in-first-out (LIFO) stack. Typically, a
data flow box only allows a message to exit after it has received an authorization signal
from each of its inputs. In this way, models can be created to demonstrate the reasoned ebb
and flow of messages throughout the system.
The simplest data flow transforms occur in state machines. These systems are akin to
having a single message in an event-driven system; where the message resides corresponds
to the system state. This is best illustrated by an example.
EXAMPLE 1.9
Model a 2-bit binary counter using a finite state machine. If the input is x = 0
then the counter stops counting, and if x = 1 then the counter continues on from
where it last left off. The output of the counter should produce the sequence 3, 1,
5, 2, 3, 1, 5, 2, . . . . Since there are four different output values, there are four
1.4 Simulation Diagrams 23
different state values too. Clearly there are only two input values. Model this state
machine using bit vectors.
Solution
Since there are at most 22 = 4 different states, this is a 2-bit binary counter. A
suitable block diagram is shown in Figure 1.18. The state is shown in binary form
as the vector y = (y1, y2). The input is x and the output is variable z. Each of the
variables x, y1, and z have two values, 0 and 1. Output z is not shown as a bit
vector, but takes on one of the values {1,2,3,5}.
The actual working of the system is best understood using a transition
diagram as shown in Figure 1.19. In this diagram, states are shown as vertical
lines with a different output associated with each one. Transitions from one state
to another are represented by horizontal arrows with the input required to achieve
each. In this case, the counter progresses through the states in a binary form: 00,
01, 10, 11, 00, etc. However, the output that is actually observable is 3, 1, 5, 2, 3,
etc., as required. This is a state machine, since for the same input (1) there are
different outputs depending on which state the system is in.
In general, there is not simply one input, but a sequence of inputs x(k). For
instance, if the input string is x = [1, 1, 0, 0, 1, 0, 1, 0, 1 , 1 , 1 ] and the initial state
is y = 10, the output string is z = [5, 2, 2, 2, 3, 3, 1, 1, 5, 2, 3]. If the output z is
also required to be a bit vector, z = [z1, z2, z3] can be used. O
State machines are important, since their response to an input can vary. Unlike
function machines, which use the same formula under all circumstances, state machine
responses depend on both the input and the current state. The archetypical finite state
machine (FSM) is the digital computer. It is a state machine, since its output depends on
the memory configuration as well as user initiative. The FSM is finite since there are a
finite number of memory cells in any computer. Engineers design and program using state
machine methods, and they will be explored later in this text.
state
machine
x=1
x=1
x=1
However, state machines are restrictive in the sense that there can be only one "token"
in the system at a time. By token we mean a generic entity such as a process in a
multitasking operating system or a message in communication network. Describing
systems with multiple, often autonomous, tokens, requires a more general structure than
an FSM diagram. This is especially true when the tokens have a need for inter-process as
well as intra-process communication. Modeling and simulation of such systems with
parallel processes requires devices called Petri nets. These will also be discussed later in
the text.
A scientist will tend to use analysis. From this perspective, the system is part of nature
and is given a priori. It only remains to discover just what the system actually is. By
bombarding (sometimes literally in particle physics) with a number of different inputs and
analyzing the results, it is hoped that the system description will reveal itself. Supposedly
after much study and many trials, the scientist gets an idea that can be described as a
mathematical formulation. Using the scientific method, a hypothesis is conjectured for a
specific input. If the output matches that predicted by the system model, our scientist gets
to publish a paper and perhaps win a grant; otherwise he is relegated to more testing, a
revision of the mathematical model, and another hypothesis.
An engineer takes a different view. For him, inputs and outputs are basically known
from engineering judgement, past practice, and specifications. It remains for him to design
a system that produces the desired output when a given input is presented. Of course,
designing such a thing mathematically is one thing, but creating it physically using non-
ideal concepts adds a number of constraints as well. For instance, an electrical rather than
mechanical system might be required. If a system can be designed so that the input—output
pairs are produced and the constraints are met, he gets a raise. Otherwise, another line of
work might be in order.
A manager takes another view. Whether a manager of people, a computer network, or
a natural resource system, the system in already in place. Also, the output is either
specified directly (a number of units will be manufactured in a certain period of time) or
indirectly (maximize profit and minimize costs). It is the manager's duty to take these
edicts and provide inputs in such a way as to achieve the required ends. If he is unable to
satisfy his goals, the system might need adjusting, but this is a design function. He is only
in charge of marshaling resources to achieve the requirements.
Each of these views is correct, and in fact there are books written on each of them.
However, most are discipline-specific and lack generality. Therefore, the system scientist
will address specific problems with each view in mind. After mastering the basic
mathematics and system tools described in this text, it is only natural to look to literature
addressing each problem. For instance, the system identification problem studies how best
to "discover" a correct system description. This includes both the mathematical form and
parameter values of the description.
System optimization, on the other hand, assumes that the mathematical form is
known, but strives to find the parameter values so that a given objective function is
optimized. In practice, system designers have to know not only how to design systems but
also how to identify them and do so in an optimal manner. Thus, even though design is but
one facet, designers are usually well versed in all systems aspects, including analysis and
management as well as design. Each of these views will be investigated throughout this
book.
BIBLIOGRAPHY
Andrews, J. G. and R. R. McLone, Mathematical Modeling. Butterworth, 1971.
Aris, R., Mathematical Modeling, Vol. VI. Academic Press, 1999.
Aris, R., Mathematical Modeling Techniques. Dover, 1994.
26 Chapter 1: Describing Systems
Close, C. M. and Frederick, D. K., Modeling and Analysis of Dynamic Systems, 2nd edn. Wiley,
1994.
Cundy, H. H. and A. P. Rollett, Mathematical Models. Oxford University Press, 1952.
Director, S. W. and R. A. Rohrer, Introduction to Systems Theory. McGraw-Hill, 1988.
Gernshenfeld, The Nature of Mathematical Modeling. Cambridge University Press, 1999.
Law, A. and D. Kelton, Simulation, Modeling and Analysis. McGraw-Hill, 1991.
Ljung, L., System Identification - Theory for the User, 2nd edn. Prentice-Hall, 1999.
Profozich, P. M., Managing Change with Business Process Simulation. Prentice-Hall, 1997.
Roberts, N., D. Andersen, R. Deal, M. Garet, and W. Shaffer, Introduction to Computer Simulation.
Addison-Wesley, 1983.
Sage, A. P., Systems Engineering. Wiley, 1995.
Sage, A. P., Decision Support Systems Engineering. McGraw-Hill, 1991.
Sage, A. P. and Armstrong, An Introduction to Systems Engineering. Wiley, 2000.
Sandquist, G. M., Introduction to System Science. Prentice-Hall, 1985.
Thompson, Simulation: a Modeler's Approach. Wiley Interscience, 2000.
Vemuri, V, Modeling of Complex Systems. Academic Press, 1978.
Watson, H. J., Computer Simulation, 2nd edn. Wiley, 1989.
White, H. J., Systems Analysis. W.B. Saunders, 1969.
Zeigler, B. P., Theory of Modeling and Simulation, 2nd edn. Academic Press, 2000.
EXERCISES
1.1 Consider the RL circuit shown, in which the input is a source voltage vs(t) and the output is the
voltage across the inductor vL(t). Assuming that the state variable is the current i(t). find state and
output equations analogous to Equation (1.5).
Exercises 27
1.2 Consider a linear, time-independent, first-order SISO system described by the following input output
relationship:
+ az — bx(t).
(a) Derive a general explicit solution for z(t) in terms of the initial output z(0).
(b) Apply the results of part (a) to the following differential equation:
z(0) = 2,
u(t)
1
0
(c) Apply the results of part (a) to the following differential equation:
+ 4z = r(
z(0) = 0,
r(0
*
6 6-
1.3 Consider the RC circuit shown, in which there are two source voltage inputs: v1, (t) and v2(t). Use the
voltage across the capacitor vc(t) as the state variable and find the state and output equations
analogous to Equation (1.5).
(a) Assume the output is the current going through the capacitor, ic(t).
(b) Assume there are three outputs: the voltage across each resistor and the capacitor.
R2
AA/V A/W
1.4 Consider a system of two inputs x1, , x2 and two outputs z1,, z2 described by the following input—output
relationships:
z2 + 4 z 2 + 3 z 2 = —x 1+
linear form. That is for matrices A, B, C, and D, find
y = Ay + Bx,
z = Cy + Dx.
Exercises 29
1.5 Consider a system with input x(k) and outputs z(k} described by the following difference equation
relating the input to the output:
z(k) + 3z(k — 1 ) + 2z(k — 2) = x(k) + 3x(k — 1 ).
Define the column vector y for the state variable so that this system is in standard linear form. That
is, for matrices A, B, C, and D,
1.6 Consider a linear, time-independent, first-order SISO discrete system described by the difference
equation z(k) = az(k — 1) + x(k).
(a) Show that the explicit solution in terms of the initial output is given by
(b) Apply the results of part (a) to the system description z(k) — z(k — 1 ) + 2k; z(0) = 1 .
(c) Apply the results of part (a) to the system description z(k) + z(k — 1 ) = 2k; z(0) = 1 .
1.7 Consider the continuous signal x(t) — 5 sin(2;t) In t, which is sampled every tk = 1|t seconds. Find
an explicit equation for the sampled signal x(k).
1.8 Recall the model and simulation outlined in Example 1.4. Implement this simulation and perform it
for n = 10, n = 100, n = 1000, and n = 10000 iterations. Compare your results against the
theoretical expectations. Present your conclusions in the form of a graph of error versus number
of iterations. Notice that the exponential form of n implies a logarithmic scale for the iteration axis.
1.9 Consider a factory system similar to that of example 1.4 in which there are boxes of three different
weights: 5, 10, and 15 pounds. The probability an incoming box has a given weight is as follows:
w Pr[W = w]
5 0.5
10 0.2
15 0.3
1.0
(a) Create a simulation of 200 boxes being placed on the conveyor and the total weight recorded.
(b) Summarize the total weight distribution so that the relative number of times each wieght (15, 20,
25, 30, 35, 40 or 45 pounds) occurs.
(c) Calculate the theoretical distribution corresponding to the simulation of part (b). Compare the
two distributions by forming a distribution and a histogram.
(d) Using a Chi-square test at the 98% confidence level, determine whether or not the simulation is
valid.
1.10 Implement and perform the simulation outlined in Example 1.5 for various values of n.
(a) Make a study (note Exercise 1.8) by which a reasonable result can be guaranteed.
(b) Using the suitable n found in part (a), compute the mean and standard deviation of this random
process after stationarity is achieved.
1.11 Consider the sequence of inter-event times generated by the formula tk = tk—1 — In (RND).
(a) Using this formula, create a simulation similar to that in Example 1.6 where the number of
events N(t) is graphed as a function of time.
30 Chapter 1: Describing Systems
(a) Show that it is possible to create a simulation diagram for this system using only max(m.«)
memory units.
(b) Apply the technique of part (a) to the two-input, one-output system defined in Example 1.8:
z(k) = z(k — 1) + 2x1(k) + 2x3(k — 2) + sink, thereby making a simulation diagram with
max(2, 1) = 2 memory units.
1.15 Consider the finite state machine defined in Example 1.9, but this time with three possible inputs:
if x = 00, the machine stays in place;
if x = 01, the machine goes sequences forward;
if x = 10, the machine goes backward;
the input x = 11 is disallowed.
Create the transition diagram of the new state machine.
1.16 Consider a finite state machine that works like the one in Example 1.9, except that it has two outputs
instead of one. The first output z1 behaves exactly like z and generates the sequence 3, 1, 5, 2, 3, 1, 5,
2, The second output z2 also behaves like z, but generates the sequence 3, 1,5, 2, 7, 8, 3, 1,5. 2,
7, 8 , . . . .
(a) Create the transition diagram of this state machine.
(b) Generalize this result.
1.17 Two stations, P1 and P2, located on the x axis at points P 1 (d 1 , 0) and P2(d2,0), sight a target whose
actual location is at point P(x, y). However, as a result of an angular quantization error that is
uniformly distributed over [—5,5], this pair of stations calculate an apparent position P(x'.y').
Specifically, the observed angles are given by 01 + n6 and 02 + /*<5, where 01 and 92 are the actual
angles, respectively, n is a random variate that is uniformly distributed on [—1. 1]. Simulate this
system mathematically and analyze the results.
Exercises 31
Write a program, with inputs S and n (the number of points to be sampled), that reads the n
actual points (x,y); these are tabulated below. The program should calculate the apparent points
(x',y') as seen by each of the two stations Pl and P2. Using the points defining the actual trajectory
defined in the table below, compute and tabulate the apparent coordinates. Graph the actual and
apparent trajectories for several different quantization error sizes 6.
X y X y X y
20.6 13.2 19.3 10.3 8.3 7.8
17.2 7.6 14.5 5.5 11.4 11.6
10.7 4.9 8.6 6.7 9.5 5.7
8.1 10.6 10.8 12.3 3.5 1.6
11.5 9.3 9.9 6.3 18.4 8.9
7.6 3.9 4.3 1.9 12.5 4.8
20.3 12.4 18.9 9.6 8.1 8.7
16.6 6.9 13.5 5.2 11.6 10.8
10.1 5.2 10.8 7.6 8.9 5.1
8.4 11.4 6.0 2.8 2.7 1.5
11.2 8.4 19.7 11.0 17.8 8.2
6.8 3.4 15.2 5.9 11.6 4.8
20.0 11.7 9.0 6.2 8.0 9.6
15.9 6.4 9.9 12.5 11.6 10.0
9.4 5.7 10.4 6.9 8.2 4.5
9.1 12.2 5.2 2.4
CHAPTER
Dynamical Systems
Equation Order
1 n1
2 n2
The output variables of each of these first-order differential equations, each along with
their single initial condition, comprise a set of system state variables. However, since the
equations are not unique, neither are the state variables themselves. Nonetheless, there are
exactly n of them. Therefore, we begin by considering the first-order initial-value problem.
— -f(t,x),
dt~ ' (2.1)
Other documents randomly have
different content
At this moment General Quesada himself came waddling on deck,
parrot-cage in hand, evidently intending to give his accomplished pet
an early morning airing. He was a gross, ungainly man, heavy of
countenance. At sight of the indignant Alfaro he shook with laughter
and prodded the bird with his finger, which prompted it to screech:
"Viva Panama! Pobre Colombia! Ha! Ha! Ha!"
The young man whom he had enjoyed taunting as a diversion of the
voyage retorted with fiery Spanish abuse, which made the
Panamanian scowl as if he had been stung by something sharp
enough to penetrate his thick hide. He uttered a volley of guttural
maledictions in his turn, and was echoed by the blackguardly parrot.
For Fernandez Garcia Alfaro this was the last straw. His inflammable
temper was ablaze. He rushed at the corpulent general and let his
fists fly against the full moon of a countenance.
Before Walter Goodwin could interfere, the Panamanian had found
room to jerk a small automatic revolver from a pocket of his
trousers. Alfaro caught a glimpse of the weapon and tried to grip the
arm that flourished it. The decks were otherwise deserted at this
early hour and duty called Walter to attempt the rôle of peacemaker.
This was a difficult undertaking, for Alfaro, active as an angry jaguar,
persisted in fighting at close range with hands and feet, while the
bulky Panamanian twisted and wrenched him this way and that, and
vainly tried to use his weapon.
There was no pulling them apart, and the swaying revolver was a
menace which made Walter dive for a deck-broom left against the
rail. The heavy handle was of hickory. Swinging it with all his might,
Walter brought it down with a terrific thump across the knuckles of
General Quesada, who instantly dropped the revolver. Walter's blood
was up and he intended to deal thoroughly with this would-be
murderer. Whacking him with the broom-handle, he drove him,
bellowing, toward the nearest saloon entrance, while Alfaro danced
behind them, shouting approval.
By now the first mate came charging down from the bridge. Captain
Bradshaw arrived a moment later, clad in sky-blue pajamas, his bare
feet pattering along the deck. He picked up the revolver, eyed Walter
and the broom-handle with a comical air of surprise, and inquired:
"Who started this circus? Is it a revolution? I shall have to put a few
of you fire-eaters in irons."
The parrot had rolled into the scuppers, cage and all, and its nerves
were so shaken that it twisted its favorite oration wrong end to, and
dolefully and quite appropriately chanted at intervals:
"Viva Colombia! Pobre Panama!"
Captain Bradshaw aimed an accusing finger at the bird and
exclaimed:
"Shut up! You talk too much."
"That was the whole trouble, sir," said Walter, wondering whether he
was to be punished or commended. "General Quesada brought this
—this broom-handle on himself. He was trying to shoot Señor
Alfaro."
"I need no diagrams to tell me that Señor Alfaro sailed into him
first," said the captain. "This had been brewing for some time. I shall
have to investigate after breakfast."
A little later Walter discovered Fernandez Garcia Alfaro seated upon
a hatch-cover forward. At sight of his Anglo-Saxon ally the impulsive
Colombian sprang to his feet and cried, with outstretched hands:
"You have saved my life! I shall never forget it, mi amigo. I have
hated the North Americans, but my heart is full of affection for you."
Rather taken aback by this tribute, Walter said in a matter-of-fact
manner:
"You surely piled into that fat general like a West India hurricane.
I'm glad I spoiled his programme."
Alfaro's expressive face was vindictive as he exclaimed: "I have not
finished with him and his infernal parrot!"
"Pooh, forget him," carelessly advised Walter, to whom this threat of
vengeance sounded theatrical. "Better steer clear of this Quesada
person. He looks to me like an ugly customer."
Alfaro smiled rather sheepishly as he remarked:
"It was not very diplomatic? You must think I am a funny diplomat,
Goodwin."
"Well, I never happened to meet one before," confessed Walter,
returning the smile, "and I had an idea that diplomats were not quite
so violent and sudden in their methods."
"It was that beastly parrot," began Alfaro in a quick gust of anger;
but he checked himself with a shrug and asked a question which led
Walter to reply:
"Oh, no, I am not a real sailor. I am going to the Isthmus to work in
the Canal Zone."
Boyish pride made him reluctant to confess how dubious he was of
finding work. Alfaro was so full of affectionate admiration that he
was ready to believe great things of Walter, and he exclaimed:
"I am sure you will have a fine position. I knew you were not a
common sailor. You are working your passage as a lark? I have been
wishing landslides and yellow-fever and all kinds of bad luck to the
Yankees so they could never finish the canal. But now, for your sake,
my feelings are different."
Walter had begun to be fond of the fiery Colombian who was so
quick to express his likes and dislikes.
"Thank you," he replied. "I hope we shall run across each other on
shore."
"I must wait a week for my steamer from Panama down the west
coast," said Alfaro. "I am going home on leave of absence from the
legation to see my father and mother. I will say nothing about the
row with General Quesada. My father would not think it diplomatic. I
will find you at your office in the Zone?"
"I certainly hope so," gravely answered Walter, but for reasons
known to himself he failed to mention his address.
The interview was cut short by a summons from Captain Bradshaw,
who wished to see Goodwin at once. He climbed to the bridge-deck
and entered the captain's room, cap in hand.
"Don't look so scared, young man. I'm not going to eat you alive,"
was the good-humored reassurance. "General Quesada came boiling
up here just now and demanded that I lock you up and turn you
over to the Panamanian police when we dock at Colon. Of course I
told him that the deck of this ship is American territory and he was
talking foolishness."
"But he is the man who ought to be locked up," protested Walter.
"What about his trying to shoot Señor Alfaro?"
"I said as much, but he didn't listen. He swore he pulled the revolver
merely to frighten the Colombian. And then he says you whanged
daylight out of him with a club. I had to talk Spanish with him and I
missed some of his red-hot language."
"Yes, sir, I whanged him good and plenty," declared Walter, "and he
yelled and ran for all he was worth."
"The ship's doctor had to bandage his knuckles," resumed Captain
Bradshaw with a chuckle, "and there is a welt on his jaw, and he is
marked in various other places. What hurts him worst is that a
common sailor, and a boy at that, chased him from the deck with a
broomstick and battered him all up. This Quesada poses as a military
hero in Panama, you understand, and plays a strong hand in the
politics of that funny little republic."
"Perhaps I ought not to have hit him so hard," and Walter looked
solemn.
"You were a bit overzealous, but he deserved a drubbing. I just want
to give you a bit of friendly advice. Don't let this General Quesada
catch you up a dark alley. His vanity is mortally wounded, and he
carries a deck-load of it. A Spanish-American might as well be dead
as ridiculous. And it makes Quesada squirm to think how he will be
laughed at if this story gets afloat in Panama. He doesn't love you,
Goodwin."
"But the Canal Zone is part of the United States. He can't do
anything to me," said Walter.
"Not in the Zone, but it is the easiest thing in the world to drift
across the line into Colon or Panama before you know it. And the
Spiggoty police, as they call 'em, like nothing better than an excuse
to put a Yankee in jail."
Elated that Captain Bradshaw's attitude should be so friendly, and
flattering himself that with so humble a weapon as a broomstick he
had vanquished a real live general, Walter was inclined to make light
of the warning. In fact, he forgot all about the humiliated warrior a
day or so later when far ahead of the Saragossa a broken line of hills
lifted blue and misty. Yonder was the Isthmus which Balboa had
crossed to gaze upon the unknown Pacific, where Drake and Morgan
had raided and plundered the Spanish treasure towns, and where in
a later century thousands of brave Frenchmen had perished in their
futile tragedy of an attempt to dig a canal between the two oceans.
Soon the low-roofed city of Colon was revealed behind the flashing
surf, the white ribbon of beach, and the clusters of tall palms. From
the opposite shore of the bay stretched the immensely long arm of
the new breakwater, on top of which crawled toy-like engines and
work-trains. What looked like a spacious, sluggish river extended
straight inland toward the distant ramparts of the hills. On its surface
were noisy dredges, deep-laden steamers, and tow-boats dragging
seaward strings of barges heaped high with rock and dirt. This was
part of the Panama Canal itself, the finished section leading from the
Atlantic, and where the hills began to rise a great cloud of smoke
indicated the activities of steam-shovels, locomotives, and
construction plants.
Walter Goodwin, no longer brooding over his fear of becoming a
"tropical tramp," was impatient to see the wonderful spectacle at
close range. After the steamer had been moored at one end of the
government docks of Cristobal, he was assigned to duty at the
gangway while the passengers filed ashore. Conspicuous among
them was General Quesada, his right hand bandaged, his surly face
partly eclipsed by strips of plaster, his gait that of one who was stiff
and sore.
He balked at sight of the steep runway from the deck to the wharf,
and Walter offered him a helping hand. The general angrily waved
him aside and muttered something in Spanish which sounded
venomously hostile. Fernandez Garcia Alfaro, who was within ear-
shot, explained to Walter:
"He says he will find you again, and he swears it in very bad
language."
"Pooh! I'm not afraid of the fat rascal," carelessly returned Walter. "I
guess Uncle Sam is strong enough to look after me."
Before noon he found himself in the modern American settlement of
Cristobal, among clean, paved streets whose palm-shaded houses,
with wide, screened porches, were of uniform color and design. Boys
and girls were coming home from school, as happy and noisy as
Walter was used to meeting them in Wolverton. As he wisely
observed to himself, this agreeable place was where the Americans
lived, not where they worked, and a fellow had to find work before
he could live anywhere. He was among his own countrymen, but
where was there any place for him? He felt friendless and forlorn.
Strolling at random, he was unaware that he had crossed the
boundary line into the Panamanian city of Colon until the streets
became a wonderfully picturesque jumble of Spanish-speaking
natives clad in white duck and linen, chattering West India negroes,
idling Americans in khaki, and sailors from every clime.
Passing the city market, he thriftily bought his supper—bananas,
mangoes, and peppery tamales—at cost of a few cents, and pursued
his entertaining tour of sight-seeing. It was all strange and
fascinating and romantic to his untutored eyes. His wanderings were
cut short at sight of General Quesada, who was seated at a table in
front of a café with several friends. Two of these were in uniform
adorned with gold lace and buttons.
Walter wasted no time in wondering whether these were officers of
the army or the police. The battered general was pointing him out to
them with a gesture of his bandaged hand. The officers stared as if
to be sure they would know him again. Hastily deciding that the
climate of Cristobal might be healthier, Walter retreated toward the
Canal Zone and the shelter of the stars and stripes. As he glanced
over his shoulder, the three men at the café table appeared to be
discussing him with a lively interest which made him feel uneasier
than ever. Perhaps the warning of Captain Bradshaw had not been
all moonshine. It looked as if General Quesada were still thinking
about that terrible broom-handle which had bruised his pompous
pride as severely as his knuckles.
CHAPTER III
WITH THE DYNAMITE GANG
ebookgate.com