# Forwarded from System Dynamics list

[Martin Taylor 960723 11:00]

I thought that the following message, which was distributed to the system
dynamics (SD) mailing list, might be of interest, given the occasional
continuous control loops.

Martin

----- Begin Forwarded Message -----

Many many moons ago, there were discussions on discrete/continuous simulation:
discrete in time or integral-valued variables. I was going to offer a control
engineer's perspective: computer-controlled systems, but somehow never got
around to doing it. While thinking about setting up a computer-controlled
system for my experiment, I recalled the unfinished business on my part (Gene,
here it is, I am finally able to write down some insights from computer-
controlled systems). So, I shall finish this one first before moving on to
HyPE.

I think there are many insights to be gained from this perspective; some
include discrete-time measurements and the interval between measurements.
Note that the word "discrete" only applies to time, i.e. time is represented
as a sequence of integers 1, 2, ..., with the duration between two sequential
counts is called the sampling interval (or sampling time, Ts).

Contents:

0. Background.
1. Discrete- v. Continuous-Time.
2. Necessity for Added Complexity due to Hybrid Formulation.
3. Food for Thoughts.

0. Background.

The advent of fast digital computers increases the ease of implementation of
controllers. Fast digital computers also guarantees practical application of
nonconventional control algorithms such as intelligent and adaptive. However,
there is added complexities, such as finite precision arithmetic, resulting
from the use of digital computers in the control of engineering systems.
Finite precision arithmetic is due to the way digital computers represent
a real number in a string of zeros and ones. This phenomenon is called the
quantized effect of finite precision arithmetic.

As an example, a computer equipped with a 10V-bipolar 12-bit analog-to-digital
converter represents -10 V as 0, 0 V as 2048, and 10 V as 4096. In the above
example, a 2.75 V signal is recognized as an integer (2.75 - (-10))/20*4096 =
2611. The representation of any signal ranging from -10V to 10V has integral
value ranging from 0 to 4096 (for a 12-bit ADC, 2^N for an N-bit ADC). Note
the similarity between this representation and human counts; there can only be
1, 2, or any number of persons.

The computer then performs arithmetic operations to calculate the amount of
energy for the actuator(s) to expend in an effort to drive the plant. The
amount of time required to perform this computation depends on its
complication. A PID (proportional-integral-derivative) control algorithm
is one of the fastest to perform. Many times, the computation is performed
in software. Consequently, the control action is only available discretely
in time. Compare this to an analog controller in which control action is
available continuously; examples of analog controller is the electronic
circuit implementation of a PID controller with the use of resistors,
capacitors and transistors.

The control action out of the computer should be continuous in time because
of the continuous operations of actuator(s). There is also an added
complication related to the reconstruction of a continuous-time from
discrete-time signal that I opt not to discuss at this time. In a nutshell,
it is necessary that the control action be available at regular intervals.

Selection of the sampling frequency is also quite involved as it has a lot to
do with the speed of response of the plant to control and the computational
speed of the computer. We also must select it in such a way that aliasing,
fast changing signals appearing as slow changing ones, doesn't occur. So far,
I haven't been able to find such phenomenon in other fields than engineering.
Ideally the sampling frequency should be ten to twenty times the plant
natural or fastest frequency. This also ensures relevancy of the fed-back
signal.

Another direct result of this computation is the control action always lags
the measurement; the lag time depends on the speed of computation. For this
reason, in the early days of computer-controlled systems, engineers also
employed hardware-assisted computing with the use of digital signal
processing hardwares. The point is there exists a delay between measured
behavior and any action intended to affect the system's future behavior.
Note the similarity between this and an inventory control systems in
several manufacturing industries: a production output depends on
inventory and sales reports which are available only periodically. The
similarity becomes apparent as one has to wait for the product to finish
all the operations. Similar phenomenon is also observable in the fastfood
world or other service industries.

It is not very clear, in the socio-economic realm, the impact of less-than-
frequent measurements on the success of any measurement-based policies to
affect the behavior of the system. In the science/engineering realm, however,
the impact is better understood because of the existence of well-formulated
theories and their mathematical representations.

In the world of control engineering, the following terminologies are used:
-Discrete-time signal: signal available periodically at specific intervals.
-Quantized signal: integer-valued signals.
-Digital signal: discrete-time and quantized signals.

1. Discrete- v. Continuous-Time.

The name of the game is "Computer-Control that Process" which means
implementing a control algorithm to influence the behavior of
hardwares. The resulting computer-controlled system must not cause
damage to the hardware(s) or injury to the operator(s). This is the
role of modeling for control--useful for obtaining operating parameters
that yield a desired behavior.

Many physical systems operate continuously in time, yet our computer-
controlled system takes measurement and sends control command at
periodic intervals. Managers will realize that this is also one way
they operate (periodic measurement and policy implementation). They
look at monthly or quarterly reports and decide what steps to take to
go after their goal(s), e.g., bottom line, etc. So do people in
government in making policies involving economy (interest rates, taxes,
commerce, etc.), crime and policing, etc. Of course here the measurements
are also used for prediction that plays a role in selection of policy or
decision.

Having known the purpose of modeling and also operations of the system,
we are now ready to discuss the role of continuous and discrete modeling
in the design and implementation of control algorithm(s) for the intended
purpose.

Regardless of the mode, continuous or discrete time, many controllers
have been designed initially with the use of modeling and simulation
that can be performed on analog computers or using numerical integration
on digital computers. Let's ignore the fact that numerical integrations
on digital computers are also approximate! The main focus is on the
mathematical representation of the system. A continuous-time system is
typically represented as

dx1c/dt = f1[x1c(t),x2c(t),...,xNc(t),u(t),t]
dx2c/dt = f2[x1c(t),x2c(t),...,xNc(t),u(t),t]
...
dxNc/dt = fN[x1c(t),x2c(t),...,xNc(t),u(t),t]

whereas a discrete-time system is given by

x1[(k+1)] = F1[x1(k),x2(k),...,xN(k),u(k),k,T]
x2[(k+1)] = F2[x1(k),x2(k),...,xN(k),u(k),k,T]
...
xN[(k+1)] = FN[x1(k),x2(k),...,xN(k),u(k),k,T]

The relationship between the two representation is t = kT, k = 0,1,...
T is the sampling interval (time).

Physical plants operates continuously in time. Their variables (states)
have non-quantized numerical values. Some plants operates continuously
in time, yet some of their variables have quantized numerical values even
though most of the other variables have non-quantized values. Examples
of these "plants" are in manufacturing and service industries.

The measurement and controller portion of the "closed-loop" system
generally operates discretely in time. This is particularly true in a
computer-controlled system as well as in some of the aforementioned
social, economic and political systems.

In simulating the closed-loop systems, control engineers will do either
(1) transform the continuous-time representation of the "plants" into
its discrete-time form (2) insert a zero-order-hold between the controller
and the plant. A zero-order-hold extrapolates a discrete-time signal such
that it would appear continuous by holding the numerical value of the
signal at one time step constant over an interval until its value changes
at the next time step.

In other words,

for kT <= t < (k+1)T, xc(t) = x(k)

This is actually what happens in a computer-controlled system; the digital
control command from the computer is converted into an analog actuating
signal with the use of some logic circuits that perform the zero-order-hold
operations described above.

Let's look at the question that control engineers asked themselves during
the infancy of digital control theory, "Is the added complexity of hybrid
modeling and simulation necessary?" or "What is the criterion for designing
a computer-controlled system using a continuous-time formulation only?"
Note the question above is the result of my paraphrasing their quest for
better understanding at the time. Note also its similarity to the
questions in this list some time ago; such as "Is SD non-quantized formulation
sufficient to depict the behavior of the rabbit-fox dynamics in which the
rabbit and the fox have clearly integral values?" or "Can SD formulation be
used to describe the borrowing-and-paying-off debt in which interests on the
principal is calculated periodically?", etc.

2. Necessity for Added Complexity due to Hybrid Formulation.

The direct correlation between the continous- and discrete-time domain is
described in details as we explore the conformal mapping from the Laplace-
to Z-transform complex domain. Rather than spending time on Laplace and
Z-transforms, I urge whoever is interested to consult the literature on the
subjects. Instead, I will mention intuitively the basic transformation that
also determines a condition that allows the use of continous-time modeling
and simulation to design the controller of the system. Intuitively, the
determinant factor here is the sampling time T.

Ref --> Controller --> Switch --> Zero Order Hold --> Plant --> Output
> >
> >
><-------------------- Measurement <--------------------|

The switch closes when time is an integer multiple of T; it is open
otherwise. When it is closed, the system operates in a closed-loop mode
--control action is based on the deviation of output from its desired
(reference) value (negative feedback loop). When it is open, the plant
operates in an open loop mode in which the input into the plant is constant,
at the value of the control command at the previous time step. The longer
the system operates open-loop, the less efficient is the feedback action!
Also, as the sampling time depends on the speed of processing the fed-back
signal into the control command, the longer it is the controller becomes
less effective as it tries to affect the output based on obsolete measurement.
The result is a system that is unstable--blowing up or exhibiting "violent"
oscillation with growing amplitude until the system fails. Many times,
though, the outcome is not so dramatic that the output "only" exhibit damped
oscillation.

As discussed earlier, the dependency of the sampling time T on the speed of
computing and the lowest characteristic time in the system complicates the
design of a computer-controlled system. There are two contradicting criteria:
(1) sampling as fast as possible yet (2) allowing sufficient time to process
the measured data. As T gets closer to the lowest charasteristic time, we
can use continuous-time modeling and simulation to design our control
algorithm. Otherwise, control engineers have to use the hybrid modeling and
simulation described above.

3. Food for Thoughts.

In an effort to "control" the behavior of social system, people have employed
the feedback control methodology. They take measurements, compare them to
the desired behavior and, finally, make decision (or implement policy) that
will bring the behavior closer and closer to the target. Many times, we have
witnessed the lead time required to process the raw data into useful
indicators. This lag is analogous to the computing time in a computer-
controlled system. Essentially there is no control imposed on any social
system in between measurement time which can vary from weeks to months to
quarters.

In socioeconomic/sociopolitical systems, the impact of such a delay is less
understood that it is in science/engineering systems. Now, my questions are
(1) Has anyone of the esteemed SD practitioners or policy makers on this list
studied such an impact?
(2) Has anyone used SD to estimate the fastest changing dynamics in the system
of interests?
(3) How does one determine the frequency of measurement and control?
(4) Are there studies on "aliasing" phenomenon in systems other than science/
engineering?

···

Subject: Insights from computer-controlled systems. (SD0367)

---