virtual instrumentation: introduction of virtual flow ...23146/fulltext01.pdf · virtual...

100
Institutionen för systemteknik Department of Electrical Engineering Examensarbete Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system Examensarbete utfört i Reglerteknik vid Tekniska högskolan i Linköping av Erika Ödlund LITH-ISY-EX--07/3914--SE Linköping 2007 Department of Electrical Engineering Linköpings tekniska högskola Linköpings universitet Linköpings universitet SE-581 83 Linköping, Sweden 581 83 Linköping

Upload: doanbao

Post on 20-Aug-2019

250 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Institutionen för systemteknikDepartment of Electrical Engineering

Examensarbete

Virtual instrumentation: Introduction of virtualflow meters in the LHC cryogenics control system

Examensarbete utfört i Reglerteknikvid Tekniska högskolan i Linköping

av

Erika Ödlund

LITH-ISY-EX--07/3914--SE

Linköping 2007

Department of Electrical Engineering Linköpings tekniska högskolaLinköpings universitet Linköpings universitetSE-581 83 Linköping, Sweden 581 83 Linköping

Page 2: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 3: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Virtual instrumentation: Introduction of virtualflow meters in the LHC cryogenics control system

Examensarbete utfört i Reglerteknikvid Tekniska högskolan i Linköping

av

Erika Ödlund

LITH-ISY-EX--07/3914--SE

Handledare: Henrik Tidefeltisy, Linköpings universitet

Enrique Blanco VinuelaCERN

Examinator: Svante Gunnarssonisy, Linköpings universitet

Linköping, 29 January, 2007

Page 4: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 5: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Avdelning, InstitutionDivision, Department

Division of Automatic ControlDepartment of Electrical EngineeringLinköpings universitetSE-581 83 Linköping, Sweden

DatumDate

2007-01-29

SpråkLanguage

� Svenska/Swedish� Engelska/English

RapporttypReport category

� Licentiatavhandling� Examensarbete� C-uppsats� D-uppsats� Övrig rapport�

URL för elektronisk versionhttp://www.control.isy.liu.se

http://www.ep.liu.se/2007/3914

ISBN—

ISRNLITH-ISY-EX--07/3914--SE

Serietitel och serienummerTitle of series, numbering

ISSN—

TitelTitle

Svensk titelVirtual instrumentation: Introduction of virtual flow meters in the LHC cryogenicscontrol system

FörfattareAuthor

Erika Ödlund

SammanfattningAbstract

The Large Hadron Collider (LHC) is the next large particle accelerator devel-oped at CERN, constructed to enable studies of particles. The acceleration of theparticles is carried out using magnets operating at about 1.9 K, a temperatureachieved by regulating flow of superfluid helium. For economical reasons, controlof the helium flow is based on feedback of virtual flow meter (VFT) estimatesinstead of real instrumentation.

The main purpose of this work is to develop a virtual flow meter with thepossibility to estimate the flow by means of two different flow estimation methods;the Samson method that has previously been tested for the LHC, and the Sereg-Schlumberger method that has never before been implemented in this environment.

The virtual flow meters are implemented on Programmable Logic Controllers(PLCs) using temperature and pressure measurements as input data, and a tool forgenerating the virtual flow meters and connect them to the appropriate physicalinstrumentation has also been developed.

The flow through a valve depends, among others, on some pressure and temper-ature dependent physical properties that are to be estimated with high accuracy.In this project, this is done by bilinear interpolation in twodimensional tables con-taining physical data, an approach that turned out to be more accurate than thepreviously used method with polynomial interpolation.

The flow measurement methods have been compared. Since they both derivefrom empirical studies rather than physical relations it is quite futile to find theo-retical correspondencies, but the simulations of the mass flows can be compared.For low pressures, the results are fairly equal but they differ more for higher pres-sures. The methods have not been validated against true flow rates since therewere no real measurements available before the end of this project.

NyckelordKeywords Flow meters, LHC, PLC, Superfluid helium, Virtual instrumentation

Page 6: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 7: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

AbstractThe Large Hadron Collider (LHC) is the next large particle accelerator developed

at CERN, constructed to enable studies of particles. The acceleration of theparticles is carried out using magnets operating at about 1.9 K, a temperatureachieved by regulating flow of superfluid helium. For economical reasons, controlof the helium flow is based on feedback of virtual flow meter (VFT) estimatesinstead of real instrumentation.

The main purpose of this work is to develop a virtual flow meter with thepossibility to estimate the flow by means of two different flow estimation methods;the Samson method that has previously been tested for the LHC, and the Sereg-Schlumberger method that has never before been implemented in this environment.

The virtual flow meters are implemented on PLCs using temperature and pres-sure measurements as input data, and a tool for generating the virtual flow metersand connect them to the appropriate physical instrumentation has also been de-veloped.

The flow through a valve depends, among others, on some pressure and temper-ature dependent physical properties that are to be estimated with high accuracy.In this project, this is done by bilinear interpolation in twodimensional tables con-taining physical data, an approach that turned out to be more accurate than thepreviously used method with polynomial interpolation.

The flow measurement methods have been compared. Since they both derivefrom empirical studies rather than physical relations it is quite futile to find theo-retical correspondencies, but the simulations of the mass flows can be compared.For low pressures, the results are fairly equal but they differ more for higher pres-sures. The methods have not been validated against true flow rates since therewere no real measurements available before the end of this project.

v

Page 8: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 9: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

RésuméLe Grand Collisionneur de Hadrons (Large Hadron Collider, LHC) est le pro-

chain grand accélérateur de particules du CERN, construit pour permettre l’étudedes particules. L’accélération des particules sera réalisée en utilisant des aimantssupraconducteurs qui fonctionneront à 1.9 K et la température sera régulée encontrôlant le débit d’hélium superfluide. Pour des raisons économiques, la régula-tion du débit d’hélium sera basée sur les réponses des estimations des débitmètresvirtuels (Virtual flow meters, VFT) au lieu d’instrumentation réelle.

Le but principal de ce projet est de développer un débitmètre virtuel qui esti-mera le débit avec deux méthodes différentes ; la méthode Samson qui a déjà étémise en œuvre pour le LHC, et la méthode Sereg-Schlumberger qui n’a pas encoreété implémentée dans cet environnement.

Les débitmètres virtuels seront implémentés sur des PLCs avec des mesuresde température et de pression comme données d’entrée. De plus, un outil pourgénérer les débitmètres et les relier avec l’instrumentation physique adéquat a étédéveloppé.

Le débit à travers d’une vanne dépend entre autres des propriétés physiques quidépendent à leur tour de la température et de la pression. Ces propriétés devrontêtre estimées avec une grande précision. Dans ce projet, cela est fait en appliquantune interpolation bilinéaire dans des tableaux de deux dimensions. Cette méthodes’est montrée plus précise qu’avec une méthode d’interpolation polynomiale.

Les deux méthodes de mesures de débit ont été comparées. Elles dérivent toutesles deux des études empiriques et non physiques, alors les similarités théoriquessont donc peu pertinentes, mais les résultats des simulations des débits peuvent êtrecomparés. Pour des pressions basses, les méthodes sont quasiment équivalentes,mais les différences sont plus importantes pour les pressions plus hautes. Étantdonné qu’il n’y avait pas de mesures disponibles avant la fin de ce projet, lesméthodes n’ont pas été validées avec des débits réels.

vii

Page 10: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 11: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Acknowledgments

The words in this report are finally written by me, but most of them would neverhave been there without the help of many others.

The project has been conducted at the AB-CO-IS section at CERN whereI have been warmly welcomed since the beginning. I would like to thank mysupervisor Enrique Blanco Vinuela for his guidance throughout the work, andpatience while answering all my questions. Moreover, I will seize the opportunityto finally thank my hypervisor (a.k.a. section leader), Philippe Gayet, for all theopened doors.

During the entire work, I have gained invaluable support from my examinerSvante Gunnarsson, and supervisor Henrik Tidefelt at the Department of ElectricalEngineering, Division of Automatic Control at Linköping University. They havebeen assisting me all the way by helping to structure the project, keeping meon the right track during the work, and thoroughly reading the report to giveconstructive feedback. A special thanks to Henrik for his much appreciated helpwith LaTeX.

My ’opponent’ (student reviewer) Ida Johnsson has been a source of inspi-ration and, especially towards the end of project, an inestimable help with herencouragement and comments on the report.

There are many more people who well deserve being mentioned here; for ex-ample my colleagues at the AB-CO-IS and AB-CO-MA sections at CERN (inparticular my office mates for lightening up the daily round) and also the peo-ple at Linköping University. I can not mention you all and to avoid the risk offorgetting someone I do not even intend to try.

Finally - but also above all - I would never have finished this project withoutmy family and friends, both in Sweden and at CERN. I will not state your nameshere, but you know who you are and I can only hope that we remain what we are.Thank you for sharing this time with me, let there be many more moments to come.

Erika Ödlund

Geneva, January 2007

ix

Page 12: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 13: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Contents

1 Introduction 11.1 CERN - European Organization for Nuclear Research . . . . . . . 1

1.1.1 AB-CO-IS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1.2 Cryogenics . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2 Problem definition . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.1 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2.2 Outline of the report . . . . . . . . . . . . . . . . . . . . . . 3

2 Background 52.1 The LHC project . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Overview of the cryogenics system . . . . . . . . . . . . . . . . . . 6

2.2.1 Cooling down of a sector . . . . . . . . . . . . . . . . . . . . 82.2.2 Final cooling down of a cell . . . . . . . . . . . . . . . . . . 9

2.3 Virtual flow meters . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.4 Test String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 Theory 133.1 Helium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.1.1 He II state properties . . . . . . . . . . . . . . . . . . . . . 143.1.2 HEPAK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.2 Valves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.3 Joule-Thomson effect . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.3.1 Joule-Thomson valves . . . . . . . . . . . . . . . . . . . . . 183.4 Mass flow measurement . . . . . . . . . . . . . . . . . . . . . . . . 19

3.4.1 Describing reality with a model . . . . . . . . . . . . . . . . 193.4.2 Real and ideal gases . . . . . . . . . . . . . . . . . . . . . . 213.4.3 Density, heat capacity, and heat capacity ratio . . . . . . . 213.4.4 Samson method . . . . . . . . . . . . . . . . . . . . . . . . . 223.4.5 Sereg-Schlumberger method . . . . . . . . . . . . . . . . . . 233.4.6 Comparison between the Samson and the Sereg- Schlum-

berger algorithms . . . . . . . . . . . . . . . . . . . . . . . . 23

xi

Page 14: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

xii Contents

4 Implementation 294.1 Development environment . . . . . . . . . . . . . . . . . . . . . . . 294.2 Generation of virtual flow meters . . . . . . . . . . . . . . . . . . . 304.3 Supervision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.4 Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.4.1 Interpolation in two dimensions . . . . . . . . . . . . . . . . 344.4.2 Bilinear interpolation . . . . . . . . . . . . . . . . . . . . . 374.4.3 Data tables . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

4.5 Error estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.6 Testing of the code . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

4.6.1 Problems arisen during the testing . . . . . . . . . . . . . . 55

5 Results 575.1 Comparison between the Samson and the Sereg-Schlumberger meth-

ods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575.1.1 Effects of the γ calculation on the output flow rate . . . . . 58

5.2 Linear versus polynomial interpolation . . . . . . . . . . . . . . . . 62

6 Summary and conclusions 656.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

6.1.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . 656.2 Suggestions for future work . . . . . . . . . . . . . . . . . . . . . . 66

6.2.1 Conceivable improvements of the current application . . . . 67

A Error estimation 73

B Help file, Virtual Flow meter (VFT) generator 76

Page 15: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

List of Figures2.1 Overview of the LHC . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2 Schematic overview of the accelerators. . . . . . . . . . . . . . . . . 72.3 General layout of the cryogenics system . . . . . . . . . . . . . . . 82.4 Cross section of an LHC dipole . . . . . . . . . . . . . . . . . . . . 92.5 Cryogenics scheme of a standard cell . . . . . . . . . . . . . . . . . 10

3.1 Typical phase (p-T ) diagram for fluids. . . . . . . . . . . . . . . . . 133.2 Phase (p-T ) diagram of helium. . . . . . . . . . . . . . . . . . . . . 143.3 Valve trim shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.4 Valve characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . 173.5 Cond. statements for Samson and Sereg-Schlumberger . . . . . . . 253.6 Cond. statements for Samson and Sereg-Schlumberger, ideal gas . 263.7 Cond. statements for Samson and S-Schlumb., pin = 0.2183 bar . . 273.8 Samson method, A(pin, pout) with respect to γ . . . . . . . . . . . 28

4.1 Scheme over the S7 blocks and block calls. . . . . . . . . . . . . . . 304.2 Scheme over the VFT generation. . . . . . . . . . . . . . . . . . . . 304.3 Screen shot of Excel configuration file . . . . . . . . . . . . . . . . 314.4 Example of a VFT generation log . . . . . . . . . . . . . . . . . . . 324.5 Screen shot of flow meter generator . . . . . . . . . . . . . . . . . . 334.6 Runges phenomenon . . . . . . . . . . . . . . . . . . . . . . . . . . 354.7 Equation of a straight line . . . . . . . . . . . . . . . . . . . . . . . 374.8 Interpolation in ρ, Cp , and Cv tables . . . . . . . . . . . . . . . . . 384.9 Extrapolation in ρ and Cp tables . . . . . . . . . . . . . . . . . . . 404.10 Density for liquid helium . . . . . . . . . . . . . . . . . . . . . . . . 434.11 Density for helium . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.12 Cp for helium when T ≤ 5.0 K . . . . . . . . . . . . . . . . . . . . 444.13 Cp for helium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.14 Cv for helium when T ≤ 5.0 K . . . . . . . . . . . . . . . . . . . . 454.15 Cv for helium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.16 γ for helium when T ≤ 5.0 K . . . . . . . . . . . . . . . . . . . . . 464.17 γ for helium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.18 Interpolation error for ρ . . . . . . . . . . . . . . . . . . . . . . . . 514.19 Maximum interpolation error for ρ relative to p and T . . . . . . . 514.20 Interpolation error for Cp . . . . . . . . . . . . . . . . . . . . . . . 524.21 Maximum interpolation error for Cp relative to p and T . . . . . . 524.22 Interpolation error for Cv . . . . . . . . . . . . . . . . . . . . . . . 534.23 Maximum interpolation error for Cv relative to p and T . . . . . . 53

5.1 Output mass flow using erroneous gamma . . . . . . . . . . . . . . 595.2 Output mass flow using correct gamma . . . . . . . . . . . . . . . 61

xiii

Page 16: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

List of Tables4.1 Data ranges in the interpolation tables . . . . . . . . . . . . . . . . 424.2 Pressure, temperature, and gauge meter precision . . . . . . . . . . 484.3 HEPAK accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484.4 Summary of the different error sources . . . . . . . . . . . . . . . . 54

5.1 Flow rates difference, Samson vs Sereg-Schlumberger . . . . . . . . 585.2 Flow rates calculated with different γ values . . . . . . . . . . . . . 605.3 Flow rates diff., Samson vs Sereg-Schlumberger, with diff. γ:s . . . 605.4 Linear interpolation versus second order polynomial . . . . . . . . 63

xiv

Page 17: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

List of Acronyms

AB-CO Accelerator Beam department - Controls groupAB-CO-IS AB-CO - Industrial Systems sectionAB-CO-MA AB-CO - Measurement and Analysis sectionCERN Conseil Européen pour la Recherche NucléaireCV Control ValveDB Data BlockDFB Distribution Feed BoxFB Function BlockFC FunctionFT Flow meterGT Gauge meterHX Heat exchangerJT Joule-ThomsonLEP Large Electron-Positron colliderLHC Large Hadron ColliderLSSL Long Straight Sector LeftLSSR Long Straight Sector RightOB Organization BlockPLC Programmable Logic ControllerPS Proton SynchrotronPSB Proton Synchrotron BoosterPT Pressure meterPVSS Prozessvisualisierungs- und Steuerungs-SystemQRL Cryogenics distribution lineSCADA Supervisory Control And Data AcquisitionSPS Super Proton SynchrotronTT Temperature meterUNICOS Unified Industrial Control SystemVFT Virtual Flow meter

xv

Page 18: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 19: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Chapter 1

Introduction

1.1 CERN - European Organization for NuclearResearch

This diploma project has been conducted from July to December 2006 at CERN,the European Organization for Nuclear Research, which is the world’s biggestparticle physics center. CERN is situated on the Swiss-Franco border close toGeneva. The laboratory was founded in 1954 by twelve original member states,among others Sweden, a number that has now grown to twenty. Scientists fromall over the world come to CERN to study particles, their structure, and theforces that bind them together. The main mission of CERN is to provide facilitiesnecessary to carry on this research. With the objective to recreate the conditionsimmediately after the Big Bang, particles are accelerated at the energy of 7 TeV(7 · 1012 electron volts) and the speed of 99.999% of the speed of light. If the workproceeds as planned, the new particle accelerator Large Hadron Collider (LHC)will be started during 2007 to enable these studies. The LHC is built in a circulartunnel with a circumference of 27 km, in the same tunnel that has previously beenused for the Large Electron-Positron collider (LEP).

In total, CERN employs almost 3000 persons and hosts about 6500 visitingscientists every year.

1.1.1 AB-CO-ISThe project has been carried out at the AB-CO-IS section within the Controlsgroup at the Accelerator Beam department. Some of the main tasks for this sec-tion are to provide consultancy and support for industrial control systems (PLCand SCADA) to other groups within the AB department and other CERN depart-ments, and to develop and maintain industrial solutions applications. Whereas itis possible, the Unified Industrial Control System (UNICOS) framework is used.UNICOS is a project that aims to “provide components, methodology, and toolsto design, build, and program industrial based control systems for the LHC” [6].Initially, UNICOS was designed for the LHC cryogenics applications but the scope

1

Page 20: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

2 Introduction

has since then been enlarged to likewise cover other control system applications forthe LHC. An industrial based control system is normally constructed in three lay-ers with intermediate communication layers. The three layers are the applicationlayer with the actual application, the process control layer normally using Pro-grammable Logic Controllers (PLCs) but sometimes enlarged to the use of othercomponents such as industrial PCs running Unix or Linux, and the supervisionlayer based on a SCADA (PVSS) system. These layers are allowed to communicateby the means of ethernet protocols.

In the AB-CO-IS section work is conducted in smaller subgroups with differentfields of competence, roughly corresponding to the three UNICOS layers. Thisdiploma project starts from the PLC layer, and the work could be extended toinclude supervision as well.

1.1.2 Cryogenics“Cryogenics is the science and technology of very low temperatures. Tradition-ally, the field of cryogenics is taken to start at temperatures below 120 K.”, citedfrom Weisend II [31]. Cryogenics is used in several different engineering fields, suchas space technology, medical imaging that uses superconducting magnets (MRI),in particle accelerators, and also in smaller scale in coolers for night-vision systems.The science of cryogenics dates back to the nineteenth century and one of the firstmajor technical advances was when James Dewar managed to liquefy hydrogenin 1898. Still today, the cryogenic containers are built on the same technologyof the vacuum-insulated flask with reflective walls developed by Dewar, and areconsequently called Dewars as a tribute.

1.2 Problem definitionThe acceleration of the particles in the LHC is carried out in two circular vacuumtubes using superconducting cavities. Superconducting dipoles and quadrupolesare used to guide and focus the beam respectively. The magnets will operate nearabsolute zero, to be precise at 1.9 K (−271.3 ◦C), a temperature which is achievedby keeping the magnets embedded in baths of superfluid helium. The baths arein turn cooled down by low-pressure liquid helium flowing through heat exchangertubes along the magnet rows. A more extensive description of the cryogenicssystem is given in section 2.2.

Control of the helium mass flow is crucial to maintain the right temperatureduring the cooling down as well as during operation. A good distribution of theflow in the various cooling down circuits allows an optimal cooldown avoidingtemperature differences between the cold masses. The mass flow is controled bycontrol valves and the most straight forward way to govern the mass flow is to varythe valve openings; for this purpose it is necessary to have knowledge of the actualmass flow in the feeding lines. This knowledge requires measurements, and foreconomical reasons flow meters have been taken out of the first instrumentationlist. Virtual flow meters are tried to be used instead of real instrumentation.Previous tests have been conducted using one method, the Samson method, for

Page 21: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

1.2 Problem definition 3

calculating the mass flow on the basis of temperature and pressure measurements.However, it is not sure that this method is the most accurate one and furthermethods are to be implemented. In this project, a virtual flow meter using amethod called Sereg-Schlumberger will be developed. The results achieved fromthe different methods will then be compared and validated. The implementationof the flow meters is hosted on PLCs and the programming is performed in aSiemens software called Simatic S7.

One of the challenges is to include the necessary cryogenics physical data in thePLC environment. To avoid input errors that might propagate and cause succes-sive errors during the calculations, it is of the prime importance that these valuesare as accurate as possible while at the same time not being too computationallydemanding.

Furthermore it is convenient to have a standardized tool to generate flow metersfor each application, why a generator will be developed for this purpose. Asfurther work might result in other approved flow measurement methods, both thegenerator and the code must be easily adjusted to include such methods.

To summarize, the objectives of this project are to implement the flow mea-surement methods and introduce physical data accurately into the PLCs, and togenerate the high number of flow meters needed.

1.2.1 LimitationsIt is not within the scope of this project to find new measurement methods, butto implement flow meters using existing ones. The cooling down of the LHC willnot start before this project is finished, meaning that it will not be possible to testthe flow meters in real operation within this project. Therefore the comparisonbetween different methods of estimating the flow has been done only theoretically.

1.2.2 Outline of the reportThe following is a brief description of the disposition of this report, with a shortresume of the contents of each chapter.

Chapter 1 is the current chapter with a short introduction to CERN and thedefinition of the problem as well as its limitations.

Chapter 2 gives the background by describing the LHC project in a bit more de-tail, and particularly the cryogenics system and the cooling down proceduresfor a sector and a cell respectively.

Chapter 3 deals with the underlying theory such as the physical properties ofsuperfluid helium, the behavior of control valves, and the Joule-Thomsoneffect. The chapter also contains a short discussion on modeling, and adescription of the different flow measurement methods is given, as well as anattempt to make a theoretical comparison between them.

Page 22: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4 Introduction

Chapter 4 explains the methods for solving the given tasks. This includes de-scriptions of the generation of the virtual flow meters and the procedure ofintroducing physical data to the PLCs. Some comments are also given onerror estimation and problems encountered during the work.

Chapter 5 provides the results obtained from simulations, and the different meth-ods are compared.

Chapter 6 presents conclusions drawn from the achieved results and gives ideasfor future work.

Page 23: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Chapter 2

Background

2.1 The LHC projectThe Large Hadron Collider (LHC) is built in a circular tunnel of 27 km in circum-ference. The objective of the LHC project is to accelerate protons up to the energyof 7 TeV at 99.999 % of the speed of light and then smash them into each other inorder to recreate the conditions appearing immediately after the Big Bang. Thishigh level of energy is required in order to break the very strong internal bindingsbetween the particles in the collisions, and accelerating protons instead of electronsmakes it possible to reach this high energy. The LHC is built in the same tunnel asthe previous particle accelerator, the Large Electron-Positron collider (LEP), butwith a new accelerating system. Studies of the particle beam collisions will mainlybe conducted in the framework of five experiments, namely ATLAS, CMS, ALICE,LHCb, and TOTEM, situated at different places along the circle. A sketch mapof the LHC and the associated experiment points are shown in figure 2.1.

The particles are accelerated in circular vacuum tubes using superconductingdevices. A circular accelerator has the advantage, compared to a linear one, thatit allows continuous acceleration, as the particles can transit indefinitely, increas-ing its energy at every round. The superconducting devices are mainly dipoles,quadrupoles and accelerating cavities. The different magnet types have differentpurposes; the dipole magnets bend the beam to ensure nearly circular orbits whilethe quadrupole magnets focus the beam. Accelerating cavities are electromagneticresonators that accelerate particles and then keep them at a constant energy bycompensating for energy losses. These are the main devices but there are alsoseveral other magnet types used in the LHC, adding up to a total number of9300 magnets, most of them embedded in the cold masses of the main dipolesand quadrupoles. These introducing facts are quoted from the CERN websites [7]and [8].

The protons are accelerated in several steps, schematically shown in figure 2.2,starting with a linear accelerator (Linac2) where they reach the energy of 50 MeV.From the Linac the protons are injected into the Proton Synchrotron Booster(PSB) where they are accelerated to 1.4 GeV. The next step is to lead the proton

5

Page 24: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

6 Background

Figure 2.1. Overview of the LHC, Frigo [17].

beam into the Proton Synchrotron (PS) and accelerate it to 25 GeV, and the laststep before the main LHC ring is the Super Proton Synchrotron (SPS) ring wherethe particles are accelerated to 450 GeV. The protons are finally fed into the LHCin both directions, the complete filling time is about 4 minutes and 20 seconds,after that another 20 minutes are needed to reach the energy of 7 TeV. As can beseen, when talking about accelerating, one mainly refers to acceleration of energy.The main challenge is not to reach the high speed of almost the speed of light, butto do it with enough energy. The description of the accelerating procedure derivesfrom the CERN website [7].

2.2 Overview of the cryogenics systemThe magnets in the LHC will operate at 1.9 K (−271.3 ◦C), a temperature whichis achieved by the use of superfluid helium. The magnets are embedded in baths ofthis helium, which in turn are cooled down by low-pressure liquid helium flowingthrough heat exchanger tubes along the magnet rows [8].

Helium is used thanks to its properties at low temperatures; it liquefies ataround 4.2 K and then undergoes a second phase change at about 2.18 K, to asuperfluid state. In this state helium has a very high thermal conductivity, aproperty that makes it highly suitable for refrigeration as well as stabilization ofsuper conducting systems, since the same low temperature can be kept over longdistances. Solid helium exists only under a large pressure [31]. More details about

Page 25: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

2.2 Overview of the cryogenics system 7

Figure 2.2. Schematic overview of the accelerators, CERN [7].

the properties of helium are given in section 3.1.If magnets at “normal” temperature were used instead of the superconducting

ones, the same collision energy would be achieved only with a ring of at least120 km in circumference, hence increasing the electricity consumption 40 timescompared with the present circumstances [7].

This low temperature is achieved by an extensive cryogenics system, dividedinto eight sectors along the tunnel, each measuring 3.3 km. These sectors aresubdivided into 27 full-cells with a length of 107 m. Every full-cell consists of twoquadrupoles and six dipoles. The sectors are provided with one cryogenic planteach, made up of a refrigerator operating at 4.5 K. Figure 2.3 shows a simplescheme over the LHC ring with its eight sectors and their respective refrigerationplants.

Page 26: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

8 Background

Figure 2.3. General layout of the cryogenics system, Brüning et al. [4].

The cooling down of a sector takes about two weeks and the process can roughlybe partitioned into five phases. The first two phases involve the cooling down to4.5 K, the third and fourth the filling of the cold masses with liquid helium (almost60 tonnes a year), and the last phase the final cool down to 1.8 K [7].

2.2.1 Cooling down of a sectorThe sector’s 27 full-cells are simultaneously fed with cooling power from the Cryo-genics distribution line (QRL) which runs inside the tunnel parallel to the magnetsand interconnects with them at every 107 m, that is once for every full-cell. Thedistribution line is made up of five headers; line B, C, D, E, and F [13]. The linesare feeding four different circuits with helium, namely the filling & cooling circuit,the shielding circuit, the cold support & beam screen circuit, and the superfluidhelium circuit. Sometimes, these circuits are referred to as cooling loops. In thisproject, the main focus lies on the filling & cooling circuit and the superfluidhelium circuit since these are the ones that directly support the magnets withhelium.

The circuits have different importances during the individual phases of the cool-ing down procedure, where the filling & cooling one plays an active role throughoutthe whole process whereas the superfluid helium circuit’s most critical phases arethe last ones. The helium flow in the circuits are governed by control valves withdifferent properties adapted to their position in the system, see section 3.2.

Before starting the cooling down, the systems holds “normal” temperature,that is about 300 K. The first phase then implies the pre-cooling of the systemfrom 300 K to 80 K. During this process, the only active circuit is the one for filling& cooling. The QRL lines E and F are feeding the system with cold, whereas thelines C and D are used as return headers for the heated helium. Though there’s nohelium flow in the other circuits, the over all temperature for the system decreasesthanks to conduction.

Page 27: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

2.2 Overview of the cryogenics system 9

Once the system has reached the temperature of 80 K, the next phase withcooling down to 4.5 K begins. Unlike the preceding phase, there is now a heliumflow in the shielding circuit as well. From now on, only the lines C and E aresupply headers, and the others serve as return headers.

The following step is to fill the magnet cold masses and the electrical dis-tribution feed boxes (DFBs) with liquid helium at about 4.5 K. The electricaldistribution feed boxes supply the sector with electrical power. The filling is donein two phases, where the first consists in filling up to 70 % of the total amount ofhelium and the second completes the filling procedure. After these phases all thefour circuits are active. When the system is completely filled with 4.5 K helium,the final cooling down to 1.8 K can start. The cooling system on a single full-celllevel is described more thoroughly in the following section.

Figure 2.4. Cross section of an LHC dipole, Caron [5].

Figure 2.4 shows a cross section of an LHC dipole. The diameter of the totaldipole, including the outer vacuum vessel, is about 90 centimeters. The figuredisplays a lot of components that are not dealt with in this project, however thecooling tube of helium at 4.5 K and 3 bar can be seen to the lower left, and theheat exchanger pipe in the top middle of the figure.

2.2.2 Final cooling down of a cellAs described above, the filling of the cold masses is conducted in two steps. Themain difference between those is that during the final one the beam screens arealimented with helium, and the heat exchanger tube running along the magnetsis fed via the sub-cooling heat exchanger and a Joule-Thomson (JT) valve (seesection 3.3.1). The beam screens are used to shield the walls of the beam pipefrom the particle beam and the heat induction it could cause [1].

Page 28: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

10 Background

The final cooling of the cells is conducted mainly by the superfluid helium cir-cuit. Helium from line C is sub-cooled to about 2.2 K in a heat exchanger (HX).The helium from the sub-cooling heat exchanger is then expanded through a Joule-Thomson valve down to saturation pressure, about 16 mbar, with a temperatureof about 1.8 K. This is a valve that allows the gas to expand freely at constantenthalpy, thus decreasing the temperature. Eventually, the pressurized helium em-bedding the magnets is cooled down by a heat exchanger tube, in which the 1.8 Ksuperfluid helium from the JT valve outlet flows along the magnets. Figure 2.5shows the cryogenics scheme of a standard cell with its two quadrupoles and sixdipoles, the JT valve (CV910), and the heat exchanger. The four headers B, C,D and F can be found at the top of the scheme, whereas E is in the bottom. Theindicated values for the pressure and temperature correspond to the last coolingdown phase.

Figure 2.5. Cryogenics flow-scheme of an LHC standard cell, Brüning et al. [4]

As will be described in section 3.3.1, the passing through the Joule-Thomsonvalve causes a vapour flash. The vapour that arises from the process is led back byline B through the sub-cooling heat exchanger in order to provide the subcoolingof the 4.5 K liquid helium. The pressure in this line is kept very low, at about16 mbar, thus ensuring the saturation pressure in the superfluid helium circuit.

While cooling down the cold masses, the superfluid helium transfers heat andis then passed back as vapour to the refrigerator via the line B.

It is of the highest importance that the magnets keep the appropriate tem-perature, which then has to be constantly controlled. This is done by regulatingthe helium mass flow, where a crucial parameter is the opening of the differentvalves, both JT-valves and others. During the cooldown, the helium is unevenly

Page 29: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

2.3 Virtual flow meters 11

distributed to the different cryogenic cells to ensure an optimal temperature dis-tribution. In order to achieve this, virtual flow meters are needed.

The facts about the cooling down of a sector and a cell derive from Blanco [3]and Serio [27] and [28].

2.3 Virtual flow metersVirtual flow meters (VFTs) are used to estimate the flow through the valves mainlyby means of temperature and pressure measurements. Knowing the actual flow atany moment, the valve openings can be controlled to ensure the correct flow neededto keep the right temperature in the magnet cold masses. Moreover, the VFTscan have a diagnostical function during normal operation by giving an indicationof the helium consumption, hence revealing possible heat leaks.

The use of virtual instrumentation may give an important reduction in theimplementation costs compared to real instrumentation. So was economy one ofthe main reasons to reject flow meters in the LHC, thus resulting in the need forvirtual flow meters [2].

2.4 Test StringThe LHC is predicted to start its full operation in the end of 2007. In 2003, a fullscale test of one cell, called the LHC Test String, was performed. During this test,the functions of the main accelerator systems, the superconducting magnets, andthe cryogenics were validated. The Test String gave the possibility to have a firstexperience of running a complete LHC cell. This previous work is, among a lot ofother things, treated by Blanco [2].

In the work with the Test String, virtual flow meters were used to estimate theflow using the Samson method, see section 3.4. Any sample input data used inthe current project derive from this work.

Page 30: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 31: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Chapter 3

Theory

3.1 HeliumThe reason for choosing helium as the coolant for the magnets is that its uniquecharacteristics make it particularly suitable for cryogenics. The fluid phase dia-gram for helium differs from those for all other fluids. Normally, the saturationline - where liquid becomes vapour - and the melting line - where the solid mat-ter liquefies - intersect at one point, the so called triple point as can be seen infigure 3.1.

Figure 3.1. Typical phase (p-T ) diagram for fluids, Everyscience.com [14].

For helium there is no such triple point, not even at the temperature of absolutezero. On the other hand, liquid helium can exist in two different states: one is thenormal liquid state which is called He I, and the other is the superfluid state, He II.This means that the vapour and the solid phases are separated by the superfluidstate and the transition line, or the λ line. The latter is named after its shape

13

Page 32: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

14 Theory

similar to that of the Greek letter λ. Though as all fluids, helium has a criticalpoint with a critical temperature , above which the properties are similar to thoseof other fluids. These properties are briefly that the two different phases, liquidand vapour, are no longer distinguishable and the liquid matter does not existanymore. The critical point for helium occurs at the temperature 5.20 K and thepressure 2.29 bar [22].

The state diagram for helium is shown in figure 3.2. Notice that the pres-sure scale is logarithmic, this is for lisability reasons. The λ transition line thenstretches from the saturation line to the melting line, starting at the saturatedvapour pressure of 0.050 bar = 5 kPa which gives the λ transition temperature of2.176 K. The temperature along the λ transition line decreases as the pressureincreases and the intersection with the solid coexistence boundary takes place at1.763 K, with a pressure of 29.74 bar = 2974 kPa. Helium only exists in solidphase under an extreme pressure [31].

Figure 3.2. Phase (p-T ) diagram of helium, Lebrun [19].

3.1.1 He II state propertiesHe II has a very high thermal conductivity, which makes boiling impossible. How-ever, when the temperature increases it evaporates into gas. This high thermalconductivity allows the helium to be transported for long distances with very smalltemperature losses.

When He II is subject to a mass flow its particular characteristics are clearlyexposed. In order to understand the transport properties of He II, it is normallyconsidered as a mixture of normal fluid and superfluid components.

Page 33: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

3.1 Helium 15

3.1.2 HEPAKMass flow calculations require knowledge about the helium properties such as thedensity ρ, and the heat capacities Cv and Cp . These data are obtained fromHEPAK, a software developed by the US company Cryodata, Inc. Based on fun-damental state equations, HEPAK helps to calculate the thermophysical proper-ties of helium. In this project the available measurements are the pressure andthe temperature, but it is also possible to use other parameters as input data.When using pressure and temperature as input parameters, HEPAK finds the cor-responding density and heat capacity values in the state equation by numericaliteration. There are a lot of possibilities when it comes to the choice of output pa-rameters, but the ones of interest in this case are ρ,Cv , and Cp . The first versionof HEPAK was released in 1972 under the name of HEPROPS [10].

Accuracy in the HEPAK calculations

HEPAK calculates the output values by the means of thermodynamical state equa-tions, where the coefficients are estimated by least-square fitting approximation.This approximation is one of the main aspects to consider when discussing theaccuracy in HEPAK. The interesting outputs in this project are the density andthe specific heat capacities. The density ρ can be obtained with an accuracy of0.2 % to 0.5 %, the lower accuracies occur for higher pressures. The specific heatcapacities Cp and Cv are estimated with less accuracy, that is 2 % to 3 %. Theterm accuracy is here referred to as being the relative difference between the valuecalculated with HEPAK and the correctly measured thermodynamical value at agiven state point.

In some cases, there are some additional effects to take into account. Thecritical point is the point where it is no longer possible to distinguish liquid fromvapour, which means that the densities are equal. Mathematically, this meansthat the first and second partial derivatives of the pressure with respect to den-sity are zero, and the second partial derivative of the pressure with respect to thetemperature goes to infinity. One of the consequences of this is that the specificheat capacities become infinite as well. The equations that HEPAK uses to esti-mate the values are approximations and the mentioned derivatives remain finite,meaning that the obtained values are incorrect near the critical point.

Another critical region is the one with coexistence between liquid and vapour.Most experimental density data are obtained for either the liquid or the vapoursingle phase very close to the saturation line, and thereafter extrapolated to thesaturation line with the coexistence of the two phases. In addition, most mathe-matical models have problems dealing with the rapid changes that occur on thisline. Due to these facts, the estimated values are less accurate close to the satu-ration line.

All facts in this subsection derive from the HEPAK user guide [10].

Page 34: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

16 Theory

3.2 ValvesThe mass flow through a valve strongly depends on the pressure drop over thevalve, the density, and the actual pass area for the fluid. The latter is calledthe orifice pass area and is the area at the narrowest point between the seat andthe valve plug, through which there is a mass flow [30]. When talking about valveopening, l, one refers to the position of the valve plug relative to its closed positionand not the orifice pass area.

A general description of the flow rate through a valve can be made as followsaccording to Chau [9]:

m = Cv(l) ·

√∆P

ρ(3.1)

∆P here denotes the pressure drop across the valve, l the percentual valve opening,and ρ is the density of the fluid. Cv is the valve coefficient, sometimes also referredto as Kv, where Cv = 1.156 ·Kv.

There are different types of valves that are characterised by the way the valveopening influences the orifice pass area, due to the different shapes of the trim.Two valves of different types with the same valve opening may have different orificeareas. Though if they do have the same orifice area and are acting under the samepressure and temperature conditions, the flow rate will be the same. The threemost common valve types are presented in figure 3.3.

Figure 3.3. Shape of the trim for common valve types, Chau [9].

The leftmost valve in the figure is a valve of the type fast (or quick) opening.It gives a large change of the flow rate for small changes in the valve opening up toa certain limit, after which the flow rate increases only insignificantly. This typeis often called an “on/off” valve. Another common type is the middle one in the

Page 35: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

3.2 Valves 17

figure. It has linear characteristics, meaning that the mass flow through the valveis directly proportional to the valve opening. The last valve shown is a valve withequal percentage characteristics. This means that each increment in the valve liftimplies an increase of the mass flow by a certain percentage. Most valves used inthe LHC cryogenics system are of this type. The relationships between the valveopening and the flow rate for these three as well as for two other types (butterflyand ball) are illustrated in figure 3.4.

Figure 3.4. Characteristics for common valve types, Chau [9].

The valve coefficient, Cv is a function of the valve opening. In the followingequations, Cvmax denotes the coefficient at maximum opening1 and l the lift (i.e.the percent valve opening), 0 ≤ l ≤ 1.

Fast opening: Cv/Cv,max = l1α , α > 0 (3.2a)

Linear: Cv/Cv,max = l (3.2b)Equal percentage: Cv/Cv,max = Rl−1 (3.2c)

For the equal percentage valve, R is the rangeability parameter which is theratio of the maximum to the minimum controllable flow rate. The higher therangeability, the more precise is the control valve, where the common value of 50is considered as a very good precision. According to the last of the equations 3.2and 3.1, Cv and thus the mass flow m would not be zero even for a completely shutvalve. Therefore, the valve characteristics curve for an equal percentage valve willin practice differ from the theoretical expression for small l (the approximation isusually good for l > 0.05).

1The value entered in tables describing the valve characteristics is Cv,max, orKvs = Cv,max/1.156.

Page 36: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

18 Theory

3.3 Joule-Thomson effectWhen a real (see section 3.4.2) gas is expanded freely at constant enthalpy (thatis with no heat transfer and no external work), it undergoes either a decrease oran increase in temperature, depending on its initial temperature and pressure.All real gases have a certain Joule-Thomson inversion temperature for a givenpressure: an isenthalphic (constant enthalpy) expansion causes the temperatureto rise if the initial temperature was above the Joule-Thomson temperature, or tofall if it was below it. This phenomenon is called the Joule-Thomson effect. Thechange of temperature is described by the Joule-Thomson coefficient

µJT =( δT

δP

)H

(3.3)

where δT and δP denote the change in temperature and pressure respectively, andthe subscript H indicates that the process takes place at constant enthalpy [16].At the inversion temperature, µ equals zero. Below the inversion temperature,where the gas cools, the coefficient is positive, and conversely, it is negative whenthe gas is heated.

3.3.1 Joule-Thomson valvesA Joule-Thomson (JT) valve, is a valve that allows helium to expand in order tocool it [3]. When a liquid whose temperature is below the inversion temperatureundergoes a pressure drop across a JT valve, some of the liquid will vaporize, orflash into vapor. Since the process is isenthalpic, one can use the enthalpy balanceto calculate the flash. In the equations below, H is enthalpy and vflash the vaporflash.

Hbefore = Hafter (3.4a)

H liquidbefore = vflash ·H

gasafter + (1− vflash) ·H liquid

after (3.4b)

vflash =H liquid

before −H liquidafter

Hgasafter −H liquid

after

(3.4c)

Once the total mass flow through the JT valve, mJT, is estimated either bythe Samson or the Sereg-Schlumberger method (see sections 3.4.4- 3.4.5), one cancalculate the gas and liquid flow respectively as

mJTgas = mJT · vflash (3.5a)

mJTliquid = mJT · (1− vflash) (3.5b)

In the LHC cryogenics system, JT valves are used as the last valves beforethe superfluid helium reach the magnet row. The typical inlet conditions are here3 bar and 4.5 K, with the outlet values of 16 mbar and 1.8 K. The gas created bythe Joule-Thomson effect is led back through the heat exchanger and used in thesub-cooling phase where the helium is cooled down to 4.5 K, see section 2.2.2.

Page 37: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

3.4 Mass flow measurement 19

3.4 Mass flow measurementMass flow can be measured using different kinds of flow meters. One of the mostcommon types is the differential pressure flow meter, based on the principle thatthe pressure drop across a flow element is a function of the mass flow [31].

In this project, virtual flow meters are implemented for estimating the heliummass flow through valves based on measurements from physical temperature andpressure sensors. There are some inconveniences related to the use of valves asvirtual flow meters, since there are some additional phenomena affecting the flowthat are hard to take into account in the flow calculation. For example it isdifficult to calculate the valve’s stream constriction coefficient2. However, the aimof this project is not to create a new method to calculate flows using a valve,but to simulate the flow through the valves within a sufficiently low error margin.Sufficiently in this case means that it should be low enough to distribute flows byregulating valves during transients.

There are different methods to calculate the flow rate through a valve; in theTest String, this was done using the Samson method, see section 3.4.4. This projectwill deal with another method as well, namely the Sereg-Schlumberger method, seesection 3.4.5. Both these methods are typical methods used in cryogenics. SamsonAG [25] and Shlumberger Inc. [26] are two companies developing and manufac-turing valves, and the methods referred to as Samson and Sereg-Schlumbergermethods respectively might not be considered as flow calculation methods in astrict sense, but rather the companies’ ways of describing the flow through thevalves. The term method will anyhow be used throughout this report, as beingthe most suitable one for the task at hand. Both the methods derive from theBernoulli equation:

p +12ρm2 + ρgh = constant (3.6)

where p is the pressure, ρ the density, m the mass flow, g the acceleration of grav-ity, and h the height. This equation can be compared to the simpler expression inequation 3.1, where the constants are replaced by the valve coefficient. Both Sam-son and Sereg-Schlumberger methods contain some coefficients that presumablyoriginate from empirical studies rather than theory.

3.4.1 Describing reality with a modelOne of the fundamental issues in automatic control is to describe the reality bymeans of a mathematical model and predict the outcome from a given set ofinputs. Based on these outcomes, the system can then be controlled. The ambitionis to find an as accurate model as possible, to reach a high reliability in theresults. There are several different types of models, with the common approachto find equations that can describe the reality and thus build a model, and thensimulate the process using computers. Unfortunately, the reality seldom follows

2Constriction is an effect that causes an additional pressure drop during the passing throughthe valve.

Page 38: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

20 Theory

strict mathematical relations and approximations have to be done. This inevitablyintroduces a degree of uncertainty and it is necessary to take probable error sourcesinto consideration and try to minimize their effects on the result.

Somewhat simplified, there are two main methods to build models; either start-ing from physical laws or using measurement data. In this application, the massflow is estimated using a model that tries to describe the real flow with physi-cal equations. Even if these equations have strong resemblances to the Bernoulliequation (3.6) they are however not obtained by strictly mathematical relationsbut rather via empirical studies, as discussed in the previous section. The mea-surements then gave birth to a model by means of system identification.

When creating a model from measured data, it usually has to be done in discretetime since the only available measurements are discrete, that is samples of theactual continuous function. The transition from the discrete time samples to acontinuous function may introduce errors if the sampling frequency is not highenough. High enough means that the sampling frequency ωs must be greater thanor equal to twice the highest frequency of the sampled signal. This is formulatedin the sampling theorem, that says that if the time continuous signal containfrequencies only within the interval [−ωN , ωN ], where ωN = ωs

2 is the so calledNyquist frequency, then no information is lost during the sampling [18].

In this application, the input signals are the temperature and pressure mea-surements, along with the valve openings. Every time the flow estimation functionis called, the input data are obtained from the PLCs directly connected to the ana-log instrumentation. This means that the time between samples equals the cycletime of the PLC containing the flow calculation function.

Another possible error source is that the system may be disturbed by differentkinds of noise that affect the output. In this application, one type of noise is theeffect caused by the constriction mentioned in the above section. As stated, thiseffect is difficult to predict and raises the need for an accurate signal model.

After creating a model, the next step is to validate it. When creating the modelthere is a certain amount of data available. A common approach is to use one partof these data - often the half of it - to estimate the model and the rest to validateit through simulations. The act of using different data, so called cross validation,is a good way to test the robustness. If the model shows good correspondencebetween simulated and measured output data for a given set of inputs, it mightonly show that the model is well adjusted to these data. Testing with new dataexposes the model to new conditions.

In the current project, there are unfortunately no measurement data availablesince the cooling down of the LHC will not start until it is finished. Therefore,the model can not be validated for this application, and the only comparison thatcan be done is between different simulated outputs (see section 5.1) but not withreal measurements.

This section is mainly based on the lectures of the course TSRT62, Modelingand Simulation, at Linköping University [24].

Page 39: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

3.4 Mass flow measurement 21

3.4.2 Real and ideal gasesIn thermodynamics, one talks about gases in terms of real (or actual) and ideal(or perfect) gases. A perfect gas obeys to the ideal gas law pV = nRT , wherep is the pressure, V the volume, n the number of moles, R the gas constant,and T the temperature, under all temperature and pressure conditions, whereasa real gas obeys to this law only for low pressures. However, real gases are oftenapproximated by this law as well, but the approximation is not valid at highpressures and low temperatures. One property of a real gas is that the heatcapacity at constant pressure and the enthalpy is dependent on the temperature,but hardly not on the pressure [11]. In cryogenics, the gases act under as well lowtemperature as high pressure conditions, meaning that the approximation to idealgases is generally not feasible.

3.4.3 Density, heat capacity, and heat capacity ratioCalculating the mass flow requires knowledge about the density ρ at the valveinlet and the heat capacity ratio γ. The latter is in most academic handbooks aconstant, since such books use to deal with ideal gases. For real gases however,γ is the ratio between the heat capacity at constant pressure, Cp , to the heatcapacity at constant volume, Cv , that is γ = Cp/Cv . The heat capacity of a fluidis defined as “the amount of heat required to increase a unit mass of a substanceby one degree” [12]. These are hence state properties of the fluid and can be giveneither for constant pressure or for constant volume3.

When working with gases far from their critical point (the point where theliquid state ceases to exist) it is feasible to approximate γ with a constant ( 5

3 ),thus introducing an error of about 1%. However, this work deals with helium in awide temperature range, including temperatures close to the critical point, makingit impossible to do such an approximation. Since the temperature and pressureconditions vary along the passing through the valve, the Cp and Cv values arecalculated at both the inlet and the outlet and the respective average values areused to obtain γ:

γ =Cp,average

Cv,averagewhere Cp,average =

Cpin + Cpout

2and Cv,average =

Cvin + Cvout

2(3.7)

In the Test String work when the Samson method was used, γ was not obtainedusing (3.7) but as γ = Cpin/Cpout . During the first part of this project, that isthe implementation of the Sereg-Schlumberger method and the first associatedtest simulations, γ was calculated in this way as well. This was an approximationthat evoked some doubts and called for further inquires, leading4 to the abovedescribed way of finding γ. This means that the flow rates calculated up to thenwere based on an approximation leading to somewhat erroneous data. The effectof this inaccurate assumption is studied in section 5.1.1.

3The meaning of “constant pressure” here is not to be confused with the (hypothetical)situation where the inlet pressure equals the outlet pressure.

4Thanks to Mr Jaroslaw Fydrych, AT/ACR dept., CERN

Page 40: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

22 Theory

Regardless of the calculation of γ, the ρ, Cp , and Cv values which all dependon the pressure and the temperature, have to be obtained in some way. In theprevious work, this was done by polynomial interpolation with a second orderpolynomial of the type

Cp = a1p2 + a2p + a3 (3.8)

where the temperature dependent coefficients ai are obtained from HEPAK. Ina similar way, the values for the density ρ, were estimated. The procedure isdescribed more thoroughly in section 4.4.1.

In this project, not only a new flow calculation method is implemented, butalso an alternative way of computing the ρ, Cp , and Cv values. The second orderinterpolation polynomial is replaced by linear interpolation in two-dimensionalarrays. The main reason for this is that the interpolation polynomial caused anoticeable degree of inaccuracy when introducing HEPAK data into the PLC.This inaccuracy becomes even more prominent with increasing temperature andpressure, and it is assumed that the linear interpolation will result in more reliablevalues.

3.4.4 Samson methodOnce the values for γ and ρ are obtained, the mass flow can be calculated. Thereare different ways of doing this depending on the phase of the helium; gasifiedor liquefied. Kvs is in both cases the valve coefficient that describes the valvecharacteristics. In fact, Kvs denotes the valve coefficient for a fully open valve,and the actual Kv is obtained by using the appropriate one of the relations (3.2).Hence, replacing Kvs with Kv introduces the influence of the valve opening as wellas the valve type5.

• Gasified helium

A(pin, pout) =

1 if pout

pin≤ 2

γ+1

γγ−1

1.379 ·√

2γγ−1 ·

(poutpin

) 2γ · (1−

(poutpin

) γ−1γ ) otherwise

(3.9a)m(p, T ) = 14.2 ·A(pin, pout) ·Kvs ·

√pin · ρ (3.9b)

• Liquefied helium

m(p, T ) = 31.62 ·Kvs ·√

ρ · (pin − pout) (3.10)

5In this application, valves of the type equal percentage are used, so that Kv = Kvs · Rl−1.

Page 41: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

3.4 Mass flow measurement 23

3.4.5 Sereg-Schlumberger methodAs for the Samson method, the Sereg-Schlumberger one is different for the differentphases of helium. The mass flow is calculated according to the following procedure.Kv is the valve coefficient, obtained in the same way as for the Samson method.

• Gasified helium

pv = 1.25 (3.11a)

pc = pin ·( 2γ + 1

) γγ−1 (3.11b)

psc =(

0.96− 0.28 ·√

pv

pc

)· pv (3.11c)

Km =pin − pc

pin − psc(3.11d)

Xc = 0.6 · γ ·Km (3.11e)

X =pin − pout

pin(3.11f)

Y (pin, pout) ={ 2

3 if X ≤ Xc

1− X3Xc

otherwise (3.11g)

Cv = 1.156 ·Kvs (3.11h)

m(p, T ) = 27.3 ·Cv ·Y (pin, pout) ·√

X · pin · ρ (3.11i)

• Liquefied helium

Cv = 1.156 ·Kvs (3.12a)

m(p, T ) = 27.63 ·Cv ·√

ρ · (pin − pout) (3.12b)

3.4.6 Comparison between the Samson and the Sereg- Schlum-berger algorithms

In the beginning of this section it was explained that the two estimation methodswere the valve manufacturer’s ways of describing the flow through a valve. Hence,the algorithms originate from empirical studies rather than physical relations anda strict mathematical comparison is hard to bring about. This section is howeverdevoted to the search for similarities.

As can be easily seen from the algorithms described above, the Sereg-Schlumber-ger method implies a larger number of steps before obtaining the final mass flowthan Samson does. This is howver a question of how to present the methods, andseveral steps can be effectuated at once to facilitate a comparison.

It is very easy to compare the methods when dealing with liquid helium. Theexpressions are in the same form for both Samson and Sereg-Schlumberger, thatis, a constant times the square root of the density times the pressure drop:

mliquid = const ·√

ρ · (pin − pout)

Page 42: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

24 Theory

Furthermore, the constants are almost equal as well, being 31.62 ·Kvs forthe Samson method and 27.63 ·Cv = 27.63 · 1.156 ·Kvs = 31.94 ·Kvs for Sereg-Schlumberger. Therefore, the methods are roughly equivalent in the case of liquidhelium.

The comparison is somewhat more troublesome when it comes to gasified helium.By inspecting the two final expressions for the respective mass flows, (3.9) and(3.11), putting them in the same form (that is, using Kvs instead of Cv) andeliminating all common factors, the comparison can be restricted to the differingparts as follows:

27.3 ·Cv ·Y (pin, pout) ·√

X · pin · ρ ∼ 14.2 ·Kvs ·A(pin, pout) ·√

pin · ρ ⇒

31.56 ·Kvs ·Y (pin, pout) ·√

(pin − pout) ∼ 14.2 ·Kvs ·A(pin, pout) ·√

pin ⇒

2.2 ·Y (pin, pout) ·√

(pin − pout) ∼ A(pin, pout) ·√

pin

The resulting output mass flow is due to a certain condition for both cases,where the inlet and outlet pressures are compared to the heat capacity ratio γ.When the condition is true, A(pin, pout) and Y (pin, pout) respectively are constantvalues, otherwise it is obtained by a fairly complex expression involving pin, pout,and γ. For the Samson method, the expression for A(pin, pout) relates to the ratioof the outlet and inlet pressures:

pout

pin≤ 2

γ + 1

γγ−1

(3.13)

It can be seen from the expressions above that when this condition is true, theresulting mass flow is actually only implicitly dependent on the outlet pressure.This is probably an approximation justified by the fact that the outlet pressure issignificantly lower than the inlet pressure and hence negligible.

On the other hand, the Sereg-Schlumberger method rather depends on thedifference between the inlet and outlet pressures. In order to try to find somecorrespondences between the two conditional statements, the Sereg-Schlumbergercondition X < Xc can be rewritten on a form that includes the ratio between pout

and pin as follows:

pin − pout

pin≤ 0.6 · γ ·Km =⇒ pout

pin≥ 1− 0.6 · γ ·Km

Substituting Km and expanding the expression as much as possible using (3.11)gives the inequality

pout

pin≥

pin

(1 + 0.6 · γ ·

((2

γ+1

) γγ−1 − 1

))−

(0.96− 0.28 ·

√pv

pin ·(

2γ+1

) γγ−1

)· pv

pin −(0.96− 0.28 ·

√pv

pin ·(

2γ+1

) γγ−1

)· pv

(3.14)

Page 43: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

3.4 Mass flow measurement 25

Consequently, it is hard to see any straightforward similarities with the con-ditional statement used in the Samson method. A very important difference isthat the Samson method considers an upper limit for the ratio, whereas the Sereg-Schlumberger method compares the ratio with a minimum value. In fact, theinlet pressure is never lower than the outlet pressure. As shall be seen in a latersection (4.6.1), this is tested for every flow calculation and any deviant case isconsidered as erroneous and the output value is assigned the same value as for theprevious calculation. This means that the condition pout

pin≤ 1 imperatively must

be true in order to estimate the mass flow.However, the expression 2

γ+1

γγ−1 appears in both cases. Even if it is not obvious

to find any similarities between the expression, it can be of interest to substitutex = 2

γ+1

γγ−1 in both (3.14) and (3.13) and plot the expressions in the same

diagram.

pout

pin≤ x

pout

pin≥

pin

(1+0.6 · γ · (x−1)

)−(0.96−0.28 ·q pv

pin · x

)· pv

pin−(0.96−0.28 ·q pv

pin · x

)· pv

= q(x)

(3.15)

Figure 3.5. The conditional statements (3.15) plotted with respect to γ. The dashedline shows x = 2

γ+1

γγ−1 , the dash-dotted line q1(x) with pin = 0.1 bar and the dotted

line q2(x) with pin = 1.5 bar.

Figure 3.5 shows the conditions in (3.15) as functions of γ, where γ goes from6

1.1 to 4. The Sereg-Schlumberger condition is calculated for two different valuesof the inlet pressure; 0.1 bar and 1.5 bar respectively.

6The γ values are in fact concentrated around the value for an ideal gas, that is γ = 53

.

Page 44: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

26 Theory

A typical value for γ is 53 , which especially yields for ideal gases. As discussed

in section 3.4.3 it is not possible to do such an approximation in this applicationwhen dealing with helium. Nevertheless, this value of γ is very frequent and it canbe of interest to investigate what happens when γ = 5

3 is used in (3.14) and (3.13).In this case, x in (3.15) equals 0.4871. The graph in figure 3.6 shows this situation.

Figure 3.6. The conditional statements (3.15) for ideal gases, that is, when γ equals 53.

The dashed line shows the constant value of x = 0.4871 and the dash-dotted line showsq(x) with respect to the inlet pressure.

The two expressions are equal when pin equals 0.2183 bar. For the Samsoncondition this gives that

pout ≤ x · pin = 0.4871 · 0.2183 = 0.1063 bar

and consequently for Sereg-Schlumberger that

pout ≥ q(x) · pin = 0.1063 bar

The possible range for pout is quite narrow, since the inlet pressure must not besmaller than the outlet pressure, that is

0.1063 bar ≤ pout ≤ pin = 0.2183 bar

At these pressure conditions the heat capacity ratio equals 53 for temperatures

from about 15 K and higher.The expressions (3.15) can be calculated for this value of the input pressure.

Figure 3.7 shows the both conditions with respect to γ, similarly to figure 3.5.Here, the values on the γ axis only range from 1 to 2, since γ never takes highervalues for these pressure conditions.

An interesting remark for the Sereg-Schlumberger condition is that the expres-sion Xc = 0.6 · γ ·Km simply becomes Xc = Km when γ takes the constant value

Page 45: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

3.4 Mass flow measurement 27

Figure 3.7. The conditional statements (3.15) plotted with respect to γ when pin =0.2183 bar. At this pressure the conditions are equal for ideal gases, that is when γ = 5

3.

The dashed line shows x = 2γ+1

γγ−1 and the dotted line q(x) with pin = 0.2183 bar.

of 53 . Xc can hence be considered as a measure of the deviation from the situation

of an ideal gas.From both figures 3.5 and 3.6, it can be seen that the Sereg-Schlumberger con-

dition is sometimes negative. Since the pressures always are positive the conditionis true for any set of inlet and outlet pressures that give a γ value for which thecondition is negative.

To summarize, the main conclusion is that since both methods derive fromempirical studies instead of physical relations, an attempt to find mathematicalsimilarities becomes quite futile. As will be seen in section 5.1.1, tests will showthat the conditions are seldom true simultaneously.

Y (pin, pout) is continuous even in the transition between the two conditionalcases, since the expression 1− X

3Xcequals 2

3 for the limit X = Xc.As for A(pin, pout), it is more complicated to show the continuity at the transi-

tion from true to false condition. Figure 3.8 shows A(pin, pout) when poutpin

= 2γ+1

γγ−1 ,

that is exactly when the condition is true, as a function of γ. A(pin, pout) equals 1when γ = 1.660 . . . which is fairly close to the value for ideal gases.

Finally, both methods deal with the density in the same way, that meanstaking the square root out of ρ. Since neither A(pin, pout) nor Y (pin, pout) dependon ρ, the differences between the methods are due to the pressures and the heatcapacities by the means of γ. This later is however relatively constant for varyingtemperature and pressure conditions, why the main difference is directly relatedto the pressures.

Page 46: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

28 Theory

Figure 3.8. The dotted line shows A(x) where x = 2γ+1

γγ−1 and the dashed line shows

x itself, both plotted with respect to γ.

Page 47: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Chapter 4

Implementation

4.1 Development environmentThe virtual flow meters are programmed on PLCs, for which the code is writtenin the Siemens software Simatic S7. This is a programming environment which isbuilt up by different blocks, such as function blocks (FBs), functions (FCs), anddata blocks (DBs). There are also blocks called organization blocks (OBs) thatspecify the execution order.

In this project, there is one main function block which first calls the interpo-lation function to obtain the ρ and γ values, and after that calculates the flowrate, using the desired flow measurement method. The input data, that is the ρ,Cp , and Cv values, are stored in one data block each, and the analog inputs forthe pressure, p, and temperature, T , measurements are stored in two other datablocks. The reason for having two data blocks for this purpose is the simple factthat one single data block is limited to a maximum number of 1000 input values.These data blocks are called shared data blocks since they can be accessed by allfunctions and function blocks. The resulting mass flows are also written to thesedata blocks.

Each virtual flow meter represents one instance of the flow calculation functionblock and constitutes a specific instance data block. Unlike the shared data blocks,these instance data blocks are assigned to a specific function block call. Thearguments to this function call are the measurement inputs specified by theirsymbolic addresses in the data blocks. Every block is represented as a symbol in asymbol table, necessary in order to compile and run the code. A symbolic name,that is address, is assigned to each block in the symbol table.

A schematic figure of the blocks and the interaction between them is shown infigure 4.1.

29

Page 48: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

30 Implementation

Figure 4.1. Scheme over the S7 blocks and block calls.

4.2 Generation of virtual flow metersEvery sector in the LHC is considered to be made up of three parts, the ARC andthe two long straight sections left (LSSL), and right (LSSR), as described in Liuet al. [20]. Each of these parts will have its flow meters simulated in separatePLC, summing up in a total number of 24 PLC for the whole ring with its eightsectors. For every PLC, the S7 instance data blocks representing the flow metersmust be generated, as must their respective function block calls. This generationis done using Visual Basic programming with inputs from Excel. Figure 4.2 showsa scheme over the generator; how data are read from the Excel file and outputsource files generated to Simatic S7.

Figure 4.2. Scheme over the VFT generation.

Page 49: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.2 Generation of virtual flow meters 31

Input configuration data

The input data are available in Excel files containing a large amount of configu-ration data, where the interesting ones for this application are the valve opening,the inlet and outlet pressures and temperatures (pin, pout, Tin, Tout), and the valvecoefficient Kvs. A screen shot of the configuration file is shown in figure 4.3.

Figure 4.3. Screen shot of the Excel configuration file with the analog inputs.

When generating the virtual flow meters, the Excel file is searched for all dataentries starting with the string “FT”, meaning that the entry represents a flowmeter. There are several FTs with the same name - for example FT943 -, wherethe number relates to the type of valve (all valves with the same number havethe same Kvs value) but every FT has its own setup of location and equipmentspecifications, giving a unique name of the type “QRLAA_29L8_FT943”. Thecorresponding inputs for the respective flow meter are entered at the same line inthe configuration file. All inputs are given as symbolic names of the same type asfor the FT and are stored as variables in the shared data block, except the Kvs

that are directly given as numerical values.The first thing to check for every flow meter is if there is a value entered in the

Kvs column. A missing Kvs value does not indicate an error, but that the actualflow meter will not constitute a virtual one, a VFT. However, most flow metersdo have a Kvs value and are to be generated as virtual flow meters, so the rest ofthe input data are read as well. The temperature and pressure measurements areobtained from pressure meters (PTs) and temperature meters (TTs) respectively.For every found pressure and temperature meter the file is searched once againfor the unique setup of name, location, and equipment, in order to find on whichline the PT/TT is entered, and hence in which of the two data blocks the currentinput is stored. If one data block would have enough memory space to store allinputs, this second search would not be necessary. In the column for the valveopening, the name of the actual control valve - such as CV943 - is entered, andthe corresponding measurement value is obtained from a so called gauge meter,for example GT943.

Page 50: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

32 Implementation

There are some exceptional cases for the input data that have to be takeninto account. Sometimes there is no measurement available for the valve’s outletpressure but only for the pressure drop over the valve. This knowledge is sufficientto calculate the flow, but not to find ρ, Cp , and Cv where it is necessary to knowthe absolute values. In order to cope with this, it is assumed that the outletpressure is 1.1 bar for these valves and thus the inlet pressure is calculated as(1.1 + ∆p) bar. Another case that might occur is that the temperature (either atthe inlet or the outlet) is not given from a temperature measurement in the analoginput data block, but as a numerical constant value.

Some of the flow meters, to be precise those who represent JT valves, receivetheir outlet pressure values from the pressure meter PT811. This Pressure meter(PT) measures in millibars instead of bars and the S7 code requires the pressureto be given in bars, hence the pressure value is divided by 1000 for those cases.

If there is an entry missing in any of the input columns, or if the entered valueis given on an invalid form, no virtual flow meter (i.e. no instance data block) isgenerated for this valve, since this would cause errors in the execution of the PLCprogram. On the other hand, an error message is generated and included in thelog file for the generation. An example of a log from a VFT generation is shownin figure 4.4.

Figure 4.4. Example of a VFT generation log.

Page 51: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.2 Generation of virtual flow meters 33

From Visual Studio generation to S7 execution

When the user has selected the input file, the program automatically generates thenecessary S7 source code files (instance data blocks, function calls, and compilationfile) and a symbol table, and moreover a log file indicating if there were any indatamissing in the Excel file. These files are saved in the destination folder chosen bythe user. A screen shot of the generator application can be seen in figure 4.5. When

Figure 4.5. Screen shot of the application for generating the virtual flow meters

the files are generated, they have to be manually imported into a S7 project, oneproject for each PLC. These projects contain not only application1 specific sourcefiles (symbol table, instance data blocks, and function calls), but also the sourcefiles common for all applications such as the flow calculation function block andthe data blocks containing the analog inputs, as well as the ρ, Cp , and Cv tables.The compilation file mentioned above is a file that compiles all the other sourcefiles at once.

In the S7 code, there is an internal variable indicating which flow measurementmethod is to be used. At the moment there are two possible methods: Samsonand Sereg-Schlumberger. Therefore it would be possible to use a boolean variable,but this would limit the number of possible flow calculation methods to two. Evenif it is slightly more computationally demanding, an integer is used since addingmore methods is a likely extension for future work.

At an early stage of the work, the flow measurement method was given as anoption in the Visual Studio generator, hence sending the method variable as aninput variable. However, this changed later on to match new interface constraints.

1The word application here refers to a part (ARC, LSSL or LSSR) of a sector.

Page 52: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

34 Implementation

Interpolation tables

The three data blocks with the ρ, Cp , and Cv tables are created by importing theHEPAK data into Excel, where a Visual Basic macro creates the data blocks astext files. Then the text is manually pasted into SCL source files. In order to makethe generation of the data blocks to work correctly, there are some constraints thatmust be followed whilst importing the HEPAK data to Excel. This procedure isdescribed in the help file for the flow meter generator, if the user would like to usedifferent interpolation tables. The mentioned help file also gives the instructionson how to use the flow meter generator. The help file is enclosed to this report inAppendix B.

4.3 SupervisionIn the end of this project, the first steps were taken to introduce the virtual flowmeters in PVSS. This is a supervision software that visualizes the in- and outputsand allows the user to survey the PLC. It is also possible to show the status of theflow meter, regarding the actual inputs etc. For this purpose, some code elementswere added to the S7 code by means of an output vector with status bits that areset by logical tests. One thing that is tested is whether the input values for pressureand temperature are within the table ranges, or if they are exceeding them so thatextrapolation is needed. Both the inlet and outlet values are tested, summing upin four bits. Furthermore, there is one bit indicating if it is a negative pressuredrop over the valve, which is an erroneous situation as described in section 4.6.1.The sixth bit tells whether the flow meter deals with liquid or gasified helium(which in this case means, if the inlet temperature is below or above 5 K).

4.4 InterpolationOnce the VFTs are generated the S7 code can be executed. The structure of thiscode is described graphically in figure 4.1. The current section deals with the firststep in the execution, namely the interpolation function.

4.4.1 Interpolation in two dimensionsFinding the values for ρ, Cp , and Cv as functions of the pressure p and temperatureT can be done in different ways. As mentioned in section 3.4, a one variableinterpolation polynomial of second order was used in the previous studies relatedto the Test String. One of the predefined goals for this project was to get the valuesby linear interpolation in two-dimensional arrays, an approach which is extensivelydescribed in section 4.4.2. There are several other generally accepted methods thatcan be used for interpolation in two dimensions, some of which are presented inthis section, together with the polynomial interpolation. However, the extent ofthis project is not enough to implement and test any of these methods. Doingthis and comparing the different methods’ accuracies versus implementation costscould be a possible task in further development.

Page 53: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.4 Interpolation 35

The rest of this section will be devoted to various forms of interpolation in twodimensions that could be applicable for this project.

Second order interpolation polynomial

The interpolation polynomial used in the Test String is a one variable polynomial,i.e. it depends only on the pressure explicitly. Both the temperature and thepressure are anyhow influencing the resulting value; the temperature implicitlyas the coefficients ai = ai(T ). These coefficients are obtained by the means of apredefined Simatic S7 function block, NONLIN, whose inputs are HEPAK data andthe temperature. The HEPAK data are introduced in Simatic S7 as data blocks,with different blocks for ρ and Cp respectively. Each coefficient ai is equippedwith its own ρ and Cp blocks, summing up to six data blocks in total. The generalequation 3.8 is applied to each specific case according to the following:

Cpin = a1p2in + a2pin + a3 where ai = ai(Tin)

Cpout = a1p2out + a2pout + a3 where ai = ai(Tout)

ρ = a1p2in + a2pin + a3 where ai = ai(Tin)

One of the inconveniences related to polynomial interpolation is Runges phe-nomenon. When interpolating a function f(x) in the interval [−a, a] at n equidis-tant points xi = −a + (i − 1) 2a

n where i = 1, . . . , n + 1 with a polynomialof degree ≤ n, the solution tends to oscillate close to the end points of the in-terval, ±a. This problem increases with higher degrees and may even result in adiverging interpolation error toward the infinity for high degrees. An example ofRunges phenomenon is illustrated in figure 4.6.

Figure 4.6. Example of Runges phenomenon. The curve with the highest peak isthe original function, the one with the lowest peak is an approximation made by 5th

degree polynomial, while the middle curve is an approximation by a 9th degree polyno-mial, Wikipedia [33]. This later fits better to the original function in the middle of theinterval, but oscillates near the end points.

Page 54: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

36 Implementation

Nearest neighbor interpolation

This method is the least computationally demanding one, but it also introducesthe highest degree of inaccuracy to the calculations. The method simply findsthe nearest point and assigns the value of this point to the interpolated point.Finding the nearest point nevertheless requires a procedure quite similar to theone finding interpolation points for bilinear interpolation (see section 4.4.2), withthe difference that no further calculations are needed once the nearest point isfound. However, these are not very extensive and the gain thanks to simplercalculation is not sufficiently large to justify the loss in precision that comes withthe nearest neighbor interpolation.

Bicubic interpolation

A method commonly used in computer graphics is bicubic interpolation where theresulting value for a given point is a weighted value from the 16 closest points, orsamples, forming a 4 × 4 grid. In a compact form, bicubic interpolation can beexpressed as

f(x, y) =3∑

i=0

3∑j=0

aijxiyj (4.1)

The ways of finding the coefficients aij depend on the application and on themathematical properties of the functions, but they normally include the gradientsin both the x- and y- directions, that is ∂f(x, y)/∂x and ∂f(x, y)/∂y, as well asthe cross derivative ∂2f(x, y)/∂x∂y at the corners of the grid. It is not necessaryto know the exact derivatives; the best solution is of course to compute themanalytically, but if that is impossible they can be estimated numerically by finitedifferencing of the functional values on the grid. This would be necessary if onedesired to use bicupic interpolation for the HEPAK data.

One of the main reasons for using bicubic interpolation in computer graphics isthat it preserves fine details better than linear interpolation. When dealing withimage processing applications with a lot of discontinuities this is an important as-pect, whereas it is not as crucial for functions that show up more or less harmonicalcharacteristics, such as the density and the heat capacities (with some exceptions,see section 4.5). As the method is quite computationally demanding it is reason-able to assume that the possible gain in accuracy would not counterbalance theincreased complexity.

Bicubic spline interpolation

A special case of the bicubic interpolation is the bicubic spline interpolation, whichis based on this same interpolation function, (4.1), but with the difference that thepartial derivatives at the grid points are determined by splines. The derivativesmay than be referred to as being globally determined.

Page 55: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.4 Interpolation 37

A spline is a function built up of piecewise polynomials: given a sequence{xi} ⊂ R, xi < xi+1 and 0 < i < n, a spline function S(x) of degree n is afunction where Si(x) coincides with some polynomial of degree n at each interval(xi, xi+1). The spline must be continuous at each data point, i.e. Si(xi) = Si+1(xi)and exist all along the real axis.

The bicubic spline interpolation method is also suitable for rapidly varyingdata, which is in general (see section 4.5) not the case for the data in this applica-tion. Calculating the derivatives from the splines requires even more computationsthan for the “normal” bicubic interpolation, making the use of this method evenless justified with respect to the gain in accuracy.

The theory about the two bicubic interpolation methods originate from Flan-nery et al. [15], and Wikipedia [32], and [21].

4.4.2 Bilinear interpolationIn the outlines for this project it was stated that the ρ(p, T ), Cp(p, T ), and Cv(p, T )values should be obtained by linear interpolation in two-dimensional tables, i.e.by bilinear interpolation.

The general procedure for linear interpolation in one dimension can be describedby the help of the equation of a straight line

y = kx + m (4.2)

and the theory of derivatives. Let x1 and x2, where x1 < x2, be two values forwhich the two function values f1 = f(x1) and f2 = f(x2) are known. The slope kof the straight line (4.2) between (x1, f1) and (x2, f2) can simply be calculated ask = f2−f1

x2−x1, see figure 4.7.

×f(x1)

f(x2)f(x)

x1 x2x

Figure 4.7. The slope of the straight line between (x1, f1) and (x2, f2) is k = f2−f1x2−x1

and the function value at x is given by (4.3).

To estimate the function value at a point x, x1 < x < x2, (4.2) can be usedwith y = f(x), k = f2−f1

x2−x1, and m = f1:

f(x) ≈ f1 +f2 − f1

x2 − x1(x− x1) (4.3)

If h is the distance between x1 and x2, and qh the distance between x and x1,then the derivative can be expressed as f ′(x) = f2−f1

h , and the function value as

f(x) ≈ f2 − f1

hqh + f1 = (f2 − f1)q + f1 (4.4)

Page 56: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

38 Implementation

Interpolation

The interpolation tables cover a temperature range from 1.5 K to 300 K and apressure range from 0.01 bar to 3.5 bar. In order to determine ρ, Cp , or Cv atthe measured pressure and temperature values, the algorithm performs a linearinterpolation between the two closest values of both p and T as follows:

p pl pu

T

Tl

Tu

×fll

flu

ful

fuu

Figure 4.8. Interpolation in ρ, Cp , and Cv tables

1. For the measured inputs p and T , find the nearest upper (pu, Tu) and lower(pl, Tl) entries in the tables respectively.

2. Find the four corresponding table entries to these values (see figure 4.8):

fll = f(pl, Tl), ful = f(pu, Tl)flu = f(pl, Tu), fuu = f(pu, Tu)

3. As described above, h is the distance between the two interpolation pointsin the table, and qh the distance to between the actual input point and thelower of the interpolation points. Below is described how to get qT when Tis the input; qp is obtained analogously.

qT =T − Tl

Tu − Tl

4. Interpolate in the T direction as in (4.4) to get one function value, fu, cor-responding to the upper pressure value pu, and one function value, fl, cor-responding to pl:

fu ≈ (fuu − ful)qT + ful

fl ≈ (flu − fll)qT + fll

5. Use these intermediate f -values and interpolate in the p direction to get thefinal output:

f(p, T ) ≈ (fu − fl)qp + fl

Page 57: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.4 Interpolation 39

Extrapolation

In some cases the input variables may be out of the table ranges, to be preciseby exceeding the upper bounds. When this occurs, an extrapolation is performedinstead of interpolation to obtain ρ, Cp , and Cv . This may be done either for boththe input parameters p and T , or for only one of them while the other one is foundby interpolation.

At an earlier stage of this project, extrapolation was used also for values lyingbelow the lower bounds. However, the table ranges were increased to cover alsothese extreme values since interpolation within the table range is a safer way toestimate the output value.

Similarly to the interpolation case, the two-dimensional extrapolation is con-ducted by extrapolating once in each dimension. The extrapolation is done usingsimple recurrence based on the same relation as for the interpolation, namely (4.2).This relation can be modified for a x value x > x2 > x1 by using m = f2 andassuming the the function value f(x) lies on the extension of the straight linebetween x1 and x2. Then the estimated value becomes as follows:

f(x) ≈ f2 +f2 − f1

x2 − x1(x− x2)

If h is the distance between the interpolation points x1 and x2, and qh thedistance between x and x2, then the slope of the straight line can be expressed ask = f2−f1

h , and the function value analogously to (4.4) as

f(x) ≈ f2 − f1

hqh + f2 = (f2 − f1)q + f2 (4.5)

Knowing these relations, the extrapolation procedure can be described as fol-lows:

1. The equivalences to pu, pl, Tu and Tl in the interpolation algorithm are setto be the highest entries that are inside the table ranges.

2. fll, flu, ful and fuu are found in the same way as in the case of interpolation.

3. As described above, h is the distance between the two last points withinthe table, and qh the distance from the actual input value to the first valueinside the table (see figure 4.9). Below is described how to get qT when T isthe input; qp is obtained analogously.

qT =T − Tu

Tu − Tl

Once q is calculated, (4.5) can be used. This is done first in the T and thenin the p direction, like for the interpolation.

4. Extrapolate in the T direction:

fu ≈ (fuu − ful)qT + fuu

fl ≈ (flu − fll)qT + flu

Page 58: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

40 Implementation

5. Extrapolate in the p direction to find the final output. The intermediatefunctions fu and fl may have been obtained from either inter- or extrapola-tion:

f(p, T ) ≈ (fu − fl)qp + fu

p pl pu

T

Tl

Tu

×

hp

hT

qphp

qThT

Figure 4.9. Extrapolation in in ρ, Cp , and Cv tables

Symmetry of the inter- and extrapolation algorithms

The way of finding the ρ and Cp values in two-dimensional tables requires a two-step procedure. In this project, the choice was made to start working in the Tdirection and make the final calculation in the p direction. The result is howeverindependent of the calculation order, which will be shown in the current section.

Considering the final expression for the interpolated function value in the in-terpolation algorithm and substituting fu and fl with their respective expressionsgives the following:

f(p, T ) = (fu − fl)qp + fl =

= qp

(qT(fuu − ful) + ful − qT(flu − fll)− fll

)+ (flu − fll)qT + flu =

= qpqT(fuu + fll − ful − flu) + qp(ful − fll) + qT(flu − fll) + fll

(4.6)If one would start the interpolation in the p direction and thereafter find the

final value by interpolating in the T direction, the following relations would beused instead:

fu = (fuu − flu)qp + flu

fl = (ful − fll)qp + fll

f(p, T ) = (fu − fl)qT + fl

Page 59: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.4 Interpolation 41

Here, fu is the function value at the upper temperature value Tu, and fl is thefunction value at Tl. Effectuating the same substitutions as in (4.6) leads to:

f(p, T ) = (fu − fl)qT + fl =

= qT

(qp(fuu − flu) + flu − qp(ful − fll)− fll

)+ (ful − fll)qp + fll =

= qTqp(fuu + fll − flu − ful) + qT(flu − fll) + qp(ful − fll) + fll

(4.7)Generally, the interpolated function can hence be expressed as

f(p, T ) = c1qTqp + c2qT + c3qp + c4 (4.8)

which is actually not a linear function but rather a product of two linear functions.Comparing the coefficients c1, . . . , c4 in (4.6) and (4.7), one can see that these

are identical and therefore the result of the interpolation is independent of thecalculation order. The same relations hold for the extrapolation, that is it canbe shown in the same way that the extrapolation is likewise independent of thestarting direction.

4.4.3 Data tablesThe data in the tables used for the inter- and extrapolation are obtained fromHEPAK by choosing p and T as input parameters. For different ranges of p andT , the precision is chosen differently with a higher resolution for low temperatureand pressure. Limitations which must be taken into account are the availablememory space and the execution time of the interpolation function. Therefore itcould be of interest to use separate tables for different valves according to theiroperating conditions, but an overlap would be inevitable and overlapping tables area waste of memory space. Knowing beforehand that the sought value lies withina specific range, it would not be necessary to interpolate in the wide-range table,thus decreasing the execution time. However, finding the interpolation valuesrequires no more than about one quarter of a millisecond in execution time. Thecycle time for the whole process is about 10 milliseconds, meaning that the timefor the interpolation constitutes about 2.5 % of the total time. Therefore it is notmeaningful to use different tables, considering the increase in code complexity andneeded memory space this would cause.

A very critical region in the helium phase diagram is the saturation line, whichis the limit between the vapour and liquid phases. Consequently, the value forthe density changes very rapidly and two neighboring data entries may have asdifferent values as 145.53 and 2.01. It goes without saying that an interpolationbetween these two points would give an erroneous output value of the density,not taking the coexistence of the phases into consideration but just estimating anintermediate density value. In the current application, the helium is consideredto be in its liquid phase for all temperatures below 5.0 K. According to figure 3.2this is not generally true and a more appropriate solution could be to express the

Page 60: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

42 Implementation

saturation line by means of a function of both the temperature and the pressure,and hence deduce for every input which is the actual phase. Then two different datatables could be used, one for the liquid and one for the vapour phase. However,this situation will never occur in this application. The helium will always be undera sufficiently high pressure when below 5.0 K to ensure the liquid phase.

The data tables’ precisions are discussed closer in the following section that dealswith error estimation. There are two main aspects to take into consideration whenchoosing the sampling interval in the data tables. First, it is a waste of memoryspace to divide the table into too small steps in ranges where the function is linearenough to make the interpolation error negligible with respect to other errors, forexample the input variables’ accuracies. On the other hand, it can be necessaryto have a very short interval to follow rapid changes of the function values.

The precision of the tables used in this project are presented in table 4.1. Withthese sample intervals, the tables have 107 temperature and 22 pressure entries,giving in total 2247 interpolation points. In this project the ρ, Cp , and Cv tableshave the same size with the same p and T ranges, but as will be discussed in thefollowing section, this is not necessarily the optimal solution and there is nothingthat prevents from having different table sizes.

T [K] 1.5-2 2.2-3 3.25-10 10.5-20 21-30 32-50 55-80 90-300∆T [K] 0.10 0.20 0.25 0.50 1.0 2.0 5.0 10

p [bar] 0.01 0.1-1.0 1.2-2 2.25-3.5∆p [bar] - 0.10 0.20 0.25

Table 4.1. Data ranges in the interpolation tables.

Using linear interpolation on a function that is not truly linear inevitably in-troduces an error in the output (see section 4.5). Studying the characteristics ofthe functions can give a rough idea of how “safe” it is to interpolate linearly. Thefigures 4.10-4.17 visualize the ρ, Cp , Cv , and γ = Cp

Cvvalues in three-dimensional

surface diagrams. For each parameter there are two diagrams; one for tempera-tures T ≤ 5.0 K and one for the whole temperature range (T ∈ [1.5, 300.0] K).This temperature limit is chosen since the helium is considered to be in its liquidphase for all temperatures below 5.0 K. As can be seen in the diagrams, this isnot generally true but the assumption is fair enough for this application.

For the diagrams covering the whole temperature range, the axes are in somefigures given in logarithmic scale to better present the characteristics of the func-tion values. It can be seen that logarithmic tables could be more suitable in certaincases, where the function is linear to log T rather than to T . This would mean thatthe interpolation points are found on a logarithmic scale, but the interpolation isstill performed linearly. Unfortunately, logarithmic tables have not been used inthis project, but it could be a natural step for improving the code and use thememory space more efficiently.

Page 61: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.4 Interpolation 43

Figure 4.10. Density ρ [kg/m3] for liquid helium with respect to p and T , with p ∈[0.01, 3.5] bar and T ∈ [1.5, 5.0] K. Helium is not in its liquid phase all over this range,but density values for non-liquid helium have been removed in this graph.

Figure 4.11. Density ρ [kg/m3] for helium with respect to p and T , with p ∈[0.01, 3.5] bar and T ∈ [1.5, 300.0] K. The ρ and T axes are logarithmically scaled, whichclearly shows the linear properties for the density of gasified helium, and the nearly con-stant density of liquid helium. This means that ρgas is nearly linear with respect to pand lg(x) and linear interpolation can be performed here with a good accuracy. However,in the region close to the saturation line the interpolation becomes very dangerous withbig discontinuousities.

Page 62: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

44 Implementation

Figure 4.12. Heat capacity at constant pressure, Cp [J/kgK] for helium with respectto p and T , within the ranges p ∈ [0.01, 3.5] bar and T ∈ [1.5, 5.0] K. The saturation linewhere helium liquefies is clearly visible as the distinct curve with a peak near the criticalpoint of T = 5.20 K and p = 2.29 bar (see section 3.1.2). The marked saddle point atT = 2.176 K corresponds to the λ transition line, see section 3.1.

Figure 4.13. Heat capacity at constant pressure, Cp [J/kgK] for gasified helium withrespect to p and T , with p ∈ [0.01, 3.5] bar and T ∈ [1.5, 300.0] K and logarithmic Cp

and T axes. The phenomena with diverging heat capacities when approaching the criticalpoint, described in section 3.1.2, can be seen here. Further away from this point and thesaturation line, Cp takes the nearly constant value of about 5200 J/kgK. Likewise thedensity, it is safe to conduct interpolation for the gasified helium, while it is far morecritical in the liquid phase and especially close to saturation and λ lines.

Page 63: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.4 Interpolation 45

Figure 4.14. Heat capacity at constant volume, Cv [J/kgK] for helium with respect top and T , within the ranges p ∈ [0.01, 3.5] bar and T ∈ [1.5, 5.0] K. Analogously to Cp

(figure 4.12), Cv shows special characteristics at the saturation and λ transition lines.

Figure 4.15. Heat capacity at constant volume, Cv [J/kgK] for helium with respect top and T with p ∈ [0.01, 3.5] bar and T ∈ [1.5, 300.0] K. Here it is only the T axis thatis logarithmic, since Cv is best rendered in linear scale. Cv shows characteristics similarto Cp (figure 4.13), that is fairly constant (around 3115 J/kgK) for a large range of p, Tvalues, but with deviant values close to the saturation line.

Page 64: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

46 Implementation

Figure 4.16. Heat capacity ratio γ =CpCv

for helium with respect to p and T , within theranges p ∈ [0.01, 3.5] bar and T ∈ [1.5, 5.0] K. The flow meters treat all helium with atemperature under T = 5.0 K as liquid, and γ is actually not used in the flow calculationwithin these p, T ranges.

Figure 4.17. Heat capacity ratio γ =CpCv

for helium with respect to p and T withp ∈ [0.01, 3.5] bar and T ∈ [1.5, 300.0] K, and logarithmic γ and T axes. The diagramclearly shows that γ often takes the constant value of 5

3, when the helium is considered

to be a real gas.

Page 65: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.5 Error estimation 47

4.5 Error estimationDescribing reality with a model introduces a certain degree of errors in the es-timation, since it is rarely possible to reproduce real developments exactly withmathematical relations. In addition to this, there might also be errors due tothe numerical computations. These may be errors related to either input data orto approximations in the calculations, and they can be estimated using numeri-cal analysis. The mass flow is a function of the temperature T , the pressure p,and the valve opening. Errors in these input values may propagate in the calcu-lations and affect the resulting output. These measurements are obtained fromthe temperature, pressure, and gauge meters and their precision is thus a crucialpoint. Furthermore, these values are used to estimate ρ, Cp , and Cv by interpo-lation. This procedure involves two additional possible error sources; one is theHEPAK accuracy, that is the reliability of the actual table entries, and the otherthe interpolation in itself where the table precision is the critical point.

When using values that are already somewhat defective in calculations, theerror propagates according to some given rules. The definition of the absoluteerror εa is simply that if a0 is an approximation to a, then ε = a0−a. The relativeerror ra is then computed as ra = εa

a ≈ εa

a0. The error obeys to certain relations,

more closely described in Appendix A.

To illustrate the effects of the different error sources, the Samson method isstudied from this perspective. Similar calculations can be made for the Sereg-Schlumberger method; the magnitudes of the error sources are still the same.

The expression for calculating the mass flow for gasified helium using the Sam-son method is the following (3.9):

m(p, T ) = 14.2 ·A(pin, pout) ·Kv ·√

pin · ρ

Using the relation rf ≈ k1r1 + · · · + knrn that yields when f(x1 . . . xn) =xk1

1 . . . xknn , the relative error for the mass flow can be expressed as:

rm =εm

m= rA + rKv +

12rpin +

12rρ ≈ εA

A0+

εKv

Kv0

+12(

εpin

pin,0+

ερ

ρ0) (4.9)

The value of Kvs is obtained from a table and may not be considered as beingafflicted with errors, however Kv depends on the valve opening whose value ismeasured by a gauge meter. Therefore the contribution from rKv can not beneglected when estimating the total error.

According to (4.9) it would be more deserving finding the respective relativeerrors than the absolute ones, but it is only in the special case when f(x1 . . . xn) =xk1

1 . . . xknn that there exist a simple relation to estimate the relative error.

Studying the different errors in (4.9) gives the following description of theirdependences.

εA depends on the precision of the pressure meters, the estimation of γ - whichimplies the same dependencies as mentioned below for ρ -, and the actualcalculation of A(pin, pout).

Page 66: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

48 Implementation

εKv depends on the precision of the gauge meter measuring the valve opening,and the calculation of Kv.

εp depends only on the precision of the pressure meters and can not be expressedas a function of other errors.

ερ depends on the pressure and temperature meters, the HEPAK accuracy andthe errors due to approximations in the interpolation algorithm.

Already by this non-mathematical description of the errors it becomes evidentthat the different errors highly affect each other. However, some errors may bevery small relative to others, hence making them negligible for the total error.

Input errors

The precision in the pressure end temperature meters are obtained from [3] and [29],and presented in table 4.2.

Type of instrumentation Operation range PrecisionTemperature meter 1.6− 40 K ±0.01 KTemperature meter 50− 300 K ±5.0 KPressure meter 0.01− 0.07 bar 0.1 %Pressure meter 0− 20 bar 1 %Gauge meter (valve opening) 0− 100 % 0.5 %

Table 4.2. Pressure, temperature, and gauge meter precision.

HEPAK errors

The HEPAK accuracies differ for the density and the heat capacities. The valuesshown in table 4.3 are the upper bounds for the errors. Though, close to the criticalpoint the inaccuracy for the heat capacities is even higher, see section 3.1.2.

Density, ρ ≤ 0.5 %Heat capacities, Cp and Cv ≤ 3 %

Table 4.3. HEPAK accuracy for the density and heat capacity values.

Mathematical expressions

The calculations in this section are, if not complicated, at least tedious, why onlythe results are presented here. The calculation steps are described in more detailin Appendix A. In all the following expressions, the subscript “0” denotes theactual estimate (measurement or approximation) of a variable.

Page 67: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.5 Error estimation 49

The relative errors rA and rKv are estimated starting from (3.2) and (3.9) andcan be expressed as follows:

rKv ≈εKv

Kv,0= εl ln(R)

rA ≈ εA

A0= εP

γ0

(1

P0+ 1−γ0

2(P1

γ00 −P0)

)− εγ

γ0

(1

2(γ0−1) + ln(P0)γ0

(1 + 1

2(P

γ0γ0−10 −1)

))where P0 = pout,0

pin,0, l is the valve opening, and R the rangeability parameter

(commonly set to 50).

The absolute error for the density, ερ can be estimated from (4.8), and someapproximations - all shown in Appendix A - lead to the following expression:

ερ =εpin

pu − pl(c10

Tin,0 − Tl

Tu − Tl+ c30) +

εTin

Tu − Tl(c10

pin,0 − pl

pu − pl+ c20) + εH

The density is calculated at the inlet, meaning that the p and T values are mea-sured at the inlet to the valve.

Interpolation errors

As can be seen, the absolute error due to errors in the input data decreases whenthe distances pu−pl and Tu−Tl between the interpolation points increase. This iscompletely natural, since the influence of the faulty measurement is less importantrelative to sparse samples than to close ones. A rash conclusion could be that atable with low precision would minimize the total error. Nevertheless, this wouldrequire that the interpolated function is truly linear, which is not the case forneither the density, nor the heat capacities. The error due to the interpolationand the assumption that these non-linear functions can be treated as linear, isestimated by studying the absolute error

ϕ(θ) = f∗(pm + θ∆p, Tm + θ∆T )− f(pm + θ∆p, Tm + θ∆T )

where f∗(p, T ) is the true function value, f(p, T ) the interpolated value, ∆p, ∆Tthe distances from the interpolation point (pm, Tm) to the actual point (p, T ), andθ a parameter 0 ≤ θ ≤ 1. This expression can be developed as a Taylor seriesto the first order and the interpolation error can be expressed as the remainderincluding the second derivative. Where the first derivative can be held to describethe linear changes of a function, the second derivative shows the deviation fromthis supposed linearity.

Once such a study performed, it would be possible to see how the samplinginterval affects the interpolated value and from this the table can be designed withaccurate precision. However, in this project the study is restricted to examinethe interpolation error for the actual data tables, without bringing out a generalexpression for the error relative to the sampling interval.

Page 68: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

50 Implementation

The robustness of the interpolation algorithm was tested by implementing itin Matlab. To get an idea about the accuracy, interpolation was conducted withthe input pressure and temperature values consequently lying midway betweenthe values in the interpolation table. The interpolated values were compared toHEPAK values for the same input values, constituting a validation table. The aimof the study was to find the errors caused by the interpolation in itself, so errorsdue to HEPAK were ignored and the table entries supposed to be correct. In fact,this approximation is fairly harmless since the errors in the interpolation table andthe validation table counterbalance each other.

Not very surprising, the interpolation error is generally bigger where the func-tions are discontinuous (see figures 4.10-4.17). The most important errors henceoccur close to the saturation and λ lines where the helium changes its phase. Thisis most evident for the density, where the situation when one of the interpolationpoints lies within the range of liquid phase and the other in the gas phase, causesthe absolute error to be very big. If this absolute error is then compared to thedensity of the gasified helium, the relative error can be several hundred per cent.This obliges to keep high attention to the saturation line and requires very closesamples if one is to operate in this region. In this application, the helium is alwaysconsidered to be liquid for temperatures below 5 K (see section 4.4.3) and is notreally close to the saturation line, why the following study disregards the highinaccuracies in this region.

The figures 4.18, 4.20, and 4.22 show the relative error |f∗(p,T )−f(p,T )|f∗(p,T ) on

greyscales, where white corresponds to a error of zero and black to 0.1 = 10 % andhigher. All exceeding error values have been mapped to 0.1 and the figures showthat this only occurs along the saturation line, and for Cp on the λ line. Thesefigures give a rough idea of the magnitude of the errors, but their coarse resolutionrequires more precise tools in order to draw any conclusions.

In order to estimate the influence of the interpolation error relative to the othererrors, they are also studied with respect to one of the variables p and T at a time.The maximum errors for every p and T value respectively, are plotted againstthe actual variable in the figures 4.19, 4.21, and 4.23. In these graphs, the errorsclose to the saturation line have been truncated (set to zero) in order to betterillustrate the errors further away from this region, with their completely differentmagnitudes.

To start with the density, it can be seen from figure 4.18 that the relative error isalways less than about 1 % when going away from the saturation line. If studyingthe data tables it can actually be seen that the error hardly ever exceeds even0.5 %. This agrees well with figure 4.11 where the density shows nearly linearcharacteristics for high temperatures. In the figure 4.19, the error values close tothe saturation line have been truncated, but the peaks in both the graphs derivefrom p and T values close to this region. To be more precise, the region aroundthe critical point of T = 5.20 K and p = 2.29 bar is the most difficult.

Page 69: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.5 Error estimation 51

Figure 4.18. The interpolation error for the density, |ρ∗−ρ|ρ∗ on a greyscale plot for

p ∈ [0.01, 3.5] bar and T ∈ [1.5, 300.0] K.

Figure 4.19. The maximum interpolation error for the density, |ρ∗−ρ|ρ∗ . The upper

figure shows the error with respect to p ∈ [0.01, 3.5] bar, and the lower with respect toT ∈ [1.5, 300.0] K, with logarithmic axes.

The relative error for the heat capacity at constant pressure, Cp , shows similarcharacteristics as the error for the density, with big errors close to the saturationline. In addition, the effects of the incorrect values close to the critical point, seesection 3.1.2, spread over a larger area than only in the immediate neighborhoodof the saturation line. Furthermore, the λ line also constitutes a critical region.From the data tables, one can see that the errors might reach values up to 45 %along this line. This is visualized in figure 4.21 where the upper graph shows amaximum error constantly above 45 %. The lower of the graphs renders the samemaximum value, but only as a peak at the temperature of 2.1 K, not far from the

Page 70: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

52 Implementation

Figure 4.20. The interpolation error for the heat capacity at constant pressure, |C∗p−Cp |C∗p

for p ∈ [0.01, 3.5] bar and T ∈ [1.5, 300.0] K.

Figure 4.21. The maximum interpolation error for the heat capacity at constant pres-sure, |C

∗p−Cp |C∗p

. The upper figure shows the error with respect to p ∈ [0.01, 3.5] bar, andthe lower with respect to T ∈ [1.5, 300.0] K, with logarithmic axes.

λ transition temperature of 2.176 K. Consequently, a higher precision than thepresent one is needed in the Cp table for temperatures around this value. Morefrequent temperature samples are also desirable for pressures around and over thepressure of the critical point, p = 2.29 bar. When interpolating in regions far fromboth the saturation and the λ lines, the error is - like for the density - almostalways ≤ 1 %, a fact that corresponds well to the nearly constant Cp shown infigure 4.13.

Page 71: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.5 Error estimation 53

Figure 4.22. The interpolation error for the heat capacity at constant volume, |C∗v−Cv |C∗v

for p ∈ [0.01, 3.5] bar and T ∈ [1.5, 300.0] K. Compared to Cp in figure 4.20, the errorsclose to the saturation and λ lines are fairly small.

Figure 4.23. The maximum interpolation error for the heat capacity at constant volume,|C∗v−Cv |

C∗v. The upper figure shows the error with respect to p ∈ [0.01, 3.5] bar, and the

lower with respect to T ∈ [1.5, 300.0] K, with logarithmic axes.

The heat capacity at constant volume, Cv , does not vary as much as Cp anddoes not have the same discontinuities along the saturation line, seen already infigure 4.15. Figure 4.22 confirms this and even at the saturation line the relativeerror is bounded by about 5 %. The λ line is also less protuberant, and figure 4.23shows that the error is ≤ 2.5% here, and for the rest of the range ≤ 0.5 %.

Page 72: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

54 Implementation

Summary of the different error sources

The different relative errors presented in this section are summarized in table 4.4.The values in the table are all upper limits for the respective errors, with theexception that the interpolation errors do not pay attention to the “high riskregion” around the saturation line.

In addition there is the error introduced by the gauge meter measuring thevalve opening, which according to table 4.2 is about 0.5 %.

Range rp rT rH(ρ) rint(ρ) rH(C) rint(Cp ) rint(Cv )

T = 1.6− 40 Kp = 0.01− 0.07 bar 0.1 % 0.6 % 0.5 % 1 %* 3.0 % 10 %* 0.5 %*

T = 1.6− 40 Kp = 0− 20 bar 1.0 % 0.6 % 0.5 % 1 % 3.0 % 1 %** 0.5 %**

T = 50− 300 Kp = 0− 20 bar 1.0 % 10 % 0.5 % 0.5 % 3.0 % 1 % 0.5 %

Table 4.4. Summary of the different error sources. *The interpolation error in thisregion is without regard to the values in the absolute neighborhood of the saturationline. The high value for Cp is close to the critical point, otherwise it is ≤ 1.0 %. **Alongthe lambda line, that is close to T = 2.176 K, the error for Cp and Cv may be up to45 % and 2.5 % respectively.

The only accuracy that is possible to affect without changing instrumentationis the one of the interpolation, by varying the sampling interval in the data tables.

From table 4.4, it can be concluded that the interpolation error is often neg-ligible relative to the other errors, especially for higher temperatures where thetemperature meters are not very accurate. For the heat capacities, the error re-lated to HEPAK inaccuracy is about three times bigger than the interpolationerror and it is not useful to interpolate with so high precision in most regions.In order to not waste memory space the tables could be made smaller withoutimportant accuracy losses in the resulting mass flow.

This statement is however not without exceptions. The Cp table needs a higherprecision for temperatures around the λ line, say between 1.9− 2.5 K. The sameyields for the Cv table, even if the situation is not as bad as for Cp . The precisionalso has to be increased around the critical point for Cp . Though, at this pointthe HEPAK values are also more inaccurate.

As mentioned several times in this section, the saturation line constitutes avery critical region for interpolation. In order to reproduce the real values alongthis line, a very fine precision is needed. One problem is that with the currentprogram code, the tables have to be symmetric which could mean unnecessaryhigh precision for ranges where the functions are fairly linear. Another solutioncould then be to express the saturation line as a function of p and T and determinethe phase before interpolating. Hence different interpolation tables could be usedfor liquids and gases.

Page 73: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

4.6 Testing of the code 55

4.6 Testing of the codeAll along the development of the code, it has been tested regularly when newfunctions were added. When the Visual Basic flow meter generator and the codewere considered as sufficiently complete to make a real test, five flow meters fora fictive application were generated. Since no real analog inputs were available,a function was implemented writing varying inputs to the input data block. Thisfunction rendered “measurements” that were not always physically possible butexposed the virtual flow meters to somewhat extreme conditions in order to testtheir robustness and ability to deal with strange values.

The tests were made as simulations on the work station, connected to the PLC.The simulation was left running for long time (i.e. over the night) without inter-ruptions to increase the probability of striking into improper flow measurementsthat could block the flow meter.

4.6.1 Problems arisen during the testingWhen the flow rate has been calculated by the means of either of the flow measure-ment methods, the results are filtered in a predefined filtering function block calledLAG1ST. The name derives from its function, which is simply to filter the inputvariable with a first order time lag, assigned with either a manually specified or adefault value. This function block is fairly sensitive, meaning that once an invalidvalue is sent as input the output will be invalid until a complete restart, no matterthe actual input. Hence it is very important to remove all conceivable undefinedinput values, in order not to block the filter. The main cause for an invalid valueis if the input pressure should happen to be smaller than the output pressure (i.e.pin < pout). This is not a normal operational case but the code must be ableto deal with it since it would cause all expressions of the type

√pin − pout to be

undefined. The obvious solution to this problem would simply be an IF statementin the code, testing whether the inlet pressure actually is lower than the outputpressure. If this is the case, the last previously calculated value of the flow rate isonce again sent as input to the LAG1ST function block. It is important in the realapplication to have a real output value at any moment, and keeping the last valueis preferable to setting a default value such as zero for these cases, thus avoidingtransients.

This IF statement was implemented but did not turn out to work properly, forexample the calculation X = pin − pout sometimes gave a negative value even ifentered inside the IF statement. A quite extensive, or at least time consuming,trouble-shooting was conducted and finally it turned out that the flow calculationfunction block was by mistake called simultaneously from two different organiza-tion blocks. This meant that it was called with a frequency far too high withrespect to its cycle time and the input values changed faster than the code couldhandle them.

Page 74: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 75: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Chapter 5

Results

5.1 Comparison between the Samson and the Sereg-Schlumberger methods

When calculating the flow rate, it is possible to use either the Samson or the Sereg-Schlumberger method for flow calculation. According to the valves’ operatingconditions, one method may be a better model than another.

In the beginning of this project, the Sereg-Schlumberger method was imple-mented in Simatic S7 and the mass flow rates were calculated with measurementsfrom the Test String as input data. The results were compared to those previ-ously calculated for the Samson method with the same inputs. Measurementswere available for four different valves, of which two had two distinct sets of tem-perature and pressure measurements, ending up in a total number of six virtualflow meters. Exactly the same configurations were used as inputs to the Sereg-Schlumberger method. This simple comparison was not sufficient to draw anyconclusions concerning which method to use under which circumstances, but itgave a rough indication about the methods’ accuracies in different ranges. To doa more extensive comparison, one would need more different input data.

An important observation about this comparison is that it was conducted us-ing the defective heat capacity ratio relation (γ = Cpin/Cpout), described in sec-tion 3.4.3. To still make the comparison valid, this same relation was used for boththe Samson and the Sereg-Schlumberger methods. In the first subsection below,some of the valves are studied more closely with the particular interest to find outhow the γ calculation affects the output flow rate.

The comparison was made by calculating the percentual flow rate difference,that is the difference relative to the flow calculated with the Samson method:

∆m =

∣∣msamson − msereg

∣∣msamson

(5.1)

The results are presented in table 5.1.

57

Page 76: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

58 Results

Valve pin [bar] pout [bar] Tin [K] Tout [K] Kvs ∆m [%]CV970 1.7 1.2 19.0 13.8 3.2439 0.91CV971 1.7 1.2 19.0 13.8 11.2457 0.91CV971 (2) 1.5 1.0 19.0 13.8 11.2457 3.49CV988 10.0 2.0 19.0 75.0 25.9516 35.25CV988 (2) 15.0 1.8 19.0 300.0 25.9516 47.69CV998 1.8 1.2 19.0 19.0 11.2457 3.11

Table 5.1. Samson vs Sereg-Schlumberger method, relative mass flow rate difference,see (5.1).

For each valve, the flow rate was calculated for different valve openings rangingfrom 5 to 100 % of a fully open valve. The value of the flow rate difference isthe average value, hardly differing from the real value for any valve opening. Aremark is that for low values of the input pressure, that is .2 bar, there was nosignificant difference in the flow rate between the two methods (1− 3 % relative tothe absolute flow rate). Though, when the pressure increased the difference becamemore important with a significantly lower flow rate for the Sereg-Schlumbergermethod. For high inlet pressures, the inequality (3.13) is true and the flow rateestimated with the Samson method depends only implicitly on the outlet pressure.With this knowledge in consideration, the method could constitute a critic choicefor higher pressures when implementing the virtual flow meters. Figure 5.1 showsthe output mass flows for the valves CV971, CV998, CV988 and CV988(2) withrespect to the valve opening.

5.1.1 Effects of the γ calculation on the output flow rateIn section 3.4.3, it is described how an erroneous heat capacity ratio, γ, was used forthe flow calculations in the Test String, along with the Samson flow measurementmethod. Typically, the faulty calculation gives a γ value of about 1.0, to becompared with about 1.7 using the correct expression. Knowing that γ equals theconstant value of 5

3 for real gases, one can already here get an indication that thisway of calculating γ is probably the appropriate one. When this misconceptionbecame evident, its consequences for the resulting mass flows were studied forthree valves. These were the valves CV971, CV998, and CV988, with the sameoperating conditions as during the recently described comparison between the flowcalculation methods.

For the two first-mentioned valves, there was no difference at all in the flowrates while using the Sereg-Schlumberger method. This is simply explained bystudying the algorithm in equations 3.11, where γ actually does not affect theoutput flow when X ≤ Xc, that is when

pin − pout

pin≤ 0.6 · γ ·Km

Page 77: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

5.1 Comparison between the Samson and the Sereg-Schlumbergermethods 59

Figure 5.1. Output mass flow using the erroneous γ = Cpin/Cpout . The dottedlines show the flow estimated with Samson method, and the dashed line the Sereg-Schlumberger method. For CV988(2) the mass flow is estimated only at every othervalve opening value, therefore the less smooth curve.

For these valves this inequality is true for both values of γ, so that the inter-mediate variable Y equals 2

3 , which effectively makes the resulting mass flow rateindependent of γ.

However, when using the Samson method there was a remarkable difference.This is due to the fact that under these operating conditions the inequality 3.13leads to the case where A(pin, pout) is directly dependent of γ. Similarly to equa-tion 5.1, the following relation was used to get the relative difference between theflow rates, where mreal and merror are the mass flows obtained with the correctand erroneous γ values respectively:

∆m =|mreal − merror|

mreal(5.2)

It was found that the relative difference is about 10.43 % for CV971. ForCV998 this same value is approximately 13.08 %.

The third studied valve, CV988, had completely different operating conditions,consequently leading to different results. The situation is now the opposite as for

Page 78: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

60 Results

the two other valves. Here, the flow calculated with the Samson method remainsunchanged despite the new γ value, since A(pin, pout) in equation 3.9 is at theconstant value of 1.0 for both cases. On the contrary, the Sereg-Schlumbergermethod gives a much higher flow for the new heat capacity ratio, owing to thefact that the inequality X ≤ Xc is false with the old γ value but true for thenew one. The relative difference turned out to be as high as 43.59 %. The resultsare summarized in table 5.2 If repeating the comparison made in the previous

Valve ∆m [%], Samson ∆m [%], S-Schlum.CV971 10.43 0CV998 13.08 0CV988 0 43.59

Table 5.2. Relative flow rate difference according to (5.2).

section with these new mass flow rates, it would have been reasonable to assumethat the results would differ less, since the new rates should be more consistentwith the reality. However, this is not the case for the two first valves where therelative differences have increased from 0.91 % to 11.25 % for CV971, and from3.11 % to 8.82 %for CV998. This result is a bit unsatisfactory, making the choiceof flow calculation method more critical. It also arouses some suspicions whetherthe earlier γ calculation for the Samson method was really a mistake or rather adeliberate choice.

Though, when it comes to CV988 the accordance between the two calculationmethods is much higher than before. From the earlier relative difference of 35.25 %there is a big improvement to have “only” 14.77 %. Taking these three examples inaccount, one can now see that the relative difference between Samson and Sereg-Schlumberger is more uniform over the pressure range. This fact may be consideredas a sign of reliability concerning the implementation of the two methods, eventhough the new relations were not favourable for CV971 and CV998, and a highercorrespondence could have been desirable.

The fact that the γ calculation did not affect the valves simultaneously forthe different methods confirms what is stated in the theoretical comparison insection 3.4.6, that the conditional statements for the respective methods are seldomtrue at the same time.

Table 5.3 shows the differences in mass flow between the two methods for theerroneous and correct γ value respectively.

Valve ∆m [%], γ = Cpin/Cpout ∆m [%], γ = Cp/Cv

CV971 0.91 11.25CV998 3.11 8.82CV988 35.25 14.77

Table 5.3. Relative flow rate differences according to (5.1), when γ = Cp/Cv andγ = Cpin/Cpout respectively.

Page 79: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

5.1 Comparison between the Samson and the Sereg-Schlumbergermethods 61

Figure 5.2 shows the absolute mass flows for the studied valves CV971, CV998,and CV988 with respect to the valve opening, as well as CV988(2) for which a lessextensive check was conducted later on. Comparing these diagrams with the onesin figure 5.1 confirms that the difference between the methods is bigger for CV971and CV998, but also remarkably smaller for CV988.

Figure 5.2. Output mass flow using the correct γ = Cp/Cv . The dotted lines showthe flow estimated with Samson method, and the dashed line the Sereg-Schlumbergermethod. For CV988(2) the mass flow is estimated only at every other valve openingvalue, therefore the less smooth curve.

To summarize the results from these comparisons, it is not far-fetched to con-clude that the heat capacity ratio really should be computed as γ = Cp/Cv .Considering the statement in the beginning of this report that neither the Samsonnor the Sereg-Schlumberger methods are real flow measurement methods in thephysical sense, it is not very dramatic that there is a considerable difference be-tween the resulting flow rates. The two companies may very well consider differentdesign goals when calculating the flow through their specific valves; besides thevalves used in this project are manufactured by none of them. On the other hand,this new observation that the correspondence between the methods is fairly goodover the pressure range is a gain and it does not demand mistrust of either of themethods.

Page 80: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

62 Results

As a final check, a slightly less extensive study was conducted for the othervalve showing up a great discrepancy between the methods (named CV988 (2) intable 5.1) and the result confirmed the presumption of a higher degree of unifor-mity; the relative difference was now 18.53 % instead of 47.69 %.

5.2 Linear versus polynomial interpolationBefore starting this project, the assumption was made that linear interpolationwould give higher accuracy than the polynomial interpolation when introducingthe ρ, Cp , and Cv values from HEPAK into the PLCs. Hence the recently describedcomparison between the flow calculation methods was based on data obtained frominterpolation in tables.

One way to examine which interpolation method is the most accurate one issimply to compare the interpolated values with values generated by HEPAK forthe exact input pressure and temperature. For this purpose, a simple test wasconducted using only the code for getting the ρ and Cp values, both by linearand polynomial interpolation. This code was executed with different temperatureand pressure values, chosen by hazard not to be actual entries in the interpolationtables, thus forcing interpolation to be performed in at least one direction.

The result is shown in table 5.4 and it is easy to see that the linear interpola-tion almost always generate more accurate values. In some cases the polynomialinterpolation is better, but the inaccuracy is though negligible. Otherwise a so-lution could be to use another method, for example a method based on a largernumber of known values. Some of the values obtained by polynomial interpolationare obviously erroneous, even negative, stating that this method is not at all validfor the actual value ranges.

This test was carried out before the faulty expression for calculating the heatcapacity ratio γ was corrected, which explains why the values for the heat ca-pacity ratio at constant volume, Cv , are not studied and displayed in table 5.4.An extension of the study to cover Cv as well would not be difficult but timedemanding. Considering that Cv shows even more uniform characteristics thanCp , no sensational results compared to those already achieved are to be expectedwhy such a study is not considered necessary.

Page 81: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

5.2 Linear versus polynomial interpolation 63

HEPAK Linear interpolation Polynomial interp.p [bar] T [K] ρ Cp ρ Cp ρ Cp

0.03 2.8 0.5260 5383 0.5439 5391 0.5003 53450.03 7.3 0.1982 5205 0.1989 5205 0.2432 52200.03 12.4 0.1165 5197 0.1166 5198 0.1172 51970.05 2.3 1.107 5902 1.018 5605 0.9249 54970.05 4.4 0.5531 5263 0.5586 5265 0.6181 53241.5 5 20.86 9007 21.01 9148 20.79 89551.5 15 4.859 5346 4.860 5346 4.859 53461.5 30 2.399 5230 2.399 5230 2.249 52212.4 12 9.985 5589 9.988 5616 10.08 56002.4 43 2.670 5219 2.672 5221 0.9413 51292.4 79 1.456 5199 1.457 5199 -6.384 48313.7 59 2.994 5212 2.998 5212 -3.652 48833.7 123 1.442 5196 1.444 5196 -23.86 40563.7 358 0.4969 5193 0.4744 5193 -98.05 1017

Table 5.4. HEPAK values for ρ [kg/m3] and Cp [J/kg K] compared to those obtained bylinear interpolation and second order polynomial respectively. The extrapolated valuesare displayed in bold.

Page 82: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 83: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Chapter 6

Summary and conclusions

6.1 SummaryThis project has mainly consisted in the following parts:

Theory studies about the underlying theory concerning particularly superfluidhelium, control valves and mass flow measurement.

PLC programming, which mainly included implementing the two functions listedbelow.

Interpolation in two-dimensional tables containing physical data to esti-mate the ρ, Cp , and Cv values needed for the flow calculation. Thisapproach replaced an earlier used method with polynomial interpola-tion.

Flow calculation - or rather flow estimation, using data from physical in-strumention and the above mentioned physical properties. Two differ-ent flow measurement methods have been implemented, the Samsonand the Sereg-Schlumberger methods respectively.

Validation of the implemented methods; the bilinear interpolation approach wascompared to polynomial interpolation, and the two flow measurement meth-ods were compared to one another. Possible error sources affecting the re-sulting flow measurement were also studied.

VFT generation - a tool used to generate the Virtual flow meters in a convenientway and assigning them data from the appropriate physical instrumentationwas developped.

6.1.1 ConclusionsInterpolation methods

The accuracy in the HEPAK data introduced in the the PLCs is an importantdesign parameter to give an as correct estimation of the flow as possible. Different

65

Page 84: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

66 Summary and conclusions

interpolation methods are described in section 4.4, and the two implemented ones- polynomial and bilinear interpolation - are compared in section 5.2. From thisit can easily be deduced that the bilinear interpolation gives the most accurateresults, confirming the initial assumption.

Data table precision

The precision of the data tables and the errors they introduce to the estimatedflow relative to other error sources are studied in section 4.5. From there, it canbe deduced that the precision in the current tables in general is too high, whereasthere are ranges where substantially more frequent samples are desired in order toreproduce the real values.

Flow measurement methods

Since no measurement data have been available during this project, it has not beenpossible to draw any conclusions about the methods’ accuracies. The simulationsof the two methods have only been validated against each other, and the result fromthis is described in the section 5.1. An observation is that for low inlet pressures,the methods give fairly equal results but differ more for higher pressures. Thismay partly be explained by the fact that when the pressure drop is important -which is often the case when the inlet pressure is high - the flow estimated by theSamson flow depends only on the inlet pressure according to (3.9).

Flow meter generation

The development of a flow meter generator was chiefly a quantitative work, notgiving raise to any qualitative analysis of methods used. One comment upon thegeneration is that it is crucial that the configuration file containing the inputmeasurements holds the correct format, that is that the correct data are enteredin the accurate columns according to the specific interface constraints. The sameyields when creating S7 data blocks from the HEPAK data, see section 4.2 andAppendix B.

6.2 Suggestions for future workThe obvious next step in this work is to test the virtual flow meters with thereal input data from the cooling down of the LHC machine. This is predicted tostart by beginning of January 2007, so the data should be available in early 2007.At this time, measurement data for the pressure, temperature and gauge meterscan be used as inputs, and the simulated result can be validated against real flowmeasurements. Hence, it will be possible to really see which of the Samson andthe Sereg-Schlumberger methods that is the most convenient, and if one is moresuitable than the other under certain operation conditions.

Page 85: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

6.2 Suggestions for future work 67

One of the primary possible further developments of the virtual flow meters isto implement new flow measurement methods. The code is prepared for this andas long as the interface constraints are obeyed, it is a simple thing to add a newmethod.

During the last weeks of this project, the first steps were taken to introduce thegenerated virtual flow meters in the supervision system PVSS. Here it is possibleto graphically present the flow meters and see the current input and output values,and hence control the valves (that is, the valve openings), to obtain the desiredmass flow. If it is established that the virtual flow meters describe the actual massflow in an accurate way, their outputs can be used with good reliability as an inputto a regulator, which in itself is one more development to do.

6.2.1 Conceivable improvements of the current applicationRegarding the current application, there are some improvements to do, not havingto involve any of the new methods or applications described above.

One possible improvement is to pay higher attention to the actual physicalproperties of helium. For example, the Sereg-Schlumberger method exists notonly for the gas and liquid states of helium, but also for the liquid-gas coexistenceregion. In this project, the helium is considered to be either gas or liquid, butalong the saturation line there is a region where the helium shows gas and liquidproperties simultaneously.

When it comes to the saturation line, a somewhat rough approximation isdone in this project, stating that the helium is in its liquid phase as soon asthe temperature is below 5 K, see section 4.4.3. This simplification is a possiblesource of error and the real saturation line can be rendered in a more veraciousway, for example approximated by a function dependent on the pressure and thetemperature.

In the same section the possibility of using different data tables for differentphases is discussed. The decision was made not do this use in this project, but itcould still be of interest to investigate what the consequences would be when itcomes to execution time and needed memory space to have several tables. In thisproject the data tables are linear, but according to characteristics of especiallythe heat capacity ratios, with nearly constant values at large ranges, logarithmictables could probably be a more appropriate solution. In this case, the interpola-tion points should be found using the logarithmic scale, whereas the interpolationshould still be carried out with the linear values.

The valves closest to the magnets are the so called Joule-Thomson valves. Asdescribed in section 3.3, liquid helium at the valve inlet is subjected to a pressuredrop, which causes part of the helium to evaporate. This vapoured helium is thenled back to a heat exchanger. However, the flow measurement method only calcu-lates the total mass flow through the valve and does not take the Joule-Thomsoneffect into consideration, that is the flash is not calculated and consequently notthe respective gas and liquid mass flows. This could be an amelioration and a wayto refine the knowledge of the actual liquid flow to the magnet cold masses, as wellas the amount of gas led back to the heat exchanger.

Page 86: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 87: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Bibliography

[1] B Backman. Future Upgrades of the LHC Beam Screen Cooling System.Master’s thesis, Linköpings Universitet, 2006.

[2] E. V. Blanco. Superfluid Helium Cooling Loop on String 2. Technical report,CERN, Octobre 2003.

[3] E. V. Blanco. Nonlinear Model-based Predictive Control Applied To LargeScale Cryogenics Facilities. PhD thesis, Universidad de Valladolid, July 2001.

[4] P. Brüning et al. LHC Design Report, Volume I The LHC Main Ring.Technical Report 2004-003-v1, CERN, June 2004. Also available at http://doc.cern.ch.

[5] J-L. Caron. Cross section of LHC dipole. http://doc.cern.ch, May 1998.CERN, AC Collection. Legacy of AC.

[6] CERN. AB-CO-IS section. http://ab-dep-co-is.web.cern.ch/ab-dep-co-is/, Octobre 2006.

[7] CERN. FAQ: The LHC. http://public.web.cern.ch/public/Content/Chapters/AskAnExpert/LHC-en.html, August 2006.

[8] CERN. LHC cryogenics. http://lhc-machine-outreach.web.cern.ch/lhc-machine-outreach/components/cryogenics.htm, August 2006.

[9] P. C. Chau. Valve characteristics and steady state gains. Technical report,Cambridge University Press, 2001.

[10] User’s Guide To HEPAK. Cryodata, INC, Louisville, Colorado, January 1999.Version 3.4.

[11] Taftan Data. Perfect gas or ideal gas. http://www.taftan.com/thermodynamics/IDEALGAS.HTM, November 2006.

[12] R.C. Dorf, editor. The Engineering Handbook. CRC Press, California, 1996.

[13] W. Erdt, G. Riddone, and R. Trant. The cryogenic distribution line for theLHC: Functional specification and conceptual design. LHC Project Report326, CERN, December 1999. Also available at http://doc.cern.ch.

69

Page 88: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

70 BIBLIOGRAPHY

[14] Everyscience.com. Introduction to phase diagrams. http://www.everyscience.com/Chemistry/Physical/Phases/a.1122.php, December2006.

[15] W.H. Flannery et al. Numerical Recipes in C, The Art of Scientific Comput-ing, chapter 3.6., pages 123–128. Cambridge University Press, 2nd edition,2002. Also available at http://www.nrbook.com/a/bookcpdf/c3-6.pdf.

[16] T.M. Flynn. Liquefaction of gases. AccessScience@McGraw-Hill, http://www.accessscience.com, December 2006. DOI 10.1036/1097-8542.385800.

[17] V. Frigo. LHC map in 3D. http://doc.cern.ch//archive/electronic/cern/others/PHO/photo-lhc//LHC-PHO-1997-237.jpg, March 1997.CERN, AC Collection. Legacy of AC.

[18] F. Gustafsson, L. Ljung, and M. Millnert. Signalbehandling. Studentlitter-atur, Lund, 2nd edition, 2001.

[19] P. Lebrun. Superfluid helium as a technical coolant. LHC Project Report125, CERN, December 1997. Also available as http://doc.cern.ch.

[20] L. Liu, G. Riddone, and Tavian L. Numerical analysis of cooldown andwarmup for the Large Hadron Collider. Cryogenics, 43(6):359–367, June 2003.Also available at http://doc.cern.ch.

[21] Y. Lyubarskii. Lecture notes, TMA4170 Fourieranalyse, NTNU. http://www.math.ntnu.no/~yura/h05/TMA4170/notes6.pdf, Octobre 2006.

[22] C Nordling and J. Österman. Physics Handbook for Science and Engineering.Studentlitteratur, Lund, 6th edition, 1999.

[23] L. Råde and B. Westergren. Mathematics Handbook for Science and Engi-neering. Studentlitteratur, Lund, 4th edition, 1998.

[24] J. Roll. Lecture notes, TSTR62 Modelling and Simulation, Linköping Uni-versity. http://www.control.isy.liu.se/student/tsrt62/, June 2006.

[25] Samson AG. Samson AG Mess- und Regeltechnik. http://www.samson.de,January 2007.

[26] Schlumberger Inc. http://www.slb.com/, January 2007.

[27] L. Serio. The Cryogenics Circuit of String 2. Engineering specification LHC-XMS-ES-0003, CERN, Octobre 2000. Also available at https://edms.cern.ch/file/114371/1.1/lhc-xms-es-0003-00-11.pdf.

[28] L. Serio. From String 2 To The Sector Test: The Tunnel Cryogenic System.Technical report, CERN, January 2001. Also available at http://sl-div.web.cern.ch/sl-div/publications/chamx2001/PAPERS/6-2-ls.pdf.

[29] Sipart PS2 electropneumatic positioners. Siemens, 2000. Also available athttp://www.cashco.com/iom/ps2.pdf.

Page 89: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

BIBLIOGRAPHY 71

[30] Steam Engingeering Learning Modules: Module 6.5, Control Valve Charac-teristics. Spirax-Sarco Learning Centre, Gloucestershire, United Kingdom,2002-2005.

[31] J. G. Weisend II, editor. Handbook of Cryogenic Engineering. Taylor &Francis, 1st edition, 1998.

[32] Wikipedia. Bicubic interpolation. http://en.wikipedia.org/wiki/Bicubic_interpolation, Octobre 2006.

[33] Wikipedia. Runge’s phenomenon. http://en.wikipedia.org/wiki/Runge’s_phenomenon, November 2006.

Page 90: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system
Page 91: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Appendix A

Error estimation

This appendix contains the more detailed calculations behind the resulting expres-sions in section 4.5 about error estimation.

When using values that are already somewhat defective in calculations, theerror propagates according to some given rules. The definition of the absoluteerror εa is simply that if a0 is an approximation to a, then ε = a0−a. The relativeerror ra is then computed as ra = εa

a ≈ εa

a0. The error obeys to the following

relations, all stated from Råde and Westergren [23]:

εa+b = εa + εb εa−b = εa − εb

rab =εab

ab≈ εa

a+

εb

bra/b =

εa/b

a/b≈ εa

a− εb

bεf(a) ≈ εaf ′(a0) εf(a,b) ≈ εaf ′

a(a0, b0) + εbf′b(a0, b0)

A special case occurs when f(x1 . . . xn) = xk11 . . . xkn

n . If ri are the relativeerrors for the respective xi, then the relative error for the function f(x1 . . . xn)can be calculated as rf ≈ k1r1 + · · ·+ knrn.

The total error for the Samson method is presented in section 4.5 as (4.9):

rm =εm

m= rA + rKv +

12rpin +

12rρ ≈ εA

A0+

εKv

Kv0

+12(

εpin

pin,0+

ερ

ρ0) (A.1)

Since A(pin, pout) depends on the fraction poutpin

, this later can be treated as onevariable, called P , and the errors for pin and pout respectively can be obtainedfrom the relation for fractioned variables. The expression (3.9) for A(pin, pout) canbe rewritten as A(P ):

A(P ) = 1.379 ·( 2γ

γ − 1) 1

2 ·P1γ · (1− P

γ−1γ )

12 = f(P, γ)

The absolute error can now be estimated using the relation for functions of two

73

Page 92: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

74 Error estimation

variables, resulting in the following:

εA ≈ εP f ′P (P0, γ0) + εγf ′

γ(P0, γ0) =

= εP · 1.379γ0

·√

2γ0γ0−1 ·

(P

1−γ0γ0

0 ·

√1− P

γ0−1γ0

0 − γ0−1

2

r1−P

γ0−1γ0

0

)−

− εγ · 1.379 ·(P

1γ00 ·

r1−P

γ0−1γ0

0

(γ0−1)2 ·q

2γ0γ0−1

+

+ ln(P0)γ20

·√

2γ0γ0−1 · (P

1γ00 ·

√1− P

γ0−1γ0

0 + P0

2

r1−P

γ0−1γ0

0

))

(A.2)

In this expression, εγ is used as an error variable. However, this variable canbe expanded further, as γ is a function of Cp and Cv . This is treated below,along with the estimation of ερ. The error of the fractioned variable P0 can besubstituted by εP =

( εpoutpout,0

− εpinpin,0

)· pout,0

pin,0.

The expression for the relative error rA =εA

A0is somewhat simpler than (A.2)

and takes the following form:

rA ≈ εP

γ0

( 1P0

+1− γ0

2(P1

γ00 − P0)

)− εγ

γ0

( 12(γ0 − 1)

+ln(P0)

γ0

(1+

1

2(Pγ0

γ0−1

0 − 1)

))(A.3)

Analogously, εKv is estimated starting from how Kv is computed, which for anequal percentage valve is (3.2):

Kv = Rl−1Kvs = f(l)

where l is the valve opening. This gives the following absolute and relative errorsfor Kv:

εKv ≈ εlf′(l0) = εlR

l0−1 ln(R)Kvs

rKv ≈εKv

Kv,0= εl ln(R)

(A.4)

In section 4.5, (A.3) and (A.4) are the same as (4.5).

To write ερ as a function of εp, εT , and the errors due to HEPAK accuracy, εH ,one starts with the general bilinear interpolation function (4.8):

ρ = c1qTqp + c2qT + c3qp + c4 = f(qp, qT, c1, . . . , c4)

The errors related to the HEPAK accuracy are introduced in the ci coefficients.These coefficients depend on the function values at the interpolation points accord-ing to (4.6):

c1 = fuu + fll − flu − ful

c2 = flu − fll

c3 = ful − fll

c4 = fll

Page 93: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

75

To simplify the calculations, it can be assumed that the HEPAK accuraciesand hence the relative errors are the same at the four interpolation points. This isnot completely true, see section 3.1.2, but the differences are sufficiently small tobe ignored. Since the interpolation points are neighbouring their absolute valuesare of the same magnitude and the absolute errors for the HEPAK values can beestimated as εH for all the points. The respective errors for the ci:s can then beexpressed as:

εc1 ≈ εH + εH − εH − εH = 0εc2 ≈ εH − εH = 0εc3 ≈ εH − εH = 0εc4 ≈ εH

(A.5)

Consequently, the only coefficient that contributes to the total error is c4.The absolute error for ρ then becomes:

ερ ≈ εqpf′qp

(qp0 , qT0 , ci0) + εqTf ′qT

(qp0 , qT0 , ci0) + εc4f′c4

(qp0 , qT0 , ci0) == εqp(c10qT0 + c30) + εqT(c10qp0 + c20) + εH · 1 (A.6)

The errors due to lack of precision in the temperature and pressure meters arenow embedded in εqp and εqT where qp and qT are functions of p and T respectively:

qp =p− pl

pu − pland qT =

T − Tl

Tu − Tl

Using εf(a) ≈ εaf ′(a0), they can be substituted by the actual errors εp and εT :

εqp ≈εp

pu − pland εqT ≈

εT

Tu − Tl

Which eventually makes it possible to express ερ by means of only the “pure”errors εp, εT , and εH . The density is calculated at the inlet, meaning that the pand T values are measured at the inlet:

ερ =εpin

pu − pl(c10

Tin,0 − Tl

Tu − Tl+ c30) +

εTin

Tu − Tl(c10

pin,0 − pl

pu − pl+ c20) + εH (A.7)

This result is presented as (4.5) in section 4.5.

The absolute errors for Cp and Cv can be estimated in the same way as for ρin (A.7). These are not implicitly involved in (A.3), but they are used to estimatethe error for γ:

γ =Cp,average

Cv,average=

(Cpin + Cpout)/2(Cvin + Cvout)/2

=Cpin + Cpout

Cvin + Cvout

⇒ εγ ≈( εCpin

+ εCpout

Cpin,0 + Cpout,0

−εCvin

+ εCvout

Cvin,0 + Cvout,0

)·Cpin,0 + Cpout,0

Cvin,0 + Cvout,0

(A.8)

Page 94: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Appendix B

Help file, VFT generator

This appendix contains the help file for the VFT generator, starting on the nextpage. This file describes the use of the generator in itself, as well as how to generatedata blocks containing data from HEPAK.

76

Page 95: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Table of contents Overview Generating Source Files

Select File and Select Target buttons Config. Specifications Generate button View Log, Help and Open Target Directory

Generated Flow Meters Flow calculation method

Implementing the S7 Code Create project Import Symbol Table Import Source Files

Modifications Generating HEPAK data tables

Overview This program generates VFTs (virtual flow meters) by creating source files for instance data blocks and function block calls in Siemens SIMATIC Manager S7. Specific source files are created for each application (that is LSSL/LSSRxy and ARCxy, where xy is the sector number). Every application represents exactly one PLC. The following source files are created: - Symbol table (VFT_symbol_NNxy.sdf) - Instance data blocks (VFT_DB_Inst_NNxy.scl) - Function block calls (VFT_FC_VFLOW_NNxy.scl) - Compilation file (10_compilation_VFT_NNxy.inp) A log file presenting the result of the generation is created as a text file: - Log File (VFT_log_NNxy.txt)

Generating Source Files

Select File and Select Target buttons In order to generate the source files an Excel configuration file with the analog inputs and a target directory are required. Select those by clicking the “(1) Select File” and the “(2) Select Target” buttons respectively and browse in the dialog windows that open. The filename and filepath will be displayed in the text boxes next to the buttons. Until these steps are carried out, the “Generate” button is disabled.

Configuration Specifications The four text boxes labeled “Configuration Specifications” show the block numbers of the first instance data block, the function block for calculating the flow, the function for calling the flow meters and the first data block containing HEPAK data. There are predefined values (100 for the first instance DB, 70 for the FB, 70 for the FC and 70 for the first HEPAK DB) but custom values may be specified instead.

77

Page 96: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Generate button When clicking the “(3) Generate” button, the flow meters are generated according to the given specifications (input file, output directory, block number, flow calculation method). The name of the current application and the name for the actual PLC will be displayed next to the “Generate” button. The bar below the button shows the generation progress. If any data are missing when this button is clicked, a message box will show up requesting the user to correct this. If a block number is missing in the text boxes, the default value for the actual block will be suggested but the generation will not start until the “Generate” button is clicked again.

View Log, Help and Open Target Directory When the execution is finished a message box shows up telling the number of generation errors, if any. By clicking "View log", the log of the generation will be displayed allowing tracking of the eventual errors. The log file indicates any missing input data in the Excel file (line and type of missing data). In the case of incomplete inputs, no VFT is generated for that specific valve. The total number of correctly generated VFTs, their respective data block numbers, and the application specific blocks that are generated are also displayed in the log file. All generated files are saved in the specified target directory, accessible by clicking the “Open Target Directory” button.

78 Help file, VFT generator

Page 97: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Generated Flow Meters Every generated flow meter is represented by one instance data block. Each instance DB is assigned to a specific call to the FB Virtual_FT that calculates the mass flow; these calls are made from the function VFLOWMETERS. The input variables to Virtual_FT are the inlet and outlet pressure and temperature respectively, the valve opening, and the valve coefficient Kvs. The five former ones are all analog inputs assigned with symbolic addresses in the Excel file, whereas the latter are given as absolute numbers. Once an analog input is found, the generator searches this entry in the file and decides whether it is stored in the data block DB_AIC_all.AIC_SET or DB_AIC_all2.AIC_SET. There are two data blocks since one single block only stores 1000 entries, which is less than the total number of inputs. If the pressure meter PT811 is used as input, the real value is divided by 1000 since this measurement is done in the unit millibar instead of bar. If a flow meter does not have an assigned Kvs value, it is not generated as a virtual flow meter, but no error message is raised.

Flow calculation method At the moment there is an option between two possible flow calculation methods. Samson and Sereg-Schlumberger. The choice between these two methods is not made in the generator but directly in the S7 FB by setting the integer variable “method” to either 1 (Samson) or 2 (Sereg-Schlumberger).

Implementing the S7 Code

Create project The import of the source files into Simatic Step 7 has to be done manually. Open Simatic Step 7 and open the already generated UNICOS project.

Import Symbol Table In S7, open the symbol table which at the moment has no entries, and import the symbols from the .sdf- file in the target directory. Make sure to save the symbol table.

Import Blocks From the S7 library called “VFT_library”, copy the following predefined function blocks (one or more of the blocks may already exist in the UNICOS project, if this is the case they should be replaced by the predefined ones): FB 9 LAG1ST FB 12 LIMITER FB 15 NONLIN

Import Source Files From the same library, copy the following SCL source files that are common for all applications: VFT_InterpolationDB (DBs containg the ρ and Cp tables (HEPAK data)) VFT_Virtual_FT (FB calculating the mass flow) Insert new source files in the project by importing the generated external sources, that is: VFT_DB_Inst_NNxy.scl VFT_FC_VFLOW_NNxy.scl 10_compilation_VFT_NNxy.inp Now all the necessary source code files are imported and the project may be compiled. This is simply done by compiling the SCL compile control file 10_compilation_VFT, which compiles all the SCL sources.

79

Page 98: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

Launch program The program is launched from the projects Organization Block 1. For this purpose, the following line shall be included in the OB1 source file to the call of the VFT calculation: // Executing calculation of virtual flow meters

VFT_Virtual_FT();

Outputs Outputs from the S7 file are:

- The resulting mass flow in gram per second - Status bit that is set to 1 if at least one of the bits 0-5 in the internal error

vector are set to 1 for the following reasons: 0: Inlet pressure out of range 1: Outlet pressure out of range 2: Inlet temperature out of range 3: Outlet temperature out of range 4: Pin <= Pout 5: (negative ρ => interpolation error!) 6: 7: 0 if vapour, 1 if liquid

Modifications

Generating HEPAK data tables The HEPAK data tables are generated using a Visual Basic macro in an Excel file, to which the HEPAK data are entered. The current ranges are 1.5K – 300K for the temperature and 1mbar – 3.5bar for the pressure, with the following resolution in different ranges:

T [K] 1.5-2 2.2-3 3.25-10 10.5-20 21-30 32-50 55-80 90-300 ΔT [K] 0.10 0.20 0.25 0.50 1.0 2.0 5.0 10

p [bar] 0.01 0.1-1.0 1.2-2 2.25-3.5 Δp [bar] 0.10 0.20 0.25

The tables are symmetric, meaning that there is one measured value for every T-p pair in the above mentioned ranges. If other ranges are desired, the values must first be generated in HEPAK. The inputs are pressure p [bar] and temperature T [K]. Outputs are the density ρ [kg/m3], and the two heat capacities Cp and Cv [J/gK]. Each output has to be generated for every possible (p,T) pair in the desired ranges to keep the table symmetry. However, it is not necessary to keep the same ranges for ρ, Cp, and Cv since the tables are independent of each other and constitutes one data block each in the S7 code. Thereafter, the data should be imported in the Excel file Completetable.xls. This file has two assigned Visual Basic modules. One is called Datablocks and generates text files that can be imported into Simatic data blocks; the other is called Exceltables and generates the tables on a matrix form in Excel. These tables do not have any other use than to explicitly present the HEPAK data in an easy readable way. When importing the HEPAK data in Excel the following constraints must be respected in order to make the macro work correctly:

• Import the data to the CompleteTable worksheet. • Make sure that the data are presented in the following column order:

- Col 1: Pressure - Col 2: Temperature - Col 3: Density (ρ) - Col 4: Heat capacity at constant volume (Cv) - Col 5: Heat capacity at constant pressure (Cp)

• Sort the data in ascending order by the first column (pressure).

80 Help file, VFT generator

Page 99: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

• The first line with data should be line 4 (allowing one line with the name of the column, one with the unit used and one empty line before the data begins).

• It is of highest importance that there are the same number of temperature measurements for every pressure temperature, i.e. that the respective tables are symmetric, and that there are no empty or duplicated lines in the Excel file.

The module Datablocks generates three text files for ρ, Cp, and Cv respectively: - VFT_Cp_tables.txt - VFT_Cv_tables.txt - VFT_rho_tables.txt

These files are saved in the current directory and are to be imported into Simatic S7 by simply copying and pasting into the SCL source file VFT_InterpolationDB in the library VFT_library.

Troubleshooting

Single errors in the log file All errors during generation are reported in the log file, giving the source of the current error. Single errors may due to missing input data or input data on an incorrect form.

The log file indicates the line in the configuration file where the error occurred. If there is no input at all, the type of the lacking input is stated; if there is a value for the input but the specific input is not found in the configuration file, its name is indicated.

Multiple errors in the log file If there is a large amount of errors of the type ”Missing value for xx”, a likely cause is that the input configuration file does not fulfill the interface constraints. The generator will not know whether the input is of the correct type, for example it could assign the measurement from a temperature meter to a pressure variable, and hence no error will be reported. However, a column displacement will inevitably cause an empty column for at least one input variable, leading to missing input data. The correct columns for the configuration data are the following:

A Equipment B Location C Name

BX Kvs CA Valve opening CB Inlet temperature CC Outlet temperature CD Inlet pressure CD Outlet pressure

This error can be corrected either by moving the inputs to the correct column in the configuration file (best solution if there are only occasional incorrect files) or by changing the strings indicating the columns in the generator code (best solution if for example the interface constraints change). These are given as constants in the declaration section of the code.

81

Page 100: Virtual instrumentation: Introduction of virtual flow ...23146/FULLTEXT01.pdf · Virtual instrumentation: Introduction of virtual flow meters in the LHC cryogenics control system

På svenska Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare – under en längre tid från publiceringsdatum under förutsättning att inga extra-ordinära omständigheter uppstår.

Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och för undervisning. Överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av dokumentet kräver upphovsmannens medgivande. För att garantera äktheten, säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ art.

Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i den omfattning som god sed kräver vid användning av dokumentet på ovan beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan form eller i sådant sammanhang som är kränkande för upphovsmannens litterära eller konstnärliga anseende eller egenart.

För ytterligare information om Linköping University Electronic Press se förlagets hemsida http://www.ep.liu.se/ In English The publishers will keep this document online on the Internet - or its possible replacement - for a considerable time from the date of publication barring exceptional circumstances.

The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for your own use and to use it unchanged for any non-commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility.

According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement.

For additional information about the Linköping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its WWW home page: http://www.ep.liu.se/ © Erika Ödlund