CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged. Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. Updating Variables 6 1. Output Timing 7 1. Numerical Integration 9 1. User Programs and Editor Windows 13 1. A Host—Parasite Problem 45 2. Coupled Oscillators 90 4.
Rotation Matrices 6. A Glimpse of Advanced Applications 6. The Bouncing Ball 7. The Pilot Ejection Problem 7. Simulation Accuracy and Integration Techniques, A. I hope that this book will help engineers and scientists use personal computers for modeling and simulation. The book is not a survey or history of simulation programming. The book CD has an industrial-strength simulation-program package. Readers can then run and modify every program example in the text, or try their own projects.
Our simulation language reads much like ordinary mathematics notation, e. Chapter 1 introduces dynamic-system models and then explains how differential equation—solving software works. The program readily combines differential equations with difference equations to model sampled-data control systems and neural networks.
Desire does not solve differential algebraic equations. We then present a new detailed treatment of the difference equation programs needed to model sampled-data control systems with digital controllers. The remainder of the chapter discusses the use of submodels for efficient programming. Every simulation implies an experiment protocol that sets parameters, calls simulation runs, and decides what to do next. Typed commands will do for very simple experiments, but serious studies need a full-fledged programming language to combine and compare results, or to do parameter optimization and statistics.
Chapter 5 describes our experiment-protocol scripting language. Compact vector operations can implement model replication: I am deeply indebted to Theresa M. I would also like to thank Professor A. Vakilzadian University of Nebraska , Dr. Main University of Colorado for valuable help with his Windows graphics library. Korn, Advanced Dynamic-System Simulation: Chapter 1 Interactive DynamicSystem Simulation 1. Useful models can involve toy building blocks, sandboxes, or sketches on paper. Simulation is experimentation with models.
What is more, simulation lets you experiment with the design and operation of projects—say, space vehicles or forest reserves—before they are built. Simulations, of course, manipulate only models and must eventually be validated by real-world tests. The dual-screen display shows Command and Graph Windows, a user-program file folder, and three Editor Windows. Programs in different Editor Windows can be run in turn to compare models or different versions of a model. This chapter introduces state-transition models of dynamic systems and describes how a differential-equation-solving simulation program does its job.
We then exhibit a complete, easily readable simulation program in Section 1. However, defined variables may also simply be intermediate results introduced for convenience in computations. In computer programs, the defined-variable assignments Equation 1. It must be fast, and is therefore compiled at runtime. The less time-critical experiment-protocol script is interpreted.
Both script and simulation runs execute at once on a typed run command. More specifically, the derivative routine computes all derivatives G1, G2, …, Gn and stores them in a hidden array. To run a simulation, the experiment protocol initializes displays and other output, and sets parameters and initial values. A programmed or command-mode drun statement compiles the derivative routine, if it was not already compiled by an earlier run.
Yes Yes Output Routines Figure 1. An extra set of samples is collected at the end of the simulation run to provide initial values for continued runs. Some simulation programs obtain such time-history values by interpolation between samples outside the integration-step interval, but that slows the simulation. Even then, some integration steps could overlap one output-sampling point. Each integration step ends with a derivative call that produces derivative and defined-variable values for the next step.
Voluminous literature and many useful program libraries exist. References 2 and 3 are recent comprehensive treatments of this subject, and the Appendix has more references. This extra computation per step often reduces the number of steps, and thus the total number of derivative calls needed for a specified accuracy. Explicit integration rules such as Equation 1. Implicit rules clearly involve more computation, but they may admit larger DT values with acceptable errors see also Appendix A.
This can save many integration steps and thus much computing time. Variable-step rules are further discussed in the Appendix. The experiment-protocol statement irule n selects one of the 15 integration rules listed in Table A. The integration rule defaults to Rule 1 fixed-step 2nd-order Runge—Kutta integration. This topic will be discussed in Chapter 4. Finally, simulation time histories and error messages must display during rather than after a simulation run or simulation study.
This can save valuable time by letting you stop simulation runs with uninteresting or faulty results. No installation program is needed. Desire can also be run directly from the distribution CD or from a flash stick. One can also run multiple copies of Desire and thus multiple simulations concurrently.
Uninstallation is equally simple. No garbage is left on your hard disk. Desire is not bothered by the difference between Windows and Linux text-file formats, so that user programs prepared under either system work in both. These folders are also distributed over the Internet as compressed folders mydesire. Overall, Linux is very reliable and avoids the registry problems that plague Windows after multiple program installations and removals. User Programs and Editor Windows 1.
User programs are ordinary text files stored anywhere on your computer, usually with the file extension. You can then edit and run again. Your original program file is unaffected until you decide to save the edited program with Do not associate the file extension. To pause a simulation run, double- or triple-click the Graph Window under Windows type Ctrl-c under Linux.
This can be extraordinarily useful for comparing different models, or different versions of the same model, for example, with changed parameters or program lines. A typed reload command reloads the last-saved version of the program and closes all Editor Windows.
Interactive Dynamic-System Simulation
The typed command keep replaces the original user program with the edited file. Statements or lines starting with — two hyphens are comments, and is a statement delimiter. The initial values of the t and of the state variables x and xdot are not specified and automatically default to 0.
Next, an experiment-protocol for loop Sec. Note that thick curves display R take some extra time.
Graphs normally display in color. The output request type x1, x2, Automatic display scaling is discussed in Chapter 6, Section 6.
Interactive Dynamic-System Simulation - CRC Press Book
It is often useful to plot multiple time histories on different time axes. Not used in command mode. Color keys relate the colors of up to 8 curves to variable names in the display list. The default background color is black. Under Windows, interpreter plots Chapter 8, Section 8. But the best way to save a simulation-run time history is with a store statement that saves the time history in an array declared by the experiment-protocol script Chapter 5, Section 5.
Graph Windows captured with Alt-Prt Scr under Windows or with a snapshot command under Linux can be pasted into word processors or graphics editors for storage and printing. That takes only seconds, so that you can try different versions of graphs interactively. The graphs in this book were prepared in this manner. To create black-on-white graphs for publication use display N - 8 display C16 under Windows or display N16 display C17 under Linux. Thick curves display R may look better in print, but thin curves display Q provide better resolution and take less time.
But there is no need to remember the precedence convention; simply use parentheses! And each program starts with an experiment-protocol script that controls the simulation, just as a Basic program might control an automated chemistry experiment. In particular, the command new erases the program currently in memory, and ed or edit displays it in a new Editor Window. Programmed STOP statements in experiment-protocol scripts stop execution until the user types go.
STOP cannot be used in command mode, but under Linux Ctrl-c stops execution even during simulation runs. A programmed or command-mode write x statement displays the current value of x. The program reminds you if you forget to specify the simulation-run time TMAX. The Reference Manual has default parameter values for variable-step integration.
These topics will be discussed in Chapter 5. These are easily reduced to the first-order differential equations Equation 1. Computer simulation permits thorough studies of such problems. Much as in Chapter 1, Section 1. For larger values of theta we have a nonlinear oscillator. The equation of motion Equation 2. The original display showed each phase—plane plot in a different color. The for loop Chapter 5, Section 5. The figure also shows the resulting time history of the reactor power density after a control rod is pulled out.
The filemanager window lists additional available examples. Such simulations are important for engineering design, safety studies, and operator training. Simulation of nonlinear electric circuits e. Here, an initial disturbance resulted in a short and safe pulse based on Reference 1.
We included this program here to demonstrate that a program with explicit derivative assignments works perfectly well. However, it is clearly not practical to key in such long programs. The improved program in Chapter 6, Section 6.
Bestselling Series
Note the reflection of the input step in the unmatched case. In Chapter 6, Section 6. A loop in the experiment protocol computes the initial xdot and ydot values for different elevations. The statement term y — 0. We use six state variables: The four equations 2. Computation of the aircraft trajectory with respect to earth-fixed x and y axes earth axes requires two additional state equations: We keep only terms linear in the small perturbations 2. This simple linear model exhibits the typical time delays associated with pitch and altitude control.
Specifically, elevator deflections must change the pitch angle before the resulting increased angle of attack increases the flight-path angle and thus lifts the aircraft. For better control, a voltage proportional to the pitch-rate perturbation phidot is sensed by a rate gyro and added to the attitude signal. The autopilot control voltage controller output is then Figure 2. A more realistic autopilot model will be described in Chapter 4, Sections 4. The yaw rotation is determined by state equations similar to those for pitch in Section 2.
We are interested in the population counts of susceptible, sick, and cured individuals. Although population counts are really integers, we model them as continuous state variables. Note that population counts are treated as continuous variables. A cure is assumed to confer immunity. A Host—Parasite Problem 2. The parasite population then declines; as a result, the host population tends to increase again.
With different parameter values e. Time units could be hours, days, or months. The original color-coded display clearly identified the curve with the larger excursions as the host—population curve. The parasite population grows after the host population grows, then chokes it off, and decreases from lack of food. With the parameter values used here, the populations recover, and the process repeats periodically.
It is not easy to measure the rate at which 2-year-old coyotes eat 4-month-old rabbits. Models essentially similar to population-dynamics models are also very useful for studying chemical reactions [5,6]. Chapter 3 Introduction to Control System Simulation 3. We have already introduced a simple autopilot model in Chapter 2, Section 2.
Both displays show time histories of the servo input, output, error, and torque. The original displays were in color. More damping slows the response. Frequently used test inputs are steps, ramps, sinusoids, and noise. More often than not, one needs to try several different test inputs. One tries to vary design parameters until the errors look reasonably small. Such simpleminded computer-aided experimentation gives the designer some feeling for a proposed new system. The simulation may show up control system instability or gross design errors. One computes these simply as extra state variables with zero initial values: Desire automates such studies with more or less elaborate experiment-protocol scripts.
We shall present a simple example in Chapter 6, Section 6. A display 2 statement Chapter 1, Section 1. The graphs show how each working run is followed by a gradient-measuring run, and then by a larger working step. ISE for the specified step input u t. The optimization process is stopped when DISE becomes smaller than a specified small number crit. Values of the optimizer parameters Dr and opgain were deliberately selected to slow the optimization for a better demonstration. The linear-controller definition Equation 3.
Error-rate feedback as opposed to the simpler output-rate feedback in Section 3. They can, for instance, implement relay servos bang-bang control, Chapter 4, Sections 4. Desire models of fuzzy-logic control are treated in Reference 1. Desire programs for Monte Carlo simulation of noisy control systems are discussed in a separate textbook [1]. Simulations usually generate sampled-data time histories by solving difference equations.
As noted in Chapter 1, Section 1. But difference equation state variables must be explicitly selected and updated in each user program. Desire, though, is specifically designed to deal directly with difference equations. If the DYNAMIC program segment does contain differential equations, then the simulation time t is incremented by an integration routine, and we have the normal situation described in Chapter 1, Section 1.
At the periodic sampling times Equation 3. This technique lets you sample pseudorandom noise Chapter 4, Section 4. But such relatively primitive difference equations have much interesting and important applications Chapter 4, Sections 4. Unlike the simple recurrence relations Equation 3. A program for solving the difference equations Equation 3. The defined-variable assignments Equation 3. The difference equation assignments Equation 3. Updating assignments Equation 3. It is easy to overlook the fact that the state-variable values qi produced by the updating assignments Equation 3.
One must then display or list qq t rather than q t to ensure that state variable values as well as defined variables are output at the correct sampling times. Note at this point that the experiment-control commands reset and drunr reset only t, DT, and differential equation state variables. Difference equation state variables must be reset individually. For this reason, any and all difference equation code Equation 3. But it is impossible to display or list interpolated data when display and sampled-data sampling rates are equal.
Sampled-data operations then execute at the uniformly spaced sampling times Equation 3. References 2 and 3 present comprehensive introductory discussions of PID control. Bishop , Modern Control Systems, 11th ed. Chapter 4 Function Generators and Submodels 4.
- Interactive Dynamic System Simulation Second Edition Numerical Insights.
- Interactive Dynamic-System Simulation, Second Edition (Numerical Insights)?
- Interactive Dynamic-System Simulation, Second Edition (Numerical Insights) - PDF Free Download.
- Analytical Methods for Markov Semigroups (Chapman & Hall/CRC Monographs and Research Notes in Mathematics)?
- Interactive Dynamic-System Simulation, Second Edition : Granino A. Korn : !
The piecewise-linear functions in the last three lines are discussed in Sections 4. Function arguments can be user-written expressions. To define the function table, the experiment-protocol script declares an array F that concatenates an array x of the n breakpoint abscissas x[i] and an array y of the n function values y[i], as shown in Chapter 5, Section 5. The function generator implements the relation in Equation 4.
The function-table entries can be read from a data list or file Chapter 5, Section 5. The assignment Equation 4. Such functions can be collected in library files for reuse. Function definitions may include constant parameters and variables. Dummy arguments must not be subscripted. SAT x similarly limits its output between 0 and 1. The quantizer error y - x is often called quantization noise. But that is really not true.
Interactive Dynamic System Simulation Second Edition Numerical Insights
Reference 1 discusses tests of pseudorandom-noise quality. Readers of this introductory text, though, ought to be aware of the following points: This results in predictable noise power spectra [1] and also prevents execution of these discontinuous functions in the middle of integration steps Section 4.
It is, in principle, possible to replace limiters and switching functions with differentiable approximations. But this introduces large absolute Jacobian eigenvalues stiffness, see Section A. Early simulation projects ignored the problem altogether and often produced reasonable results, either by sheer luck or perhaps because stable control system models reduced errors. In simulations combining differential equations and periodic sampled-data operations, limiters, switches, noise, and rounding functions called by sampled-data operations are safe, because they necessarily follow an OUT or SAMPLE m statement Chapter 1, Section 1.
But if such functions are called within a differential equation system, they must follow a step statement that postpones their execution until the end of the current integration step. Switching-time accuracy then requires acceptably small integration steps near a switching point. With the fixed-step integration rules 1, 2, and 3 Table A. Integration rules 2, 3, and 5 let the users themselves program the integration step size during simulation runs by assigning new DT values in a DYNAMIC program segment.
When you use, say, swtch x — a , you can decrease DT as a function of x - a Section 4.
As noted in Chapter 3, Section 3. As we saw in Chapter 3, difference equation state variables are not automatically reset by reset or drunr statements but must be reset explicitly by the experiment protocol. As with all hysteresis models, this is not a static transfer characteristic but implements a difference equation. We give x the initial value A, and let the initial value of the difference equation state variable p default to 0.
You can combine the sawtooth wave y and a nonlinear-function generator—say a table-lookup generator Section 4. In the latter case, this recurrence relation must be invoked even in the middle of integration steps. The recursion relation tries to move y in the direction of the negative gradient of the squared error E. With suitably differentiable functions, the optimization succeeds if y is never far from the correct minimum. We shall return to the coupled-oscillator problem when we discuss submodels with vectors and matrices in Chapter 6, Section 6.
As discussed in Section 4. We added a small amount of hysteresis to the deadspace comparator. The comparator is followed by a time delay Chapter 6, Section 6. It would be possible to save computing time by reducing DT only when it is necessary. Conventional variable-step integration does not help here, since it tests only integration errors within integration steps. Note the effect of introducing a realistically small integration step DT. This technique was first demonstrated in Reference 1 with a complete Desire program simulating the response of a bang-bang servo to a suddenly applied sine wave input.
The time histories show clearly how DT decreases for small absolute errors, and thus near each switching point. Chapter 5 Programming the Experiment Protocol 5. We saw in Chapter 1, Section 1. Beyond this, Desire experiment-protocol scripts can include operating-system commands prefaced by sh. This lets simulation experiment protocols call external programs such as spreadsheets or special graphics programs and communicate with them through files or pipes. The following sections present the program-control and array-handling syntax used in application programs later in the text.
We shall refer to this chapter as needed. For truly interactive modeling, screen-edited programs are run-time compiled and immediately produce solution displays on a typed run command. Since , Granino A. Korn has been a full-time software developer and consultant at his company G. From —, he was a professor of electrical engineering at the University of Arizona, where he directed the Computer Engineering Research Laboratory.
Korn has authored numerous books and papers over the years. He earned his M. We provide complimentary e-inspection copies of primary textbooks to instructors considering our books for course adoption. Learn More about VitalSource Bookshelf. CPD consists of any educational activity which helps to maintain and develop knowledge, problem-solving, and technical skills with the aim to provide better health care through higher standards.
It could be through conference attendance, group discussion or directed reading to name just a few examples. We provide a free online form to document your learning and a certificate for your records.
Top Authors
Already read this title? Please accept our apologies for any inconvenience this may cause. Exclusive web offer for individuals. Add to Wish List. Toggle navigation Additional Book Information. Summary Showing you how to use personal computers for modeling and simulation, Interactive Dynamic-System Simulation, Second Edition provides a practical tutorial on interactive dynamic-system modeling and simulation.
Author s Bio Since , Granino A.