• No results found

Implementation of a Wireless Control System

N/A
N/A
Protected

Academic year: 2021

Share "Implementation of a Wireless Control System"

Copied!
51
0
0

Loading.... (view fulltext now)

Full text

(1)

Implementation of a Wireless Control System

Network Routing and Unreliable Communication Link Compensation

JAKOB WALLANDER

Master’s Degree Project in

Automatic Control

Stockholm, Sweden 2012

(2)
(3)

Abstract

Wireless communication systems have been a part of everyday life for many decades but implemented in an industrial control system they are yet to make their big breakthrough. This is despite of the fact that wireless control systems show great promise in reducing installation costs and down time. The biggest reason why they have not already revolutionised the industry is reliability, as they are much more susceptible to delays and communication breakdowns compared to their wired counterpart.

The foundation for this thesis is the following scenario. In an industry a control loop uses a wireless link between the control computer and the actuator. A forklift moving heavy equipment happens to park in a position where it is blocking the communications. This thesis suggests a solution to this problem through the implementation of two separate measures. First a Collection Tree routing Protocol (CTP) is responsible for detecting bro-ken links and finding a disturbance free path for the packet through the network. Secondly a Kalman filter based Predictive Outage Compensator (POC) estimates the missing data when the real control signal is delayed or missing.

(4)
(5)

Sammanfattning

Tr˚adl¨osa kommunikationssystem har varit en del av vardagen i m˚anga de-cennier, men i industriella styrsystem v¨antar de fortfarande p˚a sitt stora genombrott. Detta trots att tr˚adl¨osa styrsystem visar p˚a lovande m¨ojligheter att kunna minska installationskostnader och stop i processerna. Den stora anledningen till att de inte redan har revolutionerat branschen ¨ar tillf¨orlit-ligheten. De ¨ar avsev¨art mer mottagliga f¨or f¨ordr¨ojningar och kommunika-tionshaverier j¨amf¨ort med en tr˚adbunden motsvarighet.

Denna avhandling har sin grund i f¨oljande scenario. I en industri finns ett reglersystem som anv¨ander sig av en tr˚adl¨os l¨ank mellan styrdatorn och st¨alldonet. En gaffeltruck som flyttar tung utrustning i fabriken r˚akar park-era i ett l¨age d¨ar den blockpark-erar kommunikationen. Avhandlingen f¨oresl˚ar en l¨osning p˚a detta problem genom tv˚a separata ˚atg¨arder. F¨orst genom implementationen av ett Collection Tree Protocol (CTP) som ansvarar f¨or att uppt¨acka trasiga l¨ankar och att hitta en v¨ag f¨or paketeten som ¨ar fri fr˚an avbrott. I andra hand genom en Kalmanfilterbaserad Predictiv Outage Compensator (POC) som har till uppgift att skatta styrsignalen d˚a verkliga data ¨ar f¨orsenade eller saknas.

F¨or implementationen anv¨andes Moteiv Tmote Sky i alla n¨atverksnoder och tv˚a-tanks processen som testplattform f¨or POCen. Resultaten visar att CTP n¨atverket klarade att dirigera data genom flera hopp utan alltf¨or stora dr¨ojsm˚al och att mellan 1 och 8 paket tappas d˚a topografin i n¨atet ¨

(6)
(7)

NOMENCLATURE

Notations

E[w] Expected value of w V ar(w) Variance of w

x+ Next discrete value of x x− Previous discrete value of x Variables

ˆ

u Estimated control signal/pump voltage . . . V r Reference for lower tank . . . m u Control signal/pump voltage . . . V x1 Water level upper tank . . . m

x2 Water level lower tank . . . m

Abbreviations

(8)
(9)

CONTENTS

Abstract i Sammanfattning iii Nomenclature v Contents vii 1 Introduction 1 1.1 Wireless Control . . . 1 1.2 Problem Formulation . . . 2 1.3 Outline . . . 3

2 Packet Routing in a Multi-Hop Network 5 2.1 Program Abstraction Layers . . . 5

2.2 The CTP Algorithm . . . 6

3 Compensating for Lost Packets 11 3.1 Introduction . . . 11

3.2 The Closed Loop System . . . 12

3.3 Outage Compensation . . . 13

4 Implementation 17 4.1 The Tmote Sky . . . 17

4.2 The Double Tank Process . . . 18

4.3 Implementation of a Small CTP Network . . . 21

4.4 The Kalman Based POC . . . 22

5 Results 25 5.1 Evaluation of CTP Routing Performance . . . 25

5.2 Simulation of POC Performance . . . 29

5.3 Implemented POC Experiments . . . 36

6 Conclusions 39 6.1 Future Work . . . 39

(10)
(11)

CHAPTER

1

INTRODUCTION

Wireless communication has become a more and more important part of the modern society. Different technical solutions ranging from the infra-red short range system in a TV remote control, to ultrasonic signals and radio frequency communication systems. All of the above systems aim to solve the problem of transporting information from one device to another without having to connect them with cables[1].

Today we depend on wireless systems in many parts of our daily lives. They are used for distributing information through TV, radio and internet, for communication with cellular telephones and different radio systems, for positioning in the Global Positioning System and much more. In the indus-try wireless systems are already widely used for monitoring processes and gathering data and in the future they are expected to play an important role in the control of industrial processes. This thesis investigates how such a control system could be constructed.

In this chapter the reader is given an introduction to wireless communi-cations from a control theory point of view and the problems to be solved are presented. Finally the Chapter contains the outline of the rest of the report.

1.1

Wireless Control

In basically all industries there is a desire to control different processes. All control theory is based on the idea of continuously measuring states of a system and then calculate how to actuate in order to achieve desired output. It does not matter if it is the temperature in an oven, the speed of a conveyor belt or the water level in a coolant tank.

(12)

Introduction

valves, heater elements etc. The use of cables for transmitting data has several drawbacks. First of all it creates a system with limited flexibility. It is hard to move equipment and sensors that are connected with cables and if the process needs to be upgraded with more sensors new cables have to be installed. This leads to a second drawback with wired control systems. It is extremely expensive to install new cables in an already operational industry. There are strict limitations on where cables can be installed and the production might have to be shut down during the work, leading to big financial losses. With a wireless network, equipment can be moved and new sensors installed to improve the process with relative ease. Also, wireless networks are less susceptible to ware and tare and can therefore save money by reducing maintenance and downtime[2, p. 2].

The downside of wireless communication is that it is less reliable. In an industrial environment especially, there are many uncontrollable things that affect radio communications. This introduces uncertainties into the control system such as transmission delays, lost packets or even complete communi-cation breakdown between nodes. To achieve good performance these uncer-tainties needs to be taken into account and compensated for when designing the wireless network and controller. Furthermore the capacity limitations in a wireless network are more complex than in a wired counterpart. Different signals needs to be separated in time, frequency or location, meaning that two nodes can not transmit data on the same channel at the same time if they are within range of each other.

All in all it is clear that wireless communications will become a central part of future control systems just as they will create many opportunities to improve on existing ones.

1.2

Problem Formulation

The problem considered in this master thesis is how to construct a simplified version of a wireless control system that could be used in an industrial environment.

The final system as shown in Figure 1.1 has to be able to handle heavy disturbances to the radio communication between individual nodes in the network and re-route control traffic through links that are disturbance free. The report will describe how this network routing can be achieved by using the Collection Tree Protocol (CTP) algorithm.

A strategy to cope with lost packets caused by imperfections in the network routing has to be a part of the control method. This report will suggest a solution where a model based Predictive Outage Compensator (POC) is used on the receiver side of the network to fill in the information needed when packets are lost.

Finally the control system is implemented on the classic double-tank pro-cess described in Section 4.2, using the Moteiv Tmote Sky motes described in Section 4.1 for the network nodes.

(13)

1.3. Outline POC Controller Network POC Process Network

Figure 1.1: Overview of the wireless control system.

actuator while communications between the sensor and the controller (shown in gray in the Figure) is considered to be ideal. The POC is implemented as a part of the actuator. For further reading on the sensor side of the system please refer to master thesis by Ivar Cornell [3].

1.3

Outline

The outline of the rest of this thesis is as follows.

• The theory behind the CTP algorithm is presented in Chapter 2. • Chapter 3 explains the stochastically synthesized POC, also referred

to as the Kalman based POC, for the general case.

• The thesis continues with the implementations in Chapter 4, where the Tmote Sky is presented as well as the double tank process and the derivation of its model. The Chapter also describes how the CTP is implemented to create a small network and how a Kalman based POC for the double tank system is calculated.

• Chapter 5 contains results, first from experiments on the CTP network and then from simulations of the outage compensators. Experimental data from the real double tank system with the CTP network and compensators implemented is also presented.

(14)
(15)

CHAPTER

2

PACKET ROUTING IN A

MULTI-HOP NETWORK

Packet routing attempts to solve the problem of sending data through a network along a varying path while minimizing delays and losses. Many different routing techniques have been developed over the years and this thesis will focus on one technique in particular that is widely regarded as a reference protocol for data collection, the Collection Tree Protocol (CTP).

The following Sections first include a short introduction to some of the components that constitute a wireless network. This knowledge is needed to fully understand the CTP routing algorithm that is the main topic of this Chapter. For information on how a CTP network can be implemented using TinyOS, please refer to Section 4.3.

2.1

Program Abstraction Layers

The goal of this Section is to give a very short introduction to the Open Systems Interconnection (OSI) model and pinpoint the areas that are of interest for the rest of this thesis. The OSI model in Figure 2.1 is a good way to visualize how a communication system works by dividing the program up into seven different layers. A brief explanation of the layers is available below[4].

• Application layer.

The application layer is closest to the user and interacts directly with for example control algorithms.

• Presentation layer.

(16)

Packet Routing in a Multi-Hop Network Physi cal Dat alin k (MA C) Net wor k (Ro utin g) Tran spor t Sess ion Prese nta tion Ap plica tion Recieving data Sending data

Figure 2.1: The OSI network stack.

• Session layer.

The session layer controls connections between nodes. It manages the connection between the local and remote application. The session layer is not a part of this application and will not be discussed further. • Transport layer.

The transportation layer ensures end to end delivery of packets in a network. It is not active in this application and will not be discussed further.

• Network layer.

Also referred to as routing layer. The network layer controls the flow of data in the network and the Collection Tree Protocol investigated in this thesis is implemented as a part of it.

• Data link layer.

Also referred to as MAC layer. Simultaneous communication between nodes is avoided in this layer. There are different solutions for this. The Time Division Multiple Access (TDMA) schedule is a contention-free MAC that distributes timeslots to nodes statically or dynamically. Another example is the contention-based Carrier Sense Multiple Ac-cess (CSMA) MAC used for this implementation. The CSMA MAC implements no fixed schedule, instead the individual nodes sense the channel to make sure it is free before sending packets.

• Physical layer.

The physical layer is closely connected to the hardware. It takes care of the final output to, or first input from, different transmission mediums such as copper cables or the air, in case of radio communications.

2.2

The CTP Algorithm

(17)

2.2. The CTP Algorithm S1 S2 S3 S4 S5 S6 S7 S9 S8 S10 Root 1 Root 2

Figure 2.2: A typical CTP topography with 10 sources (S1to S10) and two roots.

The nodes in the tree can be ether sources or roots and the decision is made by the application of the program. A source node can be the creator of data packets, as in a sensor node, or simply act as a routing node, only forwarding information towards the root. The CTP algorithm makes no difference between these two cases.

A key reason to why CTP might be a good option for sensor networks in industries is that, when running on a CSMA MAC, there is no need for any kind of network manager or synchronization node that has to reach all other nodes. This makes it a lot easier to set up the network in an environment with lots of radio disturbances. Instead each node only knows what other nodes are within its range and the tree is constructed by every individual node choosing a parent i.e. choosing who to forward data packets to. A source node can not influence which root the packet will arrive at if there are more than one. Hence the applications of the root nodes are responsible for distributing the data between them, indicated by the dotted arrows in Figure 2.2.

The choice of parent is important and CTP uses expected transmissions (ETX) as a routing gradient to find the best possible way to a root. It works by giving all roots the predefined ETX value of zero. All other nodes gets the ETX value of its parent plus the ETX value of the link to the parent. An example of this can be seen in Figure 2.3. For further information on how ETX values are obtained see Section 2.2.1

The information necessary to construct and maintain the tree is passed between nodes using two different methods. The first one is a header at-tached to every data packet being sent through the network. The second method is a routing frame transmitted by all nodes to all other nodes within range. The structure of the data header and routing frame is shown in Fig-ure 2.4.

(18)

Packet Routing in a Multi-Hop Network S1 17 S2 7 S3 9 S4 18 S5 3 S6 7 Root 0 14 4 2 11 3 7

Figure 2.3: A CTP topography showing arbitrary ETX values of links and nodes.

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

CTP Data Header CTP Routing Frame

Sequence number Collect ID Origin ETX P C Empty THL ...ETX ETX... ...Parent Parent... P C Empty

Figure 2.4: The CTP data header and routing frame.

be sent more rapidly for a while. The routing frame contains the following pieces of information:

• ETX: The current ETX value of the node sending the frame. Receiv-ing nodes use this information to update their tables containReceiv-ing the information about other nodes in the vicinity.

• Parent: The parent of the sender node. Other nodes can use this information to detect inconsistencies in the network. If a node receives a routing frame from a child advertising that the child has a lower ETX then the parent, the parent can reset its routing frame timer to try and fix the error.

• C: The sending node can set the C bit to 1 to inform other nodes that it is congested.

• P: By setting the P bit to 1 the sending node can request routing frames from other nodes. If a node hears a message with the P bit set to 1 it should reset its own routing frame timer.

• The routing frame also contains 6 bits that are not used for the CTP algorithm and thus available for the programmer.

(19)

2.2. The CTP Algorithm

• Collect ID, Origin: These fields together denotes a unique data packet. They are both set by the origin node and must not be changed by any forwarding node.

• Sequence number: The sequence number is a higher level identifier used to separate different instances of CTP from each other (if there are more then one running)[7].

• ETX: Same as for the routing frame.

• THL: The Time-Has-Lived field denotes a unique instance of a unique packet. Before any node forwards a packet it must increase the value in the THL field by one. This allows the network to eliminate duplicate packets. If a node sees the same packet more than once (denoted by the Collect ID, Sequence number and Origin fields) where the THL field has not been increased this indicates a faulty retransmission. Perhaps the retransmission caused by acknowledgement not getting through, and thus the packet can be dropped. Simply sending the same data only once will not work for CTP since changes in the tree might create a situation where the same node has to route the same data multiple times.

2.2.1 Link Estimator

The link estimator is responsible for estimating the ETX value of links be-tween nodes. It does this using two different mechanisms.

Whenever a data packet is transmitted the link estimator is informed where the packet was sent and whether it was acknowledged or not. The ratio between acknowledged packets and sent packets is a direct estimate of link quality. A constant wd defines how many packets must be sent before

the link estimator generates an estimate, i.e. an estimate is generated once every wd transmissions.

The above method works well for links that are a part of the data path but it does not give any information about link quality to other nodes. To estimate these links the link estimator attaches a header to all beacon frames containing a sequence number that indicates the total number of transmitted beacons by the node in question. Receiving nodes can compare the sequence number to the number of beacon actually received to estimate the link quality. One such estimate is generated once for every wb received

beacons.

The final ETX value sent to the routing engine is a composite based on both data and beacon transmissions as well as the previously calculated ETX value according to:

ET X = (αET Xold+ (10− α)Q)/10

(20)

Packet Routing in a Multi-Hop Network

2.2.2 Routing Engine

The routing engine has two main responsibilities. It is responsible for choos-ing a parent, and therefore indirectly for constructchoos-ing the tree, and for send-ing out beacons to inform other nodes of its status as described in Section 2.2. The choice of parent is done by storing all neighbour’s ETX values in a table together with estimates of link ETXs generated by the link estimator, and picking the parent with the smallest total ETX. Also if network condi-tions change, the routing engine should switch to a new parent if the new one has an ETX substantially better then the old one. How much better the new ETX has to be to trigger a switch is defined by a preset threshold value.

2.2.3 Forwarding Engine

The forwarding engine has several responsibilities[5], first and foremost for deciding what to do with incoming packets (received or locally generated). It is responsible for signalling the application layer receive function if the node is a root or forwarding the packet to the next hop if it is not. The forwarding engine also schedules packets for retransmissions a limited number of times if acknowledgements are not received. The time between two transmissions is random within a specified interval.

(21)

CHAPTER

3

COMPENSATING FOR LOST

PACKETS

The CTP algorithm described in the previous chapter is capable of finding the best way to send information through a network. Sometimes however even the best way is not good enough and the CTP will struggle to deliver data packets to the actuator in a timely fashion. Such delays and outages combined with the fact that the CTP inevitably will drop some packets when changing routes if the connection to the old route was completely lost, calls for a control strategy capable of handling various outages. In this thesis a Predictive Outage Compensator (POC)[2] implemented in the actuator is suggested to solve this problem by filling in the information lost in the network.

This chapter starts with an introduction to the terminology used and continues with the derivation of a closed loop system on state space form. The next Section introduces the concept of outage compensation and the theory behind the optimal stochastically synthesized POC, also referred to as the Kalman based POC. Finally two alternative naive approaches that will be used for comparison are presented.

3.1

Introduction

As a first step towards the closed loop system the terminology for the process, controller and disturbance model is established. Consider the process P on discrete state space form

P( x

+

p = Apxp+ Buu + Bdd

y = Cpxp+ n

(3.1) where y is the desired output and u is the input given by the controllerC

C (

x+c = Acxc+ Bce

u = Ccxc+ Dce

(22)

Compensating for Lost Packets

where e is the control error. The measurement noise n is considered to be a vector of white uncorrelated noise and the process noise d is given byD

D (

x+d = Adxd+ Bww

d = Cdxd+ Dww

(3.3) where w is a vector of white uncorrelated noise.

3.2

The Closed Loop System

The goal in this Section is to derive the closed loop system with the reference and noises as inputs and the control signal as output. The control error e is first considered to be the difference between some reference r and the process output y according to

e = r− y

Inserting u from (3.2) and d from (3.3) in (3.1) yields:

x+p = Apxp+ BuCcxc+ BuDcr− BuDcy + BdCdxd+ BdDww

= (Ap− BuDcCp)xp+ BuCcxc+ BdCdxd+ BuDcr + BdDww− BuDcn

Inserting y from (3.1) in (3.2) yields:

x+c =−BcCpxp+ Acxc+ Bcr− Bcn

Using the two equations above together with (3.3) the complete closed loop system on state space form evolves as:

(23)

3.3. Outage Compensation

3.3

Outage Compensation

The goal of outage compensation is to have some intelligent method of es-timating a signal when no actual data is received from the network. As mentioned before this thesis investigates the possibility of implementing this intelligence in the actuator node.

3.3.1 Designing a Kalman Based POC

In this Section the closed loop system from Section 3.2 is used to derive a stochastically synthesized POC capable of estimating the control signal u. To start, the system in (3.4) can be rewritten as

x+cl = Aclxcl+ Brr + Nw n  | {z } v1 u = Cclxcl+ Dcl1r + Dcl2 w n  | {z } v2 (3.5)

Given this system the optimal estimator of the states xcl is the Kalman filter

POC ( ˆ x+cl = Aclxˆcl+ Brˆr + K(u− ˆu) ˆ u = Cclxˆcl+ Dcl1ˆr (3.6)

where ˆxcl and ˆu are the estimates of the closed loop states and control

signal respectively. The estimator uses ˆr as the reference and ˆr is updated according to

ˆr = (

r If no outage

ˆr− During outage

The optimal feedback gain K is calculated through solving the discrete time Riccati equation[8, p. 158]

P = APAT + NR

1NT− (APCT + NR12)(CPCT + R2)−1(APCT + NR12)T K = (APCT + NR

12)(CPCT + R2)−1

(3.7)

where A = Acl, C = Ccl and N all come from (3.5). The noise covariance

(24)

Compensating for Lost Packets R1= E[v1vT1] =          

E[w1w1] · · · E[w1wi] E[w1n1] · · · E[w1nj]

..

. . .. ... ... . .. ... E[wiw1] · · · E[wiwi] E[win1] · · · E[winj]

E[n1w1] · · · E[n1wi] E[n1n1] · · · E[n1nj]

..

. . .. ... ... . .. ... E[njw1] · · · E[njwi] E[njn1] · · · E[njnj]

          =           V ar(w1) 0 0 0 0 0 0 . .. 0 0 0 0 0 0 V ar(wn) 0 0 0 0 0 0 V ar(n1) 0 0 0 0 0 0 . .. 0 0 0 0 0 0 V ar(nm)           R2= E[v2vT2] = E[(Dv1)(Dv1)T] = DE[v1vT1]DT = DR1DT

R12= E[v1vT2] = E[v1(Dv1)T] = E[v1vT1]DT = R1DT

(3.8)

where D = Dcl2 and assuming that w is a vector of i uncorrelated noises

and n is a vector of j uncorrelated noises.

The POC in (3.6) is implemented according to the block diagram in Figure 3.1. When there is no outage the estimator error  = u− ˆu is used to update the estimator states according to (3.6). When outage occurs  is assumed to be zero and the states are updated and control signal estimated according to ˆ x+cl = Aclxˆcl+ Brˆr ˆ u = Cclxˆcl+ Dcl1ˆr

P

D

C

POC

r n w ˆr + + + y e u u|ˆu ˆ u  d POC on POC off − −

(25)

3.3. Outage Compensation

State reduction

For complex processes run by advanced controllers and with intricate dis-turbance models it is most likely that the closed loop system in (3.5) will become even more complicated. Since the number of states in xcl is the

combined sum of the number of states in xp, xcand xdit might be good to

reduce the the system to a lower order. The goal of such a reduction is to, as accurately as possible, describe the relation between input and output using a smaller number of states. There are several methods for performing the reduction, for example singular perturbation, balanced truncation or Hankel approximation. Using any of these methods on the final POC system (3.6), it can be rewritten as

ˆ

x+rcl = Arclˆxclr + Brrˆr + Kr(u− ˆur) ˆ

ur = Crclxˆrcl+ Drcl1ˆr

where xrcl is the state vector with a reduced number of states. It is good to keep in mind that any physical interpretation of the system states is lost after doing the reduction even if the input/output relation remains similar.

3.3.2 Zero Compensator

A zero compensator is perhaps the most simple form of compensator. Im-plemented in the actuator a zero compensator would estimate the control signal according to ˆ u = ( u If no outage 0 During outage

It could be argued that setting the control signal to zero when all feed-back is lost is a safe option. This is especially true if applied to a process that require zero control signal to maintain stationarity i.e. a process that has a pure integration as a part of its model. An example of such a process is a robot arm that moves when voltage is applied to a motor and sits still when no voltage is applied. In this thesis the zero compensator will be used as a benchmark for the stochastically synthesized POC from Section 3.3.1.

3.3.3 Hold Compensator

The hold compensator is arguably the most commonly used form of outage compensator. It follows a do nothing approach where the actuator simply does not update the control signal if no new data is received.

ˆ u = ( u If no outage ˆ u− During outage

(26)

Compensating for Lost Packets

(27)

CHAPTER

4

IMPLEMENTATION

This Chapter describes the implementation of the CTP and the POC in a small networked control system running the double tank process. The reader is first given necessary information about the hardware used in the network and about the double tank process itself, including how its mathematical model can be derived. Using the knowledge about the system the TinyOS implementation of CTP is adapted and the POC parameters are calculated. The implementation of the POC into TinyOS is also described.

4.1

The Tmote Sky

In every network node there is a need for both communication abilities and processing power to transfer the data and run tasks like the CTP or control algorithms. The hardware chosen to be used in all nodes is the Moteiv Tmote Sky as can be seen in Figure 4.1.

USB Connector USB TX Led USB Flash User button Reset button 32kHz Oscillator 6-pin exp. connector Internal Antenna 10-pin exp. connector Texas Instruments MSP430 F1611 Microcontroller ST Code Flash (1MB) USB RX Led Leds USB Micro-controller CC2420 Radio

(28)

Implementation

The Tmote Sky has all the equipment needed to work in a wireless control network application. Its key features include[9]:

• A 250kbps, 2.4GHz, IEEE 802.15.4 Chipcon Wireless Transceiver to communicate with other 802.15.4 compliant devises.

• 8MHz Texas Instruments MSP430 micro controller for performing cal-culations.

• Integrated ADC and DAC for easy connection to any analogue sensors and actuators.

• Integrated on-board antenna with 50m/125m range (indoors/outdoors). • Ultra low current consumption that enables the device to run on

bat-teries for extended periods of time.

• Programming and data collection to desktop computers via USB. • 16-pin expansion support for connection to external devices. • TinyOS support.

• User programmable button and three leds.

For more information on the Tmote Sky, please refer to the data sheet[9].

4.2

The Double Tank Process

The CTP and POC algorithms presented in previous Chapters can be im-plemented on any process that can be modelled reasonably well by a linear and time-invariant (LTI) system. In this thesis the Quanser double-tank process will be used to evaluate the performance of the implementation.

The Quanser double tank process in Figure 4.2 has four major compo-nents. Two tanks, one upper and one lower, a basin and a pump powered by an electric motor. Furthermore there are two pressure sensors measuring the water level in both the upper and the lover tank and a tap that allows for manual draining of water from the upper tank.

During operation the pump draws water from the basin and dumps it in the upper tank. Water then flows from the upper tank through a nozzle into the lover tank and then back to the basin through another nozzle.

In Figure 4.2b A indicates the cross sectional area of both tanks while a1 and a2 are outlet hole areas for the upper and lover tanks respectively.

The tank levels are x1 and x2 and they are also the system’s states as will

be demonstrated in Section 4.2.1. The pump voltage u is the input to the system.

(29)

4.2. The Double Tank Process

(a)The double tank process to-gether with the universal power module. x1 x2 A A a1 a2 Up p er T an k L ow er T an k + u Tap

(b) Diagram of the double tank process.

Figure 4.2: The double-tank process

4.2.1 Modelling

To have a good mathematical model of the process is important when doing any kind of model based control. For this implementation a good model will help create an estimator that accurately estimates the control signal in case of communication failure. The model will also enable quick and easy PID-regulator design possibilities in Matlab.

For deriving the model a gray box approach is used where knowledge of the system is combined with data from experiments to form a model. It is suggested that the upper tank can be modelled as a first order system with the control signal u as input according to

X1(s) =

k

1 + τ sU (s) (4.1)

where k is the gain of the process and τ is the time constant. Furthermore that the lower tank can be modelled as

X2(s) = γ

1 + γτ sX1(s) (4.2)

where the input is the water level in the upper tank and γ is a constant relating the level in the upper tank to the level in the lower tank at steady state.

(30)

Implementation

time to stabilize. At time ts = 50 s a step was made in the voltage to

us= 7.3 V. The recorded data is shown in Figure 4.3a.

0 50 100 150 200 10 12 14 16 Time [s] W at er lev el [cm ] x1 x2

(a)Real process.

0 50 100 150 200 26 28 30 32 Time [s] W at er lev el [cm ] x1 x2 (b) Derived model.

Figure 4.3: Step responses of the double tank system and its model.

The gain k of sub system (4.1) is found as the ratio between the change in water level for the upper tank and the change in voltage.

k = x1s− x10

us− u0

= 0.169− 0.107

7.3− 5.9 = 0.0443 m/V

The time constant τ is defined as the time it takes for the water level in the upper tank to reach 1− e−1 of the total step size. From the plot in Matlab

it can be read that

τ = 18.1444 s

Finally γ can be calculated from the water levels at t = 0 s as previously described.

γ = x20

x10

= 0.103

0.107 = 0.9626 The two systems (4.1) and (4.2) evolve as

X1(s) = 0.0443 1 + 18.1444sU (s) X2(s) = 0.9626 1 + 17.4661sX1(s)

The last step is to rewrite the transfer functions into a state space repre-sentation of the double tank process. This is done by converting each of the sub systems into observable canonical form as in[10, p. 159]. The advantage of this method is that the states in the state space representation will corre-spond to the two tank levels which makes the notation more understandable. The complete process model on state space form with the lower tank water level as output is ˙x =−0.05511 0 0.05511 −0.05725  x +0.002441 0  u y = 0 1 x (4.3)

(31)

4.3. Implementation of a Small CTP Network

the upper and lower tanks are shown in Figure 4.3b. The water levels are much higher in the simulation compared to the experimental data. This is due to the fact that the tank system is not linear and thus that the model will only be valid for water levels close to x0and xs. The time characteristics and

step size of the simulation is almost exactly the same as in the real system and ratio between lower and upper tank is equal to γ. The conclusion is that (4.3) is a good enough model to use when implementing the POC.

To create a more realistic simulation environment a set of non-linear equations for the double tank process was derived from Newtonian relations and Bernoulli’s law.

˙x1=−α1p2gx1+ βu

˙x2= α1p2gx1− α2p2gx2

The constants α1, α2 and β can be estimated using the constants derived in

the experiment above.

τ = 1 α1 r 2x10 g , γ = α21 α22, k = βτ

4.3

Implementation of a Small CTP Network

In TinyOS 2.0 an implementation of CTP is available in the tos/lib/net directory. It implements the CTP algorithm using a link estimator, a routing engine and a forwarding engine as described in Sections 2.2.1-2.2.3. There are many parameters in the implementation that can be varied to manipulate the performance of the network. The choice of ideal parameters depends on many different things, for example the size of the network, network load, delay tolerances and what types of network disturbances are common.

For the implementation of a small CTP network between the controller and the actuator in the double tank control system the parameters seen in Table 4.1 were used. Experiments will show that these parameters work well for the double tank process with 1 s sampling time in a laboratory environment. Also from this point on a network will be considered to have a singular source (a sensor node) rather then multiple where other nodes in the network simply pass information towards the root (the controller).

In a CTP network all nodes are allowed to choose any other node in range as their parent. This creates problems with experimental repeatability since it is extremely hard to foresee all radio conditions that will influence the nodes choice of parent. To minimize this problem the routing engine was modified to only allow a node to chose from a certain set of parents. This made it possible to create the semi static routing tree shown in Figure 4.4.

(32)

Implementation

Parameter Value Unit

Link Estimator:

α 7

-wd 5 packets

wb 3 packets

Routing Engine:

Minimal beacon window length 128 ms

Maximal beacon window length 10 s

Parent switch threshold 5

-Parent refresh period 8192 ms

Forwarding Engine:

Maximum retransmissions 6

-Time to hold before retransmission 15-30 ms Table 4.1: Table of tunable constants for a CTP network.

Controller (Source) R3 R2 R1 R4 R5 Actuator (Root) Routing net

Figure 4.4: The semi static route implementation of CTP.

4.4

The Kalman Based POC

This Section describes the synthesis of the Predictive Outage Compensator theory from Section 3.3.1 with the double tank process model derived ear-lier in this Chapter. The goal is a POC on state space form as in (3.6) implemented in TinyOS.

To achieve this goal all the discrete state space functions described in Section 3.1 needs to be calculated. A first step is to chose a sampling fre-quency for the system. As a rule of thumb it is good to sample 20 times faster then the open loop systems crossover frequency. However the sam-pling frequency can be somewhat reduced if the control design is, as in this case, done with a method that takes the sampling frequency into account. A choice of sampling frequency Ts= 1 s is therefore motivated by the crossover

frequencies presented later in this Section.

(33)

4.4. The Kalman Based POC P                  x+1 x+2  =0.9464 0 0.0521 0.9444  | {z } Ap x1 x2  | {z } xp +  0.002375 6.479· 10−5  | {z } Bu u + 0.9729 0.02655  | {z } Bd d y = 0 1 | {z } Cp x1 x2  + n

The noise n is white Gaussian measurement noise.

Two different controllers, a slow PI- (C1) and a more aggressive

PID-controller (C2), are designed using Matlab’s pidtune.

C1          x+c1 = 1 |{z} Ac1 ·xc1 + 1 |{z} Bc1 ·(r − y) u = 0.521 | {z } Cc1 ·xc1 + 4.748 | {z } Dc1 ·(r − y) C2                x+c2 =1 0 0 0.7453  | {z } Ac2 xc2 +  1 −0.2547  | {z } Bc2 (r− y) u = 1.477 13.13 | {z } Cc2 xc2 + 82.37 | {z } Dc2 ·(r − y)

The controllers give the open loop system the following phase margins and crossover frequencies. ϕm1 = 60 ◦ , ωc1 = 0.02 rad/s ϕm2 = 56 ◦ , ωc2 = 0.08 rad/s

The disturbance model D is chosen as a pure integration of the single white Gaussian noise w.

D        x+d = 1 |{z} Ad ·xd+ 1 |{z} Dw ·w d = 1 |{z} Cd ·xd+ 0 |{z} Dw ·w

This model is a close enough representation of irregularly opening and closing the tap.

The final piece of the puzzle is choosing the variances of the two un-correlated white Gaussian noises w and n. The values were first estimated through measurements on the real process and then put through extensive simulations to find the variances below that gave the best POC performance.

V ar(w) = 2· 10−6, V ar(n) = 4· 10−5

(34)

Implementation

calculated through solving the Riccati equation in (3.7). This was done numerically using Matlab’s dare function.

K1 =     −0.2932 −0.0751 0.2106 −0.0394     , K2 =       −0.0147 −0.0043 0.0121 −0.0031 −0.0023       4.4.1 Implementation in TinyOS

The program running in the actuator was designed to follow the structure in Figure 4.5. An important problem to solve when implementing the POC is how to decide when to use the estimate and when to wait for a packet with the real control signal. The approach used in this thesis is an intuitive solution based on the fact that the actuator knows approximately when to expect a packet since the sampling time is well established.

Whenever a packet containing the control signal is received from the controller the actuator starts a countdown timer. The time to count down is set to the sampling time plus an extra delay. The extra delay is estab-lished based on the number of retransmissions and the time between each retransmission. After this time the controller have surely dropped the packet and thus the POC should step in and estimate the control signal. For this specific application the delay time is set to 0.2Ts= 0.2 s and thus the timer

counts down from 1.2 s. Before the program starts the estimation calcula-tions it resets the countdown timer but this time without the delay. This is necessary to maintain the sampling frequency during long outages.

Start

Initialize

New data?

Start POC timer 1.2 s Update POC state

Output u

POC timer?

Start POC timer 1 s Update POC state

Output u yes

no

yes no

(35)

CHAPTER

5

RESULTS

So far this thesis has described the theory behind the CTP algorithm and its implementation as a small network with routing restrictions. The idea of outage compensation has also been explained in theory and a stochastically synthesized POC for the double tank system has been designed. In this step the results of the above is presented both as simulation results and data from real experiments.

The first Section in this Chapter presents results from real experiments performed on the small CTP network described in Section 4.3. It continues with a simulation study of the three different outage compensation methods presented in Section 3.3 and ends with results from real experiments per-formed on the complete system with the CTP network active between the controller and actuator and a POC implemented in the actuator.

5.1

Evaluation of CTP Routing Performance

This Section aims to evaluate how the CTP network performs and identify any weak spots that inevitably will have to be handled by the POC. All experiments were performed on the small CTP network illustrated in Fig-ure 4.4 with the nodes placed about 1 m apart in a laboratory environment. This means that the results presented here might not be representative of how the network would perform implemented in a real industry. To answer this question the nodes would have to be placed further apart in the actual environment while handling more network traffic. Two types of experiments were conducted each to answer the following:

• How will the multi-hop network between the controller and actuator affect the end-to-end delay between these nodes? What kind of packet loss is expected under close to ideal conditions in a laboratory. • How does re-routing in the network affect the delay and number of

(36)

Results

In the first experiment, dummy data was sent from the controller node to the actuator node through the network while transmission times and num-ber of lost packets were monitored. The experiment ran for approximately 40 min. Figure 5.1 shows the histogram of the end-to-end delays.

0 20 40 60 80 100 120 140 160 180 200 220 240 260 0 200 400 600 Time [ms] P a ck ets

Figure 5.1: Histogram of end to end delay between controller and actuator in the CTP network.

The diagram shows a clear normal distribution of the delays around the average delay time 65.1 ms with very few stray packets. During this test not a single lost packet was recorded. The minimum delay time was recorded to 46.8 ms and the maximum to 251.9 ms (a single stray packet).

Figure 5.2 shows the transportation of a single packet to help visualize what is going on in each node during the routing process. In this Figure the y-axis represents the individual nodes and the x-axis represents the time. Different colors are used depending on in what node an event takes place. Black is for the controller, blue is for the actuator and red is for node R3.

The lower path through R2 and R1 is represented by dark greed color and

the upper path through R4 and R5 by light green.

41.00 41.05 41.10 41.15 41.20 Cont. R3 R2 R1 R4 R5 Actuator Action Time [s] N o d e

Figure 5.2: A single data packets route through the network.

The Figure illustrates the following. The controller starts by sending a packet indicated by a dot on the controller line in the controller color (black). The packet is received by R3, indicated by a red cross, and R3 acknowledges

the packet. The acknowledgement is received at the controller and indicated by an asterisk. R3 then tries to send the packet to R2 (the first red dot)

but the transmission fails leading to retransmissions (the subsequent dots). A square (not present in Figure 5.2) would indicate that a packet has been retransmitted the maximum number of times and therefore dropped. The red triangle on the action line indicates a decision made by R3 to change its

(37)

5.1. Evaluation of CTP Routing Performance

the same structure. Note that the times on the x-axis is not 100 % accurate due to delays and collisions in the serial communication between the motes and the computer recording the data. These Figures should therefore only be used to analyse what is happening in the network and not to measure time intervals and such.

The next trial was designed to test the effects of re-routing. Just as before the nodes were set up according to Figure 4.4 sending dummy data from the controller to the actuator. For the experiment the following steps were then taken.

1. Block connection between node R3 and its parent (R2 or R4) at time

t = 40 s.

2. Re-open the connection at time t = 80 s.

3. Block connection one step further down the data path (between R2

and R1 or R4 and R5) at time t = 140 s.

4. Re-open the connection at time t = 180 s. 5. End experiment at time t = 220 s.

The connection was blocked by turning off the radio of the receiving node in software. The test was repeated several times, half of the times according to the list above and half with step 1 and 3 in the opposite order. It was done this way to reduce the impact of ETX build-up.

Whenever the route has to change due to a complete communication breakdown as in this case (turning of the radio of the receiving node) the network always drops one or more packets. Figure 5.3 shows the rerouting for the two cases, blocking a node close to R3 and blocking a node far from

R3.

This Figure illustrates the typical difference between blocking a node close to, and far from the node that has to make the switch. Far fewer packets are lost if the node blocked is close the the node switching parent. This observation is supported by theory. When node R5in Figure 5.3b is blocked

R4 can no longer deliver its packets and thus increases its ETX. This ETX

is then broadcasted with every beacon sent by R4 and sooner or later R3

will hear the beacon, discover that R2 is now a better parent and make the

switch. In the case as in Figure 5.3a when R2 is blocked, R3 discovers this

directly since none of its packets gets acknowledged. The information does not need to propagate through the network and the switch happens faster.

On average the network drops 1.75 packets when R2 or R4 is blocked

and 4.25 packets when R1 or R5 goes down, but up to 8 dropped packets in

(38)

Results 39 39.5 40 40.5 41 Cont. R3 R2 R1 R4 R5 Actuator Action Time [s] N o d e (a) R2 blocked. 139.5 140 140.5 141 141.5 142 142.5 143 143.5 Cont. R3 R2 R1 R4 R5 Actuator Action Time [s] N o d e (b)R5 blocked.

(39)

5.2. Simulation of POC Performance

5.2

Simulation of POC Performance

Extensive simulation work has been done on the stochastically synthesized POC as well as on the hold and zero compensators. The goal has been to find the best performing Kalman based POC and to compare that POC to the less complicated compensation strategies.

To reduce the number of varying parameters in the simulations the fol-lowing static operating scenario was chosen:

• At all times. Measurement noise n with variance V ar(n) = 4 · 10−7m is added to the process output. In the Figures below the noise is not shown however it is a part of the feedback to the controller and compensator.

• At t = 0 s. Water levels stable, r = x2 = 0.1 m. Simulation starts.

• At t = 100 s. Step in reference, r = 0.16 m.

• At t = ds = 230 s. A disturbance simulated as a constant drain of

0.003 m/s from the upper tank starts. Note that this disturbance is not the integrated white noise used for the design of the POC but a more realistic disturbance emulating opening of the tap.

• At t = de= 280 s. Constant drain from upper tank stops.

• At t = 500 s. Simulation ends.

This left the following parameters to be varied:

• Type of controller. One slow (C1) and one fast (C2) controller as

de-scribed in Section 4.4.

• Outage start time. Varied between 0 s and 400 s in steps of 5 s. • Outage duration. Varied between 0 s and 100 s in steps of 5 s.

• Type of outage compensation. Kalman based POC, hold compensator and zero compensator.

To quantitatively evaluate the performance of the regulator and com-pensator together the integrated absolute error (IAE) was used.

IAE = Z ξ

0 |e(t)| dt

With ξ = 500 s, the end time, the simulation was first run without outages to get a baseline for the IAE for each controller.

C1 → IAE0 = 6.3080 m s C2 → IAE0= 2.0068 m s

This baseline is in a way a measure of the pure control performance but it does not consider requirements on for example overshoot. Figure 5.4 shows the simulated performance of both controllers. The Figure shows thatC2 is

(40)

Results 0 100 200 300 400 500 12 14 16 18 20 Time [s] W at er lev el [cm ] x1 x2 r ds de 0 100 200 300 400 500 5 6 7 8 9 Time [s] P um p vol tage [V] u ˆ u ds de

(a)Slow controllerC1.

0 100 200 300 400 500 12 14 16 18 20 Time [s] W at er lev el [cm ] x1 x2 r ds de 0 100 200 300 400 500 5 6 7 8 9 Time [s] P um p vol tage [V] u ˆ u ds de (b) Aggressive controllerC2.

(41)

5.2. Simulation of POC Performance 0 100 200 300 400 0 50 100 0 1 2 Start time Du ra tio n IA En

(a)C1, Kalman POC.

0 100 200 300 400 0 50 100 0 2 4 Start time Du ra tio n IA En (b) C2, Kalman POC. 0 100 200 300 400 0 50 100 0 1 2 Start time Du ra tio n IA En (c) C1, hold compensator. 0 100 200 300 400 0 50 100 0 5 Start time Du ra tio n IA En (d)C2, hold compensator. 0 100 200 300 400 0 50 100 0 5 Start time Du ra tio n IA En

(e)C1, zero compensator.

0 100 200 300 400 0 50 100 0 10 20 Start time Du ra tio n IA En (f )C2, zero compensator. 0 100 200 300 400 0 50 100 −1 0 1 Start time Du ra tio n IA En (g) C1, Kalman-hold comparison 0 100 200 300 400 0 50 100 0 5 Start time Du ra tio n IA En (h) C2, Kalman-hold comparison

(42)

Results

The real multi case simulation was then started, varying all the parame-ters listed above and returning data from 10126 unique cases. The 3D-plots in Figure 5.5 visualize all that data. On the z-axis is the normalized IAE.

IAEn=

IAE IAE0

This normalized value can be interpreted as how much worse the control performance becomes due to the various outages. The x-axis shows the start time of the outage and the y-axis its duration. Plots on the left hand side of Figure 5.5 represent simulations done with the slow controller and those on the right with the more aggressive one.

The first thing noticeable when studying the plots is that the zero com-pensator performs worse than both the hold and Kalman based compen-sators under every possible outage scenario. This result was expected know-ing that the double tank process is a system that requires a non zero input to maintain a non zero water level. For this reason the zero compensator will not be considered further in this thesis.

The second observation is the three major peaks presented in Figures 5.5a-5.5d. These peaks correspond to large the changes in the system such as making a step in the reference, opening the tap and closing the tap. Finally it is noted that there is an almost linear relation between outage duration and deterioration of control performance for a given outage start time.

By comparing the peaks of the plots corresponding toC1 to those

cor-responding to C2 it is possible to draw the conclusion that outages cause

more harm in a system with a fast controller. This conclusion can be refined a bit by comparing Figure 5.5c to Figure 5.5d. Given a static operation scenario as in this case, the system with the slow controller is more likely to be in a transient when the outage occurs. This is bad, especially for the hold compensator, and results in the wider peaks seen in Figure 5.5c. With an aggressive controller the system is more likely to be stationary, but if the outage occurs when it is not, the results become more severe, leading to higher and thinner peaks.

One way to compare the two compensation methods, Kalman based POC and hold compensation, is to calculate the ratio between the sums of all outages for the hold compensator and the Kalman based POC.

X all outages IAEholdn X all outages IAEkaln = ( 1.0118 forC1 1.0861 forC2

Using IAE as a measurement of control performance this indicates that the hold compensator performs 1.2 % worse with the slow controller and 8.6 % worse with the fast one. Another way to compare them is to study the Figures 5.5g and 5.5h which shows the differences in IAEnbetween the two.

(43)

5.2. Simulation of POC Performance

Two outage cases for each controller were chosen to be studied further, one that gave the Kalman based POC the best performance compared to the hold compensator (designated best case) and one that gave it the worst (designated worst case).

Best case Worst case

Start Duration Start Duration

C1 320 100 270 100

C2 105 100 250 100

Figure 5.6 shows the best possible outage case for the Kalman based POC using the slow controller. The outage occurs just as the control signal is starting to decrease to compensate for the tap just closing. The hold compensator holds the control signal to a much to high value throughout the 100 s outage. The Kalman based POC is capable of spotting the transient and reduces the output to the water pump during the outage. By doing so the control error is minimized.

0 100 200 300 400 500 12 14 16 18 20 22 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 5 6 7 Time [s] Pu m p v o lta g e [V ] u ˆ u ds de

(a)Kalman based POC.

0 100 200 300 400 500 12 14 16 18 20 22 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 5 6 7 Time [s] Pu m p v o lta g e [V ] u ˆ u ds de (b)Hold compensator.

Figure 5.6: Best possible outage case for the Kalman based POC using controller C1. Shaded area indicates outage.

(44)

Results 0 100 200 300 400 500 10 15 20 25 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 4 5 6 7 8 Time [s] Pu m p v o lta g e [V ] u ˆ u ds de

(a)Kalman based POC.

0 100 200 300 400 500 10 15 20 25 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 4 5 6 7 8 Time [s] Pu m p v o lta g e [V ] u ˆ u ds de (b)Hold compensator.

Figure 5.7: Worst possible outage case for the Kalman based POC using controller C1. Shaded area indicates outage.

0 100 200 300 400 500 12 14 16 18 20 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 4 6 8 Time [s] Pu m p v o lta g e [V ] u ˆ u ds de

(a)Kalman based POC.

0 100 200 300 400 500 0 5 10 15 20 25 30 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 0 2 4 6 8 Time [s] Pu m p v o lta g e [V ] u ˆ u ds de (b)Hold compensator.

(45)

5.2. Simulation of POC Performance

With the faster controller things become a bit more sensitive. Figure 5.8 shows the best case for the Kalman based POC where the outage occurs just after the step. This means that the estimator can continue the transient and reduce the control signal, finally stabilizing at the level it believes is correct. The hold compensator holds the output at the high level present just after the step, causing the tanks to fill up fast. Figure 5.8 also shows one of the biggest problem with actuator based compensation methods, integral wind-up of the controller output. Since the level x2 does not reach r during the

outage, the controller will continuously integrate the resulting error. This means that when the outage finally ends, the real control signal u might be even more wrong then the estimate ˆu leading to big overshoots.

Lastly Figure 5.9 shows the worst case for the Kalman based POC com-pared to the hold compensator. This case is similar the one in Figure 5.7. The outage occurs before the tap is closed. The Kalman based POC has no knowledge of this change in the system and floods the tanks with too much water. The hold compensator gets lucky as the outage happens before the control signal has reached its peak.

0 100 200 300 400 500 7 12 17 22 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 0 2 4 6 8 Time [s] Pu m p v o lta g e [V ] u ˆ u ds de

(a)Kalman based POC.

0 100 200 300 400 500 12 15 18 21 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 2 4 6 8 Time [s] Pu m p v o lta g e [V ] u ˆ u ds de (b)Hold compensator.

(46)

Results

5.3

Implemented POC Experiments

This Section contains results from real experiments on the double tank sys-tem controlled via a wireless CTP network with outage compensation imple-mented as a part of the actuator. The results are from tests similar to those simulated, implementing the best and worst outage cases for the Kalman based POC compared to the hold compensator. To break the connection between the controller and actuator for a duration of 100 s the network node R3 was shut down. For all experiments the more aggressive controller

C2 was used. 0 100 200 300 400 500 12 14 16 18 20 22 Time [s] W at er lev el [cm ] x1 x2 r ds de 0 100 200 300 400 500 6 7 8 9 10 Time [s] P ump vol tage [V] u ˆ u ds de

Figure 5.10: Data from real experiment showing the static operating scenario without outage.

Figure 5.10 shows the water levels, control signal and control signal esti-mate while running the static operating scenario suggested in the previous Chapter. The results are as expected and by comparing them to the sim-ulation in Figure 5.4 it becomes even more clear that the model used for simulation fits well with the actual system.

An experiment with a 100 s outage starting at t = 105 s was then run. Figure 5.11 shows this experiment and the results compare well to previous simulations. If anything it can be said that the Kalman based POC performs even better in this real experiment, stabilizing x2 closer to r before the

outage ends leading to less integral wind-up.

(47)

5.3. Implemented POC Experiments 0 100 200 300 400 500 12 14 16 18 20 22 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 6 7 8 9 10 Time [s] Pu m p v o lt ag e [V ] u ˆ u ds de

(a)Kalman based POC.

0 100 200 300 400 500 0 5 10 15 20 25 30 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 0 2 4 6 8 10 Time [s] Pu m p v o lt ag e [V ] u ˆ u ds de (b)Hold compensator.

Figure 5.11: Data from real experiment with outage best suited for the Kalman POC. Shaded area indicates outage. Note that the y-axes are scaled differently. 0 100 200 300 400 500 5 10 15 20 25 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 -3 0 3 6 9 Time [s] Pu m p v o lt ag e [V ] u ˆ u ds de

(a)Kalman based POC.

0 100 200 300 400 500 10 15 20 25 Time [s] W a ter lev el [c m ] x1 x2 r ds de 0 100 200 300 400 500 2 4 6 8 10 Time [s] Pu m p v o lt ag e [V ] u ˆ u ds de (b)Hold compensator.

(48)
(49)

CHAPTER

6

CONCLUSIONS

The goal of this thesis was to construct a simplified wireless control system and then implement measures to overcome some of the drawbacks of wireless control. We have therefore investigated the Collection Tree Protocol routing algorithm and the concept of outage compensation using a stochastically synthesized Predictive Outage Compensator.

Through the implementation of a CTP network we are able to avoid lengthy outages as long as there is at least one possible route from the controller to the actuator. In theory we have explained how this algorithm works and in the implementation we have adapted it to suit the double tank process in a laboratory environment. Through experiments we have then tried to highlight the strong points of CTP such as its flexibility and consistently low delay, despite using multi-hop. Tests have also illustrated weaknesses such as dropped packets during route changes, especially if the break occurs far from the decision making node.

Because of these network flaws it was necessary to develop a control method that would keep the performance of the control system even if several data packets in a row were lost in the network. The POC suggested in this thesis is based on a Kalman filter and therefore depend highly on a good model of the closed loop system. We have shown through simulations and real life experiments that the double tank system can highly benefit from the addition of a more advanced compensation method implemented in the actuator node. For the comparison we have used the two naive approaches, hold compensation and zero compensation. The Kalman based POC have clearly shown better results.

6.1

Future Work

(50)

Conclusions

• Utilizing the advantages of CTPs mesh type architecture.

The CTP network have, during our experiments, been restricted to a semi-static route where only one node has a choice of parent. It was done this way to enhance the repeatability of the experiments. It is likely that the algorithm will perform better if not restricted and experiments on big multi-hop mesh type CTP networks are therefore of great interest.

• Experiments in a factory environment.

The ultimate goal of this work is to develop a wireless network capable of controlling processes in a factory environment. To achieve this much work still needs to be done in the actual environment. For example running experiments on a network under heavy load and with many radio disturbances.

• Anti wind-up techniques.

The weakest point of these actuator based compensators is their ability to cause the controllers integral term to grow. Standard anti wind-up techniques are hard to implement since the controller is not aware of the outage and thus this needs to be investigated further. Note that a POC placed in the controller will not suffer from these wind-up effects[3].

• Implementation of multiple POCs.

(51)

BIBLIOGRAPHY

[1] Wikipedia article, Wireless.

http://en.wikipedia.org/wiki/Wireless Accessed 7 May 2012

[2] Erik Henriksson, Compensating for Unreliable Communication Links in Networked Control Systems.

Licentiate Thesis, 2009

[3] Ivar Cornell, Implementation of a Collection Tree Routing Protocol and a Predictive Outage Compensator.

Master Thesis, 2012

[4] Wikipedia article, OSI model.

http://en.wikipedia.org/wiki/OSI_model Accessed 12 June 2012

[5] TinyOS TEP 123, The Collection Tree Protocol (CTP) v. 1.8. http://www.tinyos.net/tinyos-2.x/doc/html/tep123.html Accessed 7 May 2012

[6] TinyOS TEP 119, Collection.

http://www.tinyos.net/tinyos-2.x/doc/html/tep119.html Accessed 16 May 2012

[7] Ugo Colesanti et. al, A Performance Evaluation Of The Collection Tree Protocol Based On Its Implementation For The Castalia Wireless Sensor Networks Simulator.

http://e-collection.library.ethz.ch/eserv/eth:5087/ eth-5087-01.pdf

Accessed 16 May 2012

[8] Torkel Glad, Lennart Ljung, Reglerteori. Flervariabla och olinj¨ara metoder.

Edition 2:5, 2009

[9] Moteiv, Tmote Sky Data Sheet.

http://www.eecs.harvard.edu/~konrad/projects/shimmer/ references/tmote-sky-datasheet.pdf

Accessed 20 May 2012

References

Related documents

The collision detect model of a virtual assembly is indirectly generated by facet model, with the help of the graphical system Open GL Performer, the STL model is converted to a

To enable the WSNs to be immortal, we jointly consider providing additional energy source to the sensor nodes based on wireless energy transfer (WET) [3, 4], and also reducing

The Gateway node has the most basic design of all the nodes. This device is only used to facilitate communication from a PC to the rest of the Xbee network. Thus it only needs to

Adding a vapour leakage through the Phase selector that is 40 times smaller than the consumed mass by the engine ˙ m e during the consummation of liquid, shows better

It is in fact amazing how the problem unfolds and reveals its multiple facets as we try to formulate it and solve it.”. – Anthony Ephremides, IEEE

organisationen är många arbetsuppgifter sammansatta och komplexa och därför är det inte möjligt för en medarbetare att vara bra på alla delar i processen, därför finns behovet av

It shows that 80 percent of the population in Kenya would be negatively affected by higher maize prices and that poor households would lose a larger proportion of their welfare

This master’s thesis deals with the control design method called Non-linear Dynamic Inversion (NDI) and how it can be applied to Unmanned Aerial Vehicles (UAVs).. In this