      Consult the following link to a summary of the next book on computer simulation by Stanislaw Raczynski:  Link to the book summary

Vehicle dynamics simulation: CarDyns program

Get the C++ source code for queuing simulation: CQM - C source code generator for queuing models

Low cost system dynamics simulation: SimBall program

New version of the Fluids program: Fluids6 - fluid dynamics simulation Molecular Simulation Simulation Encyclopedia Fluid flow Simulation  Queuing ModelSimulation  Heat transferSimulation Optimal settings of the Proportional-Integral-Derivative controller PIDS program The PIDS program calculates the PID controller settings and simulates the close-loop control system with the following structure Figure 1. Set point - the desired value of the controlled variable XError - control error. This is the difference between the set point and the measured real controlled value.Y - the controller outputV - delayed controller output ( the Delay and Process blocks form the model of the controlled process)X - controlled value. This is the output of the controlled process, for example temperature, pressure, motor velocity, flow etc.Xm - the measurement result. The measurment instrument may have the gain different from zero and a first order inertia, given by its time constant.   The main simulation procedure was generated using the Signal Flow module of the  PASION Simulation System. There are two parts of the program: 1. ZIEGLER-NICHOLS settings (a practical way to find the controller tunning) 2. Optimal settings with integral optimization criteria (more "academic" way to find optimal controller settings)   PART 1 Ziegler-Nichols methods The two Ziegler-Nichols (Z-N) methods are implemented. Using the first method you must provide the rpocess reaction rate and the equivalent time delay. The program calculates the Z-N tunning for the proportional, PI or PID controllers. The controller can have the anti-windup feature to avoid the saturation of the integral part. Then, the process transfer function is being estimated, supposing it is a second order process with time delay. This transfer function is used to simulate the open loop process response and the closed loop response with Z-N tunning. You can verify if the controller is working as expected, and then change the settings and repeat the simulation. The project data and results can be stored in a file, retrieved and editted. Using the second Z-N method, you provide the "ultimate period" and the "ultimate gain". Recall that those are the parameters of the closed loop oscillations at the limit of stability. The rest is done as for the first Z-N method, described above. In the Z-N methods the measurement instrument is supposed to be a part of the process (the block is supposed to have gain 1). The following figure shows en example of PIDS program output for the settings obtained by the first Z-N method. PART 2 Integral optimization criteria Controlled process The PIDS program supports controlled processes that are linear and are given by a transfer function of up to fifth order, with or without additional time delay. The time delay is introduced as a separate block. Only the delay value is necessary to define it.The controller The controller type can be: Proportional, given by its gainPID - controller with proportional, integral and derivative actionsPD - proportional-derivative controllerPI - proportional-integral controllerI - integral controller The controller may have limitted output. This means that a saturation can be defined at the controller output. If so, the whole system becomes non-linear. Optimization procedure The PIDS program can be used to simulate the control system with given user settings or to optimize the settings according to certain optimization criteria. The program supports some typical integral criteria, all of them being related to the control error in response to a step function applied to the system input (set point). The criteria are as follows. ITAE - The Integral of Time per Absolute Error ITQE - The Integral of Time per Cuadratic Error IQE - The Integral of Quadratic Error IAE - The Integral of Absolute Error An Example Consider a temperature control system. The controlled process is a small electric heater. The time unit for the whole system is one minute. The input to the process is a volage sent by the PID controller. Suppose that the powel amplifier has no inertia and that it is included in the process block. The total static gain of the process (including the amplifier) is equal to 60 degree C/volt. The process dynamics is approximated by a third order transfer function with additional delay of 0.2 min. So, the whole transfer function of the process is as follows As for the measurement channel, suppose that we use a thermoresistor with corresponding signal conditioner, which overall gain (sensor and the circuit) is equal to 0.003 Volts/degree C. The sensor time-constant is equal to 0.3 min. So, the total static gain of the feedback loop excluding the controller is equal to 0.18. To make this gain equal to one, we would need the controller with gain 5.55. Suppose that our initial settings make the total feedback gain slightly greater than one, the controller gain being equal to 7. Let set the integration time and derivative action coefficient equal to 2 and 0.1, respectively. To avoid big signals in the case if instability and to take into account some physical limitations, we set the controller upper saturation limit to 10 and the lower limit to -10. You will see that with the above user settings the system is unstable. The following figure shows the growing oscillations of the controlled value (temperature). Note that our controlled process is lineal, and it can reach positive as well negative output values. Physically, this means that the process includes a heater and a cooler, and that both operation modes (heating and cooling) have the same dynamic properties. Now, let us request the ITAE optimization procedure. The optimization procedure finds controller settings that stabilize the process and minimize ITAE. First, the global rough solution is found by a random search. Then, the settings are refined with the non-gradient Powell optimization algorithm. The optimization progress is shown for the controlled variable. The following plot is the temperature response of the whole system with controller settings near to optimal ones (after calculating 1065 trajectories). The optimal controller settings are also shown. Contact: Stanislaw Raczynski  stanracz@stanr.com How to buy it: Go to the PidFeel page on http://www.raczynski.com/pid/pidfeel.htm and use the Buy button. Buying PidFeel you will receive both PidFeel and Pids programs.