100% found this document useful (1 vote)
26 views

System modeling and simulation an introduction 1st Edition Frank L. Severance instant download

The document is an introduction to the book 'System Modeling and Simulation' by Frank L. Severance, which covers various aspects of system modeling, including event-driven and time-driven models. It emphasizes the importance of digital computers in solving complex problems and aims to provide a comprehensive understanding of modeling techniques suitable for engineering and science courses. The text serves as a foundational resource for students in system modeling and simulation, with a focus on developing new tools and methodologies.

Uploaded by

zihyupllana
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
26 views

System modeling and simulation an introduction 1st Edition Frank L. Severance instant download

The document is an introduction to the book 'System Modeling and Simulation' by Frank L. Severance, which covers various aspects of system modeling, including event-driven and time-driven models. It emphasizes the importance of digital computers in solving complex problems and aims to provide a comprehensive understanding of modeling techniques suitable for engineering and science courses. The text serves as a foundational resource for students in system modeling and simulation, with a focus on developing new tools and methodologies.

Uploaded by

zihyupllana
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 73

System modeling and simulation an introduction

1st Edition Frank L. Severance pdf download

https://ebookgate.com/product/system-modeling-and-simulation-an-
introduction-1st-edition-frank-l-severance/

Get Instant Ebook Downloads – Browse at https://ebookgate.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Introduction to Digital Systems Modeling Synthesis and


Simulation Using VHDL 1st Edition Mohammed Ferdjallah

https://ebookgate.com/product/introduction-to-digital-systems-
modeling-synthesis-and-simulation-using-vhdl-1st-edition-mohammed-
ferdjallah/
ebookgate.com

Electromagnetic Modeling and Simulation 1st Edition Levent


Sevgi

https://ebookgate.com/product/electromagnetic-modeling-and-
simulation-1st-edition-levent-sevgi/

ebookgate.com

Introduction to Law and the Legal System 11th Edition


Frank August Schubert

https://ebookgate.com/product/introduction-to-law-and-the-legal-
system-11th-edition-frank-august-schubert/

ebookgate.com

Introduction to Law and the Legal System Tenth Edition


Frank August Schubert

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

Modeling and Simulation in Python Allen B. Downey

https://ebookgate.com/product/modeling-and-simulation-in-python-allen-
b-downey/

ebookgate.com

Underwater acoustic modeling and simulation 3rd ed Edition


Etter

https://ebookgate.com/product/underwater-acoustic-modeling-and-
simulation-3rd-ed-edition-etter/

ebookgate.com

Underwater acoustic modeling and simulation 4th ed Edition


Etter

https://ebookgate.com/product/underwater-acoustic-modeling-and-
simulation-4th-ed-edition-etter/

ebookgate.com

Chromatographic Processes Modeling Simulation and Design


1st Edition Roger-Marc Nicoud

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

JOHN WILEY & SONS, LTD


Chichester • New York • Weinheim • Brisbane • Singapore • Toronto
Copyright T 2001 by John Wiley & Sons Ltd
Baffins Lane, Chichester,
West Sussex, PO19 1UD, England

National 01243 779777


International (+44) 1243 779777

e-mail (for orders and customer service enquiries): [email protected]

Visit our Home Page on http://www.wiley.co.uk

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.

Other Wiley Editorial Offices


John Wiley & Sons, Inc., 605 Third Avenue,
New York, NY 10158–0012, USA
Wiley-VCH Verlag GmbH, Pappelallee 3,
D-69469 Weinheim, Germany
John Wiley and Sons Australia, Ltd, 33 Park Road, Milton,
Queensland 4064, Australia
John Wiley & Sons (Asia) Pte Ltd, 2 dementi Loop #02–01,
Jin Xing Distripark, Singapore 129809
John Wiley & Sons (Canada) Ltd, 22 Worcester Road,
Rexdale, Ontario, M9W 1L1, Canada

Library of Congress Cataloging-in-Publication Data


Severance, Frank L.
System modeling and simulation: an introduction / Frank L. Severance.
p. cm
Includes bibliographical references and index.
ISBN 0–471–49694–4
1. System theory. I. Title.

Q295.S48 2001
003'.3–dc21

British Library of Cataloguing in Publication Data


A catalogue record for this book is available from the British Library
ISBN 0471–49694–4
Typeset in Times Roman by Techset Composition Limited, Salisbury, Wiltshire
Printed and bound in Great Britain by Biddies Ltd, Guildford and King's Lynn
This book is printed on acid-free paper responsibly manufactured from sustainable forestry in which at least two
trees are planted for each one used for paper production.
Contents

Preface ix

J DESCRIBING SYSTEMS

1.1 The Nature of Systems 1


1.2 Event-Driven Models 10
1.3 Characterizing Systems 13
1.4 Simulation Diagrams 15
1.5 The Systems Approach 24

DYNAMICAL SYSTEMS 32

2.1 Initial-Value Problems 32


• Euler's Method 34
• Taylor's Method 38
• Runge—Kutta Methods 40
• Adaptive Runge—Kutta Methods 42
2.2 Higher-Order Systems 44
2.3 Autonomous Dynamic Systems 46
2.4 Multiple-Time-Based Systems 57
2.5 Handling Empirical Data 67
vi Contents

STOCHASTIC GENERATORS 84

3.1 Uniformly Distributed Random Numbers 84


3.2 Statistical Properties of U[0,l] Generators 88
3.3 Generation of Non-Uniform Random Variates 92
• Formula Method 92
• Rejection Method 94
• Convolution Method 98
3.4 Generation of Arbitrary Random Variates 101
3.5 Random Processes 107
3.6 Characterizing Random Processes 110
3.7 Generating Random Processes 118
• Episodic Random Processes 119
• Telegraph Processes 119
• Regular Random Processes 123
3.8 Random Walks 123
3.9 White Noise 127

SPATIAL DISTRIBUTIONS 141

4.1 Sampled Systems 141


4.2 Spatial Systems 151
4.3 Finite-Difference Formulae 160
4.4 Partial Differential Equations 168
4.5 Finite Differences for Partial Derivatives 172
4.6 Constraint Propagation 177

STOCHASTIC DATA REPRESENTATION 184

5.1 Random Process Models 184


5.2 Moving-Average (MA) Processes 193
5.3 Autoregressive (AR) Processes 198
5.4 Big-Z Notation 206
5.5 Autoregressive Moving-Average (ARMA) Models 209
5.6 Additive Noise 214
Contents vii

MODELING TIME-DRIVEN SYSTEMS 224

6.1 Modeling Input Signals 225


6.2 Nomenclature 231
6.3 Discrete Delays 239
6.4 Distributed Delays 243
6.5 System Integration 250
6.6 Linear Systems 257
6.7 Motion Control Models 264
6.8 Numerical Experimentation 268

282

7.1 Disturbance Signals 283


7.2 State Machines 287
7.3 Petri Nets 293
7.4 Analysis of Petri Nets 305
7.5 System Encapsulation 317

ft
2 MARKOV PROCESSES 334

8.1 Probabilistic Systems 334


8.2 Discrete-Time Markov Processes 336
8.3 Random Walks 346
8.4 Poisson Processes 353
• Properties of the Poisson Process 357
8.5 The Exponential Distribution 360
8.6 Simulating a Poisson Process 363
8.7 Continuous-Time Markov Processes 365

EVENT-DRIVEN MODELS 380

9.1 Simulation Diagrams 380


9.2 Queuing Theory 391
9.3 M/M/1 Queues 395
viii Contents

9.4 Simulating Queuing Systems 403


9.5 Finite-Capacity Queues 405
9.6 Multiple Servers 410
9.7 M/M/c Queues 415

SYSTEM OPTIMIZATION 426

10.1 System Identification 426


10.2 Non-Derivative Methods 435
10.3 Sequential Searches 439
10.4 Golden Ratio Search 442
10.5 Alpha/Beta Trackers 445
10.6 Multidimensional Optimization 452
10.7 Non-Derivative Methods for Multidimensional Optimization 454
10.8 Modeling and Simulation Methodology 468

APPENDICES 476

A Stochastic Methodology 477


• Determining the Density Function 477
• Estimation of Parameters 483
• Goodness of Fit 486
B Popular Discrete Probability Distributions 490
• Discrete Uniform 490
• Binomial 491
• Geometric 492
• Poisson 492
C Popular Continuous Probability Distributions 493
• Continuous Uniform 493
• Gamma 493
• Exponential 494
• Chi-Square 494
• m-Erlang 495
• Gaussian 495
• Beta 496
D The Gamma Function 497
E The Gaussian Distribution Function 498
F The Chi-Square Distribution Function 499

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

1.1 THE NATURE OF SYSTEMS


The word "system" is one that everyone claims to understand - whether it is a
physiologist examining the human circulatory system, an engineer designing a transporta-
tion system, or a pundant playing the political system. All claim to know what systems are,
how they work, and how to explain their corner of life. Unfortunately, the term system
often means different things to different people, and this results in confusion and problems.
Still there are commonalities. People who are "system thinkers" usually expect that
systems are (1) based on a set of cause—effect relationships that can be (2) decomposed
into subsystems and (3) applied over a restricted application domain. Each of these three
expectations require some explanation.
Causes in systems nomenclature are usually referred to as inputs, and effects as
outputs. The system approach assumes that all observed outputs are functions only of the
system inputs. In practice, this is too strong a statement, since a ubiquitous background
noise is often present as well. This, combined with the fact that we rarely, if ever, know
everything about any system, means that the observed output is more often a function of
the inputs and so-called white noise. From a scientific point of view, this means that there
is always more to discover. From an engineering point of view, this means that proposed
designs need to rely on models that are less than ideal. Whether the system model is
adequate depends on its function. Regardless of this, any model is rarely perfect in the
sense of exactness.
There are two basic means by which systems are designed: top-down and bottom-up.
In top-down design, one begins with highly abstract modules and progressively decom-
poses these down to an atomic level. Just the opposite occurs in bottom-up design. Here
the designer begins with indivisible atoms and builds ever more abstract structures until
the entire system is defined. Regardless of the approach, the abstract structures encapsulate
lower-level modules. Of course there is an underlying philosophical problem here. Do
atomic elements really exist or are we doomed to forever incorporate white background
noise into our models and call them good enough? At a practical level, this presents no
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

FIGURE 1.1 System block diagram.


1.1 The Nature of Systems

two algebraic equations involving the input, state, and output:

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

FIGURE 1.2 Feedback system.


Chapter 1: Describing Systems

o VW

FIGURE 1.3 Electrical circuit as a SISO system, Example 1.1.

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

FIGURE 1.4 Electrical RC circuit as a first-order SISO system.

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 ^ ^ ^

FIGURE 1.5 An open-loop control system.


Chapter 1: Describing Systems

disturbance

goals response
r ^ r ^
u,(0
Controller Plant
^ ^ L. ^

FIGURE 1.6 A closed-loop control system.

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

FIGURE 1.7 A deterministic conveyor system, Example 1.4.


Chapter 1: Describing Systems

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

FIGURE 1.8 State N(t) for constant inter-arrival times.


1.1 The Nature of Systems

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.

FIGURE 1.9 Histogram.


Chapter 1: Describing Systems

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.

""^ EVENT-DRIVEN MODELS


Examples 1.1, 1.2, and 1.5 of the previous section were examples of time-driven
systems. This can be seen from the program sketch given in Listing 1.1, in which
successive k-values in the for—next loop compute the response to equally spaced time
1.2 Event-Driven Models 11

events. In fact, the program structure is analogous to a microprocessor-based polling


system where the computer endlessly loops, asking for a response in each cycle. This is in
contrast to an interrupt approach, where the microprocessor goes about its business and
only responds to events via interrupts. These interrupt-like programs create so-called
event-driven models.
In an event-driven model, the system remains dormant except at non-regularly
scheduled occurring events. For instance, in modeling the use of keyboard and mouse
input devices on a computer, a user manipulates each device on an irregular basis. The
time between successive events k and k+1, tk+1, — tk, is called the inter-arrival time.
Unlike the case of time-driven models, where this difference is constant, here this
difference generally varies and is non-deterministic. Thus, event-driven models and
simulations are often based on stochastic methods.
In models of this type, there are two most interesting questions to be asked. First, we
might ask how many n events occur in a fixed interval, say [0, t]. For a great number of
problems, this number depends only on the length of the interval. That is, the expected
number of events over the interval [0, t] is the same as the number expected on [T, T + t]
for any t ^ 0. When this is true, the probability distribution thus defined is said to be
stationary. Specifically, the answer is in the form of a probability statement:
P n (t) = "probability there are n events during interval [0, t]", where n = 0, 1, 2, . . . is
the sample space. Since the sample space is countably infinite, Pn(t) is a discrete
probability mass function.
A closely related question to the one above is the expected inter-event time. Even
though the inter-event time is not constant, its statistical description is often known a
priori. Denoting the inter-event time by the random variable T = tk+1 — tk, it should be
clear that T is continuous. Thus, we define the probability density function fT(t) rather than
a probability mass function as we would for a discrete random variable. Recall that
continuous random variables are more easily specified by their distribution function
FT = Pr[T ^ t]. The density function follows immediately since fT(f) = dfT(i}/dt.
The probability distributions defined by Pn(t) and fT(t) are most important, and will be
considered in detail in the next section. But first let us see how straightforward the
application of event-based models is to simulate. The problem is to calculate a sequence
of event times tk = "time at which the kth event occurs". For simplicity, let us simply
assume that the inter-arrival times are uniformly distributed over [0,1). In other words, we
can use RND for our random intervals. Note that the statement tk+l — tk = RND is
equivalent to tk. — t k _ 1 = RND. It follows that a code sequence to produce n random event
times is

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

Consider a conveyor system similar to the one described in Example 1.4.


However, this time, all boxes are the same but they arrive with random (in the
RND sense for now) inter-arrival times. This time, let us investigate the number
of boxes N(t) that have arrived up to and including time t. Our results should
resemble those shown graphically in Figure 1.10.
Solution
The simulation input is the set of critical event times discussed earlier. The output
is the function N(t), which is the number of events up to and including time t.
But, in order to compute the number of events at time t, it is necessary to check if
t falls within the interval [t k , tk+1]. If it does, N(t) = k; otherwise, a next interval
must be checked. Listing 1.2 shows code producing the required pairs t, N from
which the graph in Figure 1.10 can be created. Notice that while the input times
are continuous, the event times are discrete. Also, the output N(t) is a mono-
tonically increasing function taking on non-negative integral values. O

Modeling and simulating system behavior is fundamentally a statistical problem.


Whether by Heisenberg's uncertainty principle on the nanoscale or simply by experimental
error, the deterministic formulae given in traditional texts do not precisely predict practice.

A(t)

•1 p
V
'o=0 f
J *3 4

FIGURE 1.10 State N(t) for random inter-arrival times.


1.3 Characterizing Systems 13

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

'"^ SIMULATION DIAGRAMS


As in mathematics generally, equations give precise meaning to a model's definition,
but a conceptual drawing is often useful to convey the underlying intent and motivation.
Since most people find graphical descriptions intuitively pleasing, it is often helpful to
describe systems graphically rather than by equations. The biggest problem is that the
terms system and model are so very broad that no single diagram can describe them all.
Even so, models in this text for the most part can be systematically defined using
intuitively useful structures, thus making simulation diagrams a most attractive approach.
System diagrams have two basic entities: signals - represented by directed line
segments - and transformations - represented as boxes, circles, or other geometric shapes.
In general, signals connect the boxes, which in turn produce new signals in a meaningful
way. By defining each signal and each transform carefully, one hopes to uniquely define
the system model. By unique it is meant that the state variables of the model match the
state variables of the underlying system, since the drawing per se will never be unique.
However, if the states, signals, and transforms coincide, the schematic is said to be well
posed and the system and model are isomorphic. Of course obtaining the schematic is
largely an art form, and one should never underestimate the difficulty of this problem.
Even so, once accomplished, the rest of the process is largely mechanical and simulations
can be straightforward.
There are several different types of signals. It is always important to keep precise track
of which signal type is under discussion, since many system models are heterogeneous.
Perhaps the primary distinction is whether a signal is an across variable or a through
variable. An across signal has the same value at all points not separated by a transformer.
In contrast, a through signal has the same value at all points not separated by a node. Thus,
an across variable is just a value of the signal produced by an input or transformer. It can
be thought of as akin to voltage in an electrical circuit where every point on the same or
connected arcs (physically, wires) has the same signal value.
A through signal takes an entirely different view. Rather than thinking of a function at
a given time, we envision various events occurring within the system. For instance, the
conveyor in Example 1.3 would be such a system, and the times at which the boxes enter
constitute the signal. Here the signal description is given by a formula for tk, which is the
time at which event k occurs. That is, given an event number, the time at which that
particular event occurs is returned. A through signal can be visualized as the messages in a
communications link where each message flows through various conduits. As messages
come to a junction, they go to only one of several direction choices. So, rather than the
same signal throughout the wire as in an across signal, a through signal has a conservation
principle: the number of messages leaving a junction equals the number of messages
entering the junction.
An across signal represents a common value (of voltage), while a through signal
represents an amount (of messages). Notice how the through description is the inversion of
the across description:

across signal: given time, return level


through signal: given a level, return time
16 Chapter 1: Describing Systems

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

(a) across (b) through


signal: signal:

FIGURE 1.11 Across (a) versus through (b) signals.

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

FIGURE 1.15 Generic data flow 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

FIGURE 1.16 Encapsulation of primitive elements.


22 Chapter 1: Describing Systems

t I
A

FIGURE 1.17 Sampled and desampled signals.

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

state (y1, y2)

FIGURE 1.18 Block diagram of state machine.


24 Chapter 1: Describing Systems

state: 00 state: 01 state: 10 state: 11

x=1

x=1

x=1

x=0 x=0 x=0 x=0

z=3 z=1 z=2


FIGURE 1.19 Transition diagram for state machine.

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.

1.5 THE SYSTEMS APPROACH


Every system has three basic components: input, output, and the system description. If
any two of these are specified, the remaining one follows. Each possibility results in a
different problem, analysis, design, and management, with a different view. We list these
possibilities below.

Specified entity Unspecified entity Name

input system output analysis


input output system design
system output input control
Bibliography 25

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,

where u(t) is the unit step function: u(t) — 1, t > 0; 0, t < 0.

u(t)

1
0

(c) Apply the results of part (a) to the following differential equation:

+ 4z = r(
z(0) = 0,

where r(t) is a rectangular wave: r ( t ) = 1 ,


k = 0, 1, 2 , . . . (see the graph on the next page).
28 Chapter 1: Describing Systems

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:

z1 + 3z1, + 2z1, = x1 + 3x2

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,

z(k) = Cy(k) + Dx(k).

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

(b) Using the simulation, compute an average inter-event time.


(c) Using the simulation, compute the standard deviation of the inter-event rimes.
(d) Repeat parts (a)—{c) for the inter-event sequence defined by tk = t k _ 1 — 2 In(RND) — 3 In(RND).
1.12 Write a program that will find the merge union of two event-time sequences [tk] = [rk] U [sk], where
fa] = [r1,r2 rm] and [sk] = [ s 1 , s 2 sn] are the inputs and [tk] = [t1, t2 t m+n ] is the
output.
(a) Using your merge union program, create a simulation that generates two event sequences
rk = r k _ 1 + 2 1n(RND) and sk = s k _ 1 + 3 In(RND), and generates the results as a sequence [tk].
(b) Create graphs of your results similar to Figures 1.12–1.14 of Example 1.7.
1.13 Consider transformers defined by the following input-output relations. Implement each at the atomic
level using only + (addition), * (multiplication), and M (memory) units. Try to use as few memory
units as possible.
(a) z(k) + 2z(k – 1) + 4z(k – 2) = x(k);
(b) z(k) + 4z(k –2) = x(k) + 3x(k – 1);
(c) z(k) = x(k) + x ( k – l ) + x ( k – 2 ) .
1.14 Consider the most general input-output relationship for a linear, discrete-time, time-invariant SISO
system:

z(k) + £ ajZ(k –j) = £ bjX(k – j ) .


7=1 i=0

(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

Mathematical models of continuous systems are often defined in terms of differential


equations. Differential equations are particularly elegant, since they are able to describe
continuous dynamic environments with precision. In an ideal world, it would be possible to
solve these equations explicitly, but unfortunately this is rarely the case. Even so,
reasonable approximations using numerical difference methods are usually sufficient in
practice. This chapter presents a series of straightforward numerical techniques by which a
great many models can be approximated using a computer.

2.1 INITIAL-VALUE PROBLEMS


One general class of models is that of dynamical systems. Dynamical systems are
characterized by their system state and are often described by a set of differential equations.
If the differential equations, combined with their initial conditions, uniquely specify the
system, the variables specified by the initial conditions constitute the system state variables.
In general, suppose there are m differential equations, each of order ni. There are
n = Y^iLi ni initial conditions. Equivalently, there are n first-order differential equations.

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

What he had heard Colonel Gunther say on shipboard made Walter


think it useless to apply for one of those wonderful positions at
seventy-five dollars a month on the "gold roll," which the steam-
shovel man, Jack Devlin, had painted in such glowing colors. He
must try to get a foothold somewhere, no matter how humble it
might be, and hope to win promotion. It was really a case of
jumping at the first chance to earn a dollar. Without employment
what money he had would soon be spent, and then he must slink
home in the Saragossa.
He picked his way through a net-work of tracks, switches, and
sidings among the busy wharves and warehouses of Cristobal. This
was the nearest scene of activity, although it seemed to have very
little to do with digging the Panama Canal. There were railroad yards
at home, reflected Walter, and he had seen miles of warehouses and
wharves along the water-front of New York. He walked rather
aimlessly beyond the crowded part of Cristobal, hoping to find
steam-shovels and construction gangs.
At length his progress was blocked by the wreckage of several
freight-cars which were strewn across the tracks in shattered
fragments. Negro laborers were clearing away this amazing disorder,
which could have been caused by no ordinary collision. In answer to
Walter's questions one of them said:
"Dynamite, boss. A car got afire down by de ship, sah, an' de mens
tuk all de dynamite out 'cept two boxes. An' when dey was runnin'
de car up here in de yard to fotch it away from de wharf, she done
'splode herself to glory."
"Anybody killed?"
"Two mens, sah, an' some more is in de hospitubble."
"Too bad, but there is something doing here," said Walter to himself.
"This is a hurry-up job, and perhaps they can use another man."
Climbing over the débris, he accosted a lean, brick-red American
with a fighting jaw who was driving the wrecking-crews at top
speed.
"I am not the superintendent," was the impatient reply, "but I'll save
you the trouble of looking him up. He is taking no more men on the
gold roll. The railroad has been laying people off."
"But I am not looking for a job on the gold roll," stubbornly returned
Walter. "I am ready to pitch in with your laborers. Can't you take me
on to help clear this mess?"
"For twenty cents an hour? You're joking," snapped the foreman.
"White men don't do this kind of work down here."
Walter was for continuing the argument, but the other jumped to
adjust the chains of a wrecking-crane. Just then there appeared a
man of such a calm, unhurried manner that he seemed oddly out of
place in this noisy, perspiring throng. As Walter brushed past him the
placid stranger drawled:
"These tracks will be cleared by night. The job won't last long
enough for you to make a start at it. Are you really looking for hard
work at silver wages?"
"Please lead me to it," gratefully cried Walter. "I guess I can live on
twenty cents an hour until something better turns up."
"Good for you," said the unruffled gentleman. "I am Mr. Naughton,
in charge of the dynamite. We use eight hundred thousand pounds a
month on the canal. I have a ship to unload, and the negroes have
been panicky since the explosion this morning. Several of them quit
me, and I guess they are running yet."
Walter shied like a frightened colt, and stammered with sudden loss
of enthusiasm:
"A whole s-ship-load of d-dynamite? You w-want me to help handle
it?" Then he grinned as his sense of humor overtook his fright. He
had just fled from Colon at sight of General Quesada and his friends.
This was hopping from the frying-pan into the fire with a vengeance.
"What if I drop a box of it?" he asked.
"I am not hiring you to drop it," was the pensive answer of Mr.
Naughton, as he flicked a bit of soot from his white serge coat and
caressed his neatly trimmed brown beard. "I wish I had something
better to offer you. I like your pluck."
"I am not showing any pluck so far," confessed Walter. "You have
scared me out of a year's growth. But I'm willing to take a chance if
you are."
"Then come along with me to the Mount Hope wharf, and I'll put you
on my pay-roll."
The weather was wiltingly hot for one fresh from a northern winter,
but as Walter followed his imperturbable employer he felt the chills
run up and down his spine. The sight of the havoc wrought by two
boxes of dynamite was not in the least reassuring.
"Here is where I get scattered all over the tropical landscape," he
said to himself. "A greenhorn like me is sure to do something foolish,
and if I stub my toe just once, I vanish with a large bang."
He might have taken to his heels but for the soothing companionship
of Mr. Naughton, who was humming the air of a popular song and
seemed to have not a care in the world. Ahead of them lay a rusty
tramp steamer flying a red powder-flag in her rigging. A few laborers
and sailors were loafing in the shade of the warehouse. At a word
from Mr. Naughton they filed on board, some to climb down into the
hold, others to range themselves between an open hatch and the
empty freight-cars on the wharf.
Walter pulled off his shirt, gingerly tightened his belt, and took the
station assigned him on deck. Presently the men below began to
pass up the heavy wooden boxes from one to another until the
dangerous packages came to Walter, who was instructed to help
carry them to the ship's side.
He eyed the first of them dubiously for a moment, took a long
breath, and clasped the box to his breast, squeezing it so tightly that
he was red in the face. Lifting his feet very high and setting them
down with the greatest caution, he advanced with the knee action of
a blue-ribbon winner in a horse-show. Quaking lest he trip or
stumble, he delivered the box to the man at the gangway. The
seasoned handlers chuckled, and Mr. Naughton said to the American
who was checking the cargo:
"I took no risks in picking up that youngster, even if he is a new
hand with the powder. His nerves haven't been spoiled by rum or
cigarettes. Nice, clean-built chap, isn't he? What do you think of
him?"
Lifting his feet very high and setting them down with the
greatest caution
"He is no stranded loafer or he would sponge on the Americans in
Colon sooner than work on the silver roll."
"I shall ask him a few questions when we knock off," returned
Naughton.
After Walter had safely handled a score of boxes, he gained
confidence and worried less about "'splodin' himself to glory," as he
toiled to keep pace with the other men. The humid heat was
exhausting, but as the afternoon wore on his efficiency steadily
increased. When the quitting hour came, Mr. Naughton told him:
"I'll be glad to keep you on until the cargo is out. Where are you
living?"
"Nowhere at present. I can't afford to go to a hotel, and even if I
had the price I am afraid Colon might disagree with me."
"Oh, it is a healthy town nowadays. Our people have cleaned it up
like a new parlor."
"I mean the police—" began Walter, but this sounded so suspicious
that he blushed, thought it hardly worth while explaining, and
concluded, "I guess I can find a bed somewhere."
Mr. Naughton whistled, cocked a scrutinizing eye, and observed:
"So you got into trouble with the Spiggoty police? Anything serious?
I won't give you away."
"Nothing against my morals," smiled Walter. "My manners were
disliked."
"I'll take your word for it. One of my minor ambitions has been to
punch the head of a Panamanian policeman. The chesty little
beggars!" drawled Mr. Naughton. "You don't belong with the
laborers, Goodwin, and you wouldn't like their quarters. I can find
you a place to sleep at our bachelor hotel, and you can get
commissary meals at thirty cents each. Uncle Sam is a pretty good
landlord."
Cordially thanking him, Walter exclaimed as he straightened his
aching back:
"I haven't been as lame and tired since I pitched a twelve-inning
game for the high-school championship of the State. Phew! I must
have moved enough dynamite already to blow Colon off the map.
But I'll be glad to report in the morning, sir."
This casual reference to base-ball had a most surprising effect upon
the placid Mr. Naughton, who had seemed proof against excitement.
He jumped as if he had been shot at, grasped Walter by the arm,
and shouted eagerly:
"Say that again. Can you pitch? Are you a real ball-player? Man alive,
tell me all about it!"
Walter stared at the "powder man" as if suspecting him of mild
insanity.
"We have a crack nine in Wolverton for a high-school," he replied. "It
is a mill town, you see, and most of the fellows begin playing ball on
the open lots as soon as they can walk. We were good enough last
season to beat two or three of the smaller college teams."
"And you were the regular pitcher?" breathlessly demanded Mr.
Naughton, as he backed away and surveyed the broad-shouldered
youth from head to foot.
"Yes, I pitched in all the games."
"Well, you handle yourself like a ball-player, and I believe you are
one. You come along to supper with me."
"But what in the world—" began the bewildered Walter.
"Leave it to me. Your destiny is in my hands," was the mysterious
utterance of Mr. Naughton.
In the cool of the evening they sat and ate at their leisure on the
breezy piazza of the "gold employees'" hotel. From other small
tables near by several men called out greetings to Naughton, who
beckoned them over to be presented to his protégé. No sooner had
they learned that the tall lad was a base-ball pitcher of proven
prowess than they became effusively, admiringly cordial. In fact,
Walter held a sort of court.
"Goodwin is one of my unloading gang on the dynamite steamer,"
explained Naughton.
At this there arose a fiercely protesting chorus. One might have
thought they were about to mob the "powder man."
"How careless, Naughton! It makes no difference about you, but we
can't afford to risk having a ball-player blown up."
"A real pitcher is worth his weight in gold just now."
"It won't do, Naughton, old man. If you permit this valuable person
to be destroyed, the Cristobal Baseball Association will hold you
responsible."
"Don't you dare let him go near your confounded dynamite ship
again."
Thanks to the magic of base-ball, although he could not understand
the why and wherefore of it, Walter found himself no longer a
friendless waif of fortune, but regarded as something too rare and
precious to be risked with a dynamite gang. It seemed rather absurd
that these transplanted Americans should have any surplus energy
for athletics after the day's work in the steaming climate of the
Isthmus. But his new friends proceeded to enlighten him, led by
Naughton, who exclaimed with much gusto:
"My son, we eat base-ball. The Isthmian League is beginning its
third season, and you have alighted among the choicest collection of
fans, cranks, and rooters that ever adorned the bleachers. Mr.
Harrison here is captain of the Cristobal nine. Our best pitcher went
back to the States last week."
"But I'm afraid I shall have no time to play," said Walter. "I didn't
come down here for base-ball."
"Oh, we all work for a living. Don't get a wrong impression of us,"
put in Harrison, a young man of chunky, bow-legged type of
architecture whom nature had obviously designed for a short-stop. "I
am a civil engineer, Atlantic Division. I used to play at Cornell. We
can't practise much, but if you want to see some snappy games——"
"I would rather handle the dynamite than umpire when you play
Culebra or Ancon," broke in Naughton, who showed signs of
renewed excitement as he went on to say to Harrison:
"If I bring Goodwin to the field at five o'clock to-morrow afternoon,
will you furnish a catcher and give him a chance to limber up? Better
lay off and take it easy for the day, hadn't you?" he added, turning
to Walter.
"No, the hard work will take the kinks out of my muscles, and I can't
afford to lose any time on my first job."
"Oh, hang his tuppenny job!" spoke up one of the company. "He
doesn't understand how important he is. Enlighten him, Harrison."
"This frenzied person on my right means to convey that a young
man with a first-class pitching arm will have the inside track with the
powers that be," explained the Cristobal captain. "There is Major
Glendinning, for instance——"
"He is head of the Department of Commissary and Subsistence,"
chimed in Naughton. "He feeds and clothes the whole Canal Zone.
When Cristobal makes a three-bagger he jumps up and down and
yells himself hoarse."
"But I heard Colonel Gunther himself say that no more Americans
were needed down here," said Walter.
"That doesn't mean there is to be no more weeding out of
undesirables," Naughton explained. "There is still room on our happy
little Isthmus for a man who can deliver the goods. I don't want you
to infer that the government is hiring ball-players. But as an
introduction, Goodwin, you couldn't beat it if you brought letters
from eleven United States senators."
"Now let's talk base-ball," impatiently interjected a lathy individual in
riding breeches and puttees, who had come in from a construction
camp somewhere off in the jungle.
"We ought to tuck our prize package in bed very early," objected
Naughton. "He is as sleepy as a tree full of owls."
"Juggling dynamite is no picnic!" and Walter struggled with a yawn.
His friends good-naturedly escorted him to the bachelor quarters,
where he speedily rolled into his cot and dreamed of fighting a duel
with General Quesada, the weapons being base-ball bats.
When he reported on board the dynamite ship next morning,
Naughton greeted him with a slightly worried air and declared:
"I have been thinking it over and perhaps those chaps were right.
We have very few accidents with the stuff, but we ought not to run
the slightest risk of losing the league championship to Culebra or
Ancon."
Walter laughed and replied:
"This is the best kind of practice for me. If I can keep my nerve and
make no errors, I am not likely to be rattled when the bases are
full."
This argument had weight, although Naughton was still anxious as
he strolled to his office. By noon the stiffness had been sweated out
of Walter's back and shoulders, and the supple vigor was returning
to his good right arm. Shortly before five o'clock the inconsistent
Naughton, who lived in daily peril of his life with all the composure in
the world, was fairly fidgeting to be off to the base-ball field. A
battered victoria and a rat of a Panama pony hurried them thither,
and they found Harrison and several other players busy at practice
against a background of cocoanut palms and bread-fruit trees.
The Cristobal catcher trotted up looking immensely pleased:
"Hello, Goodwin, you don't know me," said he, "but my kid brother
was on that Elmsford freshman team that you trounced so
unmercifully last season. I saw the game. Brewster is my name.
When Harrison told me he had been lucky enough to discover you, I
chortled for joy."
This was a cheering indorsement for the others to hear and it gave
Walter the confidence of which he stood in need. A great deal
appeared to depend on his pitching ability, and this test was more
trying to the nerves than handling dynamite or dodging General
Quesada.
The catcher tossed him a ball and they moved to one side of the
field. At first Walter pitched with caution, but as he warmed to his
work the ball sped into Brewster's glove with a wicked thud.
"Send 'em along easy to-day. Better not overdo it," the catcher
warned him. Walter smiled and swung his arm with a trifle more
steam in the delivery. He felt that he must show these friendly critics
what he had in him, wherefore the solid Brewster withstood a
bombardment that made him grunt and perspire. The other players
looked and whispered among themselves with evident approval.
"What did I tell you?" proudly exclaimed Naughton. "Am I a good
scout? I unearthed this boy phenomenon."
The battery had paused to cool off when a big-boned American
saddle-horse came across the field at an easy canter. The rider sat
as erect as a cavalryman, although he was old enough to be Walter's
grandfather. Halting beside the group, he said:
"I rode out this way on the chance of seeing a bit of practice. Do
you expect to whip those hard-hitting rascals from Culebra?"
"Good afternoon, Major Glendinning," replied Naughton, with a wink
at the others. "Harrison has been feeling very gloomy over the
prospects. We lost our only first-class pitcher, you know."
"What an outrageous shame it was!" earnestly ejaculated the head
of the Department of Commissary and Subsistence.
Harrison nudged Naughton. Major Glendinning had come upon the
scene at precisely the right moment. Here was the employer who,
above all others, must be made to take an interest in Goodwin's
welfare if these amiable conspirators could bring it about. Noting
that Walter was beyond ear-shot, Harrison spoke up.
"Sorry you couldn't arrive a little sooner, Major. We are inclined to
think we have found a better pitcher, though I'm not at all sure that
we can keep him at Cristobal."
The elderly gentleman leaned forward in the saddle and eagerly
inquired:
"Bless me, is that true? I swear you don't look at all gloomy,
Harrison. Who is he? Where is he? And you think he can pitch
winning ball for Cristobal?"
"Yes, sir. Brewster has seen him play at home. He is one of your
born pitchers. He is a wonder."
"What do you mean by saying we can't keep him?" demanded the
major.
"He is working for me—on the silver roll," vouchsafed Naughton,
with a hopeless kind of sigh. "He hasn't been able to find anything
better to do. But I can't hold him, of course. He is a first-class man
in every way. He is likely to quit almost any day and drift over to
Culebra or Ancon, where he will be sure to land a position on the
gold roll, as foreman, clerk, or time-keeper. And then he will be
pitching for our hated rivals."
"Um-m, he will, will he?" and Major Glendinning fairly bristled. "I am
not letting any good men get away from my department. Show him
to me."
Naughton nodded in the direction of Walter, who was deep in a
discussion of signals with his catcher. Then the "powder man," with
Harrison as fluent ally, paid tribute to the manly qualities of the
young pitcher, nor were their motives wholly selfish. The major
listened attentively, chewing his gray mustache, and now and then
glancing at Walter with keen appraisement. At length he exclaimed:
"You chaps know how to get on my blind side. I have had my eye on
a cheerful young loafer in the Cristobal commissary who is not
earning his salary. If he should—er—resign, there might be a
vacancy. I like Goodwin's looks. Fetch him over here, if you please."
Naughton and Harrison grinned at each other as they marched to
the side of the field and escorted Walter with great pomp of manner.
The abashed pitcher wiped his dripping face and heard Major
Glendinning say to him:
"You had better not think of leaving Cristobal just now. It is the best
place in the Zone. When you are through with Naughton and his
infernal cargo, come and see me in my office, if he doesn't blow you
sky-high in the meantime. And don't forget that I expect you to win
that next game against Culebra."
He wheeled his horse sharply and trotted from the field, leaving
Walter to gaze after him with a dazed, foolish smile. Harrison
thumped him on the back and jubilantly shouted:
"Wasn't that easy? What did we tell you?"
"But do you honestly think he has any intention of giving me a job
on the gold roll?" tremulously implored Walter, whose emotions were
in a state of tumult.
"Sure thing," said Naughton. "He can always find a place for a young
fellow with the right stuff in him."
"'A husky young fellow with the right stuff in him,'" echoed Walter.
The familiar words had come home to roost.
"He will start you in at seventy-five per month"—this was from
Harrison—"and you will have to earn it. Base-ball cuts no figure with
the major in business hours."
"Your conscience can rest easy on that score," added Naughton. "No
danger of your cheating Uncle Sam."
"An honest pull is the noblest work of man," declaimed Harrison, and
this seemed to sum up the whole matter.
When Walter returned to his quarters, his first impulse was to write
a letter home. This proved more difficult than might seem. To report
to his anxious parents and his adoring sister that he was employed
on board a dynamite ship would not tend to ease their minds. He
could imagine this bit of news landing in the cottage at Wolverton
with the effect of a full-sized explosion. Eleanor would probably take
her pen in hand to compose a metrical companion piece of "The Boy
Stood on the Burning Deck."
"I must be tactful," frowningly reflected Walter. "I don't want to
make them nervous. Perhaps I had better not go into details. I will
simply say that I have a fairly lucrative position. Twenty cents an
hour isn't much down here, but it sounds big alongside that four-
dollar-a-week job in the hardware store."
Then he discovered that to discuss the better position which he had
not yet secured was to raise hopes that sounded fantastic. Those
rival ball-players from Culebra might knock him out of the box in the
first inning. This would mean good-by to Major Glendinning's favor.
Base-ball cranks were fickle and uncertain persons. Walter therefore
merely informed the family that the climate agreed with him and he
was sure his judgment had been sound in coming to the Isthmus.
"Between unloading dynamite and worrying about this base-ball
proposition," he soliloquized, "not to mention the fact that General
Quesada is camping on my trail, I expect to be gray-headed in about
one more week."
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookgate.com

You might also like