Physics and Astronomy 

Physics Home  Study here  Our Teaching  Our Research  Our Centres  News  Work here  EMPS 
Back to top
Technical Details About The SimulationReturn to: Interactive Simulation. The HTML InterfaceThe simulation is a fairly simple FORTRAN program frontended by an HTML form. John Rowe's Metaform system processes the submitted form, identifying and substituting variables. It is this mechanism that updates the sentence about the setpoint programme so that it describes the times and settings correctly. The browser reads the processed form and, by loading the graph, activates a second Perl script called Metagraph. Metagraph pipes parameter values from the form into the FORTRAN simulation code and passes the output to GNUPLOT which generates HPGL. This is converted to the gif format to be displayed by the browser. Frequency Domain SimulationThe frequency domain simulation PIDFD is straightforward; it calculates values for the frequencydomain magnitude and phase of the oven temperature using the defining equations for the oven and PID controller. FORTRAN's good feature, complex arithmetic, makes this very easy to do, about a dozen lines. This is increased to about 400 lines by the code that chooses nice ranges and tick mark positions so that it all fits on one graph that can be seen on a 13" monitor! It is not a bug that causes the 'closedloop' response curve sometimes to lie above the openloop response. This can happen when the sensorlag is nonzero because the graph shows how changing the setpoint temperature affects T_{o} which is not the same as how changes in the temperature of the sensor affect T_{o}. Time Domain SimulationIf the noise density is zero the differential equations describing the oven are solved using the NAG routine D02CJF which is a variableorder variablestep Adams method. Small values of sensor lag (compared with the oven time constants) increase the calculation time so sensorlag=0 is recognised and dealt with as a special case. The setpoint ramp has had its corners replaced by part of a tanh() function to keep all derivatives continuous. Initial ConditionsThe initial conditions are calculated on the assumption that the system has been running undisturbed for a very long time. For the OnOff controller the heater is off, the oven temperature is at the setpoint and is falling at a rate found by setting the second derivative of T_{o} wrt time equal to zero. This was intended to be an approximation for test purposes but I have yet to see any evidence of a significant startup transient resulting from it, so it'll do for now. For the PID controller things are simpler. The first derivative of T_{o} is zero, T_{err}=0 when the integral level is nonzero, or has the appropiate value when I=0. If I>0 then the integral of T_{err} wrt time is set to a value that will eliminate the static offset. This has the useful sideeffect that if the static offset interfering with the scaling of a graph it can normally be eliminated by setting I to a very small value, such as 10^{30}, without affecting the dynamic response. NoiseOne can't just add Gaussian noise from a random number generator to to this system and expect D02CBF, or similar adaptive integrators, to work. This is because they rely on the system of equations having derivatives that are continuous to high order. I've dealt with this problem here by generating a random spectrum for the noise and using the components of this to calculate Noise(time) and NoiseDerivative(time). The Fourier components of Noise(time) have random phase and frequency but unit amplitude. This trick has one undesirable property  it's slow to calculate. However, since the RMS noise can be estimated from the closedloop amplitude response and the noise density, it should be possible to specify an absolute accuracy target for D02CBF which is slacker than the one used in the noisefree case and recover some of the speed that way. ProblemsMost of the returned error messages are selfexplanatory. Small, but nonzero values for the sensor lag significantly increase the CPU time needed for the simulation. In this context small means less than about 1% of shortest time constant associate with the oven, which is usually C_{h}*(R_{ho}R_{o}). Extremely small values of sensor lag cause solutions may become unreliable, which can be recognised because noise appears on the power signal W which is not evident when the sensorlag is set to zero. Sensor lags less than 10^{4} times the shortest time constant associated with the oven are rejected to try and avoid users ever seeing this problem. Return to: Interactive Simulation. 