You are on page 1of 91

AB

HELSINKI UNIVERSITY OF TECHNOLOGY Department of Automation and Systems Technology

Mikael Pohjola

PID Controller Design in Networked Control Systems

Masters thesis for the degree of Master of Science in Technology submitted for inspection, Espoo, 9. January, 2006.

Supervisor:

Prof. Heikki Koivo

Instructor:

M.Sc. (Tech.) Lasse Eriksson

TEKNISKA HGSKOLAN Automation och Systemteknik Frfattare Mikael Pohjola Tittel: PID Controller Design in Networked Control Systems Professur: Systemteknik vervakare Professor Heikki Koivo Handledare DI Lasse Eriksson

DIPLOMARBETE ABSTRAKT Datum: 9.1.2006 Sidor: 81

Kod: AS-74

I styrsystem ver ntverk (Networked Control Systems, NCS) r processen och regulatorn separerade av ett datorntverk. Diplomarbetet behandlar olika typer av NCS och sensorntverk och de reglerproblem som uppstr lyfts fram. Traditionella justeringsmetoder fr styrsystemet kan inte ta i beaktande den varierande tidsfrdrjningen som uppstr p.g.a. ntet. Nya justeringsmetoder behvs. Diplomarbetet bestr av tv delar: 1) Justeringsmetoder fr diskret-tids PID regulator i system med varierande tidsfrdrjningar, inklusive NCS, och 2) utveckling av MoCoNet systemet. Regulatordesignen fokuserar p en optimering genom simulationsteknik. Regulatorn testas med MoCoNet systemet. Med MoCoNet systemet kan laboratorie-experiment utfras ver Internet. Systemet kan anvndas med en webblsare med Java-std. Styrsystem byggda med MATLAB/Simulink kan snabbt testas p en riktig process med rapid controller prototyping-metodiken. En ntverks-simulator mjliggr studier av styrsystem ver ntverk. Den andra delen av diplomarbetet utnyttjar denna mjlighet. Resultat med optimala PID parametrar presenteras fr olika typer av frdrjningar i ett allmnt fall med konstant, tids- och tillstnds-beroende eller slumpmssiga frdrjningar. Resultaten ges som funktioner av processens tidskonstant och regulatorns sampeltid. En disktret-tids PID regulatorn r justerad fr en exempelprocess och regleringen verifieras med MoCoNet systemet. Optimeringsmetoden visar sig fungera bttre, bde i simulationer och i verkligheten med MoCoNet systemet, jmfrt med andra traditionella justeringmetoder som undersks i arbetet.

Nyckelord: styrsystem ver ntverk, diskret-tid PID regulator, justering, varierande tidsfrdrjning, fjrrlaboratorium.

HELSINKI UNIVERSITY OF TECHNOLOGY Department of Automation and Systems Technology Author Mikael Pohjola Title: PID Controller Design in Networked Control Systems Professorship: Control Engineering Supervisor Professor Heikki Koivo Instructor M.Sc. (Tech.) Lasse Eriksson

ABSTRACT OF MASTERS THESIS Date: 9. January, 2006 Pages: 81

Code: AS-74

Networked control systems (NCS) and sensor networks, where the process and the controller are separated by a network, are discussed in this thesis and new problems in control are pointed out. Traditional tuning methods can not handle the varying time-delay in NCS. New controller tuning techniques are needed. The thesis consists of two parts: 1) Discrete-time PID controller tuning for varying time-delay systems, including NCS, and 2) development of the MoCoNet system. The controller design in the thesis focuses on an optimisation by simulation tuning technique. The tuning is tested with the MoCoNet system. The MoCoNet system enables students to conduct remote laboratory experiments over the Internet. The interface is an applet and can be run with any Java enabled browser. The MoCoNet system supports rapid control prototyping, where controllers built with MATLAB/Simulink can be easily tested on a real process. With a network simulator control design of NCS can be investigated in the MoCoNet system with a real process. The other part of the thesis takes advantage of this feature. Optimal PID tuning results are presented for a general process model in different cases of constant, state- and time-dependent or random delays. The results are displayed as functions of process time constant and controller sampling time. A discrete-time PID controller is tuned for an example process and the tuning is verified with the MoCoNet system. The optimisation tuning is shown to perform better, both in simulations and in practice with runs on the MoCoNet system, than other traditional tuning methods investigated in the thesis.

Keywords: networked control systems, discrete-time PID controller, tuning, varying time-delay, remote laboratory. ii

Preface
I have worked on-and-off at the Control Engineering Laboratory, Helsinki University of Technology since 2003. My first summer job was part of the ERHE - Very Distributed Sensor and Actuator Networks1 project, funded by TEKES, which dealt with optimisation of discrete-time PID controllers for variable time-delay systems. The next summer I developed the MoCoNet platform, funded by TKK2, for doing laboratory experiments from home. The work I have done at the lab has been much assistance in my studies. I am fortunate that my boss suggested that my thesis should incorporate these topics. Writing has been a relatively easy job, as I have leaned on my previous work. I have, though, worked hard to be clear and precise, with great assistance from my instructor. Effort has been done to form the thesis into a whole from the pieces of my work. The MoCoNet platform has been published to the scientific community at the 16th IFAC World Congress, Prague, Czech Republic (Pohjola et al., 2005). The presentation was held to an interested audience with tough questions. I thank The Finnish Foundation for Economic and Technology Sciences - KAUTE for granting me a stipend to travel to the congress and present the paper at a session. I must thank my family, although they have had nothing to do with the thesis, and my girlfriend for listening to me and for nodding when I ramble on what I have and havent managed to do that particular day.

January 2006, Mikael Pohjola

1 2

Erittin hajautetut anturi- ja toimilaiteverkot TKK:n opintotoimikunnan hankerahoitus

iii

Table of Contents
PREFACE .......................................................................................................................................... III TABLE OF CONTENTS ...................................................................................................................IV LIST OF SYMBOLS AND ABBREVIATIONS ..............................................................................VI 1 2 INTRODUCTION ....................................................................................................................... 1 VARYING TIME-DELAY SYSTEMS...................................................................................... 3 2.1 EXAMPLES OF VARYING TIME-DELAY SYSTEMS.................................................................. 3 2.1.1 2.1.2 2.1.3 2.2 Transport Belt ....................................................................................................... 4 Tank-Pipe .............................................................................................................. 4 Traffic.................................................................................................................... 4

NETWORKS........................................................................................................................... 5 2.2.1 2.2.2 2.2.3 Ethernet and Internet ............................................................................................ 5 Internet Delay Distribution ................................................................................... 6 Internet Packet Loss.............................................................................................. 8

NETWORKED CONTROL ....................................................................................................... 9 3.1 3.2 3.3 DISTRIBUTED SYSTEMS ........................................................................................................ 9 SENSOR NETWORKS ........................................................................................................... 12 COMPONENTS OF DELAY .................................................................................................... 13

PID CONTROL METHODS.................................................................................................... 15 4.1 4.2 4.3 4.4 DISCRETE-TIME PID CONTROLLER..................................................................................... 16 PRACTICAL ASPECTS OF THE PID CONTROLLER................................................................. 18 ZIEGLER-NICHOLS TUNING ................................................................................................ 20 OPTIMISATION TUNING ...................................................................................................... 21 4.4.1 4.4.2 4.5 4.6 4.7 Optimisation Criteria .......................................................................................... 22 Optimisation Criterion Source ............................................................................ 23

INTERNAL MODEL CONTROL.............................................................................................. 24 GAIN SCHEDULING ............................................................................................................. 26 FUSION OF MEASUREMENT PACKETS ................................................................................. 28

MOCONET................................................................................................................................ 31 5.1 5.2 5.3 5.4 RAPID CONTROL PROTOTYPING ......................................................................................... 32 USER INTERFACE................................................................................................................ 33 SOFTWARE ......................................................................................................................... 35 HARDWARE ........................................................................................................................ 36

iv

5.5 5.6 6

NETWORK SIMULATOR ....................................................................................................... 37 EXAMPLE PROCESS ............................................................................................................ 38

OPTIMISATION AND SIMULATION RESULTS ............................................................... 40 6.1 OPTIMISATION FOR DIFFERENT DELAYS ............................................................................ 40 6.1.1 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.2 Case 1a - Constant Delay.................................................................................... 42 Case 1b - Random Delay..................................................................................... 43 Case 1c - Sinusoidal Delay ................................................................................. 44 Case 1d - State Delay.......................................................................................... 45 Case 2a - Constant Delay.................................................................................... 46 Case 2b - Random Delay..................................................................................... 47

OPTIMISATION FOR NETWORK DELAYS.............................................................................. 48 6.2.1 6.2.2 Case 3a - Semi-Distributed System ..................................................................... 48 Case 3b - Fully-Distributed System..................................................................... 50

6.3

GAIN SCHEDULING BY DELAY ........................................................................................... 51 6.3.1 6.3.2 Case 4a Step Delay Change ............................................................................. 53 Case 4b Sinusoidal Delay Change ................................................................... 54

6.4 6.5

SENSOR NETWORK ............................................................................................................. 55 TUNING FOR EXAMPLE PROCESS ........................................................................................ 59 6.5.1 6.5.2 6.5.3 6.5.4 Optimisation Tuning............................................................................................ 59 Ziegler-Nichols Tuning ....................................................................................... 62 IMC Tuning ......................................................................................................... 62 Results ................................................................................................................. 63

MOCONET RESULTS............................................................................................................. 67 7.1 7.2 7.3 7.4 OPTIMISATION TUNING ...................................................................................................... 68 ZIEGLER-NICHOLS TUNING ................................................................................................ 69 IMC TUNING ...................................................................................................................... 70 CONCLUSIONS OF TEST RUNS............................................................................................. 72

8 9 10

CONCLUSIONS........................................................................................................................ 73 REFERENCES .......................................................................................................................... 76 APPENDICES............................................................................................................................ 80 10.1 DERIVATION OF IMC TUNING FOR EXAMPLE PROCESS ...................................................... 80 10.2 RESULTS FOR EXAMPLE PROCESS ...................................................................................... 81

List of Symbols and Abbreviations Symbols


D e G(s) Gc(s) Gf(s) h I J Kp L N P P(x) T Td Ti ui ud up u(t), u[k] y(t), y[k] Derivative gain of PID controller Error Transfer function of process Transfer function of controller Transfer function of filter Sample time Integration gain of PID controller Cost function Gain of PID controller Time delay Filter coefficient for discrete-time derivative Proportional gain of PID controller Probability distribution Time constant of first order process Derivation time of PID controller Integration time of PID controller Integral part of control signal of PID controller Derivative part of control signal of PID controller Proportional part of control signal of PID controller Control signal, continuous- and discrete-time Process output, continuous- and discrete-time Tuning parameter of IMC controller Time-delay

vi

Abbreviations
GUI IAE IMC IP I/O ISE ITAE ITSE LAN MPC NCS PID TDM RCP RTOS Z-N Graphical User Interface Integral Absolute Error Internal Model Control Internet Protocol Input/Output Integral Square Error Integral Time Absolute Error Integral Time Square Error Local Area Network Model Predictive Controller Networked Control System Proportional-Integral-Derivative Time Division Multiplexing Rapid Control Prototyping Real-Time Operating System Ziegler-Nichols

vii

1 Introduction
Control theory is extending to new areas. As the use of Internet grows rapidly, more use for it has emerged. The idea to extend control loops over the Internet or over standard Ethernet networks has come up and this direction is being researched widely. The traditional local control loop is expected to expand to tomorrows control over large communication network with variable delay times (Katayama et al., 2005). The problem is that the network induces a varying time-delay into the control loop, which has to be taken into account in control design. Conventional control design can not take the varying time-delay into account, new methods are called upon. Networked control systems (NCS) are researched and some results have been achieved (e.g. Zhang et al., 2001). Dynamic programming has been proposed for controlling varying time-delay systems (Lincoln, 2003). But still simple tuning rules for varying time-delay systems are needed. The problem is hard because the timedelay in NCS often has a stochastic nature and it is difficult to approach it analytically. The thesis investigates optimisation in tuning controllers for varying time-delay systems using simulation. A PID controller structure is selected to control the system as it is easy and intuitive to tune. It is also used extensively in the industry (strm and Hgglund, 1995) and there is a benefit of using a well-known and trusted controller in future applications. This is a simple and desirable solution, since it does not require new control algorithms, just new tunings to fit for the varying delay. With a more complex controller the delay could be explicitly taken into account in the control algorithm, and better results could be possible. With a PID controller adequate performance can nevertheless be achieved. In modern industry where discrete-time PID controllers are used the controllers are tuned as if they where continuous controllers. The sampling frequency is set sufficiently high, so that the discrete-time controller approximates a continuous controller. This is acceptable if there is enough computing power and signalling capacity, as there usually is. In some new applications these luxuries are not always available. In networked control systems the network can not offer such a high bandwidth to transmit the measurement and control packets. The energy source and 1

the computing power are often limited on mobile devices, such as robots and autonomous devices. In these applications one has to enter the true discrete-time domain by lowering the sample frequency. Reijonens (2003) thesis introduced optimisation tuning for a continuous-time PID controller in varying time-delay systems, and now the work is extended into the framework of NCSs for a discrete-time controller. As the controller works in the discrete domain the tunings are done as a function of sampling time. The main contributions of this thesis are: Modification of the optimisation and simulation based tuning method for discrete-time PID controllers in NCS. Tuning rules for a first order system with several varying delays. Development and comparison of data fusion methods in NCS. Development and implementation of the MoCoNet system for investigating NCS with rapid control prototyping. Verification of the simulation based tuning with a real process using the MoCoNet system. The results and methods, as well as the theory they are based on, are presented in the thesis as follows: First varying time-delay systems are generally introduced and the time-delays in these systems are identified and analysed, including the delay distribution of the Internet. Then networked control systems are explained in Chapter 3, and the problems they produce to the control loop are pointed out. The discretetime PID controller and the optimisation tuning are presented in Chapter 4 among with other PID controller design methods such as internal model control and gain scheduling. The optimisation tuning method is applied in a general case for a first order system and for a certain example process in Chapter 6. These results are finally tested and verified on a real process in Chapter 7 with the developed MoCoNet platform described in Chapter 5. Finally, conclusions are offered in Chapter 8.

2 Varying Time-Delay Systems


In every practical control loop there is a time-delay. Often it is quite small resulting from sampling, computations of the control signal and the limited speed of the measurement sensors. In most cases such a delay is negligible. Other delays can be caused by the process itself. These are usually longer and give the process its particular character. Such delays stem from dead times such as transportation lag. These delays can be constant, but in some cases they are time- or state-dependent. This complicates the situation from the control design point of view. A time-delay is also introduced into a control loop when the loop is over a network, because of the transmission delay. The network can be anything from an industrial control network to even Internet. The nature of the delay depends on the network type. This delay can be e.g. time- or state-dependent or random. Some simple types of varying time-delay systems are explained in the following sections.

2.1 Examples of Varying Time-Delay Systems


Varying time-delays can arise in several ways in control loops. A process can have an inherent time-delay, such as in the examples in the following subsection, or the control loop can induce the time delay when controlling a process over a network. The control loops are similar, both depicted in Figure 2.1, but in the latter case one can talk about an undelayed output variable that is to be controlled whereas in the former case the delayed output is to be controlled. In the following subsections examples of systems with varying time-delays are given. First some physical example systems are given, and then a network is

yr

Controller

Process

L(t)

yr

Controller

Process

Reference1

Reference

L(t)

Figure 2.1: On the left: the delay as a part of the process. On the right: the undelayed process and a delay caused by e.g. network.

described as a stochastic varying time-delay system. The delays are identified from the example systems and their mathematical formulation is given.

2.1.1 Transport Belt


A transport belt transports the inflow of material Qin to the outflow Qout with the speed v. If the belt has a length L the material at the end of the belt will reach the other end in the time = L/v. The input-output relationship can then be described as: Qout (t ) = Qin (t ) . (2.1)

where is the time-delay. If the belt has a variable speed, the delay is timedependent:

(t ) = L / v(t ) .

(2.2)

2.1.2 Tank-Pipe
Consider a pipe with length L at the bottom of a fluid filled tank. In the pipe the velocity of the flow is v = Q / A , where A is the cross section area of the pipe. The pipe flow, Q, is a function of the height, h, of the fluid in the tank, due to the pressure difference of the air at the pipe outlet and the water pressure at the pipe inlet, according to Bernoullis law. Suppose that the tank is filled from above. Then the water flow, Qin(t) can be considered an outer disturbance. The water level in the tank varies with time. The velocity in the pipe and therefore the delay between the fluid entering and exiting the pipe is in other words dependent of the state of the system, h, and the delay is expressed as:

(h) = LA / Q(h)

(2.3)

A real example with similar setup is described in de Prada et al. (2005) with a heater in the tank. The temperature of the fluid in the tank is controlled by measuring the temperature of the fluid coming out of the outlet pipe.

2.1.3 Traffic
In urban traffic the queue lengths can be expressed as continuums. The time-delay for a car to reach the end of the queue from the previous traffic light is a function of the queue length, L, that is: ( L) . Define un (t ) (0) to be the length of the cars
4

passing a light. The change in queue length,

dLn (at light n), is then the difference dt between the cars reaching the light from the previous light and passing on green light
dLn (t , Ln ) = un 1 (t ( Ln )) un (t ) . dt

(2.4)

Let D denote the distance between the traffic lights and v the average speed of the cars. The delay from the previous light is the time it takes for the cars to reach the end of this lights queue. The distance for the cars to travel is D subtracted by the queue length. The time-delay is then

( Ln ) = ( D Ln ) / v .
The delay is thus state-dependent, i.e. a function of the system state, L.

(2.5)

2.2 Networks
A network can be used to interconnect the components of a control loop. The industrial networks used in automation are usually deterministic and they can guarantee certain reliability and time-delay bounds. This eases the design of control algorithms as stable operation can be determined with certainty. The delay is managed by token-ring, time division multiplexing (TDM) or similar technology or by having a high enough capacity network for it to deliver the demanded service even during exceptional loads. In a TDM network an upper bound of the delay can be set by letting every node in the network have its timeslot for communication, the timeslot being periodical. The information in the networks is transmitted as packets. Therefore as soon as we transmit a continuous-time variable through a network it is turned into discrete-time and we talk about the delay at certain time-steps, k.

2.2.1 Ethernet and Internet


Other networks than industrial can also be used. One attractive alternative is to use Ethernet, which is well known, cheap and easy to install because of its wide usage in computer networks. The downside is that Ethernet has an exponential fallback during collision. If two nodes try to transmit simultaneously there is a collision and both wait for a random time. If consecutive collisions occur the fallback time increases exponentially. Special care has to be taken in the control design to ensure stability 5

because of the exponential fallback. Either the control loop has to cope with the delays or the Ethernet can be improved to ensure real-time performance (Alves et al., 2000). The expected delay for a packet in an Ethernet bus is statistically random. One statistical model for the delay according to Cao et al. (2002) is the Weibull distribution, given by

P( x) = x n 1e ( x / ) ,
where is the shape parameter, the scale parameter and x a random variable.

(2.6)

The assumption that the network can be described by a delay distribution implies that there is no correlation between consecutive packets sent over the network. The assumption holds if the packets are transmitted sufficiently far apart, so that the queue lengths etc. have time to change between the packets. This is not the only requirement since the delay is usually also dependent on the utilisation of the network and the utilisation changes. To model a network with correlation a Markov chain can be used (Nilsson, 1998). In a Markov chain several delay distributions and a matrix expressing probabilities to change from one distribution to the other are defined. If the link is highly utilised (used by others) the delay distribution approximates an exponential distribution (Cao et al, 2002). This is a special case of the Weibull distribution with = 1 and = 1 / . Delay at time k is (k ) P( x) and P( x) = e x is the exponential distribution function with x being a random variable. (2.7)

2.2.2 Internet Delay Distribution


The control loop can be extended to several Ethernet busses or even to the Internet. The Internet resembles the situation of the traffic lights, where the packets play the role of the cars and the routers those of the traffic lights. The delay at the router queue is determined by the waiting packets and the routers throughput. It is however not feasible to count the packets. The delay can rather be modelled by a statistical distribution.

In a network such as the Internet, the delay distribution has been shown to resemble a shifted gamma distribution in a study by Mukherjee (2001), where the gamma distribution model was statistically verified with quantile-quantile plots. The plots showed that the delay data gathered and the statistical model had the same probability distribution. Another assurance of the correct conclusion was that parameters of the gamma distribution could be identified with properties of the network, such as the number of hops. The gamma distribution is also a generalization of the Weibull distribution encountered earlier. The gamma probability distribution function is given by P( x) =

( n)

( x) n 1 e x ,

(2.8)

where is the gamma function


(n) = t n 1e t dt
0

(2.9)

and n (the shape parameter) is the number of hops between the first and last node, = n / T, where T is the mean delay. Figure 2.2 shows the gamma probability distribution function for n = [1, 10] with mean delay T = 1. With n = 1 the distribution becomes exponential and is the distribution of a (one hop) Ethernet bus. The variance of the gamma distribution is

2 = n / 2 = T 2 / n .

(2.10)

Every network has a shortest possible delay. If a delay distribution is used for characterising a network, the distribution has to be shifted by this amount to the right to get the correct minimum delay. Typical network delay distributions have a peak and a long tail, similar to the gamma distribution. The total network delay consists of a static and a stochastic component Ttot = Tstatic + Tstochastic , (2.11)

where Tstatic is the minimum delay for the network and Tstochastic the stochastic delay induced by other traffic, approximated with the gamma distribution. The minimum delay thus shifts the graph to the right and results in the total network delay distribution.

Gamma distribution n = 1..10 1.4

1.2

0.8 P(x) 0.6 0.4 0.2 0 0

0.5

1.5

2 x

2.5

3.5

Figure 2.2: Gamma distribution for n = 1, 2, , 10, T = 1.

2.2.3 Internet Packet Loss


In computer networks such as the Internet the packets can also get lost. The loss is due to transmission errors and queue overflow at the routers. The packet loss is random and independent of the delay according to the investigation of Bolot (1993), if the packets are sent sufficiently far apart and the packets take up less than 10% of the links capacity. This is logical; consider two packets sent right after one-another. If the first packet is dropped due to a queue overflow, the second packet will probably also be dropped. This probability decreases as the time difference between the packets is increased. The 10% constraint is a similar assumption made when modelling networks with delay distributions. The assumptions are thought to hold simultaneously. A packet loss can be modelled with an infinite delay. In some protocols (e.g. TCP/IP) lost packets are retransmitted, which causes extra delays. In practice a packet is lost when the delay exceeds a certain threshold, or is declared lost when the information in the packet is outdated.

3 Networked Control
Nowadays there is a trend in the research of control theory to investigate control loops that are stretched over a network. The benefits include more flexible control loops and cheaper hardware, as of-the-shelf Ethernet networks and the Internet can be used. In networked control systems (NCS) the process and the controller are connected to each other by a network. The properties of the network such as delay and packet loss must be considered when designing the control strategy. The mentioned properties impose restrictions and difficulties in the control loop that are not present in traditional control loops. It is of assistance to design the control strategy by identifying how the control loop is structured and where the network comes into play. Work in the field is reviewed in Zhang et al. (2001) where a more practical view of NCSs is given and results on the control loop stability are presented. In this chapter the general structure of a networked control system is described and the characteristics and problems are illuminated.

3.1 Distributed Systems


In distributed systems the controller and process are physically separate and connected with a network. The measurement and control signals are sent over the network as seen in Figure 3.1, where a fully-distributed NCS is shown. There are two network induced varying time-delays in the control loop. The process variable (y) to be controlled is measured and the measurement is transmitted to the

yr

Controller

L(t)

Actuator

Process

Reference

Network
L(t) Sensor

Figure 3.1: Fully-distributed NCS where controller, actuator and sensor are distributed and connected with a network.

controller via the network. The controller compares it with a reference (yr), the desired response, and calculates the control output (u) based on the error signal (e). The controller output is transmitted over the network to the actuator that acts on the process to adjust the controlled variable. The network sends the measurement and control signals as packets. The sensor is usually time driven and sends periodically measurement packets to the controller. The controller can be event or time driven. In the event driven case the controller calculates a new control value when a packet reaches it. In this case the actuator is also event driven and is triggered as soon as the control packet arrives at the actuator (Nilsson, 1998). Both the controller and the actuator can be time driven in which case the calculations are done with the most recently received packet at regular intervals. This leads to a constant sampling time. In this thesis everything is time driven. The control system can also be semi-distributed, with the controller situated at the actuator as in Figure 3.2. The measurement is done at a distance, possibly at the other end of a large process (e.g. paper machine). The control signal is calculated locally at the actuator. This is the situation in Figure 2.1, right, where the controller tries to control a process without delay by delayed measurements. There can be several control loops in a distributed system, each affecting everything else. The sensors, controllers and actuators can be scattered in a network to control some large process. Figure 3.3 illustrates a wireless sensor and actuator network.

yr

Controller

Actuator

Process

Reference

Network
L(t) Sensor

Figure 3.2: Semi-distributed system where measurements from a sensor are sent over a network to the controller and actuator node.

10

Figure 3.3: Sensors, controllers and actuators in a distributed wireless (ad-hoc) network.

Because of the limited range (circles) of the nodes transmission must be done in several hops. This leads to different packet delays in the network depending on the path and utilisation of the network. The routes can also vary on the fly in case of an ad-hoc network. The network delay can be thought of, and implemented, as an output variable delay (Ekanayake et al., 2001). At every time step the packet leaving the network is selected with a selector pointing at a random location, according to a delay distribution, in a delay line, which contains all the packets travelling in the network (Figure 3.4). This is how the network is simulated in this thesis.

Delay Line
-1 Z Z -1 Z -1 Z -1 Z -1

Delay distribution

Delay selector
Figure 3.4: Simulation of a network delay with an output variable delay switch.

11

Old packets are filtered. If a received packet has an older timestamp than the previous packet it is dropped and the previous packet is held as the current one. The varying time-delay from the network can be converted to a constant delay with a sufficiently large buffer. This leads to a simpler controller tuning, but the delay raised by the buffer can be too large for a decent control performance. Therefore one is guided to solve the control problem with a variable delay. Intuitively the controller should take the network delays into account or compensate for them in order to have a good closed-loop performance. Delays are taken into account in model predictive control (MPC), see Chai (2005) and delay compensation with prediction (Liu et al., 2005a and 2005b). Simpler methods may also result in good performance even if they do not take the explicit delay variance into account, but rather incorporate it indirectly by a design that is robust to the variations. Topics in distributed systems not discussed in this thesis are efficient transmission protocols, speed and routing problems, reliability and security. There could, for instance, be a protocol that would minimize the packet delay and the drop-out so that they could be neglected in control design, but here it is assumed that these phenomena are significant. The varying time-delay is only relevant if the variation is in the order of the process time constant and larger than the sampling time. If the delay variations fit inside the sampling time the variation is not noticeable and can be neglected. In this case the controller can be tuned for a constant delay.

3.2 Sensor Networks


Sensor networks are similar to the networked control systems described in the previous section. The distinction is that they have several sensors measuring the same process variable. The measurements are transmitted and fused together before the controller calculations as depicted in Figure 3.5. Extensive research on sensor networks is done in the fields of control, automation and robotics. Figure 3.3 illustrates fusion done in a distributed manner in a sensor network. The fusion can be done in several ways and these are further investigated in Section 4.7.

12

yr

Controller

L(t)

Actuator

Process

Reference

Network
L(t) Sensor

Fusion

L(t)

Sensor

L(t)

Sensor

Figure 3.5: Fully distributed sensor network where measurements from several sensors are sent over a network to a fusion unit and further to the controller.

3.3 Components of Delay


The delay in the network (shaded area of figures above) can be separated into three distinct components: The processing delay, p, which incorporates the time it takes to prepare and send a packet, such as calculating a new control value in case of a controller or taking a measurement in case of a sensor. The network delay, n, which is the delay for the packet to traverse the network. The network delay is analysed in more detail in Section 2.2. The synchronisation delay, s. This is the time the packet is queued before the next processing period where it is used. The synchronisation delay is only in time-driven systems, in event-driven systems the packet is processed upon reception and the synchronisation delay is omitted. The different components of the delay are illustrated in Figure 3.6. The network delay is variable and can be several sampling times long. The figure reveals also a lost packet. In this case the delay can be thought of as infinite.

13

h Sender

tot =

Network

Receiver

n tot

Figure 3.6: Components of delay in time-driven systems.

The varying delay can change the order of the packets as is the case for the second and third packets in the figure. It is better not to use the most recently received packet, but the most recently sent packet to get the most up to date information. This can be done by using timestamps. The synchronisation delay satisfies s < h as it rounds the total delay to the next time-step. In other words

tot = p + n + s = nh , n `
for time-driven systems.

(3.1)

The total delay of the closed loop, cl , in a fully-distributed system is the delay from the sensor to the controller sc and from the controller to the actuator ca:

cl = sa + ca ,

(3.2)

where both sc and ca incorporate the three delays introduced above (tot) (Nilsson, 1998).

14

4 PID Control Methods


This thesis aims at investigating PID controller design methods for processes with varying time-delays. In the case of varying time-delay systems the control strategy is hard to analyse with standard analytic control theory. Analytical tuning methods such as pole placement can not be applied, because the process model has the delay as a dynamic or stochastic component. The system can be analysed with simulation tools such as Jitterbug and TrueTime (Cervin et al., 2002), or MATLAB/Simulink. Controller tuning can be done based on simulation. The PID controller does not usually take into account the changing delay of a varying time-delay system, but it is simple to tune, and adequate performance can nevertheless be achieved (strm and Hgglund, 1995). For more advanced control algorithms e.g. model predictive control (MPC) and delay compensation can be used (Chai, 2005), (Liu et al., 2005a, 2005b). See references in Tipsuwan and Chow (2004) for other methods. Networked control systems almost demand algorithms like MPC, but in some cases a simple and well performing PID controller can be set up with considerably less effort. The stability and robustness of the control loop is hard to guarantee with unexpected long delays. Some work has been done for formulating optimal control for networked systems with long random delays (Lincoln, 2003). Stability is not guaranteed, but in practice the control loops turn out to be stable. Robustness is not taken into account with the tuning rules presented here. In this chapter the discrete-time PID controller is derived. It is later used to control a distributed system. Some practical aspects that have to be considered in PID controller design are put forth. Then some tuning methods that can be used for processes with varying time-delays are introduced. For sensor networks the fusion of measurements is also considered for control with a single-input-single-output controller. Some fusion strategies are presented in Section 4.7.

15

4.1 Discrete-time PID Controller


The controllers used to control processes can have several structures. The choice of the structure determines how well the plant can be controlled. The plant poses some guidelines and restrictions on the controller. The choice of controller determines the best possible performance achieved of a well-tuned controller. PID controllers are used extensively in the industry as an all-in-all controller, mostly because it is an intuitive control algorithm (strm and Hgglund, 1995). The controller does not explicitly take the varying time-delay, which this thesis is dealing with, into account. Since the PID controller is widely used, it is investigated to see if it nonetheless could be used by selecting a suitable tuning. The textbook version of the PID controller in continuous time is
t 1 de(t ) u (t ) = K p e(t ) + e( )d + Td = u p (t ) + ui (t ) + ud (t ) , T dt i 0

(4.1)

where e(t) is the difference e(t ) = yr (t ) y (t ) (4.2)

between the reference signal (the set-point), yr(t) and the output, y(t) of the controlled process as in Figure 2.1, with L(t) = 0. In transfer function form Equation (4.1) becomes
GPID ( s ) = U (s) 1 = K p 1 + + sTd E ( s) sTi I E ( s ) = P + + Ds . s

(4.3)

The coefficients Kp, Ti, Td and P, I, D are related by:


P = Kp I = K p / Ti . D = K p Td The controller has three parts: the proportional part (up) is proportional to the error, the integral part (ui) removes the steady-state error and the derivative part (ud) reduces the overshoot. The weights of the controllers actions are adjusted with the P, I and D gains. (4.4)

16

The PID controller is traditionally suitable for second and lower order systems. It can also be used for higher order plants with dominant second order behaviour. The controller is usually implemented in a computer that does calculations in discrete-time. In networked control systems a discrete-time version of the controller is needed because the measurements are sent over the network as packets. The discretisation is done by computing the error at discrete time-instants, tk = kh, k ` (with sampling time h), replacing the integral by a sum and the derivative by a difference. The proportional part of the controller at time-step k is then

u p [k ] = u p (tk ) = K p e(kh) . The integral part

(4.5)

u i (t ) =

K Ti

e ( ) d
0

(4.6)

is discretised by approximating the integral with a sum

ui [k ] =

K Ti

h e[ n ] .

(4.7)

n=0

This can further be simplified by computing the difference ui [k ] ui [k 1] = Kp Ti

he[n]
n =0

Kp Ti

he[n]
n =0

k 1

ui [k ] = ui [k 1] +

Kph Ti

e[k ] .

(4.8)

The derivative part, ud [k ] , can be discretised in several ways, with different outcome of the stability and accuracy. The simplest form is the Euler approximation (forward difference):
ud [k ] = K p Td e[k + 1] e[k ] , h (4.9)

which is usually not used since it amplifies random errors.

17

4.2 Practical Aspects of the PID Controller


The derivative amplifies noise, which is present in real systems. To avoid this filtering is used, to smooth out the derivative action of the controller. A filtering factor, N, is introduced, and the derivative is smoothed with a first order filter. For the continuous case the filtering derivative is
U d (s) = K p Td s E (s) Td 1+ s N (4.10)

or in time domain
ud (t ) = Td dud (t ) de(t ) + K p Td . N dt dt

(4.11)

A value for N must be chosen. It is clearly seen that with a large N the derivative is reduced to the unfiltered version

Td N

0 and with decreasing N the derivative is

filtered more. Traditionally used values range from 1 to 20, usually 10 (which is used here) is fine. It has been pointed out that the PID controller with filtered derivative has four degrees of freedom and the filter constant, N, should also be tuned. This is not usually done although better performance can be achieved by tuning N (Isaksson and Graebe, 2002). The filtering constant is often selected on the basis of how much noise there is in the measurements. The discretisation of the filtered derivative part with backward difference gives
ud [ k ] = Td ud [k ] ud [k 1] e[k ] e[k 1] + K p Td N h h

ud [ k ] =

K p Td N Td ud [k 1] + ( e[k ] e[k 1]) . Td + Nh Td + Nh

(4.12)

Another discretisation method is Tustins approximation, where the forward and backward approximations are summed and averaged, which leads to ud [ k ] = 2 K p Td N 2Td Nh ud [k 1] + ( e[k ] e[k 1]) . 2Td + Nh 2Td + Nh (4.13)

Other derivative discretisation methods also exist: for example the ramp equivalence (which is more accurate, but harder to compute).

18

All derivative approximations can be written in the form (strm and Hgglund, 1995)
ud [k ] = ad ud [k 1] + bd ( e[k ] e[k 1]) .

(4.14)

The approximations are stable only if a d < 1 . The backward difference is well behaving, even with small values of Td, and is used frequently. Tustins algorithm agrees well with the continuous time derivative, but it can ring with small values of Td < Nh / 2 , because then ad becomes negative. If there are steps in the reference signal the derivative will react unnecessarily on the discontinuity. A solution to this is to take the derivative of only the process output. The PID controller in (4.1) takes the form
t 1 dy (t ) u (t ) = K p e(t ) + e( )d Td . Ti 0 dt

(4.15)

This can be generalised to set-point weighting where the reference and output are weighted by and before taking the error signal.
t 1 u (t ) = K p yr (t ) y (t ) + e( )d + Td Ti 0

dyr (t ) dy (t ) dt dt .

(4.16)

The integral has no weighting, otherwise steady-state error would not be compensated. In this thesis the backward integral and filtered backward derivative approximations are used (Equations (4.8) and (4.12)). Thus, the discrete-time PID controller becomes:
u[k ] = u p [k ] + ui [k ] + ud [k ] u p = K p e[k ] ui [k ] = ui [k 1] + ud [ k ] = K ph Ti e[k ] . (4.17)

K TN Td ud [k 1] + p d ( e[k ] e[k 1]) Td + Nh Td + Nh

19

4.3

Ziegler-Nichols Tuning

The Ziegler-Nichols (Z-N) methods rely on open-loop step response or closed-loop frequency response tests. A P-, PI- or PID controller is tuned according to a table based on the process response test. In the step response test a step is applied on the open-loop system. A tangent line is drawn at the inflexion point on the response curve. The dead-time, T1, and the risetime, T2, are measured (Figure 4.1). In the frequency response method the loop is closed and a pure gain controller is used. The gain is increased to the ultimate gain, Ku, when the system exhibits a steady oscillation whereby the oscillation period is measured, Tu (Figure 4.1). The PID tuning is calculated from the Z-N tuning table found in literature such as strm and Hgglund (1995). Table 1 shows the tuning rules for a PID controller. P and PI controllers have separate tuning rules.
Table 1: Ziegler-Nichols tuning table for PID controller.

Method/Parameter Z-N step response

Kp
1.2 K1 T2 K 2 T1

Ti 2T1

Td 0.5T1

Z-N frequency response

0.6Ku

0.5Tu

0.125Tu

Step response 1.6

u(t)

1.4

Tu

1.2

K1

y(t)
Amplitude

y(t)
0.8

0.6

K2 T1 T2

0.4

0.2

-0.2

5 Time (sec)

10

Figure 4.1: Ziegler-Nichols tuning with step response test (left) and frequency response test (right).

20

For a discrete-time PID controller the table should be revised to take the sampling time into account. There is, however, no discrete Z-N tuning table, so Table 1 is used in lack of other. A discrete-time controller approximates a continuous-time controller at small sampling times, so this tuning rule is only used for the shortest sampling times. The Z-N method is designed for rejecting load disturbances. For reference step changes it performs worse and gives for simple systems a damped oscillating response, where consecutive peaks are of the previous peak. The tuning is usually bad for higher order systems and can only be considered as a simple first aid tuning. There are refinements to the Z-N method to improve the performance of set-point changes proposed by Hang et al. (1991). Other tuning tables that rely on the same response tests, such as the Cohen-Coon method, can also be used to gain better performance.

4.4

Optimisation Tuning

In the optimisation tuning method the tuning of a parameterised controller such as a PID controller is based on an optimisation criterion. The optimal tuning parameters, x*, is where the criterion or cost function, J, has its minimum. x* = arg min J ( x) (4.18)

The cost function describes how well the system responds to an outer disturbance. The disturbance can act on the reference signal, be a load or measurement disturbance. In this thesis a step in the reference signal is the disturbance. This measures how well the system follows set-point changes. Load disturbance rejection is achieved with set-point tuning, but it is not optimal. The tuning can also be done for load disturbance rejection, if the disturbance acts on the process output during optimisation. Noise rejection can be incorporated into the tuning by adding noise to the simulation model and penalizing noise in the cost function. The optimisation is done here by using a simplex search algorithm for unconstrained optimisation (Mathworks, 2005). The cost function is evaluated with simulation, so a simulation model of the process is needed. Reijonens thesis (2003) described how the tuning is done in practice with MATLAB/Simulink and Optimisation Toolbox. 21

The procedure is followed in this thesis, with the modification that for the varying time-delays many step response tests are performed and the cost is averaged. The cost function is consequently modified as in Equation (6.1). This restrains the method from optimising for a certain instance of a varying delay and to take into account many possible variations in the delay. The tuning is done in a similar way in Eriksson (2005) with a graphical user interface, where the user can specify a plant, select network properties and optimisation criterion. The optimal tuning is a button click away. In this thesis only PID controllers are tuned with the optimisation method, whereas the method is applicable to other parameterised controllers as well.

4.4.1 Optimisation Criteria


The criterion under optimisation can be any measure of the system performance that depends on the controller tuning. The cost is often an integral function of the error, as a disturbance acts on the process, until the system returns to steady-state. The cost can also be a function of rise time, overshoot and settling time or similar measures. Some well-known cost functions are listed below. IAE
J = e(t ) dt
0

(Integral Absolute Error),

(4.19)

ISE

J = e 2 (t )dt
0

(Integral Square Error),

(4.20)

ITAE

J = t e(t ) dt
0

(Integral Time Absolute Error),

(4.21)

ITSE

J = te 2 (t )dt
0

(Integral Time Square Error).

(4.22)

The optimisation criteria are functions of the controller tuning parameters. In this thesis they should be written as functions of the PID controller: J ( P, I , D) . The error, e, can be any, or a combination of those error signals described in Section 4.4.2. The integrals are in practice not evaluated to infinity, but to large enough time T at which the system has settled down and the error has reached zero.

22

The listed cost functions give different optimal results. The square error (ISE, ITSE) integrals give usually a larger overshoot because they try to minimise the initial large error as fast as possible. The time integrals (with explicit t in the integral, which is small in the beginning and large in the end) are meant to compensate for the error that is large in the beginning (in case of a step disturbance) and small in the end. These error integrals give a slightly longer rise time and a smaller overshoot but also a short settling time, because the time weight is large in the end. The mentioned error integral criteria are minimised, but no guarantee of the robustness of the response can be made. Therefore one can introduce several optimisation constraints that force a given gain and phase margin (Eriksson and Koivo, 2005), (Eriksson, 2005).

4.4.2 Optimisation Criterion Source


The optimisation criterion can be evaluated from several signals as sketched in Figure 4.2. In the System cost block the delay is considered to be a part of the system (Figure 2.1, left) and the physical controlled variable is the delayed output. For networked control systems the error cost can be calculated from the output of the process transfer function, the Process cost block. Here it is assumed that there is an undelayed physical process which the controller tries to control over the network (Figure 2.1, right). The delayed output in the feedback loop is simply the process measurements arriving to the controller from the real process at the other end of the

Add2 g
yr y _ref y (k) u(k+1)

Gain

Controller Cost num(s) den(s) Transfer Fcn

Add

Process Cost L(t) Delay

Add1

System Cost

Reference

Controller

Figure 4.2: Different ways of determining the error signal for the cost criteria in varying timedelay systems.

23

network. The controller output can also be taken into account in the cost function to penalise excessive control use, e.g. strain on the actuator. In this case the control signal must be weighted with the process gain, g, to compensate for scaling (Controller costblock). All these cost functions can be summed to one weighted average to form a desired overall cost for the controller tuning. There exist also multiobjective optimisation methods for minimising several cost functions simultaneously. The cost functions can depend on overshoot, settling time, integral error criteria and so on. The optimisation can also include load disturbance rejection. These methods may produce better results, but they are more complicated. A good overview of multiobjective optimisation methods in control systems can be found in Liu et al. (2003). Further studies can be made to investigate tuning with different cost criteria and the resulting optimal responses.

4.5

Internal Model Control

The internal model control (IMC) method can be used to select the gains for a PID controller, because in certain circumstances the IMC controller reduces to a PID controller. The IMC scheme was collected into one framework by Garcia and Morari (1982). The advantage of the IMC method is that the controller incorporates a model of the process to be controlled. The IMC method is derived as follows. The process to be controlled is denoted by G p ( s ) and a model of it Gm ( s ) . If the controller, Gc ( s ) , is set Gc ( s ) = Gm ( s ) 1 and

the model is correct then the open-loop response is equal to the setpoint. This is the ideal case and can not work in practise, because there are always disturbances and modelling errors. Additionally, the model is not always invertible. Therefore a feedback of the error between the model and the process output is introduced as depicted in Figure 4.3.
The process model, Gm ( s ) , is then split into an invertible Gm ( s ) and a non-invertible
+ ( s ) part. Gm + Gm ( s ) = Gm ( s )Gm (s) .

(4.23)

24

yr

Gc(s)

Gp(s)

Reference

Gm(s)

ym

Figure 4.3: General concept of internal model control.


+ The non-invertible part, Gm ( s) , contains all positive zeros and time-delays, which

upon inverting becomes unstable or non-realisable. The rest of the model consists of the invertible part which is incorporated into the controller. The non-invertible part is treated as un-modelled dynamics and is handled by the feedback. The controller is then
Gc ( s ) = Gm ( s ) 1 G f ( s ) ,

(4.24)

where
G f ( s) =

( s + 1)

(4.25)

is a filter with appropriate n to make the controller proper. is a positive tuning parameter that can be manually set to achieve a suitable response. The block diagram in Figure 4.3 can be transformed into a regular feedback loop (Figure 4.4) with the model included in the controller (Garcia and Morari, 1982). With elementary block diagram algebra and using Equations (4.23) and (4.24) one gets
GIMC ( s ) =
Gm ( s ) 1 G f ( s ) Gc = . + 1 GmGc 1 Gm ( s )G f ( s )

(4.26)

This is the IMC controller, which is the shaded area of Figure 4.4. With a suitable selection of the filter and approximations of the delay (see Appendix, Section 10.1)

25

GIMC(s)
yr e

Gc(s)

Gp(s)

Reference

ym

Gm(s)

Figure 4.4: Internal model controller with model feedback as part of the controller.

the controller can be formulated as a PID controller which is tuned with the IMC method. This method can as well be applied to discrete-time systems. The difficulty is to formulate it as a discrete-time PID controller.

4.6

Gain Scheduling

For a nonlinear process a nonlinear controller is usually needed, which is more difficult to setup and tune. The easier way is to ignore the nonlinearities by linearising the process around some operating point and by tuning a linear controller to this approximation. The controller will presumably work well near this operating point. By tuning several controllers for a number of operating points (Figure 4.5) the best suited controller can be used. When the process shifts from one operating point to another a different controller is used. For a survey of gain scheduling techniques see Leith and Leithead (2000).

output

Operating point

input
Figure 4.5: Linearly approximations around operation points of a nonlinear (static) process.

26

In gain scheduling off-line tuned controller parameters are stored in a gain table. The parameters can be calculated with any tuning method, such as the optimisation method (Section 4.4), or with pole placement with a linearised process model. An operating point estimator estimates the current operating point and the gains of the controller are selected based on the estimation (Figure 4.6). The gain parameters can be interpolated from the gain table to obtain in-between tuning. The operation point estimator uses usually only the process output, which indicates directly the operating point, and the controller parameters are fetched from a look-up table. The estimator and the look-up table can also be implemented with a fuzzy system where a more sophisticated parameter selection can be done (Viljamaa and Koivo, 1995). With gain scheduling simple controllers such as the PID controller can be used with varying time-delay systems without resorting to more elaborate techniques (Tipsuwan and Chow, 2004). An example of using gain scheduling in varying timedelay systems is given in Section 6.3.

Operating point estimator

yr e

Controller

Process y

Reference

Figure 4.6: Gain scheduling with operating point estimator that tunes the controller based on the operating point of the process.

27

4.7

Fusion of Measurement Packets

In a sensor network described in Section 3.2 the data from the sensors must be fused before a scalar PID controller can be used. The fusion is in the simplest case just a weighted average of the measurements. The weight indicates how trustworthy the measurement is or how well it represents the real value. If the sensors are, for instance, spread out and some are in a bad position for measuring, the trustworthiness is lower. The estimated variance, 2, of the sensor can also be the weight. In that case the measurements are weighted with the maximum-likelihood estimation

= x

xi
2 i 2 i

(4.27)

where xi are the measurements and i2 the respective variances. In a sensor network the measurement packets arrive independently, at different times and sometimes out of order to the fusion block. Since a network is considered here, the packets are usually timestamped and they can be ordered. If the timestamps (clocks) are synchronised one can furthermore compare the send time between different sensors. There are several ways to fuse the incoming measurements from the sensors depending on how much information is available. The relevant information includes measurement variances or weights, (synchronised) timestamps to order the packets and a process model to perform Kalman filtering. Table 2b lists various conceivable possibilities for the fusion strategy.

28

Table 2: Strategies for fusion.

Case

Information

Description

Strategy

No information

No information available. No timestamp available. Weight or estimate of measurement variance available.

Take one arbitrary measurement as the fused value. Take a weighted average of the received measurements.

No timestamp

Timestamp

Every sensor has its own timestamp.

Take a weighted average of every sensors received measurements with highest timestamp.

Synchronised timestamp

The sensors timestamps are synchronised. Measurements can be compared for order.

Find the most recent measurement(s). Take the weighted average of only the newest measurements.

from different sensors (highest timestamp) received

Synchronised timestamp

The sensors timestamps are synchronised. Measurements can be compared for order.

Weight the measurements based on their delay to the newest received measurement. The weight is

from different sensors calculated as ec (max_ t t ) , where c is a constant that controls how fast the influence of old results should decay, max_t is the highest timestamp and t is the timestamp of the measurement the weight is calculated for.

29

Timestamp +

In addition to timeprocess is available.

Construct a Kalman filter for mates according to their Kalman covariance, P (Distributed Kalman Filtering).

process model stamps a model of the every sensor and fuse the esti-

Synchronised timestamp +

Same as above but with synchronised

Calculate a weighted average with one of the above methods and use a Kalman filter to estimate the measured variable (Centralised Kalman Filtering).

process model timestamps.

Kalman filtering with packet dropouts in sensor networks with two sensors is investigated in Liu and Goldsmith (2004). They give upper and lower bounds of convergence for the Kalman filer as a function of the percent of sensor measurements that are correctly received. Issues related to the decentralised Kalman filter with packets out-of-order in a sensor network are described and simulated in Hasu and Koivo (2005). Cases 1-5 are compared using simulation in Section 6.4.

30

5 MoCoNet
MoCoNet stands for Monitoring and Controlling Laboratory Processes over Internet With this platform control algorithms for networked control systems can be tested. Discrete-time PID controllers are tuned and tested in Section 6.5 with the tuning methods presented in Chapter 4 for a process attached to this platform. The laboratory course at the Control Engineering Laboratory of Helsinki University of Technology has been upgraded during the past years. One expansion to the course has been done by the author with the development of the MoCoNet platform. The use of the platform for the laboratory course is that the students can monitor and run educational laboratory processes over the Internet. The scientific objective of the platform is to test and validate control algorithms on real processes. The testing is done by a methodology called rapid control prototyping (RCP), where a simulation model of the control algorithm is automatically compiled into executable code and run on real hardware. The MoCoNet platform supports RCP, which is described in the next Section. The educational objectives are to make the laboratory processes easily available to students at anytime and anywhere. A student can for example run a process over the Internet from home or on the spot. Universities could even co-operate to offer their laboratory processes to students all over the world. The students can use the same platform for different laboratory processes and the emphasis can be put on the content of the experiments when the platform is familiar: usability is improved. Another educational goal is to show the influence of a varying time-delay in control loops. A network simulator (NetSim) was added to the system to enable the study of network induced delay in control loops. The control loop can be one of the networked control systems presented in Chapter 3. This feature is used in this thesis in Chapter 7, where one laboratory process is run and studied with the MoCoNet platform. The platform consists of a few server computers located in the laboratory, with some server software and a graphical user interface applet. The platform is described in the following sections and in depth in Pohjola et al. (2005). Other remote laboratories 31

have also been developed in the academic world, each with a different mix of techniques. E.g. Valls et al. (2005) discusses MATLAB based techniques and WinCon software to connect to a real plant.

5.1 Rapid Control Prototyping


The concept rapid control prototyping (RCP) is a method for quickly testing new control algorithms or techniques on real hardware. The controller is first implemented as a model in a simulation environment of the whole system. The key point with RCP is that the controller model can be automatically compiled into executable code to be run on the real system for experimental verification. This leads to faster iterations in the design process. A report how control strategies are developed with RCP using MATLAB in the automotive industry is in Hanselmann (1996). The advantages of RCP are that no laborious and error prone coding need to be done and the controller can easily and quickly be tested in a real environment. Several hazardous tests can be done with the simulation model without risk for the hardware. Exactly the same controller is confirmed to work at least in simulation, as used on the real hardware. Greater understanding of the system can be gained with the simulation model assisting the design of the controller. In RCP a model of the process to be controlled must first be modelled and validated. After the initial modelling the RCP procedure depicted in Figure 5.1 starts. The controller algorithm is first designed, and then it is tested with a simulation model. If the controller performs well in the simulation model it can be tested on real hardware, otherwise the controller is revised.

32

Controller design

Test

Simulation model

Good? No

Yes

Change
Real hardware Test Executable Compile

Figure 5.1: Rapid control prototyping design loop.

The MoCoNet platform uses rapid control prototyping for testing controllers on real hardware. The users can upload their controllers implemented with MATLAB/Simulink to the MoCoNet system, where the controllers are translated into C code with MATLAB/Real-Time Workshop and compiled with Target Language Compiler into executable code for testing. Hltt et al. (2004) gives a tutorial for implementing RCP with MATLAB. In the tutorial it is shown how RCP can be implemented on the same example process that is used in this thesis. The process is described in detail in Section 5.6.

5.2 User Interface


For a user, the only visible part of the MoCoNet platform is the graphical user interface (GUI) that is implemented as a web page. The GUI is a Java applet and it works in any Java enabled web browser on any operating system. With the GUI of MoCoNet it is possible to monitor and control in real-time processes that are connected to the system. The user interface is shown in Figure 5.2. The control loop is shown and several setup parameters, such as: reference signal, controller and controller parameters (controller tuning) and network type, may be selected for a run.

33

Figure 5.2: Graphical user interface, a Java applet for MoCoNet.

Previously performed experiments and collected measurements can be loaded and observed with the GUIs scope. In Figure 5.3, a laboratory process is monitored with the scope. The process is simple, but it is difficult to control because of a varying network delay. The figure shows that multiple signals can be tracked at once and that e.g. the results can be saved to a file.

Figure 5.3: Scope of the MoCoNet user interface.

34

5.3 Software
The server software is responsible for maintaining connections between users and processes, running a reservation system for controlling processes (which user can run which process and when), collecting all the data into a database and configuring the network simulator. Information of the available processes and the controllers are stored in a database with data of previously done experiments. The server software consists of two Java programs: ProcessServer and SignalServer. The ProcessServer serves the user interface applet called ProcessControl, and enables the user to control processes from a remote location. The SignalServer listens to process measurement and control messages that flow in the local network and transmits them to the remote location applet. The SignalServer incorporates a
DatabaseServer that stores the measurements in a Microsoft Access database located

on the server for recollection of done experiments. All these three programs can be run independently on different computers for scalability. The control permission reservation system is a part of the ProcessServer. The reservation system maintains a list of all clients that have requested to control a process. If the user in control releases the control of the process, the control is passed to the next user on the reservation list. The measuring and controlling software of the physical process is run on a computer equipped with MATLAB xPC Target real-time operating system (RTOS). A RTOS is required since otherwise it would not be possible to guarantee well-timed sampling times. The xPC Target computer is responsible for measuring process variables and for transmitting the measurements into the network (which are passed on to the user). The controller is implemented on the same computer as the measurement and actuator unit, but the measurement unit, controller and actuator can be virtually distributed in a network if the measurement packets are sent via the network simulator as indicated in Figure 5.4. This corresponds to the fully-distributed control system shown in Figure 3.1.

35

NET SIM MEASURE CONTROL

NET SIM ACTION

Figure 5.4: Control loop separation.

The server side Java programs are connected to MATLAB programs through the MATLAB Web Server (MWS) interface, which is also used for uploading the process control models with tuned controllers into the xPC Target computer. Once the model is uploaded, start and stop messages can be transmitted through the MWS to run the real processes.

5.4 Hardware
The system contains three physical PCs, all connected to an 100 Mbps Ethernet router. The router acts as a gateway and firewall to the Internet. The physical architecture of the implemented system is presented in Figure 5.5. One computer, the xPC Host, acts as a server for the users. The computer runs the Java server software, introduced in the previous Section, and maintains the system database. The process-end computer called xPC Target runs on the MATLAB xPC Target RTOS. It is equipped with an I/O board connected to the process. The computer is used for executing compiled C code including, among other things, controller algorithm, UDP packet sending and receiving, and I/O functions. The server computer is also called the xPC Host, because the xPC Target computer can be configured from this host. The host PC can be used for compiling Simulink models into executable code and for uploading the code into the target PC. The code is automatically generated from Simulink models using the Real-Time Workshop and the xPC Target Toolbox. This combination of MATLAB toolboxes allows easy prototyping of control software (RCP).

36

User 1 ProcessControl ProcessMonitor

...

User N ProcessControl ProcessMonitor

Internet

Gateway LAN

RTOS xPC Target

NetSim

Server, DB xPC Host

Process 1

Process 2

...

Process N

Figure 5.5: Physical layout of the MoCoNet server side computers and users connected to the MoCoNet server.

5.5 Network Simulator


One of the objectives of the MoCoNet platform was to show the control properties of a networked system with varying delays. The delay for control and measurement signals could be generated using long wires, for example in this case the messages could be sent back and forth in the Internet. However, for educational purposes the network properties should be easy to vary in order to show the effect of each property. For comparison it should also be possible to replicate the delays occurring during the experiments. Therefore the network visible to other modules is simulated with a network simulator. The delay of the used Ethernet network (approximately 1 ms) is considered insignificant with respect to the simulated variables. The network is simulated with a separate desktop PC with the QNX real-time operating system connected to the LAN. All control and measurement packets in the control loop are transmitted via the network simulator. When the network simulator receives a packet, it is dropped with a certain loss probability, according to the simulation model. If the loss filter is passed, the delay is 37

randomized from a selected distribution, a retransmitting timestamp is calculated and the packet is put to queue to wait until the real-time clock reaches the timestamp. Another thread of the software is responsible for transmitting packets back to the network. The delay distribution can be one of several, including the gammadistribution of Section 2.2. Multicast UDP/IP is used for transmitting measurement and control packets in the local network. This is because UDP packets have a low latency when compared to TCP communication, and there is no need to know what other modules belong to the network, as multicast messaging is used. The simulated network properties are configured remotely by the xPC Host server computer on the command of the user, using a specific UDP port. Because the network is simulated, it would be possible to realise all the modules on a single physical computer as separate components or processes. However, the modules are separated both in hardware and in software to enable testing of different tools and to allow easy modification of the system, e.g. the network simulator could be replaced, or the packets could be routed through the Internet for a real test.

5.6 Example Process


One of the processes attached to the MoCoNet platform is an electric circuit. It is used in this thesis as an example process. It was chosen because the time constants of the process are closest of the available processes to typical internet delay times. This enables the demonstration of the impact of the network on the control loop with realistic values on the network parameters. Test runs are done with the process to verify the tuning methods on a real process in Chapter 7. The circuit consists of resistors and capacitors. The circuit diagram is shown in Figure 5.6. The transfer function of the circuit can be derived to
G ( s) = sR2 C2 + 1 . (5.1) R1 R2 ( C1C2 + C1C3 + C2 C3 ) s 2 + ( R1 (C1 + C3 ) + R2 (C2 + C3 ) ) s + 1

With the component specifications

38

R1 = 820k R2 = 680k C1 = 0.33 F C2 = 0.68 F C3 = 0.33 F

(5.2)

the numerical transfer function becomes


G ( s) = U out ( s ) 0.4624 s + 1 . = U in ( s ) 0.311s 2 + 1.228s + 1

(5.3)

C2 R1 R2 Uin C1 C3

Uout

Figure 5.6: Circuit diagram of example process.

39

6 Optimisation and Simulation Results


Processes controlled nowadays can have various delays. They can either stem from the process itself, such as transport delays, or from a communication network. The controllers are usually discrete-time, as they are implemented on computers or mobile devices with limited computing power and network bandwidth. They have therefore long sampling times which do not approximate the continuous case. These systems were earlier impossible to tune for a tight and fast control loop. The impact of sampling time and different delays are investigated in cases 1-3 with the optimisation tuning technique. The main emphasis of the results is on the optimisation method. The goal is to assess which tuning is optimal for different cases of varying time-delay systems. Some examples and comparisons of various tuning methods for a discrete-time PID controller are done later in this chapter. The first cases are a continuation of Reijonens work (Reijonen, 2003), where she investigated the optimal tuning of a continuous-time PID controller in varying timedelay systems. Here the optimal tuning for the same processes with a discrete-time PID controller is inspected, concentrating on the impact of the sampling time of the controller. Next, tuning with the optimisation method for network delays is presented. The gain scheduling and other tuning methods are then examined. Finally, the PID controller is tuned for a real example process by simulating. The tuning is then verified on the real process in the next Chapter using the MoCoNet platform. Systems with state-dependent varying delays are not linear, so they depend also on the size of the step in the step responses. As the systems are investigated as a function of controller sampling time and process time constant the investigation of step size is not conducted for clarity. Similar results as in Reijonen (2003) are expected.

6.1 Optimisation for Different Delays


The PID controller is optimised with the tuning method presented in Section 4.4 with the ITAE cost criterion, Equation (4.21), on a step response. Several unit-step responses are simulated and the average cost is calculated to even out the randomness of the delay. The total ITAE cost is thus 40

J ( P, I , D ) =

1 nM {( t mod M ) e( P, I , D) } dt , n 0

(6.1)

where n is the number of steps and M is the time between the steps. The first step is at t = 0. The process is a simple first order system with time constant T and transfer function

G(s) =

1 . Ts + 1

(6.2)

The process is augmented with a varying time delay, L(t), as shown in Figure 6.1. The PID controller is implemented as in Equation (4.17).

yr e

PID Controller

1 Ts+1 Process

L(t)
y Delay

Reference

Figure 6.1: Model of a system with varying time-delay.

The delay can be a) constant, b) random, c) time-dependent or d) state-dependent. The respective delays used in these cases are described by a) b) c) d)

(t ) = L (t ) = rand [0.8...1.2]
(t ) = sin(t ) (t ) = x(t )
(6.3)

For the constant delay L = 1. The random delay is uniformly distributed between 0.8 and 1.2. The delay changes every other sampling period. The step responses are done from 0 to 1 and back down to 0. The time between the steps is ten seconds (M = 10), enough for the process to settle down before the next step is done and four steps are done (n = 4). For the state-dependent delay this means that on the step up the delay is zero in the beginning, increasing and approaching one as the process settles down. On the step down the delay is the other way round, first large and then decreasing towards no delay. The time-dependent delay will also be zero in the first step, but at the step down sin(t) is in another phase and the delay is nonzero.
41

The delay is considered to be part of the process (corresponding to Figure 2.1, left), so the cost criterion error is calculated from the reference signal and the output after the delay, i.e. the system cost described in Figure 4.2. The delay is simulated as an output variable delay as described in Ekanayake et al. (2001). The controller is tuned for a process with time constant, T, in the interval [1, 10]. The sampling time of the controller is in the interval h = [0.1, 1]. The results for the various delay types (a-d) are presented in the next Sections.

6.1.1 Case 1a - Constant Delay


First, the PID controller is optimised for a constant delay in the process. These results, shown in Figure 6.2, are for reference and are compared to the other cases of delay types in the following Sections.
G(s)=1/(Ts+1)e-Ls L = 1

6 4 P 2 0 10 5 T 0.2 0.4 h 0.6 0.8 I

0.6 0.4 0.2 0 10 5 T 0.2 0.4 h 0.6 0.8

2 Cost 0.8 D 1 0 10 5 T 0.2 0.4 h 0.6

4 2

0 10 5 T 0.2 0.4 h 0.6 0.8

Figure 6.2: Optimal PID controller parameters for the first order system with constant delay. P, I, D and cost as functions of process time constant, T, and controller sampling time, h.

For a small sampling time (left side of the plots) the results are similar as in the continuous case done by Reijonen. The P and D terms are linear functions of the time constant, T. The I term is hardly affected by T, but rather by the sampling time. All

42

the terms decrease with increasing sampling time. The controller becomes more cautious as it tracks the output less frequently with increasing sampling time. The optimal controller tuning is more conservative with increasing sampling time as the cost increases also. Some sampling times are relatively better than others, as 0.5 and 1.0, because they fit better the delay of 1. The best sampling time is the lowest, as it enables the controller the shortest response time on output changes.

6.1.2 Case 1b - Random Delay


Now the constant delay is turned into a random delay (Equation (6.3) b) with the same mean value as in the constant delay case. The tuning is expected to be somewhat different because of the replaced delay type.
G(s)=1/(Ts+1) Delay: L(t) = random[0.8...1.2]

6 P 4 2 0 10 5 T 0.2 0.4 h 0.6 0.8 I

0.6 0.4 0.2 0 10 5 T 0.2 0.4 h 0.6 0.8

2 1 0 10 5 T 0.2 0.4 h 0.6 0.8 Cost D

4 2 0 10 5 T 0.2 0.4 h 0.6 0.8

Figure 6.3: Optimal PID controller parameters for the first order system with random delay. P, I, D and cost as functions of process time constant, T, and controller sampling time, h.

Comparing the result shown in Figure 6.3 and the previous result there are only slight differences. The P and I terms are practically identical. There is some arbitrariness in the controller parameters, especially in the D term. This is caused by the randomness in the delay.

43

As the results are similar to the constant case, one can assume a constant delay (the mean of the random) when tuning a PID controller for this kind of uniformly distributed random delay. This can, however, change with a larger variance of the random delay or with a different distribution. The delay is in-fact similar to the constant case when the sampling time is larger than the delay variation range, as the synchronisation delay (Equation (3.1)) rounds it up to a constant case.

6.1.3 Case 1c - Sinusoidal Delay


In this case the time-delay varies like a sinusoid according to Equation (6.3) c. The results are shown in Figure 6.4.
G(s)=1/(Ts+1) Delay: L(t) = |sin(t)|

8 6 4 2 0 10 5 T 0.2 0.4 h 0.6 0.8 P I

0.8 0.6 0.4 0.2 0 10 5 T 0.2 0.4 h 0.6 0.8

3 Cost 0.8 2 D 1 0 10 5 T 0.2 0.4 h 0.6

3 2 1 0 10 5 T 0.2 0.4 h 0.6 0.8

Figure 6.4: Optimal PID controller parameters for the first order system with sinusoidal delay. P, I, D and cost as functions of process time constant, T, and controller sampling time, h.

The P, I and D parameters are larger than in the constant case. The overall tendency of the P and I parameters is similar: decreasing values with increasing sampling time, but they are decreasing faster. The D term goes in waves as a function of sampling time.

44

Some sampling times suit the system better: the cost goes in steps. At the up-steps of the cost the parameters are smaller; consequently a slower and more cautious response is tuned at those areas.

6.1.4 Case 1d - State Delay


The same system is now optimised with a state-dependent delay according to Equation (6.3) d.
G(s)=1/(Ts+1)e-Ls L = |x(t)|

6 4 P 2 0 10 5 T 0.2 0.4 h 0.6 0.8 I

0.6 0.4 0.2 0 10 5 T 0.2 0.4 h 0.6 0.8

2 Cost 0.8

0 10 5 T 0.2 0.4 h 0.6

0 10 5 T 0.2 0.4 h 0.6 0.8

Figure 6.5: Optimal PID controller parameters for the first order system with state dependent delay. P, I, D and cost as functions of process time constant, T, and controller sampling time, h.

The tuning is again similar to the constant case. The parameters decrease slightly less as functions of sampling time. The D term is a little larger for small process time constants and varies less than in the constant case. With the lowest sampling time all the above results are similar to Reijonens work, which considered the continuous-time case. This is expected, since with short sampling times the discrete-time PID controller approximates the continuous-time PID controller accurately.

45

6.1.5 Case 2a - Constant Delay


In the previous cases the impact of the delay type on optimal PID parameters at various sampling times was investigated. Now the length of delay is studied at a constant sampling time of 0.1. Optimal parameters are found for a constant delay in the range [0.31.2] (Figure 6.6). In the next case the constant delay is replaced with a random delay.
G(s)=1/(Ts+1)e-Ls L = constant, h = 0.1

15 P I 10 5 0 10 5 T 0.4 0.6 L 0.8 1

1.5 1 0.5 0 10 5 T 0.4 0.6 L 0.8 1

2 1 0 10 5 T 0.4 0.6 L 0.8 1 Cost D

1.5 1 0.5 0 10 5 T 0.4 0.6 L 0.8 1

Figure 6.6: Optimal PID controller parameters for the first order system with constant delay. P, I, D and cost as functions of process time constant, T, and feedback delay, L. Sampling time h = 0.1.

For a given delay length the parameters behave as in the preceding cases with increasing P and D terms as functions of process time constant. The P and I term increase (nonlinearly) with shorter delay. The controller is more aggressive and the response is faster. This is reflected in the cost which decreases with shorter delay.

46

6.1.6 Case 2b - Random Delay


Next, the constant delay is swapped to a random delay with the same mean as in Case 2a. The random delay is L(t ) = L + rand [0.2...0.2] . The optimisation is done as a function of the mean of the delay, L, ranging from 0.3 to 1.2. The delay has a mean of 0.3 in the lower end and varies in the range of 0.1 to 0.5. In the upper end the mean is 1.2 ranging from 1.0 to 1.4.
G(s)=1/(Ts+1) Delay: L(t) = random, h = 0.1

10 5 P

1 0.5

0 10 5 T 0.4 0.6 h 0.8 1

0 10 5 T 0.4 0.6 h 0.8 1

2 Cost 1 D 1 0 10 5 T 0.4 0.6 h 0.8

2 1 0 10 5 T 0.4 0.6 h 0.8 1

Figure 6.7: Optimal PID controller parameters for the first order system with random delay. P, I, D and cost as functions of process time constant, T, and feedback mean delay, L. Sampling time h = 0.1.

The results are to some extent similar to Case 2a with a constant delay, but the tuning is more conservative and thus the cost is higher for all tunings. The conclusion is that random delay is more difficult to handle, and the optimal tuning can not be as tight as with constant delay. Especially the P and I terms are smaller than in the previous case and they are not as nonlinear as functions of mean delay. With a long delay, where the randomness is proportionally smaller, the results are similar to the constant delay case. The differences in the results are largest, as can be expected, where the random part of the delay is dominating. 47

These results can be used in delay based gain scheduling of a PID controller as is done in Section 6.3.

6.2 Optimisation for Network Delays


In this section networked control examples are studied. The systems are of the type described in Section 3.1 (semi- and fully-distributed systems), with an Internet type delay described in Section 2.2.2. The network properties are n = 3, Tstatic = 0.6 and Tstochastic = 0.4. Old packets are filtered, i.e. if a packet with higher timestamp has already been received the packet is considered outdated and dropped. A sample of the simulated network delay is shown in Figure 6.8. The majority of the delay is around the mean, some are just shorter and a few are significantly longer (the long tail of the gamma distribution). Because the delay is assumed to be in the network only and not in the actual process, the error for the optimisation criteria is taken from the process output, recall Figure 4.2. The optimisation procedure is the same as before.

1.5 Delay [s]

0.5

10 Time [s]

15

20

25

Figure 6.8: Sample of simulated network delay.

6.2.1 Case 3a - Semi-Distributed System


The semi-distributed system (Figure 3.2) is optimised as a function of sampling time and time constant. 48

G(s)=1/(Ts+1) Delay: Network, Semi-distributed

6 4 P 2 0 10 5 T 0.2 0.4 h 0.6 0.8 I

0.6 0.4 0.2 0 10 5 T 0.2 0.4 h 0.6 0.8

1.5 Cost 0.8 D 1 0.5 0 10 5 T 0.2 0.4 h 0.6

2 1 0 10 5 T 0.2 0.4 h 0.6 0.8

Figure 6.9: Optimal PID controller parameters for the first order, semi-distributed system with network delay. P, I, D and cost as functions of process time constant, T, and controller sampling time, h.

Comparing this and Case 1b (random delay) the results are to some degree similar. The P, I and D terms are almost the same. The cost is smaller because the error signal is not taken after the delay, but right from the process output. The cost is, though in another manner, increasing with sampling time, with dips as the delay turns into constant at the larger sample times.

49

6.2.2 Case 3b - Fully-Distributed System


The system in the previous case is extended to a fully-distributed system. Now there is an additional delay between the controller and the process. This leads not only to a larger delay in the control loop, but also to a higher cost, as the delay is between the reference signal and the process output signal.
G(s)=1/(Ts+1) Delay: Network, Fully-distributed

4 0.3 P 2 0.2 I 0.1 0 10 5 T 0.2 0.4 h 0.6 0.8 0 10 5 T 0.2 0.4 h 0.6 0.8 6 Cost 0.8 4 2 0 10 5 T 0.2 0.4 h 0.6 5 T 0.2 0.4 h 0.6 0.8

2 D 1 0 10

Figure 6.10: Optimal PID controller parameters for the first order, fully-distributed system with network delay. P, I, D and cost as functions of process time constant, T, and controller sampling time, h.

The additional network delay causes the optimal controller tuning to be more cautious; the P and I terms are smaller than in the semi-distributed system. The D term has little similarities with the previous case and varies quite a bit. The cost is higher but behaves similarly as in the previous case.

50

6.3 Gain Scheduling by Delay


With the results of Case 2b - Random Delay one can use gain scheduling to tune the PID controller on-line for a random delay which exhibits changes in the local average delay. In this case the gain scheduling is based on the current average delay of the system, in practice on a low-pass filtered measured delay. After delay identification off-line tuned parameters are fetched from a look-up table to give the controller the right tuning. In Tipsuwan and Chow (2004) a similar strategy is implemented in an IP network. The PI controller is parameterised with one variable, , and optimised by simulation with an exponential distribution as the network model. The stochastic delay is estimated by taking the median of measured delays and using a look-up table to fetch the optimal as a function of static and stochastic delay. An advantage with gain scheduling was only found with the largest delay variations. The gain scheduling strategy investigated here is depicted in Figure 6.11. The delay is measured by using timestamps attached to the measurement packets in the delay block. The measured delay is filtered with a low-pass filter3 to detect the underlying slow variation. From the obtained delay the corresponding PID parameters are selected from look-up tables (inset, Figure 6.11) with the results of Case 2b.
yr y _ref y (k) PID u(k+1)

Reference

1 T.s+1 Transfer Fcn


Out1

In

Out

static delay

Tunable Discrete PID

Delay

Delay generator

delay

PID

delay

Gain sheduling
P Lookup

1 PID I Lookup

filt1.tf.num(z) filt1.tf.den(z) Delay filter

1 delay

D Lookup

Figure 6.11: Gain scheduling with PID controller. The gain scheduler has a low-pass filter for the delay and look-up tables for P, I and D parameters.

A second order Chebyshev type II filter with cut-off at 0.05 rad.

51

In the next cases gain scheduling is demonstrated with two types of delay changes and compared to a non-scheduled, constant parameter controller. First the delay is random with the same properties as in Case 2b, but there is a step in the mean delay from 0.5 to 1.0 at time 40 s. In the second example the delay has a slow sinusoidal variation with a frequency of 0.1 rad/s and amplitude 0.4 (Figure 6.12). These delay changes could for example originate from a network topology change (the step change) where a node has fallen off or moved in an ad-hoc network and the path (and delay) has become longer. The sinusoidal change could be explained as a change in network load, where an increase in load lengthens the delay.
1.4
1.4

1.2

1.2

0.8 Delay [s]


Delay [s]

0.8

0.6

0.6

0.4

0.4

0.2

0.2

10

20

30

40 Time [s]

50

60

70

80

10

20

30

40 Time [s]

50

60

70

80

Figure 6.12: Delay for simulations with gain scheduling. Thin line: measured delay, bold line: low-pass filtered delay. On the left: Random delay with step change. On the right: Slow sinusoidal variation.

52

6.3.1 Case 4a Step Delay Change


The nominal delay of the system is assumed to be 0.5. The constant controller is tuned for this delay. At some stage the state of the system changes and the delay rises to 1.0. The gain scheduled controller adapts to the situation whereas the constant controller continues its, now detuned, operation. Examination of the step responses on the right in Figure 6.13 leads to the conclusion that the gain scheduled controller is better than the non-scheduled controller. It adapts to the changed delay. When the delay changes at time 40 s there is a hiccup with a larger overshoot, but as soon as the delay is identified the steps are normal, whereas the constant controller has overshoot ever after the delay change. The PID parameters plotted in Figure 6.13 on the left show that, indeed, the controller is scheduled with appropriate gains for the current delay. There is an initial transient period where the delay is estimated. It shows up in both the PID parameter plot and the response plot as peaks.
1.4 P I D 1.4 1.2 1 0.8 0.8 0.6 0.6 0.4 0.4 0.2 0 -0.2 Output with gain scheduling Output without gain scheduling

1.2

0.2

10

20

30

40 Time [s]

50

60

70

80

10

20

30

40 Time [s]

50

60

70

80

Figure 6.13: Gain scheduling with step delay change. On the left: PID parameters for current identified delay as function of time. On the right: Step responses for system with and without gain scheduling.

53

6.3.2 Case 4b Sinusoidal Delay Change


In this case the random delay is assumed to have slow sinusoidal variations with amplitude 0.4 around a mean delay of 0.75 (Figure 6.12, Right). The constant controller is tuned for this mean delay. The scheduled controller adapts as in the previous case. The result of the sinusoidal changing delay is shown in Figure 6.14. Once again there is an initial peak until the delay is found. For the sinusoidal delay the controller tuned for an average variation does perform well sometimes, but as the delay changes the control loop has overshoots and there is risk of instability. The step response of the scheduled controller is similar regardless of the current delay. These two cases show that a gain scheduled PID controller performs better than a constant controller, when the delay changes significantly. The disadvantage of gain scheduling is that one must measure the delay and have a mechanism for changing the PID parameters of the controller online. The controller must also be tuned for several lengths of delay. The non-scheduled controller is easier in this regard to set up, and performs well enough for small variations in the conditions of the system.
1.4 P I D 1.6 1.4 1.2 1 1 0.8 0.8 0.6 0.4 0.4 0.2 0.2 0 -0.2 Output with gain scheduling Output without gain scheduling

1.2

0.6

10

20

30

40 Time [s]

50

60

70

80

10

20

30

40 Time [s]

50

60

70

80

Figure 6.14: Gain scheduling with sinusoidal delay change. On the left: PID parameters as functions of time. On the right: Step responses of the system with and without gain scheduling.

54

6.4 Sensor Network


In this section the first five fusion strategies presented in Section 4.7 are tested in simulations. A sensor network is considered here with the sensor cluster having four sensors with known noise variances. The sensors, network, fusion and controller are all time driven. The network is modelled as a 3-hop network with the same properties as in Case 3 (the network delay case). The packets from the sensors are independently delayed on their way to fusion. The same process as in the other examples (Equation (6.2) is controlled with a discrete-time PID controller. The controller is hand tuned (P = 1, I = 0.7 and D = 0.2, this is near the optimal tuning for the system) to get a satisfactory step response. The simulation is run for four step responses, and the error integrals are averaged to get a better estimation of them, because of the randomness (noise, delay, packet loss) in the network that causes varying performance on the step responses at different times. The strategies simulated are cases 1-5 from Table 2. The more advanced strategies with Kalman filters are left to another thesis. The strategies are evaluated based on their step response ITAE and the fusion error IAE over the whole simulation. The results are shown in the following figures and collected in Table 3. Figure 6.16 displays the error between the fused and the real variable, summed up with the IAE criterion to form the fusion error measure.
Table 3: Fusion strategies results.

Case 1 2 3 4 5

Name fusion_no fusion fusion_by_timestamp fusion_by_timestamp2 fusion_with_decay

Step response ITAE 1.56 1.36


1.16

Fusion error IAE 3.7 1.33


1.12

1.85 1.21

3.05 1.61

55

The best method is the fusion by timestamp (case 3), regardless of which error is chosen as evaluation criterion. The second best methods are the fusion regardless of timestamp (case 2) and fusion with decay (case 5). These methods eliminate the error variance better than the other methods because they always fuse four measurements. The worst cases are no fusion (case 1) and fusion with only the most up-to-date measurements (case 4), since these methods hardly reduce the noise (high fusion error). The step responses are similar, shown in Figure 6.15, apart from the different noise levels after fusion (Figure 6.16). The noise is further amplified by the derivative term of the controller. The output noise is proportional to the fusion IAE criterion, and thus the fusion by timestamp method has the smoothest response, the no fusion method being the worst.

56

Fused output 1.4 1.2 1 0.8 0.6 fusion_no ITAE: 1.561 fusion ITAE: 1.356 fusion_by_timestamp ITAE: 1.160 fusion_by_timestamp2 ITAE: 1.850 fusion_with_decay ITAE: 1.206

0.4 0.2 0 -0.2 -0.4 -0.6

10

12

14

16

18

20

Control 3 fusion_no fusion 2 fusion_by_timestamp fusion_by_timestamp2 fusion_with_decay 1

-1

-2

-3

10

12

14

16

18

20

Figure 6.15: Simulated step responses (top) and control signals (bottom) with various fusion strategies.

57

fusion_no IAE: 3.7 0.2 0 -0.2 -0.4 0 5 10 15 20 fusion IAE: 1.33 0.2 0 -0.2 -0.4 0 5 10 15 20 25 30 35 40 25 30 35 40

fusion_by_timestamp IAE: 1.12 0.2 0 -0.2 -0.4 0 5 10 15 20 25 30 35 40

fusion_by_timestamp2 IAE: 3.05 0.2 0 -0.2 -0.4 0 5 10 15 20 25 30 35 40

fusion_with_decay IAE: 1.61 0.2 0 -0.2 -0.4 0 5 10 15 20 25 30 35 40

Figure 6.16: Fusion errors for various fusion strategies during a simulation.

58

6.5 Tuning for Example Process


The electric circuit described in Section 5.6 is used as a real example process. Several PID controllers are tuned with the methods presented in Chapter 4, and they are tested in this Section with simulations. The tunings are then verified on the real process in Chapter 7. The derived transfer function (Section 5.6) is used as a model for the process in the simulations. The process is supposed to be in a fully-distributed networked control system as described in Section 3.1. The network has an Internet delay distribution with packet loss according to Section 2.2. The parameters for the network are presented in Table 4. The variance of the stochastic part of the delay is according to Equation (2.10) 3.33 ms2. The parameter values approximate typical short distance Internet properties (Pohjola et al., 2005).
Table 4: Network properties, typical Internet parameters.

Hops, n 3

Static delay, static 35 ms

Stochastic delay, stochastic 100 ms

Packet loss 1%

The optimisation technique with the average ITAE cost, Equation (6.1), on five unit step responses is used to tune the PID controller for the process. Several steps are done and averaged as previously, to get rid of optimisation for a particular instance of the random delay. Other tunings (Ziegler-Nichols and IMC) are used as well for comparison. The comparison is done by the average ITAE and IAE cost of a series of step responses and by visual inspection. The results are collected at the end of this Section, in Table 5.

6.5.1 Optimisation Tuning


The optimal tuning is done for sampling times ranging from 0.01 to 0.25 seconds. The optimal PID parameters are in Figure 6.17. The tuning is not as smooth as for the previous first order systems, though the results follow the general trend with decreasing PID parameters as sampling time increases. The D term is constant and nearly zero.

59

3 P I D 2.5

Parameters

1.5

0.5

0.05

0.1 h [s]

0.15

0.2

0.25

Figure 6.17: Optimal PID controller parameters for example process. P, I and D as functions of sampling time, h.

The variations in the optimal PID parameters are not a result of the optimisation algorithm being stuck in local minima. Several initial values for the optimisation algorithm have been used to avoid this. The variation is rather a consequence of the random delay. The cost plotted in Figure 6.18 rises with sampling time, but it is far from smooth, with a deep valley at h = 0.16 s. At this point the effective delay varies between two values: h and 2h (Equation (3.1)). This suggests that the PID controller works well when most of the variation of the delay is in the order of the sampling time. With this particular sampling time 85 % of the stochastic time-delay is smaller than the sampling time. This supports the work that considers the delay variation to be at most one sampling time (Nilsson, 1998). In Figure 6.19 some step responses are shown as functions of sampling time. The corresponding PID tunings are listed in Table 5. At the shortest sampling time there is some overshoot, but the system has generally a good response. With the sampling time at the local minimum of Figure 6.18 the overshoot is fixed with no significant impact on the speed of the response. This is the most preferred sampling time, as 60

concluded in the previous paragraph. The longest sampling time results in a slower response with longer rise time and settling time.
0.4

0.35

0.3

cost, ITAE

0.25

0.2

0.15

0.1

0.05

0.05

0.1 h [s]

0.15

0.2

0.25

Figure 6.18: Optimal ITAE cost as a function of sampling time, h, for example process.
Output 3 h = 0.025 h = 0.16 h = 0.25 Reference

-1

-2

-3

10 Time [s]

15

20

25

Figure 6.19: Step responses with optimisation tuning. Sampling times: 0.025, 0.16 and 0.25 seconds.

61

6.5.2 Ziegler-Nichols Tuning


To compare the results of the optimisation based tuning, other tuning methods are also tested. With the simulation model both Ziegler-Nichols step- and frequencyresponse tuning is made. The step response and the critical gain tests are shown in the Appendix, Figure 10.1. From these graphs the required properties are measured and the parameters are calculated according to Table 1 and translated to P, I and D parameters using Equation (4.4). The relevant measurements are collected in Table 7 in the Appendix. The Z-N tuning does not take into account the sampling time. A low sampling time is used h = 0.025 s, where the controller approximates a continuous-time controller to some degree. For higher sampling times the control loop becomes unstable. Step response results are shown in Figure 10.2 in the Appendix.

6.5.3 IMC Tuning


Next IMC tuning is derived. The derivation of the tuning parameters is summarised in the Appendix, Section 10.1. The varying network delay is first approximated with a constant delay and this is further approximated with a first order Taylor series. It is assumed that in spite of these rough delay approximations they do still lead to a usable controller tuning. This assumption will not hold in every case, e.g. for a delay distribution with a large variance. The resulting controller is a PID controller with parameters
Kp = a1 + a2 a1

Ti = a1 Td =

(6.4)

and with a pre-filter


G pf ( s ) =

1 bs + 1

(6.5)

consisting of the inverted zeros of the process. This pre-filter can be omitted by considering that the model is inaccurate and does not model the zeros. The IMC

62

concept ensures that the controller will work and compensate for the (artificial) modelling error. The controller is tested with and without the pre-filter. The parameters in Equation (6.4) are derived in the continuous-time case because an IMC controller derived in discrete-time can not be brought to a PID controller form. Therefore only a short sampling time of h = 0.025 s is used for the discrete-time PID so that it approximates the continuous-time controller. The tuning parameter, , for the IMC tuning is selected to be 0.65. This results in a response with little overshoot, and with minimum ITAE cost (Figure 10.3 of the Appendix).

6.5.4 Results
The process responses and the control signals for a series of reference step changes are displayed in the following figures. The PID parameters obtained with the different tuning methods and the respective average ITAE and IAE costs of the step responses displayed in Figure 6.20 are listed in Table 5. The ITAE costs of the responses are used to compare the tuning methods. This measure is chosen because it takes the whole response into account, which is not the case for measures such as the rise time or overshoot. The optimisation method has of course the best ITAE as it minimises the particular criterion, therefore also the IAE criterion is displayed. The ITAE criterion is used to compare how much worse the other tuning methods are in comparison to the optimum. The Z-N step response method is almost unstable and oscillates heavily: the cost is 6 times larger compared to the optimal tuning. This is due to the large gains of the tuning. It is omitted from the figures below and shown in the Appendix, Figure 10.2. The bad tuning can stem from uncertainties in the determination of the inflexion point of the test step response. The Z-N tuning methods are designed for load disturbance rejection so the poor performances originate partially from the reference step changes in the simulations. The IMC tuning with a pre-filter has a quite different step response compared to the others and does not belong here because of the filtering in addition to the pure PID controller. The step response is shown in the Appendix, Figure 10.3.

63

The optimisation method has the lowest ITAE and IAE cost, followed by IMC. There is a correlation between the ITAE and IAE costs. The square integral costs (ISE and ITSE, not shown) give similar results.
Table 5: PID parameters for example process and cost from simulations.

Method

Cost, ITAE

Cost, IAE 0.302 0.034


0.021

Z-N step response Z-N frequency response Optimisation, h = 0.025 Optimisation, h = 0.16 Optimisation, h = 0.25 IMC (without pre-filter) IMC (with pre-filter)

3.36 2.7 1.77 1.48 1.08 1.56 1.56

6.72 5.57 2.66 1.50 1.05 1.23 1.23

0.42 0.33 0.02 0.13 0.11 0.25 0.25

0.072 0.027
0.014

0.015 0.025 0.025 0.026

0.024 0.051 0.022 0.046

The optimisation method has a short rise time and settling time with little overshoot, even though these criteria are not explicitly in the cost function. The conclusion is that the optimisation tuning method gives the best results among the compared tuning methods, regardless of the tuning criterion. Some conclusions can be done when the step responses are visually compared (Figure 6.20). The Z-N frequency method is better than the Z-N step response method. There are still heavy oscillations and the tuning is aggressive with large PID parameters. The other tuning methods produce reasonable step responses. The IMC scheme without a pre-filter has a too large derivation term that over-anticipates the overshoot and the steady-state error disappears slowly. Some part of the slow response is owing to the zero not modelled. The version with the pre-filter shown in the Appendix (Figure 10.3) is smoother and settles down nicely. The cost is the same as without the pre-filter.

64

The tuning by optimisation is the best; it has the smoothest response and settles down in a short time with little overshoot, even the larger step is not a problem. The tuning for a sampling time of h = 0.25 s works almost as well; there is only a larger delay and a slower response because of the large sampling time.
Output 4 Z-N frequency Optimisation h=0.025 Optimisation h=0.25 IMC no pre-filter Reference

-1

-2

-3

-4

-5

10 Time [s]

15

20

25

Figure 6.20: Simulated step responses for example process.

It is notable that the IMC tuning (with and without a pre-filter) comes near the same performance as the optimal tuning, if one considers the error integrals. The control signals (Figure 6.21) show that the Z-N and the IMC tuning are aggressive with large control signals. The Z-N tuning oscillates strongly. The optimal tunings have a reliable and precise control signal in comparison to the other methods.

65

Control 20

15

10

-5

-10

-15

Z-N frequency Optimisation h=0.025 Optimisation h=0.25 IMC no pre-filter

-20

10 Time [s]

15

20

25

Figure 6.21: Control signals for example process.

66

7 MoCoNet Results
In this Chapter the example process tunings simulated in Section 6.5 are verified on real hardware. Test runs are done with the MoCoNet platform described in Chapter 5 on the electrical circuit (see Section 5.6) connected to the platform. The network is simulated with the network simulator presented in Section 5.5. The settings for the network are the same as in the simulation runs of Section 6.5 (Table 4). The controller tunings are the same as those in Section 6.5. The purpose of these tests is to verify that the tunings work in practice. The results are saved to a text file from the MoCoNet scope and analysed and plotted in MATLAB. In Figure 7.1 a sample of the network delay of the network simulator is shown. The delay has the same parameters as in the simulations, Table 4. The figure corresponds to the delay of Figure 6.8 simulated in Simulink as they both are computed in the same way. The main difference between the figures is that they have different delay parameters. The general distribution is the same with some long delays from the tail of the gamma distribution. Several test runs were made and the typical cost was estimated. The rest of the Chapter shows representative test run results, and the results are compared to the simulation results. The results are collected and compared in Table 6.
0.7

0.6

0.5

0.4

0.3

0.2

0.1

10

15

20

25

Time [s] Figure 7.1: Sample of real network delay of the network simulator (h = 0.1 s).

67

7.1 Optimisation Tuning


The optimisation tuning is run on the MoCoNet system and the result is displayed in Figure 7.2. The response varies some from time to time because the tuning is so tight that the variations in the delay affect the closed-loop behaviour more than in the other tuning methods. The response is stable, with some overshoot but similar to the simulation result.

10 Reference Control Output

8 6

0 -2

-4

-6

-8 -10

10 Time [s]

15

20

25

Figure 7.2: Optimisation tuning with h = 0.025 s. Test results with example process.

The ITAE cost ranges from 0.026 to 0.038, which is higher than the simulated cost. There are several reasons for this: the real process is different from the transfer function model and the actual network delay is different from the simulations. Measurement noise also affects the results. The optimisation method produces some aggressive control signal behaviour. If a long delay occurs at the time when a step change is performed the controller overshoots and oscillation can occur. This is only temporary and the closed loop remains stable. In case of a longer sampling time the system becomes more stable with less overshoot and oscillations. Figure 7.3 presents the results with sampling time h = 0.16 s. The ITAE cost remains stable from run to run at 0.08. 68

10 Reference Control Output

6 4

-2

-4 -6

-8

-10

10 Time [s]

15

20

25

Figure 7.3: Optimisation tuning h = 0.16 s. Run of step responses for the example process.

With the long sampling time the effective time-delay alternates between two values. The step response is stabilised, compared to the shorter sampling time (Figure 7.2), and the control signal is smoother. This choice of sampling time is the best according to the conclusions of the valley in Figure 6.18.

7.2 Ziegler-Nichols Tuning


The Ziegler-Nichols step response method is almost unstable and can not be used. The process test run result is shown in the Appendix (Figure 10.2) with the simulation result. The response of the Z-N frequency tuning method is shown in Figure 7.4. The Ziegler-Nichols tuning is not acceptable, it oscillates heavily. The ITAE cost is the highest of all the tunings: 0.3. The large gains are the problem, as they were in the simulations. The control action is limited to the interval [-10, 10] which the Z-N tuned controller exceeds, so there is also a problem with control saturation.

69

10 8 6 4 2 0 -2 -4 -6 -8 -10 Reference Control Output

10

15

20

25

Time [s] Figure 7.4: Z-N frequency tuning. Run of step responses for the example process.

7.3 IMC Tuning


The IMC tuning method is tested with and without the pre-filter. The results of both cases are shown in the following figures. The IMC tuning performs well, even without the pre-filter. The ITAE cost is around 0.1. The response is fast with little overshoot. The large D term is the only harmful aspect leading to a large control output. With the pre-filter the derivative problem vanishes. The resulting response is very smooth and the cost decreases to 0.06. One should, of course, take into account when comparing the controllers that this controller has an advantage over the other PID controllers because of its extra degree of freedom: the pre-filter.

70

10 Reference Control Output

6 4

-2

-4 -6

-8

-10

10 Time [s]

15

20

25

Figure 7.5: IMC tuning without pre-filter. Run of step responses for the example process.

10 Reference Control Output

6 4

-2

-4 -6

-8

-10

10 Time [s]

15

20

25

Figure 7.6: IMC tuning with pre-filter. Run of step responses for the example process.

71

7.4 Conclusions of Test Runs


The cost criterion from the test runs are shown in Table 6 with the simulation cost from Table 5. Compared to the simulation results the controllers perform worse in practice based on the ITAE cost. The cost rises roughly by half a decade, but by eye the responses look acceptable. The reasons for the poorer performances are modelling errors, different realisations of the network delay and measurement noise. All the tuning methods except the Z-N methods give satisfactory results based on the cost, and can thus be used to tune a PID controller for practical use. The optimisation method gave, again, the best results. There are only minor deviations from the simulation results. The optimisation with h = 0.16 s is robust to network delay, measurement noise and modelling errors. In this case the simulation results gave a good indication of the performance of the real system. This is mainly because the process is simple to model and the resulting simulation model was sufficiently accurate. As the optimisation method relies on the process model it is expected to give comparable results also in other cases, as long as the simulation model is reasonable accurate.
Table 6: MoCoNet run results. Cost and simulation cost.

Method Z-N step response Z-N frequency response Optimisation, h = 0.025 Optimisation, h = 0.16 IMC (without prefilter) IMC (with prefilter)

Cost, ITAE 0.7-1.7 0.3


0.03-0.04

Simulation cost, ITAE 0.072 0.027


0.014

0.08 0.10 0.06

0.015 0.025 0.026

72

8 Conclusions
This thesis studied the discrete-time PID controller design and tuning for varying time-delay systems and furthermore networked control systems (NCS), including sensor networks. The MoCoNet system was developed to enable RCP for educational use in laboratory courses. With the addition of a network simulator, testing of networked control systems was made possible. The MoCoNet system is operational and will be used in the laboratory course at the Control Engineering Laboratory at Helsinki University of Technology. The discrete-time PID controller was introduced and some practical aspects, such as derivative filtering were formulated. As NCS includes a network, which transmits measurements as packets, there is an inherit discreteness to the system and therefore only discrete-time PID controllers were studied. The controller tuning was focused on an optimisation by simulation technique. The tuning method was modified to work with discrete-time controllers in the context of NCSs. Other PID design methods such as Ziegler-Nichols and Internal Model Control were compared to the optimisation method. The tuning methods were tested with simulations and with experiments on a real example process with the MoCoNet system. The optimisation tuning method performed almost equally well in practice as in simulations. It was further shown to perform better than traditional tuning methods, because it can take the varying time-delay better into account. A general study of optimal tuning for varying time-delay systems was conducted. The optimisation was done for first-order systems with time-delay, as a function of process time constant and controller sampling time. The time-delay was a varying time-delay, namely time- or state-dependent and random. The results gave rules of thumbs to tune the PID controller for different types of time-delays. One general result was that with increasing sampling time the P and I terms decrease. With increasing process time constant the P and D terms increase. The tuning results of different time-varying delays were compared to the constant delay case. Differences in the optimal tuning with different types of time-delays were

73

found. However, the optimal tuning for a random delay with a small variance is virtually the same as in the constant delay case. In the case of a small random variance in the time-delay and a larger sampling time, constant delay tuning can be used, as the sampling time rounds the delay up to nearly constant. The PID controller was found to work best when most of the stochastic time-delay was smaller than or equal to the sampling time of the controller. It performs equally well with a short enough sampling time, with the expense of a more active control signal and less robust performance. The optimised tuning results were based on the ITAE cost of the error signal. As the optimisation focused on the time-response only, robustness is not guaranteed. Robustness, load disturbance rejection and noise rejection should and can easily (as outlined in the thesis) be incorporated into the optimisation criteria, and optimisation for a good response and robustness should be considered in further studies. The down-side of the optimisation technique is that a process model is needed. The model can, however, be any input-output description and it is not limited to linear and time-invariant systems. This allows one to tune for any type of processes, such as processes with time-varying delay, as is done in this thesis. Networked control systems and their various layouts, including sensor networks were described. The occurrence of a time-delay in the control loop of these systems was analysed. Especially the delay distribution in the Internet was described in detail. Sensor fusion methods for sensor network systems were developed and tested in the simulations. Gain scheduling based on delay was also demonstrated with typical delay changes corresponding to falloff of a node and daily network utilisation changes. The optimisation method was applied on networked control systems, where the varying time-delay was modelled with the Internet delay distribution. Several tuning methods were tested on an example process in simulations. The optimisation tuning cost as a function of sampling time showed that there is a local minimum at a relatively long sampling time where the performance of the controller good. The favourable sampling time is such that the resulting effective delay varies between two values.

74

Results were also verified on a real process with the MoCoNet platform. The various tunings done with a simulation model were shown to perform satisfactorily in practice. The optimisation tuning performed better than all the other tuning methods when an appropriately long sampling time was chosen, even better in practice than with a short sampling time. Another conclusion was that with an adequate process model the optimisation tuning results can be used on real processes. The thesis showed that a PID controller can be used to control a process with varying time-delay, as long as the variation in the delay is small, in the order of the sampling time. Traditional tuning methods, such as Ziegler-Nichols, do not perform well in the new setting of networked control systems. The tuning can instead be done with the optimisation tuning method using simulation described in this thesis.

75

9 References
Alves, M., Tovar, E., Vasques F. 2000. Ethernet Goes Real-time: a Survey on Research and Technological Developments. HURRAY-TR-2K01. strm, K. J. and Hgglund, T. 1995. PID Controllers: Theory, Design, and Tuning, 2nd edition. Instrument Society of America, 1995. Bolot, J. C. 1993. Characterizing End-to-End Packet Delay and Loss in the Internet Journal of High-Speed Networks. Sigcomm 1993. pp. 289 298. Cao, J., William S. C., Lin, D., Sun, D. 2002. Internet Traffic Tends Toward Poisson and Independent as the Load Increases. Nonlinear Estimation and Classification. Springer Verlag, New York, NY, Dec. 2002. ISBN: 0-38795471-6. Cervin, A., Henriksson, D., Lincoln, B., rzn, K-E. 2002. Jitterbug and TrueTime: Analysis Tools for RealTime Control Systems. 2nd Workshop on RealTime Tools. Copenhagen, Denmark, 2002. Chai, S. 2005. Design and Implementation of Networked Predictive Control Systems. In proc. 16th IFAC World Congress, Prague, Czech Republic, 2005. Ekanayake, M.M., Premaratne, K., Douligeris, C., Bauer, P.H. 2001. Stability of Discrete-Time Systems with Time-Varying Delays. In proc. American Control Conference, Arlington, VA, 2001. Eriksson, L. 2005. A PID Tuning Tool for Networked Control Systems. WSEAS Transactions on Systems, Issue1, Vol. 4. ISSN: 1109-2777. Eriksson, L. and Koivo, H. 2005. Tuning of Discrete-Time PID Controllers in Sensor Network based Control Systems. In proc. 6th IEEE International Symposium on Computational Intelligence in Robotics and Automation, Espoo, Finland. 2005.

76

Garcia, C. E. and Morari, M. 1982. Internal Model Control. 1. A Unifying Review and Some New Results. Industrial, Engineering Chemistry Process Design and Development Vol. 21, No. 2, 1982. Hang, C.C., strm, K.J., Ho W.K. 1991. Refinements of the Ziegler-Nichols tuning formula. IEE Proceedings Part D, Vol. 138, NO. 2, March I991. ISSN: 0143-7054. Hanselmann, H. 1996. Automotive Control: From Concept to Experiment to Product. In proc. IEEE International Symposium on Computer-Aided Control System Design. Dearborn, MI, 1996. Hasu, V. and Koivo, H. 2005. Decentralized Kalman Filter in Wireless Sensor Networks Case Studies. In proc. CISSE 2005. Hltt, V., Palmroth, L., Eriksson, L. 2004. Rapid Control Prototyping Tutorial with Application Examples. Sim-Serv, www.sim-serv.com. Isaksson, A.J. and Graebe, S.F. 2002. Derivative filter is an integral part of PID design. IEE Proceedings. Control Theory and Applications. 61. 149, No. I. January 2002. ISSN: 1350-2379. Katayama, T., McKelvey T, Sano, A., Cassandras C., Camp, M. 2005. Trends in Systems and Signals. In proc. 16th IFAC World Congress, Prague, Czech Republic, 2005. Leith, D.J. and Leithead, W.E. 2000. Survey of gain-scheduling analysis and design. International Journal of Control, Vol. 73, No 11, 2000. Lincoln, B. 2003. Dynamic programming and Time-Varying Delay Systems, Ph.D. thesis. Department of Automatic Control. Lund institute of Tecnology, Sweden, 2003. Liu, G., Xia, Y., Rees, D. 2005a. Predictive Control of Networked Systems with Random Delays. In proc.16th IFAC World Congress, Prague, Czech Republic, 2005.

77

Liu, G., Mu, J.X., Rees, D. 2005b. Networked Predictive Control Of Systems With Random Network Transmission Delay A Polynomial Approach. In proc. 16th IFAC World Congress, Prague, Czech Republic, 2005. Liu G.P., Yang, J.B., Whidborne, J.F. 2003. Multiobjective Optimisation and Control, Research Studies Press Ltd, England. ISBN: 0-86380-278-8. Liu, X. and Goldsmith, A. 2004. Kalman filtering with partial observation losses. 43rd IEEE Conference on IEEE Decision and Control. Volume: 4, 2004. Nilsson, J. 1998. Real-Time Control Systems with Delays. Masters thesis. Department of Automatic Control, Lund Institute of Technology, Sweden. ISSN 02805316. MathWorks. 2005. Optimization Toolbox For Use with MATLAB. MathWorks, Inc. Mukherjee, A. 2001. On the Dynamics and Significance of Low Frequency Components of the Internet Load. In proc. First ACM SIGCOMM Workshop on Internet Measurement. p: 281 293. ISBN:1-58113-435-5. Pohjola, M., Eriksson, L., Hltt, V., Oksanen, T. 2005. Platform for Monitoring and Controlling Educational Laboratory Processes over Internet In proc. 16th IFAC World Congress, Prague, Czech Republic, 2005. Prada, Cesar da, Cristea, S., Keyser, R de. 2005. Predictive Control of a Process with Variable Dead-time. In proc. 16th IFAC World Congress, Prague, Czech Republic, 2005. Reijonen, A. 2003. Tuning of PID Controller for Varying Time-Delay Systems. Masters thesis. Department of Automation and Systems Technology, Helsinki University of Technology, Finland, 2003. Tipsuwan, Y. and Chow, M-Y. 2004. On the Gain Scheduling for Networked PI Controller Over IP Network. IEEE/ASME Transactions On Mechatronics, Vol. 9, No. 3, September 2004. ISSN: 1083-4435. 78

Valls, M., Valera, A., Dez, J.L., Albertos, P. 2005. A Straightforward Proposal For Low-Cost Development Of Virtual And Remote Control Laboratories. In proc. 16th IFAC World Congress, Prague, Czech Republic, 2005. Viljamaa, P., Koivo, H. N. 1995. Fuzzy logic in PID control gain scheduling. Third European Congress on Intelligent Techniques and Soft Computing, EUFIT '95, Aachen, Germany, 1995. Aachen, Germany, Verlag Mainz, ELITE - European Laboratory for Intelligent Techniques Engineering, 927931. Zhang, W., Branicky, M.S., Phillips, S.M. 2001. Stability of Networked Control Systems. IEEE Control Systems Magazine. Vol. 21, Issue 1, February 2001. ISSN: 0272-1708.

79

10 Appendices
10.1 Derivation of IMC Tuning for Example Process
The model of the process according to Equation (5.3) is
Gm ( s ) = bs + 1 e s , a2 s + a1 s + 1
2

(10.1)

with the constant approximating the varying random delay. Splitting this into an invertible and a non-invertible part results in (the numerator is a minimum-phase zero)
Gm (s) =

bs + 1 a2 s + a1 s + 1
2

(10.2)

+ Gm ( s ) = e s

The delay can be approximated with a first-order Taylor series e s 1 s or with a Pade approximation 1 s 2 . 1+ (10.3)

e s

(10.4)

The filter, G f ( s ) , is chosen as simple as possible with n = 1 G f ( s) = 1 . s +1 (10.5)

When selecting the first-order Taylor approximation for the delay and the filter given above one can calculate the IMC controller. The controller turns out to be, according to Equation (4.26), and after some algebraic manipulation a2 s 2 + a1 s + 1 1 1 1 GIMC ( s ) = = a1 + + a2 s . s ( + )( bs + 1) s ( bs + 1) ( + ) This is a PID controller with a pre-filter G pf ( s ) = 1 , bs + 1 (10.7) (10.6)

80

and the PID parameters can be identified to be Kp = a1 + . (10.8) a2 a1

Ti = a1 Td =

The pre-filter can be discretised with an appropriate sampling time to get a discretetime filter and the PID parameters are used as they are for the discrete-time PID controller.

10.2 Results for Example Process


The simulation tests for the Z-N tuning methods are shown in Figure 10.1. From the step response the dead-time and the rise-time are measured. T2 is difficult to measure because the inflexion point is barely visible. The process has a unit gain (K1 = K2). From the frequency test one can deduct that there is a varying delay: The period and the amplitude vary from cycle to cycle. There is no gain that produces a regular oscillation, but an ultimate gain can be found. A greater gain than 4.5 causes the amplitude to increase, so 4.5 was selected as Ku. An average period at the ultimate gain was estimated from the figure below to get the ultimate period Tu.
1.6 1 1.4

0.8

1.2

1 0.6 0.8

0.4

0.6

0.4 0.2 0.2

0 0.5

1.5

2.5

3.5

4.5

10

Time [s]

Time [s]

Figure 10.1: Step response (left) and frequency response tests for Ziegler-Nichols tuning.

81

The Z-N tuning parameters from the simulations are listed in the table below. The values gained through real test runs are also shown. They do differ a little, but not significantly.
Table 7: Properties of system in Z-N tuning. Gained with simulation and test run on the real process.

Ku Simulation 4.5 Test run 4.5

Tu 0.97 1.1

T1

T2

0.25 0.7 0.22 0.8

20 Reference Control Output

10 8 Reference Control Output

15

6 10 4 5

2 0

-5

-2

-4 10 -6 15 -8

20

10

15

20

25

-10

10

15

20

25

Time [s]

Time [s]

Figure 10.2: Z-N tuning with step response method. On the left: Simulated steps for the example process. On the right: Test run on real process.

82

3 Reference Control Output

-1

-2

-3

-4

Time [s]
0 5 10 Time [s] 15 20 25

Figure 10.3: IMC tuning with pre-filter. Simulated step responses for the example process. See Chapter 6.5.4.

83

You might also like