162
ECE 4600 Group Design Project Design and Implementation of an Electromagnetic-Based Hydraulic Cylinder Positioning System by Group 01 Trevor Brown Christopher Dynowski Chaitanya Narendra Alison Smith Tyler Tiede Final report submitted in partial satisfaction of the requirements for the degree of Bachelor of Science in Electrical and Computer Engineering in the Faculty of Engineering of the University of Manitoba Academic Supervisor(s) Ian Jerey, Ph.D. Department of Electrical and Computer Engineering University of Manitoba Industry Supervisors Paul Card, Ph.D. – 151Research Inc. Colin Gilmore, Ph.D. – 151Research Inc. Date of Submission March 10, 2014 Copyright © 2014 Trevor Brown, Christopher Dynowski, Chaitanya Narendra, Alison Smith, Tyler Tiede

Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

  • Upload
    doannhu

  • View
    221

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

ECE 4600 Group Design Project

Design and Implementation of anElectromagnetic-Based Hydraulic Cylinder

Positioning System

byGroup 01

Trevor Brown Christopher DynowskiChaitanya Narendra Alison Smith

Tyler Tiede

Final report submitted in partial satisfaction of the requirements for the degree of

Bachelor of Science in Electrical and Computer Engineering in the

Faculty of Engineering of the University of Manitoba

Academic Supervisor(s)

Ian Je↵rey, Ph.D.Department of Electrical and Computer Engineering

University of Manitoba

Industry Supervisors

Paul Card, Ph.D. – 151Research Inc.

Colin Gilmore, Ph.D. – 151Research Inc.

Date of Submission

March 10, 2014

Copyright © 2014 Trevor Brown, Christopher Dynowski, Chaitanya Narendra, AlisonSmith, Tyler Tiede

Page 2: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning
Page 3: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System

Abstract

The purpose of this project was to develop an unloaded hydraulic cylinder positioning sys-

tem that uses an embedded antenna as the primary sensor. In this type of positioning

system, the piston of the cylinder is moved to a user-specified target position. Successful

implementation of this positioning system was contingent on the ability to establish a re-

lationship between the piston position and the antenna’s S11. Using a balanced antipodal

Vivaldi antenna (BAVA), resonance was observed at particular frequencies in the antenna’s

S11, at which the radiation was able to enter the cavity. Consequently, a correlation between

the piston position and resonant frequencies in S11 exists and was exploited.

The positioning system requires a Vector Network Analyzer (VNA) to perform a wide-

band frequency measurement of the antenna’s S11 for a given piston position. The magni-

tude of the S11 is extracted from the VNA and processed to extract the resonant frequencies.

This information is then supplied to a predictive algorithm that compares the present set

of resonant frequencies to a bank of calibration data containing the resonant frequencies

obtained across the entire stroke length. The algorithm returns the position that corre-

sponds to the most similar calibration data set, e↵ectively measuring the position of the

piston. Knowledge of the piston position may then be passed to a control system that will

accurately position the piston based on user input. The user interacts with the positioning

system through a graphical user interface (GUI).

The performance of the positioning system was measured by the accuracy and repeata-

bility of the measurement subsystem and overall positioning system, the response time of

the overall system to user input, and the response time of an emergency stop mechanism.

The measurement subsystem’s maximum error was 4 mm and its repeatability will always

be 0 mm. The positioning system’s maximum error and repeatability were determined to

be 9 mm and 15 mm, respectively. Finally, the maximum response times of the system to

user input and the emergency stop mechanism were 1.15 s and 0.86 s, respectively. All mea-

surable aspects of the positioning system’s performance met the project’s specifications.

- i -

Page 4: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System

Contributions

This design project resulted in a hydraulic cylinder positioning system that uses an em-

bedded antenna as a single element position sensor. The design is novel as it provides an

internal method of measuring piston position that does not require gun-drilling of the piston

rod and that utilizes modern computing software and hardware.

The following people have made significant contributions to this project:

• Our supervisor, Dr. Ian Je↵rey, who mentored us with his experience and expertise.

His perspective on the project helped us consider all angles in order to complete the

project successfully and on time. Dr. Je↵rey also gave us valuable feedback on our

numerous reports and presentations.

• 151Research Inc. provided the LabJack U3 and RB12 units along with a pump and

cylinder.

• Dr. Colin Gilmore provided previous data collected from a monopole antenna mounted

to an unpressurized hydraulic cylinder.

• Dr. Majid Ostadrahimi allowed us to use an antenna that he originally designed for

microwave imaging.

• Mr. Cory Smit was responsible for the fabrication of the collar and the antenna

mount required to install the antenna inside the cylinder. He also provided tools and

equipment that were used throughout the design project.

• Mr. Allan McKay, Mr. Daryl Hamelin, and Mr. Cory Smit provided knowledge

regarding the type of the original pump.

• Mr. Sinisa Janjic helped order various electrical components required for the project.

- ii -

Page 5: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System

The breakdown of the project between team members is listed in the table below.

TrevorBrown

Christop

her

Dyn

owski

Chaitany

aNaren

dra

AlisonSmith

Tyler

Tiede

Apparatus Assembly • � �Antenna Design and Simulation • �VNA-PC Interface •Predictive Algorithm Development � •Measurement Program Development � •Pump Control System Development � •System Integration and Testing • � � � �Final Report • • • • •

Legend: • Lead task � Contributed

- iii -

Page 6: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System

Acknowledgements

First and foremost, we would like to thank our academic supervisor, Dr. Ian Je↵rey, for his

immense support and guidance, without which this project would not have been possible.

We would also like to thank our industry supervisors Dr. Paul Card and Dr. Colin Gilmore

for their advice, for the donated equipment, and for their financial support.

We would like to thank 151Research Inc. and the University of Manitoba for covering

all of the costs of the project. Furthermore, the group would like to extend special thank you

to Dr. Joe LoVetri for providing us with the space and equipment in the Electromagnetic

Imaging Laboratory (EIL) necessary for testing.

We would like to express our appreciation for the valuable feedback by Dr. Behzad

Kordi, Mr. Daniel Card, and Ms. Aidan Topping on all of the coursework performed in

ECE 4600.

We would like to extend our gratitude to Dr. Majid Ostadrahimi for his suggestions

on antenna encapsulation, guidance in using equipment in the EIL, and for granting us

permission to use his antenna design.

We would like to thank Dr. Puyan Mojabi for his recommendation of COMSOL Mul-

tiphysics Simulation Software to perform antenna simulations and recommendation of dif-

ferent antenna designs.

We greatly appreciate the advice and excellent craftsmanship of Mr. Cory Smit in the

Electrical and Computer Engineering (ECE) Machine Shop, and the help and expertise of

Mr. Allan McKay, Mr. Daryl Hamelin, and Mr. Sinisa Janjic as ECE support sta↵.

Finally, we would like to thank our friends and families for their encouragement through-

out the course of this project.

- iv -

Page 7: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System TABLE OF CONTENTS

Table of Contents

Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i

Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii

Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv

List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii

List of Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

1 Introduction 1

1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Project Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.3 System Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.4 Positioning System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.5 Positioning System Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.5.1 Hydraulic Cylinder and Pump . . . . . . . . . . . . . . . . . . . . . 5

1.5.2 Antenna and VNA . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.5.3 PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.5.4 LabJack Components . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.6 Final Introductory Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Background 8

2.1 Brief Overview of Hydraulic Systems . . . . . . . . . . . . . . . . . . . . . . 8

2.2 Position Sensing Hydraulic Systems . . . . . . . . . . . . . . . . . . . . . . 10

2.3 Underlying Electromagnetic Theory . . . . . . . . . . . . . . . . . . . . . . 13

3 System Design 15

3.1 Apparatus and Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.1.1 Hydraulic Cylinder Bidirectionality Problem . . . . . . . . . . . . . 16

- v -

Page 8: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System TABLE OF CONTENTS

3.1.2 Protective Collar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.1.3 Drift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.1.4 Cylinder Mounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.2 Antenna Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.2.1 Antenna Design Criteria . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.2.2 Antenna Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.2.3 Antenna Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

3.2.4 Antenna Testing and Results . . . . . . . . . . . . . . . . . . . . . . 33

3.2.5 Antenna Mounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

3.3 Predictive Algorithm Development . . . . . . . . . . . . . . . . . . . . . . . 39

3.3.1 Predictive Algorithm Design Criteria . . . . . . . . . . . . . . . . . . 40

3.3.2 Calibration Data Processing . . . . . . . . . . . . . . . . . . . . . . . 40

3.3.3 Artificial Neural Network Algorithm . . . . . . . . . . . . . . . . . . 41

3.3.4 Nearest-Neighbour Algorithm . . . . . . . . . . . . . . . . . . . . . . 49

3.3.5 Interpolation Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 54

3.3.6 Final Algorithm Selection . . . . . . . . . . . . . . . . . . . . . . . . 63

3.4 Measurement System Development . . . . . . . . . . . . . . . . . . . . . . . 63

3.4.1 Measurement System Component Overview . . . . . . . . . . . . . . 64

3.4.2 Measurement System Design Criteria . . . . . . . . . . . . . . . . . . 64

3.4.3 VNA - PC Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

3.4.4 Predictive Algorithm Integration . . . . . . . . . . . . . . . . . . . . 67

3.4.5 Measurement System Assembly . . . . . . . . . . . . . . . . . . . . . 69

3.4.6 Measurement System Testing and Results . . . . . . . . . . . . . . . 72

3.5 Control System Development . . . . . . . . . . . . . . . . . . . . . . . . . . 74

3.5.1 Control System Design Criteria . . . . . . . . . . . . . . . . . . . . . 75

3.5.2 Control System Design . . . . . . . . . . . . . . . . . . . . . . . . . . 76

3.5.3 Control System Testing and Results . . . . . . . . . . . . . . . . . . 88

4 System Integration 90

4.1 Measurement and Control System Integration . . . . . . . . . . . . . . . . . 90

4.1.1 Hydraulic Cylinder Positioning System Overview . . . . . . . . . . . 90

4.1.2 Positioning System Integration Issues and Solutions . . . . . . . . . 91

4.1.3 Graphical User Interface . . . . . . . . . . . . . . . . . . . . . . . . . 94

4.2 Positioning System Verification and Results . . . . . . . . . . . . . . . . . . 98

4.2.1 Positioning System Accuracy Verification . . . . . . . . . . . . . . . 98

- vi -

Page 9: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System TABLE OF CONTENTS

4.2.2 Positioning System Repeatability Verification . . . . . . . . . . . . . 99

4.2.3 Response Time Verification . . . . . . . . . . . . . . . . . . . . . . . 99

4.2.4 Emergency Stop Response Time Verification . . . . . . . . . . . . . 99

4.2.5 System Specification Results . . . . . . . . . . . . . . . . . . . . . . 101

5 Budget Summary 102

6 Conclusions 104

References 107

Appendix A MATLAB Code 109

A.1 Frequency Range Extraction for ANNs . . . . . . . . . . . . . . . . . . . . . 109

A.2 Artificial Neural Network Training . . . . . . . . . . . . . . . . . . . . . . . 111

A.3 Nearest-Neighbour Prediction Algorithm . . . . . . . . . . . . . . . . . . . . 113

A.4 Interpolation Algorithm Development . . . . . . . . . . . . . . . . . . . . . 118

A.5 Interpolation Algorithm Prediction Test . . . . . . . . . . . . . . . . . . . . 131

A.6 Interpolation Prediction Using Previous Prediction . . . . . . . . . . . . . . 135

Appendix B LabVIEW Block Diagrams 137

B.1 Measurement System Block Diagram . . . . . . . . . . . . . . . . . . . . . . 137

B.2 Control System Block Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . 139

B.3 Complete System Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . 145

Appendix C Curriculum Vitae 147

- vii -

Page 10: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System LIST OF FIGURES

List of Figures

1.1 Information flow of the positioning system. . . . . . . . . . . . . . . . . . . 4

2.1 D/A hydraulic cylinder configuration. . . . . . . . . . . . . . . . . . . . . . 9

3.1 The protective collar, fixed to the rod clevis, that prevents the piston from

colliding into the antenna. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.2 Right-hand side view of the hydraulic cylinder cart. . . . . . . . . . . . . . . 20

3.3 Front view of the hydraulic cylinder cart. . . . . . . . . . . . . . . . . . . . 20

3.4 Close-up view of cylinder mounting points. . . . . . . . . . . . . . . . . . . 21

3.5 Example antenna model enclosed in a cylindrical PEC cavity. . . . . . . . . 24

3.6 Schematic of the rectangular ring microstrip antenna. The blue area is the

radiating microstrip line on top of the substrate, while the red area is the

ground plane on the bottom of the substrate. . . . . . . . . . . . . . . . . . 25

3.7 Simulated S11 of the rectangular ring microstrip antenna in free space. . . . 26

3.8 Simulated S11 of the rectangular ring microstrip antenna enclosed in a cylin-

drical PEC cavity with a length of 100 mm. . . . . . . . . . . . . . . . . . . 27

3.9 Schematic of the wideband probe-fed microstrip antenna. The blue area is

the radiating microstrip patch on top of the substrate, the grey area is the

Arlon substrate (✏r = 2.5) and thickness 1.56 mm, and the red area is the

ground plane underneath the substrate, separated by a gap of 6 mm. . . . . 28

3.10 Simulated S11 of the wideband probe-fed microstrip antenna in free space. . 29

3.11 Simulated S11 of the wideband probe-fed microstrip antenna enclosed in a

cylindrical PEC cavity of varying length L. . . . . . . . . . . . . . . . . . . 29

3.12 Schematic of the simulated balanced antipodal Vivaldi antenna. The blue

area represents the middle conductor layer while the red area represents the

top and bottom ground layers. . . . . . . . . . . . . . . . . . . . . . . . . . 30

- viii -

Page 11: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System LIST OF FIGURES

3.13 Simulated S11 of the BAVA in free space. . . . . . . . . . . . . . . . . . . . 31

3.14 Simulated S11 of the BAVA enclosed in a cylindrical PEC cavity of two dif-

ferent lengths, L. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

3.15 The BAVA provided by the EIL, designed by Majid Ostadrahimi. . . . . . . 33

3.16 S11 of the BAVA in free space. . . . . . . . . . . . . . . . . . . . . . . . . . 34

3.17 The cascaded adapter antenna mount (a) without the end cap and (b) with

the end cap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

3.18 End cap with through hole, counterbore, and their corresponding diameters. 37

3.19 S11 of the LeakSeal-coated BAVA in free space. . . . . . . . . . . . . . . . . 38

3.20 End cap installed on the cylinder, with the antenna mounted inside. . . . . 39

3.21 S11 measurements taken over a frequency range of 2 to 8.5 GHz for a position

of 225 mm in an air-filled cylinder. . . . . . . . . . . . . . . . . . . . . . . . 42

3.22 The extracted local minima of S11 for the calibration piston positions in (a)

the air-filled cylinder system and (b) the oil-filled cylinder system. Both

data sets have similar patterns, justifying the development of the predictive

algorithms using an air-filled cylinder system. . . . . . . . . . . . . . . . . . 43

3.23 A correlation between the local minima of S11 and the change in position is

shown within the red box for (a) an air-filled cylinder and (b) an oil-filled

cylinder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

3.24 An error histogram between the actual and predicted piston position. The

red line represents the measurement accuracy specification of 10 mm. . . . . 46

3.25 The local minima of S11 and the position exhibits a repetitive pattern. The

green box shows the position range within which an individual ANN would

cover one instance of the pattern. . . . . . . . . . . . . . . . . . . . . . . . . 48

3.26 An error histogram between the actual and predicted position. The red line

represents the measurement accuracy specification of 10 mm. . . . . . . . . 48

3.27 A high level flowchart of the nearest-neighbour algorithm. . . . . . . . . . . 51

3.28 A visual representation of converting the local minima of the measurement

data into the DFM. Local minima occurring within a frequency range will

set the corresponding value in the DFM to 1. . . . . . . . . . . . . . . . . . 52

3.29 A comparison of the predicted and actual positions using the nearest-neighbour

algorithm (air-filled data). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

3.30 A comparison of the predicted and actual positions using the nearest-neighbour

algorithm (oil-filled data). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

3.31 A high level flowchart of the interpolation algorithm. . . . . . . . . . . . . . 58

- ix -

Page 12: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System LIST OF FIGURES

3.32 The extracted local minima of S11 from the reduced frequency range using

the air-filled cylinder data are shown in (a), while (b) shows the trend lines

after interpolation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

3.33 A comparison of the predicted and actual positions using the interpolation

algorithm (air-filled data). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

3.34 The extracted local minima of S11 from the reduced frequency range using

the oil-filled cylinder data are shown in (a), while (b) shows the trend lines

after interpolation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

3.35 A comparison of the predicted and actual positions using the interpolation

algorithm (oil-filled data). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

3.36 The measurement system has many components it interfaces with, including

the VNA, MATLAB and CSV files. . . . . . . . . . . . . . . . . . . . . . . . 65

3.37 The S11 data of an enclosed air-filled steel pipe. . . . . . . . . . . . . . . . . 68

3.38 The flowchart of the measurement system program’s calibration phase. . . . 71

3.39 The flowchart for the prediction phase of the measurement system program. 72

3.40 Plot of the measurement system accuracy test data. . . . . . . . . . . . . . 74

3.41 GUI for LabJack-LabVIEW interface program. . . . . . . . . . . . . . . . . 76

3.42 GUI for the pump control program. . . . . . . . . . . . . . . . . . . . . . . . 77

3.43 The flowchart shown here describes the potential operation of a continuous

comparison control system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

3.44 The flowchart shown here describes the potential operation of a PID control

system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

3.45 The flowchart shown here describes the potential operation of a single stroke

control system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

3.46 Distance travelled by the piston vs time of extension. . . . . . . . . . . . . . 84

3.47 Distance travelled by the piston vs time of retraction. . . . . . . . . . . . . 84

3.48 Extensions after the motor was been turned o↵ vs. motor run time. . . . . 86

3.49 Low distance range extensions vs motor run time. . . . . . . . . . . . . . . . 87

4.1 This flowchart shows the high level logic for the hydraulic cylinder piston

positioning system and the emergency stop button. . . . . . . . . . . . . . . 92

4.2 This figure shows the GUI for the hydraulic cylinder piston positioning system. 95

4.3 Positioning system accuracy test. . . . . . . . . . . . . . . . . . . . . . . . . 98

B.1 The measurement system LabVIEW block diagram. . . . . . . . . . . . . . 138

B.2 This was the LabVIEW block diagram code for the Pump Control Program. 140

- x -

Page 13: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System LIST OF FIGURES

B.3 This is the GUI for the Time Test program used for experiments in Sec-

tion 3.5.2 and Section 3.5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

B.4 This was the block diagram for the LabVIEW code for the Time Test program

used for experiments in Section 3.5.2 and Section 3.5.3 . . . . . . . . . . . . 142

B.5 This was the GUI for the Time Test program used for experiments in Sec-

tion 3.5.2 and Section 3.5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

B.6 This was the block diagram for the LabVIEW code for the control system

program used for experiments in Section 3.5.2 . . . . . . . . . . . . . . . . . 144

B.7 The hydraulic cylinder positioning system LabVIEW block diagram. . . . . 146

- xi -

Page 14: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System LIST OF TABLES

List of Tables

1.1 System specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.1 Prediction errors using the interpolation algorithm. . . . . . . . . . . . . . . 62

3.2 Control system test results. . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

4.1 Explanation of GUI indicators. . . . . . . . . . . . . . . . . . . . . . . . . . 96

4.2 Explanation of GUI controls. . . . . . . . . . . . . . . . . . . . . . . . . . . 97

4.3 Positioning system repeatability test results. . . . . . . . . . . . . . . . . . . 100

4.4 Positioning system response time test results. . . . . . . . . . . . . . . . . . 100

4.5 Experimental results from emergency button response time tests. . . . . . . 101

4.6 System specifications and results. . . . . . . . . . . . . . . . . . . . . . . . . 101

5.1 Budget summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

- xii -

Page 15: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System LIST OF TABLES

List of Abbreviations

Abbreviation Description

ANN Artificial neural network.

BAVA Balanced antipodal Vivaldi antenna.

CSV Comma-separated values.

D/A Double acting.

DCV Directional control valve.

DFM Discretized frequency matrix.

DFV Discretized frequency vector.

ECE Electrical and Computer Engineering.

EIL Electromagnetic Imaging Lab.

GPIB General Purpose Interface Bus.

GUI Graphical user interface.

PC Personal computer.

PEC Perfect electric conductor.

PID Proportional-integral-derivative.

S/A Single acting.

S11 Reflection coe�cient.

SMA SubMiniature version A.

TE Transverse electric.

TM Transverse magnetic.

USB Universal Serial Bus.

UWB Ultra-wideband.

VI Virtual Instrument.

VNA Vector network analyzer.

- xiii -

Page 16: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning
Page 17: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 1. Introduction

Chapter 1

Introduction

The purpose of the project was to design and fabricate an electromagnetic-based hydraulic

cylinder positioning system. The following sections will outline the motivation for such a

project, the system specifications, project objectives, and an overview of the positioning

system and its constituent hardware components.

1.1 Motivation

The construction and agriculture industries commonly use hydraulic cylinders in heavy load

applications. These industries are constantly demanding more and more automation, e.g.

the agriculture industry has implemented auto steering in many of their new tractors and

combines [1]. The position of the piston inside the cylinder must be measured before a

hydraulic cylinder can be automated.

Currently, there are two methods of obtaining piston position information: systems that

are either internal or external to the hydraulic cylinder. Internal sensor systems provide

very accurate measurements but are costly compared to the price of a standard hydraulic

cylinder. One such position sensing hydraulic cylinder was quoted at $2000.00 [2], whereas

a similar sized regular hydraulic cylinder would cost $114.99 [3]. External systems are

- 1 -

Page 18: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 1.2 Project Objectives

cost-e↵ective compared to internal systems, but these systems are disadvantageous because

they are exposed to the environment, which can be particularly harsh in agriculture and

construction industries. Ultimately, both systems have major disadvantages in terms of

high cost or exposure to the environment. The prototype electromagnetic-based positioning

system pursued in this project seeks to provide an alternative that does not su↵er from the

aforementioned disadvantages of the predominant systems currently used.

1.2 Project Objectives

This project concerns the development and implementation of a proof-of-concept internal

hydraulic cylinder positioning system, which uses an antenna as a sensor. The antenna’s

S11 should be used to determine piston position. In this context, S11 refers to the ratio of

the voltage wave received from the antenna to the voltage wave sent to the antenna. In

addition, the system should enable a user to remotely control the cylinder.

One objective of this project was to verify that an electromagnetic radiation-based

prototype positioning system can eventually be developed into a competing technology

position sensing cylinders. Secondly, a component of this project assessed the resolution

to which position could be measured using an antenna. Thirdly, the project specifications

outlined in Table 1.1 had to have been met.

It is important to realize that industry standards for accuracy, which are on the order

of less than 1 µm are beyond the scope of this project [4]. The e↵ects due to changes in tem-

perature, pressure of the oil due to a load on the cylinder, and changes in the properties of

the oil with continued operation are also beyond the scope of this project. Consequently, the

electromagnetic-based hydraulic cylinder positioning system was developed under unloaded

conditions.

- 2 -

Page 19: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 1.3 System Specifications

1.3 System Specifications

The specifications for the designed hydraulic cylinder positioning system correspond to the

performance expectations of the measurement subsystem and overall positioning system.

As such, the specifications have been summarized in Table 1.1.

Table 1.1: System specifications.

System Feature Specification Measurement Explanation

MeasurementSystemAccuracy

< 10 mm The maximum error between theposition returned by the measure-ment system and the actual posi-tion of the piston.

MeasurementSystemRepeatability

< 20 mm The maximum variation betweenmultiple position measurementsfor one piston position.

PositioningSystemAccuracy

< 10 mm The maximum error between thedesired position input by the userand the actual position of the pis-ton after the completion of the pis-ton’s movement.

PositioningSystemRepeatability

< 20 mm The maximum variation betweenactual end positions for the sameuser-specified position.

PositioningSystemResponse Time

< 10 s The maximum time elapsed be-tween a user command and the ini-tiation of the motor’s response.

Emergency StopResponse Time

< 1 s The maximum time di↵erence be-tween a user pressing the emer-gency stop button and the pistoncoming to a complete stop.

- 3 -

Page 20: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 1.4 Positioning System Overview

1.4 Positioning System Overview

The operation of the hydraulic cylinder positioning system may be understood in three

main steps. First, a VNA performs a broadband frequency measurement of the S11 of the

antenna inside the cylinder. Then, a predictive algorithm processes the magnitude of the

S11 and uses this information to estimate the position of the piston. Finally, a control

system compares the di↵erence between the current position and the user-specified position

and accordingly adjusts the piston position to the desired position. The information flow

of the overall system is shown in Figure 1.1.

Hydraulic Cylinder

VNA

PC LabJack U3 LabJack RB12 with Opto 22 G4 DC relays

Pump

Antenna

Figure 1.1: Information flow of the positioning system.

The project was divided into five modular components that were completed individ-

ually before finally integrating them into a functional positioning system. These project

elements include (I) assembly and setup of the hydraulic equipment, (II) antenna design

- 4 -

Page 21: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 1.5 Positioning System Hardware

and fabrication, (III) predictive algorithm development, (IV) the measurement system, and

(V) the control system. The aforementioned tasks are described in more detail in the body

of this report.

1.5 Positioning System Hardware

Many hardware components were needed to develop the positioning system. Figure 1.1

shows all of these hardware items and how they interact with each other. The role and

function of each item is discussed in this section. The cylinder, pump, LabJack U3, LabJack

RB12, and Opto 22 DC relays were all donated by the industry sponsor 151Research Inc.

The use of the VNA is provided by the Electromagnetic Imaging Laboratory (EIL) at the

University of Manitoba.

1.5.1 Hydraulic Cylinder and Pump

The hydraulic cylinder is the central piece of equipment for which the positioning system is

being designed. The pump controls the hydraulic cylinder and is the positioning actuator

of the system. Section 2.1 covers the basic hydraulic properties that need to be understood

in designing the positioning system.

1.5.2 Antenna and VNA

The antenna is the sensor used to interrogate the inside of the cylinder. It is important for

the antenna to maintain its wideband properties when placed within the hydraulic cylinder,

which is explained in Section 3.2.1. Basic antenna and electromagnetic theory is also covered

in Section 2.3.

In any kind of system where measurements are performed, a sensor is useless without

equipment that is able to extract information from the sensor. As such, a VNA is used to

- 5 -

Page 22: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 1.6 Final Introductory Remarks

collect broadband frequency information from the antenna. The data collected by the VNA

is then sent to a personal computer (PC) for analysis by a predictive algorithm.

1.5.3 PC

A PC is a necessary hardware component as it performs the signal processing and predictive

functions. Furthermore, the PC acts as the brain of the positioning system, sending and

receiving commands from all of the hardware components. For this reason, the PC is a

suitable hardware component through which a graphical user interface can be made to

permit user interaction with the entire system. The PC serves these functions through the

LabVIEW software, which is able to integrate all of the hardware components into one

system.

1.5.4 LabJack Components

The LabJack components provide the interface between the PC and the pump. The Lab-

Jack U3 controller, which is able to communicate with LabVIEW, sends pump commands

through the LabJack RB12. The LabJack RB12 is a relay board that supports and connects

the Opto 22 G4 DC relays to the LabJack U3, and the state of the relays determines the

direction and movement of the pump.

1.6 Final Introductory Remarks

This introductory section has attempted to lay the groundwork for a basic understanding of

the operation and the motivation for the electromagnetic-based hydraulic cylinder position-

ing system pursued in this project. The system is intended to meet a set of specifications

outlined in Table 1.1, and the project itself sets out to meet a series of objectives highlighted

in Section 1.2. Finally, a brief overview provided a high-level explanation of the positioning

system’s operation, and an understanding of the role that each hardware component fulfills

- 6 -

Page 23: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 1.6 Final Introductory Remarks

in the positioning system was developed. Next, the hydraulic and electromagnetic principles

upon which the positioning system functions will be examined in the following chapter.

- 7 -

Page 24: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 2. Background

Chapter 2

Background

Basic knowledge of hydraulic principles and the electromagnetic principles exploited in this

project are required to understand the development of the hydraulic cylinder positioning

system, which is detailed in Chapter 3. In addition to the basic operating principles of

hydraulic systems, current position sensing technologies are explained in order to underscore

the uniqueness of the electromagnetic radiation-based solution sought in this project.

2.1 Brief Overview of Hydraulic Systems

‘Hydraulics’ refers to the use of confined liquids under controlled pressure to do work [5].

These non-compressible liquids (e.g. oil) are often confined to structures such as cylinders,

pipes, valves, etc. Hydraulic cylinders provide users with the ability to exert several thou-

sands of Newtons of force to provide vertical or lateral movement of other objects with

minimal moving components prone to breaking. A typical D/A hydraulic cylinder configu-

ration is provided in Figure 2.1. All of the components of the system and important parts of

the cylinder have been labeled to aid with the explanation of the di↵erent types of hydraulic

cylinder configurations that follows.

There are two types of hydraulic cylinder configurations: single acting (S/A) and double

- 8 -

Page 25: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 2.1 Brief Overview of Hydraulic Systems

Figure 2.1: D/A hydraulic cylinder configuration.

acting (D/A). Depending on the type of configuration, the way in which the system operates

varies slightly:

• S/A: Oil exists in the ‘piston side’ chamber of the cylinder only. Oil flows into the

piston side to extend the cylinder, meanwhile retraction occurs under the mechanical

force of the load on the piston rod. During retraction, oil is allowed to pass back into

the reservoir. Ultimately, a S/A configuration can only apply force in one direction

to move the piston.

• D/A: Oil exists on both the ‘piston side’ and the ‘rod side’. Oil flows into the piston

side to extend the cylinder, with the oil in the rod side able to flow back into the

reservoir; to retract, oil is pumped into the rod side, and the oil on the piston side is

able to flow back into the reservoir. The extend or retract force is determined by the

di↵erence in oil pressure on either side of the piston. In the end, a D/A system can

apply force on the piston in two directions to extend or retract the piston rod.

In a D/A configuration, the rate at which the rod extends or retracts is based on the

flow rate of the pump and the inner diameter of the cylinder. This statement is true also

for extension in a S/A setup [6].

- 9 -

Page 26: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 2.2 Position Sensing Hydraulic Systems

Hydraulic cylinders are used in heavy duty industries including construction and agri-

culture because of their ability to transmit large amounts of power. In these industries, the

human operator serves as the control system for hydraulic systems. There are cases for which

automated cylinder operation may be advantageous such as in levelling or lifting/lowering

heavy items where precise coordination is required (e.g. houses), saving time and increasing

the accuracy of the task. In order to be able to position a cylinder automatically, a means

of measuring the extension of the piston rod must be developed.

2.2 Position Sensing Hydraulic Systems

Position sensing cylinders can satisfy the need to develop computer-controlled control sys-

tems for hydraulic systems. There are two main types of position sensing cylinders used in

hydraulic systems: internal systems and external systems. Within each category, there are

several ways of measuring piston position.

• Internal position sensing technologies: There are three common ways to obtain the

piston position from devices placed inside a hydraulic cylinder and all require a hole to

be bored through the piston rod. These three methods include (I) the magnetostric-

tive principle, (II) linear potentiometer sensor, and (III) variable inductance sensor.

The first such method is based on the magnetostrictive principle: a waveguide is

placed through the center of the cylinder, which necessitates a hollow piston rod. A

transducer on the end cap launches an electrical pulse, which is reflected by a magnet

mounted on the piston. The interaction of the magnetic fields generated by the pulse

and of the magnet on the piston can be used to determine the piston location. The

time required for the pulse to travel to and from the piston is measured, and position

and velocity of the piston are calculated. This method involves ‘linear sensing tech-

nology’ and obtains absolute measurements of position and piston velocity [7].

- 10 -

Page 27: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 2.2 Position Sensing Hydraulic Systems

The second method uses a linear potentiometer attached to the piston and piston rod

through mechanical contacts. A feedback voltage can then be decoded to give the

piston position [7].

A third means of position sensing in hydraulic cylinder applications is via linear vari-

able inductance sensors. These inductance sensors measure the resonant frequency

of an oscillator circuit; the oscillator’s resonant frequency changes as the gun-drilled

rod moves over the oscillator circuit, which contains an inductive probe with variable

inductance [7].

Advantages of the magnetostrictive setup over the potentiometer include high accu-

racy, resolution, the absence of mechanical parts that can wear over time, and no

velocity limitations. The primary disadvantage of the magnetic-based system is its

high cost [4]. While linear potentiometer sensors are the least expensive, they pro-

vide the least accurate measurements. Furthermore, the need for mechanical contact

means that these sensors wear out over time, and the potentiometers can wear out

more quickly with higher frequency piston rod movement. Finally, although variable

inductance sensors are not as common as either magnetostrictive or potentiometer

based solutions, inductance sensors are advantageous as they do not use mechanical

contacts like linear potentiometer-based technologies nor do they require magnets.

However, these sensors do not attain the same accuracy as magnetostrictive sensors

[7].

• External position sensing technologies: Several ways of measuring piston position

externally to the hydraulic cylinder exist. These methods include (I) a linear poten-

tiometer attached to the piston rod or load; (II) a rotary potentiometer that measures

angular position directly, or which can measure linear position using a mechanism with

a fine cable that lengthens and retracts with change in extension of the piston rod [8];

(III) an optical detector that counts indicators (like a bar code) embedded in the rod

- 11 -

Page 28: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 2.2 Position Sensing Hydraulic Systems

[9]; and (V) variable inductance sensor that has a fixed transducer/interrogator coil

and moving core (i.e. the piston rod) that changes the inductance of the transducer

coil [8].

As in the case of the internal potentiometer-based position-sensing methods, exter-

nal potentiometer-based solutions provide the least expensive external alternative,

although these will wear out over time due to their reliance on mechanical contacts

[8]. Optical sensors are advantageous because they do not require mechanical con-

tacts, and these sensors can be easily replaced in case of damage or component failure

[9]. Finally, inductive sensors may be the best suited for retrofit applications as they

do not require modification of the piston rod as in the case of optical sensors, though

the signal processing equipment required to excite the transducer coil may be more

complicated than that required for the optical sensors [8].

Advantages and disadvantages exist between internal and external systems. Primarily,

external systems are disadvantageous because the sensors are exposed to the harsh oper-

ating conditions in which these cylinders are used, and external sensors add to the outer

dimensions of the cylinder. However, external systems are often lower in cost than internal

systems, do not add to the overall length of the cylinder, are easy to repair without disas-

sembly of the cylinder, and present the opportunity to retrofit older cylinders with position

sensing technologies. Even though internal systems are not exposed to the environment,

these systems are exposed to the internal environments of the hydraulic cylinder where there

may exist some temperature and pressure dependence to the accuracy of the measurements

[8].

- 12 -

Page 29: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 2.3 Underlying Electromagnetic Theory

2.3 Underlying Electromagnetic Theory

The success of this project is contingent on establishing a correlation between the piston

position (i.e. the length of the “piston side” cavity) and a distinguishable feature of the

embedded antenna’s S11. The presence of a PEC in the shape of a cylinder around the

antenna a↵ects the antenna such that there are discrete frequencies at which energy is

able to penetrate into the cavity in the form of standing waves that satisfy the boundary

conditions of the cylinder. These discrete frequencies are the resonant frequencies of the

cavity. Normally, the S11 of a wideband antenna is less than -10 dB for a vast range of

frequencies within the antenna’s operating limits. Low values of S11 indicate that almost

all of the power delivered to the antenna is transmitted into the cavity.

The resonant frequencies (f r)npq of a cylindrical cavity of radius a and length d are

given by Equation 2.1

(f r)npq =1

2⇡ap✏µ

rxnp

2 +⇣q⇡a

d

⌘2(2.1)

where ✏ and µ are the permittivity and permeability of the medium, xnp is the p

th zero of

the n

th order Bessel function (for TM modes) or the first derivative of the n

th order Bessel

function (for TE modes) [10]. The variables n, p, and q are indices used to define the di↵erent

TEnpq and TMnpq modes. Equation 2.1 shows that the resonant frequencies of a cylindrical

cavity are inversely proportional to the length of the cavity d. These resonances provide

information that can be exploited in a predictive algorithm relating resonant frequencies to

piston position.

Interrogating the cylinder with broadband electromagnetic radiation will introduce

more energy into the cylinder only at the resonant frequencies described by Equation 2.1.

For the ideal, lossless case of a PEC cylinder, the electromagnetic radiation at all other

frequencies will be reflected. Thus, the magnitude of the antenna’s measured S11 will be

very low at the resonant frequencies as shown by the definition of S11 in Section 1.2. Since

- 13 -

Page 30: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 2.3 Underlying Electromagnetic Theory

the resonant frequencies are observable in the magnitude of S11, the S11 phase information

will not be used in this project. Therefore, the magnitude of the antenna’s S11 theoretically

provides a way to exploit the relationship between the cylinder’s resonant frequencies and

the piston position.

- 14 -

Page 31: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3. System Design

Chapter 3

System Design

The system design phase of the project was divided into modules in such a way that these

design components could be completed simultaneously. These modules include (I) the ap-

paratus and setup, (II) the antenna design, (III) the predictive algorithm development,

(IV) the measurement system development, and (V) the control system development. The

following sections will detail the design and development of the individual project modules.

3.1 Apparatus and Setup

An understanding of the operation of the hydraulic equipment for which the positioning

system will be designed is essential for being able to control the action of the cylinder

through a GUI. This understanding, especially of the function of the pump, was built by

assembling the hydraulic equipment that was donated by 151Research Inc. Through the

assembly and testing of the equipment, some initial observations were made about the

behaviour of the cylinder that were thought to have an impact on design of the positioning

system - specifically the drift. Furthermore, this process of interacting with the hydraulic

hardware of the project foreshadowed two key issues that would have to be resolved at

a latter point in the project: (I) a mechanism to prevent the piston rod from retracting

- 15 -

Page 32: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.1 Apparatus and Setup

to far and damaging the embedded antenna discussed in Section 3.1.2; and (II) an easy

means of transporting the hydraulic equipment between rooms for testing purposes and for

demonstration of the final system detailed in Section 3.1.4.

The focus of our hydraulic cylinder positioning system in terms of required equipment

was the hydraulic equipment, i.e. cylinder and pump. These two items were donated by

151Research Inc. The cylinder was a standard tie rod cylinder with 3 in. bore and 18 in.

stroke. The pump intended to drive the cylinder was a DC motor-powered hydraulic pump.

Although the equipment had been donated from an industry sponsor, the team had di�culty

understanding and assembling the system due to the absence of product information on the

pump. The lack of product information necessitated the assembly of the entire apparatus

in order to understand how the pump and hydraulic component of the system functioned.

3.1.1 Hydraulic Cylinder Bidirectionality Problem

After assembling the hydraulic equipment, the donated pump was discovered to be S/A.

However, a D/A pump was required to satisfy the system specifications and project objec-

tives outlined in Section 1.2, as the positioning system would not be tested under any load

because of the possibility of undesirable e↵ects of loading. Without the presence of a load,

the only means of controlling the cylinder in both directions is with a D/A pump.

The need for a D/A pump left two options to solve the bidirectionality problem:

1. Conversion of the S/A unit to a D/A unit: Conversion required the purchase of a

directional control valve (DCV) and additional hoses, modification of the reservoir

and a switch to control the DCV. The resultant cost was approximately $264.95 plus

the time required to modify the pump.

2. Purchase of a D/A: Purchasing of a D/A pump was the most straightforward option

as it required the least amount of work. The overall setup would remain simple,

which would have been advantageous for avoiding future problems and for having a

- 16 -

Page 33: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.1 Apparatus and Setup

less complex demonstration apparatus. The resultant cost was approximately $430.00;

however, the pump was available on sale for a final cost of $269.99.

After weighing the advantages and disadvantages of each option, the team purchased

the D/A unit as it cost roughly the same amount as the conversion without the need for

extra time to make modifications.

3.1.2 Protective Collar

Since the requirements of this project mentioned in Section 1.2 necessitated that the position

of the piston be measured using an antenna embedded inside the cylinder, a protection

mechanism needed to be in place in order to prevent the piston rod from retracting too far

and colliding into the antenna. The solution pursued to protect the antenna from collision

with the piston was an aluminum protective collar 120 mm in length that could be slipped

over the piston rod, as pictured in Figure 3.1. The length of the collar accounted for the

total distance from the bottom of the antenna at its mounting point to the end cap to the

edge closest to the piston. This protective collar was fixed to the rod clevis and functioned

as a guard to disallow further retraction.

3.1.3 Drift

During testing of the D/A configuration, the cylinder was observed to drift a small distance

after releasing the switch whether extending or retracting. The piston rod actually drifted

for a approximately 11 mm in the extend direction every time. Upon further investigation,

which included consultation with Mechanical Engineering Prof. Paul Labossiere, the drift

may have been a result of the pressure di↵erence between the rod side and piston side. One

explanation of the pressure di↵erence was that by nature of the cylinder design, the smaller

surface area exposed to the oil on the ‘rod side’ meant that just before equilibrium was

reached, equal pressure on either side of the piston would cause the piston to drift in the

- 17 -

Page 34: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.1 Apparatus and Setup

Protective Collar

Rod Clevis

Figure 3.1: The protective collar, fixed to the rod clevis, that prevents the piston fromcolliding into the antenna.

- 18 -

Page 35: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.1 Apparatus and Setup

extend direction. Another explanation is that the drift may be due to air being trapped in

the rod side cavity as the cylinder had been disassembled. The disassembly process could

have allowed air to become trapped, reducing pressure. Piston rod drift was problematic as

it posed an issue in the design of the control system. The control system had to be able to

account for the drift distance, or else the controller may never be able to reach the desired

position. Hardware solutions including loading the cylinder and bleeding the cylinder were

pursued to solve the drift problem; however, the drift remained. A software solution to drift

will be discussed in Section 3.5.2.

3.1.4 Cylinder Mounting

It was important to be able to have an easy way of transporting the hydraulic equipment

to and from the Electromagnetic Imaging Laboratory (EIL) during testing. To solve this

problem, the team purchased a welding cart with the following features: (I) over 200 lbs of

capacity; (II) a convenient vertical mounting plate for the cylinder; and (III) three shelves

for holding the pump, battery, and the LabJack controller along with cables. The sequence

of figures starting from Figure 3.2 to Figure 3.3 provide a 180� view of the cart. The cart’s

low center of gravity and placement of the pump on the bottom shelf ensured that there

was little chance for the setup to tip over on its own even though the cylinder was mounted

vertically.

Figure 3.4 details the cylinder mount. Four 30 cm long sections galvanized strapping

were cut and wrapped tightly around the cylinder, in between the tie rods. These galvanized

straps were then fixed to the vertical plate each using two bolts to fasten the cylinder rigidly

in place to the vertical plate of the cart.

- 19 -

Page 36: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.1 Apparatus and Setup

Galvanized straps

Hydraulic Cylinder

Protective Collar

Pump

Figure 3.2: Right-hand side view of the hydraulic cylinder cart.

Galvanized straps

Hydraulic Cylinder

Protective Collar

Figure 3.3: Front view of the hydraulic cylinder cart.

- 20 -

Page 37: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.1 Apparatus and Setup

Galvanized straps

Figure 3.4: Close-up view of cylinder mounting points.

- 21 -

Page 38: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

3.2 Antenna Design

The hydraulic cylinder positioning system is based on the correlation between local minima

of S11 of certain antennas and length of the cylindrical cavity, as explained in Section 2.3.

These local minima needed to be obtained in order to exploit the relationship, and was

accomplished through the use of an antenna placed inside the piston side cavity of the

hydraulic cylinder, as shown in Figure 2.1. The antenna’s S11 was measured using a VNA

so that the minima could be determined.

The goal of the antenna design task was to select an antenna with characteristics that

would allow S11 measurements to be obtained over the frequency range of 0.2 to 8.5 GHz.

The other major influence in the design procedure was that the antenna would be operating

in close proximity to the metallic walls of the cylinder. The procedure used to select an

antenna that satisfied the project requirements is detailed in what follows.

3.2.1 Antenna Design Criteria

The cylindrical cavity of the hydraulic cylinder has many resonant frequencies given by

Equation 2.1 for an ideal PEC cylinder. In order to accurately measure these resonant

frequencies over a given range, the antenna must capable of radiating electromagnetic energy

in that range. For this reason, the first design criterion was that the free space bandwidth of

the antenna should be as large as possible to best capture the resonant frequency variation.

Ideally, the antenna should have a bandwidth that includes the entire 0.2 to 8.5 GHz range.

For the purposes of this project, the bandwidth of an antenna was defined as the frequency

range over which the magnitude of the antenna’s S11 < -10 dB.

An antenna with a large free space bandwidth is not guaranteed to maintain its wide-

band properties when placed inside a metallic cylinder. A highly directive antenna should

radiate electromagnetic waves that propagate primarily along the axis of the cylinder,

thereby reducing the amount of interaction between the waves and the side wall of the

- 22 -

Page 39: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

cylinder. These interactions can cause significant undesirable changes to the antenna’s

bandwidth. With this in mind, the second design criterion was that the antenna should be

directive enough so that shifting resonances can be extracted from a broadband frequency

measurement within the cylindrical cavity.

The last factor considered was that the antenna must be placed and secured inside the

hydraulic cylinder, where it would be exposed to forces resulting from flowing hydraulic fluid.

The antenna must be able to withstand the fluid flow without temporarily or permanently

deforming to ensure that the operating conditions are consistent. In order to satisfy these

concerns, the third and final design criterion was that the antenna should be of a suitable

shape that allows for simple mounting in addition to being rigid enough to not deform in

the operating environment.

The criteria stated above were used to (I) decide which antennas to simulate; (II) eval-

uate the antennas’ performance based on simulation results; and (III) select an appropriate

antenna for use in the final system.

3.2.2 Antenna Simulation

Simulation was an essential first step in the antenna selection process, and allowed for

e�cient evaluation of possible designs. COMSOL Multiphysics was used as the simulation

software to select an antenna that best met the design criteria stated in Section 3.2.1. Three

antennas of interest were simulated in the following order:

1. Rectangular ring microstrip antenna

2. Wideband probe-fed microstrip antenna

3. Balanced antipodal Vivaldi antenna

Initially, each antenna was modelled in free space to ensure that the antenna met the

bandwidth requirements. The antenna’s S11 was simulated over a broad frequency range

- 23 -

Page 40: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

with reference to a 50 ⌦ input feed because the SMA cables used in the actual system all

have a characteristic impedance of 50 ⌦. The construction of the antenna model was then

verified by comparing the simulated S11 of the antenna to the expected S11 from the design

documents [11, 12, 13].

Once the construction of the antenna model was confirmed to be correct, the antenna

was then simulated in a metallic cylindrical cavity of radius 38.1 mm (equal to the inner

radius of the hydraulic cylinder), as shown in Figure 3.5. The metallic surfaces were replaced

by PEC surfaces in the simulations in order to reduce the computational complexity. This

assumption is valid because the electrical conductivity of the stainless steel cylinder is

large (� ⇡ 1.37 ⇥ 106 S/m [14]). The simulation was then performed again in this new

configuration for various cavity lengths, and the simulated S11 was plotted for each length.

The plots were then analyzed to see if there was any significant variation in S11 for the

di↵erent cavity lengths. The results and conclusions drawn from each of the simulations

will be discussed in detail in the following sections.

Figure 3.5: Example antenna model enclosed in a cylindrical PEC cavity.

Rectangular Ring Microstrip Antenna

Many antennas have been developed in recent years for use in communication systems that

operate in the ultra-wideband (UWB) range (2.5 to 9.4 GHz) [11]. Since this bandwidth

- 24 -

Page 41: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

was desirable, the first antenna simulated for evaluation as a suitable candidate was a

rectangular ring microstrip antenna. A simulation model of this rectangular ring microstrip

antenna was created using design specifications found in [11]. A schematic of the antenna,

complete with dimensions, is shown in Figure 3.6. The substrate used in the simulation

had a thickness of 1.5 mm and a relative permittivity of 4.4. This antenna was selected for

simulation because of its large bandwidth of approximately 2.5 to 9.16 GHz, in addition to

its planar and compact form.

Figure 3.6: Schematic of the rectangular ring microstrip antenna. The blue area is theradiating microstrip line on top of the substrate, while the red area is the ground plane onthe bottom of the substrate.

The antenna’s S11 was simulated from 2.5 to 9 GHz, and a plot of the resulting data

is shown in Figure 3.7. As can be seen from the plot, the simulated bandwidth of the

antenna was approximately 3.5 to 7.5 GHz. Although the simulated bandwidth was smaller

- 25 -

Page 42: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

than the expected bandwidth, the relative shape of the S11 curve is very similar to the

S11 curve provided in [11]. For this reason, the performance of the antenna model was

deemed satisfactory and the antenna was simulated in a cylindrical PEC cavity from 1 to

8 GHz. The length of the PEC cavity was varied from 50 to 300 mm in 50 mm intervals,

but every cavity length produced the same results: S11 ⇡ 0 dB (total reflection) over the

entire frequency range. The resulting S11 data for a cavity length of 100 mm is shown in

Figure 3.8 as an example.

2 3 4 5 6 7 8 9x 109

−25

−20

−15

−10

−5

0

Frequency [Hz]

S11

Mag

nitu

de [d

B]

Simulated S11

in Free Space of the Rectangular Ring Microstrip Antenna

Figure 3.7: Simulated S11 of the rectangular ring microstrip antenna in free space.

These results showed that this antenna could not radiate any electromagnetic energy

into the cavity, and this was believed to be due to the base of the cylindrical cavity beneath

the antenna. This antenna was designed for a ground plane of a specific size that would

allow the antenna to radiate in both directions normal to the plane of the antenna. The

metal base of the cylinder directly underneath the antenna likely caused the antenna to lose

its wideband properties, thereby rendering it useless for the purposes of this project. This

result led to the decision that the next antenna to test should only radiate in one direction

and have a large ground plane to negate the e↵ect of the nearby metal surface.

- 26 -

Page 43: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

1 2 3 4 5 6 7 8x 109

−0.25

−0.2

−0.15

−0.1

−0.05

0

0.05

Frequency [Hz]

S11

Mag

nitu

de [d

B]

Simulated S11

in Cylindrical PEC Cavity of the Rectangular Ring Microstrip Antenna

Figure 3.8: Simulated S11 of the rectangular ring microstrip antenna enclosed in a cylin-drical PEC cavity with a length of 100 mm.

Wideband Probe-Fed Microstrip Antenna

The poor results of the rectangular ring antenna simulations led to the selection of a wide-

band probe-fed microstrip antenna, and the simulation model was developed according to

specifications found in [12]. A schematic of this antenna with dimensions is shown in Fig-

ure 3.9. The expected bandwidth of this antenna was given in the design document as

approximately 4.25 to 6.75 GHz. This antenna was simulated in free space, producing an

S11 as shown in Figure 3.10.

The simulated S11 data in Figure 3.10 represents a bandwidth of 4.9 to 6.0 GHz, which

is slightly smaller than the expected bandwidth. This discrepancy may be due to modelling

error of the SMA connector and probe feed, whose dimensions were not specified in the

design document. Although the bandwidth of this antenna was much less than the ideal

bandwidth discussed in Section 3.2.1, this antenna was still simulated in a cylindrical PEC

cavity with the expectations of seeing some S11 variation in this reduced frequency range.

Just as with the rectangular ring antenna simulation, the length of the PEC cavity was

varied from 50 to 300 mm in 50 mm intervals. The results of this simulation are shown in

- 27 -

Page 44: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

Figure 3.9: Schematic of the wideband probe-fed microstrip antenna. The blue area isthe radiating microstrip patch on top of the substrate, the grey area is the Arlon substrate(✏r = 2.5) and thickness 1.56 mm, and the red area is the ground plane underneath thesubstrate, separated by a gap of 6 mm.

Figure 3.11.

As can be seen from Figure 3.11, S11 was 0 dB at every frequency except 4.5 GHz for all

of the tested cavity lengths. This indicated that the antenna’s bandwidth had been reduced

even further by placing it in close proximity to the PEC cavity, and energy was only being

transmitted into the cavity over a very narrow frequency band. The suspected reason for

this reduced bandwidth was that the antenna was su�ciently directive, allowing the nearby

sides of the PEC cavity to alter the characteristics of the antenna. These results suggested

that more directivity would be required to overcome this problem.

- 28 -

Page 45: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5x 109

−14

−12

−10

−8

−6

−4

−2

0

Frequency [Hz]

S 11 M

agni

tude

[dB]

Simulated S11 in Free Space of the Wideband Probe−Fed Microstrip Antenna

Figure 3.10: Simulated S11 of the wideband probe-fed microstrip antenna in free space.

3 3.5 4 4.5 5 5.5 6 6.5 7x 109

−18

−16

−14

−12

−10

−8

−6

−4

−2

0

Frequency [Hz]

S11

Mag

nitu

de [d

B]

Simulated S11

in a Cylindrical PEC Cavity of the Wideband Probe−Fed Microstrip Antenna

L = 50 mmL = 100 mm L = 150 mmL = 200 mmL = 250 mmL = 300 mm

Figure 3.11: Simulated S11 of the wideband probe-fed microstrip antenna enclosed in acylindrical PEC cavity of varying length L.

- 29 -

Page 46: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

Balanced Antipodal Vivaldi Antenna

The last antenna that was simulated was a balanced antipodal Vivaldi antenna (BAVA),

originally developed for near-field microwave imaging [13]. The original application required

that the antenna be highly directive, making the antenna a suitable candidate for this

project. A schematic of the antenna model with basic dimensions is shown in Figure 3.12.

The curvature of each of the three conducting layers was modelled using parametric curves

(indicated as A, B, and C in Figure 3.12), whose equations can be found in [13]. A 1.5875

mm layer of RT/duroid 6002 substrate with a relative permittivity of 2.94 separated each

of the conducting layers.

Figure 3.12: Schematic of the simulated balanced antipodal Vivaldi antenna. The bluearea represents the middle conductor layer while the red area represents the top and bottomground layers.

The BAVA was simulated in free space from 2 to 13 GHz; S11 is shown in Figure 3.13.

This data indicates that the simulated BAVA has a free space bandwidth from 2.5 GHz to

at least 13 GHz, which aligns closely with the expected operating range of 2.4 to 18 GHz

as stated in [13]. These results verified that the BAVA model was constructed properly and

thus the model could be simulated in the PEC cavity.

- 30 -

Page 47: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

2 4 6 8 10 12 14x 109

−26

−24

−22

−20

−18

−16

−14

−12

−10

−8

−6

Frequency [Hz]

S 11 M

agni

tude

[dB]

Simulated S11 in Free Space of the BAVA

Figure 3.13: Simulated S11 of the BAVA in free space.

Figure 3.14 shows the resulting S11 data from the PEC cavity simulation for two di↵erent

cavity lengths (21.1 mm and 23.3 mm). Two key features were present in the displayed data:

(I) some local minima of S11 shifted along the frequency axis when the length of the cavity

was changed, corresponding to the changes in the local minima of interest; and (II) some

local minima did not shift when the length of the cavity changed. The fact that some local

minima displayed some correlation to the cavity length proved that the BAVA would be a

suitable antenna for the final system from a measurement perspective. From an antenna

mounting perspective, the BAVA’s form was undesirable as it would extend 74 mm along the

length of the cylinder, reducing the maximum stroke length. On the contrary, one advantage

of the BAVA was that its rigidity allowed the antenna to withstand the oil pressure without

deformation.

- 31 -

Page 48: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

3 4 5 6 7 8 9x 109

−40

−35

−30

−25

−20

−15

−10

−5

Frequency [Hz]

S 11 M

agni

tude

[dB]

Simulated S11 in a Cylindrical PEC of the BAVA

L = 21.1 mmL = 23.3 mm

Figure 3.14: Simulated S11 of the BAVA enclosed in a cylindrical PEC cavity of twodi↵erent lengths, L.

3.2.3 Antenna Selection

The simulation results in the previous section clearly show that out of the antennas that

were simulated, only the BAVA was able to capture a correlation between the cavity length

and the local minima of the measured S11 data. The bandwidth of the simulated BAVA

spanned from 2.5 GHz to over 13 GHz, and was directive enough to maintain its wideband

property inside the PEC enclosure. These qualities were not present in the other two

antennas, and for this reason the BAVA was selected as the antenna to use in the physical

system. The only drawback of the BAVA was that it was not planar, meaning that it would

be more di�cult to secure the BAVA in place in the cylinder. Although this drawback was

inconvenient, it would ultimately be accounted for, as discussed in Section 3.2.5.

A BAVA was provided by the EIL that was similar, but not exactly the same as the

BAVA that was simulated. This BAVA was originally designed by Majid Ostadrahimi for

microwave imaging applications, and has an expected free space bandwidth from 3.1 to 10.6

- 32 -

Page 49: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

GHz [15]. A picture of the provided BAVA is shown in Figure 3.15. The BAVA was 70 mm

long, 70 mm wide, 3 mm thick (not including the nylon screws), and was fed by a coaxial

SMA cable.

Figure 3.15: The BAVA provided by the EIL, designed by Majid Ostadrahimi.

3.2.4 Antenna Testing and Results

The BAVA was tested by first measuring S11 over the entire operating frequency range of

the VNA. The obtained data from this test is shown in Figure 3.16. As can be seen from

the plot of S11, the bandwidth of the BAVA was from 3.4 GHz to more than 8.5 GHz, which

is close to the expected bandwidth of 3.1 to 10.6 GHz. This bandwidth was large enough to

justify the use of the BAVA to gather sample data to aid the development of the predictive

algorithm discussed in Section 3.3.

- 33 -

Page 50: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

0 1 2 3 4 5 6 7 8 9x 109

−40

−35

−30

−25

−20

−15

−10

−5

0

Frequency [Hz]

S 11 M

agni

tude

[dB]

Measured S11 in Free Space of the Balanced Antipodal Vivaldi Antenna

Figure 3.16: S11 of the BAVA in free space.

3.2.5 Antenna Mounting

One of the most crucial mechanical components on which the successful operation of the

positioning system relied was a rigid mount to hold the BAVA in place in the piston side

of the cylinder. As stated in Section 3.2.1, the BAVA needed to be mounted in such a way

that it would radiate along the axis of the cylinder (similar to the orientation depicted in

Figure 3.5). For this reason, the decision was made to secure the antenna to the end cap of

the cylinder. The key design considerations for the antenna mount have been listed below:

• The mount had to provide the ability to connect an SMA cable from the VNA, external

to cylinder, to the antenna embedded in the cylinder.

• The mount had to fix the antenna in place so the antenna would not move while oil

was flowing through the cylinder.

- 34 -

Page 51: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

• The mount should cause the antenna to be flush with the bottom of the end cap to

reduce the torque of turbulent forces of oil on the antenna.

• The cylinder’s end cap had to be adequately thick after modification to withstand

internal pressure.

• There could not be any oil leaks.

• The mount and the antenna could not restrict the flow of oil between the hydraulic

hoses and the cylinder.

Keeping the above considerations in mind, the simplest design was to find an SMA

adapter that would be directly tapped through the end cap of the cylinder. This adapter

would allow a rigid connection between the SMA cable and the BAVA, while still isolating

the SMA cable from the pressurized oil within the cylinder. More specifically, a female-

to-male SMA adapter was required to establish a connection between the female end of

antenna and male end of the cable. Furthermore, this adapter needed to have a bulkhead

and an O-ring in order to provide a tight seal and prevent oil from leaking. The adapter

also needed to be at least 55 mm in length to ensure the BAVA would not be in contact

with the end cap. No such female-to-male adapter of su�cient length was readily available

and as such, multiple adapters were cascaded. This cascade consisted of one of each of

the following adapters: female-to-female, male-to-male, and male-to-female. The cascaded

adapter setup, along with a 6 inch SMA cable to facilitate the connection to the VNA cable,

is shown in Figure 3.17a.

The cascaded adapter mount required a counterbore hole to be drilled in order to

accommodate the wider bulkhead of the female-to-female adapter, while still creating a

tight fit around the threaded portion of this adapter. The diameter of the through hole and

counterbore were 8 mm and 12 mm, respectively. Another consideration was the depth of

the counterbore. The depth was selected to be 18 mm to allow a connection between the

- 35 -

Page 52: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

Male-to-female adapter

Male-to-male adapter

Bulkhead female-to- female adapter

6 inch SMA cable

BAVA

(a)

6 inch SMA cable End cap

BAVA

(b)

Figure 3.17: The cascaded adapter antenna mount (a) without the end cap and (b) withthe end cap.

- 36 -

Page 53: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

female-to-female connector and the 6 inch SMA cable. The structural integrity of the end

cap was taken into account and deemed satisfactory due to the unloaded operation and the

high quality steel construction. Figure 3.18 shows the counterbore hole drilled through the

end cap, complete with dimensions. The final structure consisting of the BAVA and the

antenna mount installed in the end cap is provided in Figure 3.17b.

Through hole Diameter: 8 mm

Counterbore Diameter: 12 mm

Figure 3.18: End cap with through hole, counterbore, and their corresponding diameters.

There were several concerns regarding the use of a bare cascaded adapter setup as an

antenna mount. On their own, cascaded adapters may not have provided a su�ciently

rigid mount to withstand the force created by oil flowing through the cavity. The rigidity

required could not be predicted easily without a full positioning system test. Consequently,

a form of encapsulation was considered for the dual purposes of protecting the antenna from

oil and to provide a structure that could be attached to the walls of the piston side cavity

for stabilization. However, initial system tests described in Section 3.4.6 did not indicate

- 37 -

Page 54: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.2 Antenna Design

any rigidity issues, and thus the encapsulation design was not needed.

Without an explicit structure to encapsulate the antenna, a rubberized spray-on sealant

called LeakSeal was applied to protect the antenna from the oil. Specifically, the purpose

of the sealant was to prevent oil from leaking in between the layers of the substrate, which

could modify the e↵ective dielectric properties of the substrate over time and consequently

the characteristics of the antenna. Three coats of LeakSeal were applied to the BAVA and

the part of the antenna mount that resided inside the cylinder.

After the antenna was coated with LeakSeal, S11 was measured once again to ensure that

the performance characteristics of the antenna did not change significantly. The S11 data

gathered from this test and compared to the uncoated antenna is shown in Figure 3.19. Not

surprisingly, the coated antenna’s S11 was generally higher than the uncoated antenna’s S11.

While this reduced the free space bandwidth of the antenna, the compromise was made to

ensure the properties of the antenna remained consistent over time. The reduced bandwidth

was not detrimental in locating local minima of the antenna’s S11, as evident by the tests

described in Section 3.3.2.

0 1 2 3 4 5 6 7 8 9x 109

−40

−35

−30

−25

−20

−15

−10

−5

0

Frequency [Hz]

S 11 M

agni

tude

[dB]

Simulated S11 in Free Space of the BAVA Coated with LeakSeal

Figure 3.19: S11 of the LeakSeal-coated BAVA in free space.

- 38 -

Page 55: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

With the LeakSeal applied to the BAVA and the antenna mounted to the end cap, the

hydraulic cylinder was reassembled. Figure 3.20 displays the end cap with the cylinder fully

assembled. Other than the SMA cable, the antenna and mount are internal to the cylinder,

satisfying the system requirement of an internally embedded antenna.

6 inch SMA cable

End cap

Connection to outer end of bulkhead female-to-

female adapter

Figure 3.20: End cap installed on the cylinder, with the antenna mounted inside.

3.3 Predictive Algorithm Development

The purpose of the predictive algorithm was to predict the position of the piston based on

information from a broadband frequency measurement of the antenna’s S11 obtained by the

VNA. MATLAB was used to develop each of the following three predictive algorithms: (I)

an ANN algorithm; (II) a nearest-neighbour algorithm; and (III) an interpolation algorithm.

- 39 -

Page 56: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

All three predictive algorithms function by providing an estimate of position that is relative

to some known position. Consequently, S11 measurements from known piston positions were

obtained prior to the development of the algorithms, and referred to as ‘calibration data’.

3.3.1 Predictive Algorithm Design Criteria

The design criteria for the predictive algorithm were formulated based on the system spec-

ifications in Table 1.1 and are listed below:

• The predictive algorithm had to be capable of predicting the position of the piston

to within 10 mm of the actual position, thereby meeting the measurement accuracy

specification.

• The predictive algorithm had to be computationally e�cient enough to allow the

measurement system (discussed in Section 3.4) to meet the response time specification

of less than 10 s.

• The predictive algorithm had to provide a single numerical output representing the

predicted position to the measurement system.

These criteria were used to evaluate the three algorithms that were developed, although

it is important to note that emphasis was placed on meeting the measurement accuracy

specification.

3.3.2 Calibration Data Processing

As previously mentioned, calibration data consisted of S11 measurements taken for known

piston positions. The S11 measurements were obtained using the BAVA, connected to a

VNA, at approximately 5 mm intervals along the stroke of the cylinder. The actual position

of these 5 mm intervals was measured and recorded using a laser distance finder, which had

a measurement accuracy of ±3 mm. The actual position of the piston was defined as the

- 40 -

Page 57: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

amount of extension from the state of full retraction (i.e. full retraction was referred to as

0 mm).

As discussed in Section 2.3, the features of the S11 data that correlated to the length

of the cylindrical cavity were the resonant frequencies of the cavity. These resonant fre-

quencies appeared in the S11 data as local minima, and therefore the local minima of the

calibration data needed to be extracted. This was accomplished using a MATLAB peak-

finding algorithm, developed by Nathanael Yoder and available as open source code [16].

An equal number of local minima from each calibration position was required for correct

interpretation by the predictive algorithms. For this reason, only a specified number of local

minima of S11 that occurred above a certain threshold frequency were saved.

Figure 3.21 shows the measured S11 data taken over the frequency range of 2 to 8.5

GHz for a single piston position in the air-filled cylinder, and the extracted local minima

have been circled. The air-filled cylinder refers to an identical hydraulic cylinder void of

oil, rather than a pneumatic cylinder. In order to acquire calibration data, the air-filled

cylinder was positioned manually, without the use of the pump.

All algorithms were initially developed using S11 data from the air-filled hydraulic cylin-

der to ascertain the functionality of each algorithm during the development stage. There

were minimal algorithmic modifications required when transitioning from the air-filled to

the oil-filled cylinder system. Figure 3.22 shows 15 extracted local minima above a thresh-

old frequency of 2 GHz for each and every calibration position, both in the air-filled and

oil-filled hydraulic cylinders. As can be seen be from the plots, both sets of data are similar,

justifying the use of the air-filled data for the development stage of the predictive algorithm.

3.3.3 Artificial Neural Network Algorithm

An ANN can be used for solving complex problems, when a numerical or analytical solution

is not realizable or di�cult to implement [17]. A basic ANN comprised of an input layer,

- 41 -

Page 58: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

2 3 4 5 6 7 8 9x 109

−35

−30

−25

−20

−15

−10

−5

0

S11

Measurements for a Single Position (Air−Filled Cylinder)

Frequency [Hz]

S11

Mag

nitu

de [d

B]

S11

Local Minima

Figure 3.21: S11 measurements taken over a frequency range of 2 to 8.5 GHz for a positionof 225 mm in an air-filled cylinder.

hidden layers, and an output layer, all of which are interconnected. The ANN accepts train-

ing data consisting of input data sets and corresponding output data sets, and iteratively

modifies the hidden layers to generate a function that relates the input to the output. After

training, the ANN should be able to accept an arbitrary input data set and produce an

output data set based on the generated function.

Based on the calibration data from the air-filled and oil-filled cylinders, the local minima

of S11 appeared to vary in a distinct pattern, and this pattern is highlighted in Figure 3.23

for the air-filled data, as well as for the oil-filled data. The exploitation of this pattern

led to the development of the ANN algorithm. The set of local minima associated with

this correlation and the piston position were used as the input and output training data

sets, respectively. Initially, a single ANN was implemented for the entire position range.

Based on the results of the single ANN approach, a cascade of ANNs was implemented by

sectioning o↵ the entire position range into smaller ranges.

- 42 -

Page 59: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

0 50 100 150 200 250 300 3502

2.5

3

3.5

4

4.5

5x 109

Variation in Local Minima of S11

(Air−Filled Cylinder)

Actual Piston Position [mm]

Freq

uenc

y [H

z]

(a)

0 50 100 150 200 250 300 3502

2.5

3

3.5

4

4.5

5 x 109Variation in Local Minima of S11 (Oil−Filled Cylinder)

Actual Piston Position [mm]

Freq

uenc

y [H

z]

(b)

Figure 3.22: The extracted local minima of S11 for the calibration piston positions in (a)the air-filled cylinder system and (b) the oil-filled cylinder system. Both data sets havesimilar patterns, justifying the development of the predictive algorithms using an air-filledcylinder system.

- 43 -

Page 60: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

0 50 100 150 200 250 300 3502

2.5

3

3.5

4

4.5

5x 109

Variation in Local Minima of S11

(Air−Filled Cylinder)

Actual Piston Position [mm]

Freq

uenc

y [H

z]

(a)

0 50 100 150 200 250 300 3502

2.5

3

3.5

4

4.5

5 x 109Variation in Local Minima of S11 (Oil−Filled Cylinder)

Actual Piston Position [mm]

Freq

uenc

y [H

z]

(b)

Figure 3.23: A correlation between the local minima of S11 and the change in position isshown within the red box for (a) an air-filled cylinder and (b) an oil-filled cylinder.

- 44 -

Page 61: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

Single ANN

The ‘single’ ANN approach used one ANN for the entire range of piston positions. The

ANN was created using the built-in Neural Network Toolbox in MATLAB. The frequency

range in which the local minima of S11 varied in a distinct pattern was 2.5 to 4 GHz for

the air-filled cylinder. The frequency range containing the pattern to be exploited was

extracted using a MATLAB script that can be found in Appendix A.2. The local minima

in this frequency range and their corresponding piston positions were provided to the ANN

as the input and output data sets, respectively.

Single ANN Tests and Results

The ANN was trained using 70% of the input and output data, validated using 15% of the

data, and tested using the remaining 15% of the data. Validation refers to checking the

error of the ANN after each successive iteration of training, the purpose of which is to end

the training process when the error converges. Testing refers to checking the error of the

ANN after training is complete with a data set that was not involved with the training

process. The input and output data sets were randomly sorted into the three categories.

In this case, the local minima of S11 in the frequency range specified in Figure 3.23a

were provided as the input data set, along with their corresponding piston positions as the

output data set. The training process was repeated multiple times and similar results were

observed for each trial. Figure 3.24 shows a produced error histogram of the predicted piston

position compared to the actual piston position for the single ANN algorithm. The red line

indicates the measurement accuracy specification of 10 mm. Based on the distribution of

the errors in Figure 3.24, this algorithm failed to meet the specification.

As can be seen from Figure 3.23, there was a repeating pattern between the frequencies

of 2.5 and 4 GHz approximately every 50 mm, with respect to the piston position. This

repeating pattern was present because multiple positions shared similar sets of local minima

- 45 -

Page 62: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 1600

2

4

6

8

10

12Position Prediction Error Single ANN Test

Actual Position− Predicted Position [mm]

Inst

ance

s

Figure 3.24: An error histogram between the actual and predicted piston position. Thered line represents the measurement accuracy specification of 10 mm.

of S11, which was one possible explanation for the poor results of the single ANN approach.

Cascaded ANNs

A cascade of ANNs over the position range was then implemented in an attempt to overcome

the problems caused by the repetitive nature of the correlation. Each individual ANN in

the cascade covered a 50 mm span of the piston position to ensure no repeating patterns

occurred within any individual ANN. Only the positions falling within the designated range

of an ANN were used for training for that specific ANN.

To predict the position, the set of local minima of S11 for an unknown position were

fed into every individual ANN, and the best prediction was chosen. The best prediction

was based on the previously known position of the piston. In this case, the best prediction

referred to the ANN that predicted a position closest to the previous position of the piston.

If none of the networks predicted the position within a predetermined distance from the

- 46 -

Page 63: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

previous position, then the previous position plus or minus a small increment of distance

would be taken as the predicted position depending on whether the piston was extending

or retracting, respectively.

Cascaded ANNs Tests and Results

The cascaded ANN algorithm used the same calibration data as the single ANN approach

in Section 3.3.3. However, only the set of local minima of S11 corresponding to the 50 mm

interval range of an individual ANN was used by that specific ANN. Figure 3.25 shows a

sample range for an individual ANN used in testing purposes, as indicated within the green

box. This test was done in order to show whether an ANN could properly train when the

positions did not share similar sets of local minima of S11.

The process of training the network was tested multiple times, and the results were

similar for all trials. Figure 3.26 shows a produced error histogram of the predicted position

compared to the actual piston position for the cascade of ANNs. The red line indicates the

measurement accuracy specification of 10 mm. Based on the distribution of the errors in

Figure 3.26, this algorithm met the specification.

ANN Algorithm Summary

The results from the single ANN configuration showed that a single network was unable to

properly predict position given a set of local minima of S11. This result was due to piston

positions sharing similar sets of local minima.

The results yielded from an individual ANN for a 50 mm range showed that a cas-

cade of ANNs could potentially meet the measurement accuracy specification. However,

this method became very complex with regards to implementing the cascaded structure of

networks. These complexities included (I) creating a program capable of recognizing the

beginning and end positions of the repeating patterns; and (II) measurement noise causing

- 47 -

Page 64: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

0 50 100 150 200 250 300 3502

2.5

3

3.5

4

4.5

5x 109

Variation in Local Minima of S11

(Air−Filled Cylinder)

Actual Piston Position [mm]

Freq

uenc

y [H

z]

Figure 3.25: The local minima of S11 and the position exhibits a repetitive pattern.The green box shows the position range within which an individual ANN would cover oneinstance of the pattern.

0 2 4 6 8 10 12 14 160

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2Position Prediction Error Multi−ANN Configuration Test

Actual Position− Predicted Position [mm]

Inst

ance

s

Figure 3.26: An error histogram between the actual and predicted position. The red linerepresents the measurement accuracy specification of 10 mm.

- 48 -

Page 65: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

expected local minima of S11 in the patterns to be missing. The biggest flaw with the

cascaded ANN approach was that ANNs require a large amount of training data in order to

provide meaningful results [17]. Since individual ANNs only cover 50 mm intervals, a large

amount of calibration data would need to be collected. Thus, calibration would become a

very tedious process and impractical in real world applications.

Overall, the implementation of the predictive algorithm using ANNs was unsuccessful

due to there being only a narrow frequency band that could correlate local minima of S11

with piston position, and due positions have similar sets of local minima. In future work, a

combination with the other algorithms may result in a useful solution.

3.3.4 Nearest-Neighbour Algorithm

A nearest-neighbour algorithm was developed because of the complexities facing the ANN

approach. The continuous nature of the data coupled with the available calibration data

previously mentioned in Section 3.3.2 allowed for an algorithm to be developed that did not

su↵er the same drawbacks as the ANN method. MATLAB was used to develop the nearest-

neighbour algorithm in a similar fashion to the ANN approach discussed in Section 3.3.3;

the code for the algorithm has been included in Appendix A.3.

Nearest-Neighbour Algorithm Development

The nearest-neighbour algorithm relied on the assumption that measurements taken at one

position should be similar to measurements taken at adjacent positions. This algorithm

was also developed with the assumption that previously attained calibration data taken

at regular intervals (known positions) along the stroke length would be available for the

algorithm to access in real-time. This calibration data was important because it allowed

the algorithm to guess where measurement data from an unknown position should fit in,

based on which calibration position data set the unknown data most closely resembled. A

- 49 -

Page 66: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

high level flowchart is shown in Figure 3.27, and can be referred to as the algorithm is

described in more detail below.

First, the algorithm needed to modify the calibration and unknown position data into a

form that only contained information about the local minima of the S11 data. This process

was accomplished by first extracting the local minima over a specified frequency range using

the peak-finding algorithm mentioned in Section 3.3.2. Next, a matrix called the ‘discretized

frequency matrix’ (DFM) was created. The purpose of this matrix was to section o↵ local

minima into discrete frequency intervals. If a local minima fell within a certain range, the

DFM value that corresponded to that frequency range and that calibration position was

changed from 0 to 1. This process was then repeated for all of the calibration positions,

resulting in each column of the DFM representing a unique calibration position. An example

of how the local minima were converted to this format is shown in Figure 3.28. A similar

process was carried out on the unknown position’s local minima to generate a ‘discretized

frequency vector’ (DFV). The size of the frequency intervals was selected to be 20 MHz

which prevented the algorithm from dealing with multiple minima occurring in the same

interval. An interval size smaller than 20 MHz would increase the computational complexity

of the algorithm, which was undesirable as stated in Section 3.3.1. This discretized format

allowed the nearest-neighbour algorithm to easily look for similarities between the DFV and

columns of the DFM.

Secondly, the algorithm must compare the unknown position data with the calibration

data. The algorithm calculates a value ranking how similar the DFV is to each of the

columns in the DFM. More detail on exactly how this value is calculated can be found in

Appendix A.3. Based on the numerical rankings, the algorithm returns the most similar

column (i.e. calibration position) as the prediction.

- 50 -

Page 67: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

S11 DATA FROM MEASUREMENT

SYSTEM

DISCRETIZE DATA INTO 20 MHz INTERVALS

COMPARE UNKNOWN POSITION DISCRETIZED

S11 DATA AND CALIBRATION S11 DATA CORRESPONDING TO A

SINGLE KNOWN POSITION

QUANTIFY AND STORE HOW SIMILAR THE TWO

DATA SETS ARE

ALL COMPARISONS COMPLETED?

RETURN THE MOST SIMILAR CALIBRATION

POSITION AS THE PREDICTED POSITION

YES

NO

START

DONE

EXTRACT LOCAL MINIMA FROM DATA

PRE-PROCESSED CALIBRATION DATA FROM

MEASUREMENT SYSTEM

Figure 3.27: A high level flowchart of the nearest-neighbour algorithm.

- 51 -

Page 68: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

Position #1Frequencies

210 MHz

222 MHz

Position #2Frequencies

258 MHz

264 MHz

Frequency Range

Position#1

Position#2

200-220 MHz 1 0

220-240 MHz 1 0

240-260 MHz 0 1

260-280 MHz 0 1

Calibration Data

Discretized Frequency Matrix

Figure 3.28: A visual representation of converting the local minima of the measurementdata into the DFM. Local minima occurring within a frequency range will set the corre-sponding value in the DFM to 1.

Nearest-Neighbour Algorithm Testing and Results

The nearest-neighbour algorithm was originally developed and tested using calibration data

acquired using the air-filled cylinder. The algorithm was tested by first extracting the data

for a single calibration position from the larger calibration data set. The algorithm would

attempt to predict where the extracted data belonged in the complete data set without any

prior knowledge. This procedure was automated to test all of the calibration positions in

succession and output a percentage indicating the prediction success rate. A ‘success’ was

defined as a prediction error less than 10 mm, as per the measurement accuracy specification

detailed in Table 1.1. Based on the results of these tests, parameters such as the frequency

range, peak-finder sensitivity, and total number of local minima were optimized to achieve

the highest success rate.

A success rate of 100% was achieved when the nearest-neighbour algorithm was opti-

mized for the air-filled cylinder. Figure 3.29 shows a plot of the predicted position compared

- 52 -

Page 69: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

to the actual position for this test. After the oil-filled calibration data was acquired the pa-

rameters were again optimized, and a success rate of 88.4% was achieved. A plot comparing

the predicted position to the actual position for the oil-filled test is shown in Figure 3.30.

This success rate could have been increased by acquiring more calibration measurements,

and for this reason the nearest-neighbour algorithm was deemed capable of satisfying the

measurement accuracy specification.

0 50 100 150 200 250 300 350 4000

50

100

150

200

250

300

350

400

Actual Piston Position [mm]

Pred

icte

d Pi

ston

Pos

ition

[mm

]

Nearest−Neighbour Algorithm Prediction Test (Air−Filled Cylinder)

Algorithm PredictionCorrect Piston Position10 mm Error Specification

Figure 3.29: A comparison of the predicted and actual positions using the nearest-neighbour algorithm (air-filled data).

Nearest-Neighbour Algorithm Summary

The high success rates of the prediction tests indicated that the nearest-neighbour algorithm

would be suitable for use in the positioning system. It is important to note that the accuracy

of this algorithm was directly related to the number and quality of calibration measurements

taken. If the number of calibration measurements were to be increased, the accuracy of the

algorithm would improve, at the expense of computational complexity. On the contrary,

- 53 -

Page 70: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

0 50 100 150 200 250 300 3500

50

100

150

200

250

300

350

400

Actual Piston Position [mm]

Pred

icte

d Pi

ston

Pos

ition

[mm

]

Nearest−Neighbour Algorithm Prediction Test (Oil−Filled Cylinder)

Algorithm PredictionCorrect Piston Position10 mm Error Specification

Figure 3.30: A comparison of the predicted and actual positions using the nearest-neighbour algorithm (oil-filled data).

if the number of calibration measurements is decreased, the accuracy of the algorithm will

degrade. This relationship can be exploited in the future to control the accuracy of the

entire system. The algorithm’s reliance on the amount of calibration measurements does

not pose a problem because the measurements do not need to be acquired more than once

with the same VNA calibration. If the properties of the oil change over time, new calibration

measurements would be required to maintain accuracy.

3.3.5 Interpolation Algorithm

The nearest-neighbour algorithm was only as accurate as the intervals at which calibration

measurements were taken; if calibration measurements were acquired every 5 mm, the best

possible accuracy would be 5 mm. As such, the interpolation algorithm looked to increase

accuracy by linearly interpolating between calibration measurements. This algorithm used

aspects from the ANN approach and the nearest-neighbour algorithm.

- 54 -

Page 71: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

First, the interpolation algorithm isolated the frequency range in which a distinctive

pattern in the local minima of S11 as shown in Figure 3.23b was observed, similar to the

ANN approach in Section 3.3.3. Secondly, the algorithm interpolated between the acquired

calibration data sets to create pseudo-calibration data sets. Lastly, the algorithm imple-

mented the nearest-neighbour algorithm from Section 3.3.4 with the new calibration data

to generate a more accurate prediction.

Interpolation Algorithm Calibration

The creation of the interpolated calibration data set was crucial to the success of the inter-

polation algorithm because it allowed a higher prediction accuracy relative to the amount

of collected calibration measurements. A MATLAB script was written to isolate the dis-

tinctive pattern between the local minima of S11 and piston position, and perform a linear

interpolation on the isolated pattern. To isolate the this pattern from the rest of the data,

the following procedure was implemented:

1. Upper and lower boundaries on the frequency range were established.

2. Starting from the upper boundary and shortest piston position, the first local min-

imum of S11 was extracted and stored in an empty row of a matrix. Each row in

this matrix contained the local minima corresponding to a single line in the overall

pattern.

3. The algorithm then looked for the next local minimum for the next piston position

that was within a predetermined frequency range lower than the first local minimum.

If such a minimum was found, it was stored in the same row and the next column

to the right of the previous minimum from step 2. If the method could not find a

minimum satisfying this condition, or the final position had been reached, the line

was considered complete.

- 55 -

Page 72: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

4. After completing a line, steps 2 and 3 were repeated to obtain another line in the

correlation, with the algorithm starting at the next calibration position.

5. Once step 4 reached the last calibration position, the method repeated steps 2 to 4.

However, the first local minimum satisfying the criteria in step 2 would be ignored,

which allowed the detection of lines that originated lower in frequency as compared

to the first line.

Linear interpolation was then used on the isolated lines to create the input pseudo-

calibration data set. Linear interpolation was also performed on a vector containing the

piston positions to produce the possible output positions corresponding to the input pseudo-

calibration data set. The complete pseudo-calibration data set was then converted to the

DFM format. The calibration data for the interpolation algorithm was then complete. A

detailed description of the creation of the calibration data can be found in Appendix A.4.

This algorithm was robust in practice due to the many settings the user could select

during the calibration process. These settings included:

1. A user-specified frequency range. This choice was important because the dielectric

properties of the oil could change over time, changing the frequency range of the

desired patterns.

2. The user could eliminate local minima that did not vary with piston position.

3. The user could remove sporadic calibration values, i.e. a single frequency not on any

of the desired lines could be eliminated from calibration data set.

4. The user could choose how many points were created between the original calibration

points depending on whether the application required a faster processing time with

a reduced prediction accuracy, or a higher prediction accuracy at the cost of slower

processing speed.

- 56 -

Page 73: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

Interpolation Algorithm Prediction

The predicted piston position using the interpolation algorithm consisted of two predictions:

nearest-neighbour algorithm prediction using (I) the original calibration data, and (II) the

pseudo-calibration data generated from the interpolation. Without the nearest-neighbour

prediction using the original calibration data, the interpolation prediction would su↵er

the same drawbacks as the single ANN algorithm discussed in Section 3.3.3. For this

reason, the nearest-neighbour prediction was used as a reference, and further refined by the

interpolation algorithm. Fig 3.31 shows a high level flowchart of the interpolation algorithm.

For a more in-depth look at how the interpolation algorithm predicted the final position,

refer to Appendix A.5 and Appendix A.6.

Interpolation Algorithm Tests and Results: Air-Filled Data

The interpolation algorithm was initially tested using the air-filled cylinder data shown in

Figure 3.22. The extracted local minima of S11 from the reduced frequency range before and

after interpolation are shown in Figure 3.32a and Figure 3.32b, respectively. A comparison

of these plots shows that the algorithm extracted the lines of interest from the data correctly

and performed a linear interpolation.

To properly test the algorithm, the data corresponding to one calibration position was

removed from the larger calibration data set before the interpolation was performed. The

removed calibration position was used as the ‘unknown’ test position. Next, the nearest-

neighbour algorithm predictions (from Section 3.3.4) were loaded into the program. These

predictions were used for reference in the interpolation algorithm. The algorithm then

predicted the position. This process was repeated to test the interpolation algorithm on all

of the calibration positions.

Figure 3.33 shows the results of this test for the air-filled cylinder. The solid red line

indicates the ideal case of perfect prediction, and the blue circles represent the predicted

- 57 -

Page 74: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

S11 DATA FROM MEASUREMENT

SYSTEM

DISCRETIZE DATA INTO 20 MHz INTERVALS

COMPARE UNKNOWN POSITION DISCRETIZED S11

DATA AND CALIBRATION S11 DATA CORRESPONDING TO A SINGLE KNOWN POSITION

QUANTIFY AND STORE HOW SIMILAR THE TWO DATA

SETS ARE

ALL COMPARISONS COMPLETED?

RETURN THE MOST SIMILAR CALIBRATION POSITION AS THE

INTERPOLATED PREDICTION

YES

START

DONE

EXTRACT LOCAL MINIMA FROM DATA

PRE-PROCESSED INTERPOLATED

CALIBRATION DATA FROM MEASUREMENT

SYSTEM

ISOLATE DESIRED FREQUENCY RANGE

IS THE INTERPOLATED PREDICTION WITHIN 10 MM OF THE

REFERENCE PREDICTION?

NEAREST-NEIGHBOUR PREDICTION (REFERENCE)

NEAREST-NEIGHBOUR PREDICTION IS USED

INTERPOLATED PREDICTION IS USED

NO

YES

WAS THE CALIBRATION POSITION WITHIN A CERTAIN

SIMILARITY THRESHOLD?

REMOVE THE CALIBRATION

POSITION CORRESPONDING TO THE INTERPOLATED

PREDICTION

NO

YES

NO

Figure 3.31: A high level flowchart of the interpolation algorithm.

- 58 -

Page 75: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

0 50 100 150 200 250 300 3502.5

3

3.5

4 x 109Local Minima of S11 Correlation

Actual Piston Position [mm]

Freq

uenc

y [H

z]

(a)

0 50 100 150 200 250 300 3502.5

3

3.5

4 x 109Interpolated Local Minima of S11 Correlation

Actual Piston Position [mm]

Freq

uenc

y [H

z]

(b)

Figure 3.32: The extracted local minima of S11 from the reduced frequency range using theair-filled cylinder data are shown in (a), while (b) shows the trend lines after interpolation.

- 59 -

Page 76: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

position. The maximum di↵erence between the predicted and actual positions is 5 mm,

and 97.22% of the predictions were within 1.5 mm. This test showed that the interpolated

algorithm was an improvement on the nearest-neighbour algorithm and performed well

within the measurement accuracy specification of 10 mm.

0 50 100 150 200 250 300 3500

50

100

150

200

250

300

350

Actual Piston Position [mm]

Pred

icte

d Pi

ston

Pos

ition

[mm

]

Interpolation Algorithm Prediction Test (Air−Filled Cylinder)

Algorithm PredictionCorrect Piston Position10 mm Error Specification

Figure 3.33: A comparison of the predicted and actual positions using the interpolationalgorithm (air-filled data).

Interpolation Algorithm Tests and Results: Oil-Filled Data

After a successful test using the air-filled cylinder data, the interpolation algorithm was then

tested using the oil-filled cylinder data. The extracted local minima of S11 from the reduced

frequency range before and after interpolation are shown in Figure 3.34a and Figure 3.34b,

respectively. As can be seen from these plots, the algorithm extracted the lines of interest

from the oil-filled cylinder data correctly and performed a linear interpolation.

The same test procedure as the one outlined in Section 3.3.5 for the air-filled case

- 60 -

Page 77: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

0 50 100 150 200 250 300 3501.5

2

2.5

3 x 109Local Minima of S11 Correlation

Actual Piston Position [mm]

Freq

uenc

y [H

z]

(a)

0 50 100 150 200 250 300 3501.5

2

2.5

3 x 109Interpolated Local Minima of S11 Correlation

Actual Piston Position [mm]

Freq

uenc

y [H

z]

(b)

Figure 3.34: The extracted local minima of S11 from the reduced frequency range using theoil-filled cylinder data are shown in (a), while (b) shows the trend lines after interpolation.

- 61 -

Page 78: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.3 Predictive Algorithm Development

was performed. Figure 3.35 shows the results of this test for the oil-filled cylinder data.

The solid red line once again indicates the ideal case of perfect prediction, and the blue

circles represent the predicted position. Table 3.1 shows the percentage of predictions

that fell within various error ranges. These test results in oil show that the interpolation

algorithm was successful because 92% of predictions were within the measurement accuracy

specification of 10 mm.

Table 3.1: Prediction errors using the interpolation algorithm.

Percentage of Predictions Maximum Error

40.58% 1.5 mm42.03% 2.0 mm69.57% 3.0 mm81.16% 4.0 mm82.61% 5.0 mm92.75% 10 mm

Interpolation Algorithm Summary

The interpolation algorithm proved to be the most accurate method, because 92% of the

predicted positions were within the specification of 10 mm using the oil-filled cylinder data.

However, the integration of the MATLAB script with LabVIEW was not successful due

unresolved communication issues. Future work to improve the accuracy of the predictions

would involve implementing the interpolation algorithm in the control system successfully.

Also, since interpolation can be used to create a larger set of pseudo-calibration data,

the cascaded ANN algorithm may viable. A combination of interpolation and the ANN

approach would reduce processing time due to front-loaded computations, while allowing

for a comparable level of accuracy.

- 62 -

Page 79: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

0 50 100 150 200 250 300 3500

50

100

150

200

250

300

350

Actual Piston Position [mm]

Pred

icte

d Pi

ston

Pos

ition

[mm

]

Interpolation Algorithm Prediction Test (Oil−Filled Cylinder)

Algorithm PredictionCorrect Piston Position10 mm Error Specification

Figure 3.35: A comparison of the predicted and actual positions using the interpolationalgorithm (oil-filled data).

3.3.6 Final Algorithm Selection

Ultimately, the nearest-neighbour algorithm was implemented in the positioning system

because the predictions were within the required specification of 10 mm 88% of the time

during testing. Both ANN algorithms were unsuccessful in predicting the piston extension

within the whole stroke range. While the interpolation algorithm improved on the nearest-

neighbour algorithm, implementation was unsuccessful, leading to the sole adoption of the

nearest-neighbour algorithm.

3.4 Measurement System Development

The measurement system was a necessary subsystem of the automatic positioning system

because a way of determining the current position of the piston was needed to use feedback as

a method to ensure proper positioning. Therefore, the purpose of the measurement system

- 63 -

Page 80: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

is to acquire S11 data from the VNA, and through the implementation of the predictive

algorithm, provide a position prediction to the control system. The control system needs to

use the provided position estimate to determine how to move the piston. The measurement

system development and implementation process is explained below.

3.4.1 Measurement System Component Overview

To obtain a position estimate, the measurement system uses the predictive algorithm ex-

plained in Section 3.3. The measurement system performs its duties in two main phases:

calibration and prediction. During the calibration phase, the measurement system collects

previously saved S11 data in comma separated values (CSV) files for known positions. Once

collected, these files are processed into calibration data for the predictive algorithm im-

plemented in MATLAB. Next, the prediction phase requires the measurement system to

acquire the S11 data in real-time. Then, this data is passed to the predictive algorithm,

which returns a position estimate to the measurement system. Given the need for the inter-

actions with both hardware and software elements, the measurement system was developed

in LabVIEW because this software supported the aforementioned interactions.

A high level overview of the measurement system program is shown in Figure 3.36. This

diagram illustrates the di↵erent components the measurement system program must inter-

face with to provide a position estimate. Specifically, the figure shows that the measurement

system interfaces with the VNA, MATLAB, and the PC all through LabVIEW.

The following sections consider the calibration and prediction phases performed by the

measurement system in more detail.

3.4.2 Measurement System Design Criteria

The final measurement system program had to (I) obtain S11 data from a frequency measure-

ment through the VNA using a general purpose interface bus (GPIB) cable; (II) interface

- 64 -

Page 81: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

Figure 3.36: The measurement system has many components it interfaces with, includingthe VNA, MATLAB and CSV files.

with MATLAB; and (III) provide previously gathered calibration data in the form of CSV

files to the predictive algorithm. The measurement system program did not have to set the

VNA measurement characteristics (e.g. start frequency, stop frequency, number of points)

because previously saved settings and a VNA calibration file were loaded manually before

the positioning system was used. Most importantly, the measurement system had to adhere

to the measurement-related specifications of the positioning system outlined in Table 1.1.

3.4.3 VNA - PC Interface

The measurement system had to be able to communicate with the VNA in order to obtain

S11 data. To establish communication with the VNA, software drivers were found for the

particular VNA that was made available for this project. These drivers enabled the VNA

to be remotely controlled through LabVIEW. The instrument drivers were developed by

- 65 -

Page 82: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

Agilent Technologies for Agilent ENA Series Analyzers1. The drivers were able to commu-

nicate with the VNA through the GPIB protocol insofar as the PC was able to recognize

the VNA. Even though these drivers allowed the VNA and PC to recognize each other, a

test program still had to be developed to verify that S11 data could be obtained using this

communication method.

VNA - PC Interface Verification

A test program was created to determine whether LabVIEW could successfully obtain S11

data from the VNA. This LabVIEW program collected S11 data from a broadband frequency

measurement (0.2 - 8.5 GHz) of air using a dielectric probe. The collected data was then

stored in a text file on the host PC. The same S11 data was also transferred directly from the

VNA onto a USB drive. This transfer method guarantees that the data as viewed directly

on the VNA will be completely preserved. Then, the data collected through LabVIEW was

compared with the data transferred onto the USB drive. The final step of this test was to

compare the two datasets to determine if there were any di↵erences. If the two data sets

were the same, there would be su�cient proof that the test program successfully collected

S11 data from the VNA and stored it on the PC.

After the test program was executed, the two data sets were plotted in MATLAB so

that the data sets could be visually compared. Comparison of the data collected through

LabVIEW and the data on the USB showed that the two data sets were identical. Conse-

quently, the test results indicated that the S11 data was transferred successfully from the

VNA to the PC using the GPIB protocol. As such, the development of the measurement

system could proceed with basic functionality of the measurement system established.

1Available at: http://sine.ni.com/apps/utf8/niid_web_display.model_page?p_model_id=5692Accessed: March 2014

- 66 -

Page 83: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

3.4.4 Predictive Algorithm Integration

LabVIEW and MATLAB had to be able to interface with each other, so that the MATLAB-

based predictive algorithm could be integrated with the measurement system. The predic-

tive algorithm needed previously collected S11 data to be calibrated as explained in Sec-

tion 3.3.2. These previously obtained data were stored as CSV files in a single folder, which

were then passed to MATLAB in the measurement system program. This section outlines

how the predictive algorithm was integrated into the measurement system program.

Measurement System Integration of MATLAB

The MATLAB Script Node driver is a LabVIEW virtual instrument (VI) that calls the

native MATLAB environment to execute the MATLAB code assigned to the driver. The

use of the native MATLAB environment provides the ability to use built-in MATLAB

functions more easily, a feature that other potential drivers did not have. The MATLAB

Script Node driver was used to interface LabVIEW and MATLAB. Once this driver was

selected, the driver had to be tested to see if it would allow the functionality necessary to

communicate with the predictive algorithm.

To assess the functionality of the MATLAB Script Node driver, a test program was

written in MATLAB to assess the ability of the driver to execute the peak-finding algo-

rithm described in Section 3.3.2. The peak-finding algorithm uses several built-in MATLAB

functions that have to work with the MATLAB Script Node driver, so that the predictive

algorithm has the correct inputs in order to properly function. As such, the test program

received a set of S11 data corresponding to a single piston position. Next, the test program

plotted the local minima of the S11 data. If the local minima were successfully plotted,

it would show that LabVIEW could successfully communicate with MATLAB through the

MATLAB Script Node driver.

The driver functionality test was performed, and the S11 data and the extracted local

- 67 -

Page 84: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

minima were plotted. The resulting plot is given in Figure 3.37, which shows that the local

minima most likely corresponding to resonant frequencies had been found. This evidence

supports the fact that LabVIEW communicated properly with MATLAB and the predictive

algorithm.

2 3 4 5 6 7 8 9x 109

−35

−30

−25

−20

−15

−10

−5

0

S11

Measurements for a Single Position (Air−Filled Cylinder)

Frequency [Hz]

S11

Mag

nitu

de [d

B]

S11

Local Minima

Figure 3.37: The S11 data of an enclosed air-filled steel pipe.

Data Retrieval for Predictive Algorithm Calibration

The calibration of the predictive algorithm requires previously saved S11 data, as mentioned

in Section 3.3.2. The Read From Spreadsheet File VI was needed to extract the data from

the CSV files containing the S11 data and provide this data to the predictive algorithm.

This VI was tested by using S11 data on a USB drive, in CSV form, and running a simple

LabVIEW program. This LabVIEW program used the Read From Spreadsheet File VI to

obtain the S11 data and plot the data through MATLAB using the MATLAB Script Node

driver. The test was successful and demonstrated that previously attained data could be

passed into MATLAB for the purpose of predictive algorithm calibration.

- 68 -

Page 85: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

3.4.5 Measurement System Assembly

The final measurement system program was created only once the the measurement system

was able to (I) obtain data from the VNA; (II) interface with the prediction algorithm

in MATLAB; and (III) obtain previously saved calibration data. The final measurement

system program has a calibration phase and prediction phase, as described in Section 3.4.1.

Both of these parts are in the main LabVIEW measurement program. The calibration only

runs once when the program is first executed, while the prediction code executes every time

the user chooses to predict the position of the piston. The development of these two main

parts is explained in the following sections.

Measurement System Calibration Phase

The calibration phase of the measurement system program retrieves previously obtained

S11 data taken from specific calibration positions and passes this data to the predictive

algorithm calibration MATLAB script. The previously attained S11 data is stored in the

form of CSV files on a USB drive with each CSV file named according to the calibration

position that it represents (e.g. data obtained for a piston position of 180 mm would be

stored in the file 180.csv). The logic of the calibration part of the measurement system

program is explained in the following paragraph.

First, all of the MATLAB variables that were created during previous executions of the

measurement system program are deleted and array variables are initialized. This is done

with the help of the MATLAB Script Node driver. Next, the program enters a for-loop to

read in and process all of the calibration CSV files. The for-loop’s maximum iteration is

set to one more than the farthest calibration position in terms of piston extension to ensure

that for-loop iterates through all of the CSV files; e.g. if the farthest calibration position is

536 mm, then the iteration limit of the for-loop is set to 537. However, the number of CSV

files in the folder is always less than the maximum iteration of the for-loop as S11 data was

- 69 -

Page 86: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

collected in 5 mm intervals along the total cylinder stroke. In the for-loop, there is another

MATLAB Script Node driver that contains code which increments a counter. The counter

starts at zero and increments for every iteration of the for-loop. The MATLAB Script Node

driver outputs this counter, and through LabVIEW it is determined if a file of the same

name as the value of the counter exists in the folder where the CSV calibration files. The

for-loop also contains a case structure that enables di↵erent actions if a condition is true

or false. Using this programming structure, the S11 data in the CSV file is read by the

Read From Spreadsheet File VI if and only if the CSV calibration file exists in the folder.

In the case that the CSV calibration file exists, the file is given to the predictive algorithm

calibration script. Therefore, only the calibration positions for which data exists are used

by the predictive algorithm. Figure 3.38 shows the flow chart that explains the calibration

program’s logic. The LabVIEW block diagram for the calibration program can be seen in

the measurement system block diagram in Figure B.1.

Measurement System Prediction Phase

The prediction phase of the measurement system program is responsible for implementing

the predictive algorithm to estimate the current position of the piston along the stroke

length. This phase runs only after calibration and is executed every time a position estimate

is required. A description of the prediction phase logic follows below.

Initially, the program waits for a request to measure the current position of the piston.

This request could come from the user (only during isolated testing of the measurement

system) or the overall positioning system program. When the request is received, the S11

data at the current piston position is taken from the VNA using the Read Data and Memory

Array VI. This S11 data is then passed to the predictive algorithm prediction script via the

MATLAB Script Node driver. The predictive algorithm uses this data and the calibration

data to generate a prediction which the measurement system program receives for use in the

- 70 -

Page 87: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

START

CLEAR MATLAB VARIABLES CREATED DURING PREVIOUS EXECUTION AND INITIALIZE NEW

VARIABLES

INCREMENT COUNTER

(START FROM ZERO)

CONVERT COUNTER TO FILENAME

DOES THE FILE EXIST?

READ S11 DATA FROM FILE AND PASS IT TO THE

NEAREST-NEIGHBOUR CALIBRATION MATLAB

SCRIPT

NEAREST-NEIGHBOUR

CALIBRATION SCRIPT STORES S11 DATA IN MATRIX FOR LATER USE

COUNTER <= FARTHEST CALIBRATION

POSITION?

DONE

YES

YES

NO

NO

Figure 3.38: The flowchart of the measurement system program’s calibration phase.

- 71 -

Page 88: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

overall positioning system. Figure 3.39 shows the flow chart that explains the prediction

program’s logic. Also, the LabVIEW block diagram for the prediction program can be seen

in the measurement system block diagram in Figure B.1.

CURRENT PISTON POSITION NEEDED?

S11 DATA IS TAKEN FROM THE VNA AND

PASSED TO THE NEAREST-NEIGHBOUR

ALGORITHM

THE NEAREST-NEIGHBOUR

ALGORITHM USES THE DATA TO PRODUCE A POSITION ESTIMATE

YES

NO

THE PREDICTION IS PASSED BACK TO THE

MAIN LABVIEW PROGRAM TO BE USED IN THE MAIN POSITION

CONTROL SYSTEM

Figure 3.39: The flowchart for the prediction phase of the measurement system program.

3.4.6 Measurement System Testing and Results

Once the measurement system program was developed, testing was done to see if it met

the measurement-related specifications outlined in Table 1.1. The measurement system was

tested with 68 calibration positions taken along the cylinder stroke length in increments of

- 72 -

Page 89: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.4 Measurement System Development

roughly 5 mm apart. The following sections outline the specific tests conducted to verify if

the measurement system met the specifications.

Measurement System Accuracy Test

To test the accuracy of the measurement system, the piston was fully retracted. Then,

the actual position of the piston and the predicted position returned by the measurement

system were recorded. LabVIEW was used to pulse the motor for a specific interval to

move the piston a short distance. After each movement interval, the actual and predicted

positions were recorded. This process was repeated until the piston reached full extension.

Figure 3.40 shows the actual position versus predicted position. A total of 55 positions

along the stroke length were measured to provide a su�cient sample size for this test; 55

approximately evenly spaced positions translated into a distance of 6 mm between points.

The magnitude of the error between the predicted and actual positions was considered in

determining how well the measurement system met its specifications. As such, the mean

error was 1.33 mm, and the maximum error was 4 mm. Given these mean and maximum

error values, the measurement system program met its accuracy specification.

Exhaustive testing was not practical, but the maximum error that can be theoretically

expected should be half of the largest interval between two consecutive calibration positions.

This is due to the fact that the position measurement returned by the measurement system

is the closest calibration point to the actual current position.

Measurement System Repeatability Test

The nature of the predictive algorithm a↵ects the measurement system’s repeatability. The

predictive algorithm compares S11 data collected at the current position to previously ob-

tained S11 data from calibration positions. Thus, if a measurement is taken at a certain

position along the piston stroke length, the predicted position returned by the measurement

- 73 -

Page 90: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

0 50 100 150 200 250 300 3500

50

100

150

200

250

300

350

400

Actual Piston Position [mm]

Pred

icte

d Pi

ston

Pos

ition

[mm

]

Measurement System Accuracy Test

Program PredictionCorrect Piston Position10 mm Error Specification

Figure 3.40: Plot of the measurement system accuracy test data.

system will always be the calibration point that the predictive algorithm determines is clos-

est to the current position. Therefore, the prediction returned by the measurement system

will not change when a new measurement is taken at the same position. Consequently,

repeatability is always 0 mm for any position measured along the cylinder stroke length, so

the measurement system meets its repeatability specification outlined in Table 1.1.

3.5 Control System Development

This section focuses on the control of the pump’s movement. While the whole project

could be considered as one complete control system, the work involved with measuring the

position of the piston has already been covered in Section 3.4, and the integration of the

individual completed components of the project will be discussed in Section 4. The purpose

of the control system discussed in this section was to bridge the gap between the knowing

the current piston position and moving the piston to the target position. Design criteria

- 74 -

Page 91: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

used in designing the control system, the process of developing the control system, and the

testing and verification of the completed program will described in detail.

3.5.1 Control System Design Criteria

According to the specifications outlined in Table 1.1, the final positioning system, and

therefore the control system, needed be able to position the piston to within 10 mm of

the target position. This specification needed to be met for any combination of initial and

target positions. The control system needed to be able to use the position information

sent from the measurement system in order to properly place the piston. Additionally, the

repeatability of the final positioning system, which directly depends on the control system,

must be less than 20 mm.

In order to easily interface the control system with the measurement system program

and the LabJack U3, the control system program had to be created in LabVIEW. The

control system consisted of the components shown in Figure 1.1. The hardware components

that were part of the control system included the LabJack U3 controller and the LabJack

RB12 relay board with two G4 DC Opto 22 relays as discussed in Section 1.5.4. These

components were selected specifically because of their ability to satisfy the needs of the

control system, i.e. the ability to control the pump.

A limitation of the hardware used in this project was that the piston always drifted

approximately 11 mm outward after being powered, regardless of whether the pump was

previously extending or retracting the cylinder. Section 3.1 discussed the reason why this

drift occurred, and the initial attempts to solve this problem. Due to the lack of success

of the attempted hardware solutions, the control system needed be able to account for the

drift using a software solution such that the positioning system specification in Table 1.1

was still met.

- 75 -

Page 92: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

3.5.2 Control System Design

This section will outline the process of developing a control system that was able to correctly

place the piston according to the previously outlined design criteria. This process included

creating a LabJack-LabVIEW interface, then creating a program to control the pump using

LabVIEW. Following this step, several controllers were analyzed and an appropriate method

was chosen and implemented.

LabJack-LabVIEW Interface

The first task required to develop the control system was to establish communication be-

tween the PC and the LabJack U3. To accomplish this, a simple test program was written

in LabVIEW. The LabVIEW program allowed a user to set any pin on the LabJack U3 to

a specified voltage level of high (5 V) or low (0 V). Figure 3.41 shows the GUI that the user

would interact with to run the program.

Figure 3.41: GUI for LabJack-LabVIEW interface program.

This program first initialized the LabJack U3, and then sent a write command to the

LabJack U3. The inputs to this write command included the user-specified pin and the

voltage level. The LabJack-LabVIEW interface was verified by measuring the voltage on

- 76 -

Page 93: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

the pins of the LabJack using an oscilloscope. All pins but the user selected pin remained

at a constant voltage level of 0 V. The pin that was selected responded to the commands

of the user without any noticeable delay, thus this task was deemed complete.

Pump Driving Program

The pump control program was created by modifying the structure of the LabJack-LabVIEW

interface program. Instead of a single write command, two write commands were used to

set the voltage of pins 9 and 10 on the U3, which in turn connected to the RB12 relay

board. The LabJack-LabVIEW program GUI shown in Figure 3.41 was then modified so

the user would not be able to directly control the voltage of the pins, but would instead

be able to select ‘Extend’, ‘Retract’, or ‘Retain Position’ to control the state of the pump

using a 3-way switch. The GUI for the modified program is shown in Figure 3.42.

Figure 3.42: GUI for the pump control program.

The operation of the pump was such that there was one solenoid that controls whether

or not the pump was running (the ‘go’ solenoid), and one that controls the direction of the

pump (the ‘reverse’ solenoid). Each relay was connected to one solenoid. To retain the

current position, neither solenoid should receive current. If the user selected the extend

option, only the ‘go’ solenoid should receive current, and if the user selected the retract

- 77 -

Page 94: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

option, both solenoids should be powered. The RB12 operated using negative logic [18],

and was taken into account when programming the appropriate voltages for each state.

For further detail about the pump control program see the LabVIEW block diagram in

Figure B.2.

Once the battery was connected to the relays, and the relays were connected to the

pump, the program was executed and tested by selecting each of the three states and ob-

serving the response of the pump. The pump responded appropriately without a noticeable

delay, and therefore this step was successfully completed.

Control System Design Alternatives

To complete the control system, a controller algorithm was required that decided when to

extend, retract, or retain the current position. Several alternatives were considered while

making this design decision.

The first structure of a controller investigated was a continuous comparison method of

controlling the pump. This method involved accepting the current position and the target

position, and calculating the di↵erence as shown in Figure 3.43. Then, based on this value,

the program decided whether to extend, retract, or retain the current position for one cycle

of the program (about 1 s — equal to the time between measurement system updates). If

the current position was within 10 mm of the target position, the system would not attempt

to move the piston. This method had the advantage of being able to quickly respond to

any changes in data, and would have also resulted in a very simple control system. The

disadvantages amount to the system being unable to function with the measurement system.

Continuous comparisons meant that the measurement system needed be constantly polled,

but this action took approximately 1 s to complete, therefore making this system impractical

for a precise positioning system.

As the continuous comparison method of controlling the pump was deemed insu�cient

- 78 -

Page 95: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

DIFFERENCE = INPUT

POSITION – CURRENT POSITION

DIFFERENCE >BUFFER?

DIFFERENCE< -BUFFER?

EXTEND CYLINDER

RETRACT CYLINDER

RETAIN POSITION

YES

YES

NO

NO

INPUT POSITION

CURRENT POSITION

Figure 3.43: The flowchart shown here describes the potential operation of a continuouscomparison control system

- 79 -

Page 96: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

for this project, a proportional-intergral-derivative (PID) controller was examined for its

feasibility in this application. This method involved providing a PID controller with the

target position and using the current position as feedback, as shown in Figure 3.44. The

PID controller would then attempt to output the pump commands to correct the piston

position. In general, PID controllers function by accepting an error between the input and

output, and then multiplying the error by a proportional constant, the integral of the error

by another constant, and the derivative of the error by a third constant. These products

are then added together and the output of the system is controlled by this value. In this

way, the system keeps track of current, past, and possible future error [19].

PID controllers are widely used for their ability to reduce error in a control system [19].

Using a PID controller would let the control system parameters such as settling time and

steady state error be explicitly selected by way of changing the proportional, integral, and

derivative constants.

While PID controllers are suitable in many scenarios, in this particular application the

same disadvantages that applied to the continuous comparison method would also apply

to a PID control system. The system would require the ability to frequently monitor the

current position, or else the di↵erence between the current position and target position

would be inaccurate, and thus the output calculated by the PID would also be inaccurate.

The slow feedback time eliminated the viability of using a PID controller.

Finally, an alternative method of controlling the pump was created that was named

the ‘single stroke method’. The single stroke method involved acquiring current and target

position information and attempting to correct the di↵erence between these two positions

with a single timed retraction or extension. A high level flowchart of this process is shown

in Figure 3.45.

This method allowed the system to use a di↵erent function for extending and retracting

so that the system could accommodate the drift of the piston. Additionally, if this method

- 80 -

Page 97: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

CURRENT POSITION

ERROR = CURRENT -

DESIRED

DESIRED POSITION

I = INTEGRAL CONSTANT x INTEGRAL OF

ERROR

P = PROPORTIONAL CONSTANT x

ERROR

D = DERIVATIVE CONSTANT x DERIVATIVE OF ERROR

P + I + D

PLANT PROCESS

OUTPUT

Figure 3.44: The flowchart shown here describes the potential operation of a PID controlsystem

- 81 -

Page 98: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

DIFFERENCE < -BUFFER?

DISTANCE > BUFFER?

DELAY = EXTENSION

DELAY FUNCTION

DELAY = RETRACTION

DELAY FUNCTION

RETAIN POSITION

EXTEND FOR DELAY

RETRACT FOR DELAY

YES

NO

YES

NO

DIFFERENCE = INPUT

POSITION – CURRENT POSITION

INPUT POSITION

CURRENT POSITION

Figure 3.45: The flowchart shown here describes the potential operation of a single strokecontrol system.

was implemented, the measurement system would only need to check the current piston

position once per positioning attempt. This would decrease piston position oscillations due

to outdated current position information.

The primary disadvantage of this system was that if the user entered a new target

position while the piston was still approaching a previous target position, the new input

would not be considered until the previous positioning attempt was completed. This will

eliminate the system’s response time to new positioning requests.

The decision was made to use the single stroke method in the design of the control

system with the hopes it would meet the specifications of the control system.

Control System Program Development

In order to develop the single stroke controller, a function was required to control the run

time of the pump. Two methods were used to produce functions capable of predicting the

required run time to satisfy the positioning system accuracy specification.

The first method used to calculate the run time function was to find the average drift

- 82 -

Page 99: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

of the cylinder following an extension or retraction, the total time it would take for the

piston to move its whole range, and the whole range of possible movement. The drift was

measured to be 11 mm, the total time it to traverse the whole range to be 8910 ms, and

the total range to be 344 mm. This data then formed Equation 3.1.

tp =8910

344|x� 11| (3.1)

where tp is the pump run time required in ms and x is the di↵erence between the target

position and the current position in mm. If x was positive, the piston would be extended,

while if x was negative, the piston would be retracted. Additionally, if |x| was less than the

accuracy specification of 10 mm then the pump would not move the piston.

Preliminary tests of this method resulted in inaccurate results (final position up to

40 mm di↵erent from the input position). As such, an alternative method of deriving a

function was investigated.

A program was written to allow a user to input an amount of time and then select

whether to extend or retract the pump, as shown in Figure B.4 and Figure B.3. This

program was then implemented using the cylinder-pump-LabJack set up. The distance

moved by the piston was measured for a range of input times from 100 ms to 5000 ms.

Figure 3.46 shows the results of this experiment when extending, and Figure 3.47 shows the

results of this experiment when retracting. Clearly, the relationship between the motor run

time and the distance moved by the piston could be approximated with a linear relationship

for both scenarios.

The resulting linear relationships were used to derive appropriate functions for both

extension and retraction using linear regression. The extension equation is described by

Equation 3.2.

te = 28.53x� 328.4 (3.2)

- 83 -

Page 100: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

0 20 40 60 80 100 120 140 160 180 200−1000

0

1000

2000

3000

4000

5000

6000

Distance Travelled [mm]

Mot

or R

un T

ime

[ms]

Extension of the Piston vs Motor Run Time

y = 28.53*x − 328.4

Original DataLinear Fit

Figure 3.46: Distance travelled by the piston vs timeof extension.

−200 −150 −100 −50 0 50−1000

0

1000

2000

3000

4000

5000

6000

Distance Travelled [mm]

Mot

or R

un T

im [m

s]

Retraction of the Piston vs Motor Run Time

y = − 25.45*x + 400

Original DataLinear Fit

Figure 3.47: Distance travelled by the piston vs timeof retraction.

- 84 -

Page 101: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

where te is the time the control system would need to extend the cylinder in ms and x is

the di↵erence in position between the target position and the current position in mm. This

function was used when x � 10.

The retraction equation derived from this relationship is described by, and was used

when x �10:

tr = �25.45x+ 400 (3.3)

where tr is the time the control system would need to retract the cylinder in ms and x is

the di↵erence in position between the target position and the current position in mm. Once

the piston had completed an attempt and been successful to within the specification of 10

mm the control system would no longer attempt to move the piston.

A control system program was then created in LabVIEW using Equations 3.2 and 3.3.

The pump driving program from Section 3.5.2 was modified to allow two user inputs, i.e. one

representing the target position and one representing the current position. The di↵erence

between the target and current positions was compared to the 10 mm accuracy specification,

and the decision is made to either extend, retract, or retain the current position. A run

time was and direction were calculated, such that the piston should settle at the target

position before attempting to measure the current position. Additionally, an emergency

stop function was added that could interrupt the current program if the ‘EMERGENCY

STOP’ button was pressed. This function sets the relays to the ‘Retain Position’ state and

then stops the program. The GUI of the complete program is shown in Figure B.5, while

the block diagram is shown in Figure B.6.

Non-Linear Piston Drift

Figure 3.48 shows how the piston drift was not consistent when the motor was run for less

than 200 ms. For this reason, the ability of the control system to account for the piston drift

using a single linear function was significantly compromised for short extension times. In

- 85 -

Page 102: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

order to address this issue, a di↵erent function was used when extending the piston for less

than 200 ms, which corresponded to approximately 20 mm of extension. When retracting,

any movement beyond 10 mm took a minimum of 700 ms. Since the drift of the piston was

only inconsistent for motor run times less than 200 ms, all possible retraction movements

posed no issue.

0 200 400 600 800 1000 1200 1400 1600 1800 20000

5

10

15Piston Drift for Varying Motor Run Times

Motor Run Time [ms]

Pist

on D

rift [

mm

]

Figure 3.48: Extensions after the motor was been turned o↵ vs. motor run time.

The relationship between extension distance and motor run time was analyzed for run

times less than 100 ms and is shown in Figure 3.49. Although the quality of the linear fit

shown in Figure 3.49 was not as good as the linear fits for Figure 3.46 and Figure 3.47, the

linear approximation should be su�cient enough to place the piston within 10 mm of the

target position. The linear fit shown in Figure 3.49 is described by the following relation:

tl = �25.45x+ 400 (3.4)

where tl is the time the control system would need to extend the cylinder in ms (for run

times less than 200 ms), and x is the di↵erence in position between the target position and

the current position in mm.

- 86 -

Page 103: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

0 2 4 6 8 10 12 14 16 18−50

0

50

100

150

200Lower Distance Range Extensions

Motor Run Time [ms]

Dis

tanc

e tra

velle

d [m

m]

y = 10.41*x − 1.305

data1 linear

Figure 3.49: Low distance range extensions vs motor run time.

Equations 3.2, 3.3, and 3.4 were combined to create the following piecewise function:

t =

8>>>>>>><

>>>>>>>:

�25.45x+ 400 x �10

0 �10 < x < 10

10.41x� 1.305 10 x 20

28.53x� 328.4 20 < x

(3.5)

where t is the time the control system will need to run the pump in ms and x is the

di↵erence in position between the input position and the current position in mm. This

equation describes the run time function that was used for all positioning attempts.

A control system program was then created in LabVIEW using Equation 3.5. The

pump driving program from Section 3.5.2 was modified to allow two user inputs, i.e. one

representing the target position and one representing the current position. The di↵erence

between the target and current positions was compared to the 10 mm accuracy specification,

and the decision is made to either extend, retract, or retain the current position. A run

time was and direction were calculated, such that the piston should settle at the target

- 87 -

Page 104: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

position before attempting to measure the current position. Additionally, an emergency

stop function was added that could interrupt the current program if the ‘EMERGENCY

STOP’ button was pressed. This function sets the relays to the ‘Retain Position’ state and

then stops the program. The GUI of the complete program is shown in Figure B.5, while

the block diagram is shown in Figure B.6.

3.5.3 Control System Testing and Results

Once the LabVIEW program involving the single stroke control system was created, the

operation of the program was verified with the following test:

1. The current position of the piston was measured using the laser distance finder.

2. The current position and the randomly selected target position were manually entered

into the control system program while the LabJack U3 was disconnected from the

pump.

3. The run time and required direction of movement was generated by the control system

and recorded.

4. The recorded values were entered into the program previously used to run the pump

for a set amount of time, discussed in Section 3.5.2.

5. The final position of the piston was measured using the laser distance finder.

This test allowed the operation of the control system to be verified without requiring

true feedback from the measurement system. The results from this test are shown in

Table 3.2. The maximum positioning error was 2 mm and the average error was 0.5 mm.

Therefore, the control system positioning accuracy was within the required specification of

10 mm. The repeatability specification is tested and discussed in Section 4.2.

- 88 -

Page 105: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 3.5 Control System Development

Table 3.2: Control system test results.

Start Position Desired Final Calculated Delay True Final Error[mm] Position [mm] [ms] Position [mm] [mm]

310 227 2512.35 227 0227 120 3123.15 118 2118 172 1212.22 172 0172 101 2206.95 101 0101 130 498.97 130 0130 193 1468.99 192 1

Average Error 0.5

- 89 -

Page 106: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4. System Integration

Chapter 4

System Integration

The final step in the development of the project was to combine the measurement and

control systems into the complete positioning system. The positioning system was then

tested to ensure all the specifications were met, as outlined in Table 1.1. This section

will discuss the details and/or problems encountered with the integration and verification

processes. The final test results are summarized in Table 4.6, located at the end of this

chapter.

4.1 Measurement and Control System Integration

Once the measurement system and control system were implemented and their modular op-

erations were verified, they were combined into one complete hydraulic cylinder positioning

system program. This final program was completed in LabVIEW. This section explains the

measurement and control system integration process in detail.

4.1.1 Hydraulic Cylinder Positioning System Overview

The final LabVIEW program that consisted of both the measurement and control systems

was able to position the piston in four steps: (I) the measurement system determined the

- 90 -

Page 107: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.1 Measurement and Control System Integration

current piston position; (II) the user-specified target position was compared to the current

position; (III) the time for which the pump must be run to bring the piston to the position

desired by the user was determined; and (IV) the control system ran the pump to extend

or retract the piston for the calculated amount of time. A short delay was incorporated

to ensure that the piston had stopped moving before the next position measurement was

taken. The subsequent measurement was then passed to the control system, so that the

system could determine if the piston was within 10 mm of the target position. If the piston

position fell within the 10 mm range, the positioning sequence was considered complete

because the position system accuracy specification in Table 1.1 had been met. If the current

piston position was not within 10 mm of the target position, a new positioning process was

repeated until the current position was within 10 mm of the target position.

An emergency stop button was incorporated into the GUI to allow a use to stop the

pump at any moment. Pressing the stop button would prompt the control system to

immediately stop the motor and pump, as well as abort the entire program. The flowchart

in Figure 4.1 shows the high level operation of the hydraulic cylinder positioning system

and emergency stop button. For reference, the LabVIEW block diagram for the hydraulic

cylinder positioning system can be seen in the Figure B.7.

4.1.2 Positioning System Integration Issues and Solutions

When integrating the measurement and control systems, programming issues were encoun-

tered in sorting out the correct sequence of events and finding out how to interrupt a

time delay to program the emergency stop button. These problems and their solutions are

explained in detail in the following sections.

- 91 -

Page 108: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.1 Measurement and Control System Integration

START

MEASUREMENT SYSTEM OBTAINS AND PROCESSES NECESSARY CALIBRATION

DATA

MEASUREMENT SYSTEM PASSES CURRENT PISTON POSITION TO CONTROL

SYSTEM

CONTROL SYSTEM COMPARES THE CURRENT PISTON

POSITION TO THE USER-REQUESTED POSITION

DIFFERENCE BETWEEN CURRENT AND REQUESTED

POSITION < 10 mm?

CONTROL SYSTEM TRIES TO MOVE PISTON TO REQUESTED

POSITION

CONTROL SYSTEM STOPS MOTOR AND PISTON

PROGRAM IS ABORTED

END

POSITION REQUESTED BY USER?

YES

YES

NO

NO

EMERGENCY STOP BUTTON PRESSED WHEN

PISTON IS MOVING?

YES

NO

Figure 4.1: This flowchart shows the high level logic for the hydraulic cylinder pistonpositioning system and the emergency stop button.

- 92 -

Page 109: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.1 Measurement and Control System Integration

Event Sequencing Issue

When the control system and measurement system programs were first combined, there

were some event sequencing issues due to the way these two separate parts were originally

created. The measurement system program was intended to be linear in execution: when

a measurement was taken by the measurement system, it got data from the VNA, gave

it to the nearest-neighbour predictive algorithm, retrieved the position estimate, and then

delivered this estimate to the control system. After this linear sequence of events, the

measurement system’s job was done.

In contrast, the control system was originally designed to run continuously. When

the user input a certain target position, the control system compared it with the current

position obtained from the measurement system, and extended or retracted the piston to

try to attain this position. The control system was originally designed so that once the

piston was moved the program would loop back to the beginning of the program and check

whether the piston was close enough or whether it had to be moved again. Therefore, it

was not possible to simply connect the measurement system and control system programs,

because the two programs were not designed to run using the same sequencing.

The solution to the sequencing issue involved two parts. First, since the control system

depended on looping back to check whether the piston was close enough to the target

position, the measurement and control system were placed in a while-loop. The while-loop

allowed the control system to finish moving the piston the while-loop enabled remeasuring

of the new position. This new position from the measurement system allowed the control

system to compare this new position to the target position to see if it needed to move

the piston again. Second, since the control system could not obtain the new position

instantaneously after the piston was moved, the relays on the LabJack controller had to be

set so that the piston stopped moving before the measurement system tried to obtain a new

position estimate. If the piston did not stop, the returned position would be inaccurate,

- 93 -

Page 110: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.1 Measurement and Control System Integration

causing the piston to oscillate around the target position. This problem was overcome using

a Flat Sequence Structure in LabVIEW. Processes occurring in the Flat Sequence Structure

occur sequentially from left to right. This structure was used to set the states of the relays

to stop the piston before a new position measurement was taken. To see these solutions

implemented in the block diagram, please see the Figure B.7.

Time Delay Interrupting

The control system used a timed delay to run the pump for the calculated run time. During

the development of the emergency stop button, there was an issue encountered when trying

to interrupt this delay. This problem occurred because the control system moved the piston

for a certain amount of time by calculating a delay, setting the piston to extend or retract

and then delaying the entire hydraulic cylinder positioning program for the calculated delay

time. During this delay time, simple button presses could not be detected. This limitation

needed to be overcome to meet the emergency stop response time specification of 1 s.

The solution to this problem was to use an Event Structure in LabVIEW. The Event

Structure acted like an interrupt, giving priority to whichever event it’s programmed to

monitor. In this case, the Event Structure was programmed to monitor the emergency stop

button. If the emergency stop button were to be pressed, the following sequence would be

initiated: the state of the relays would be set to the ‘Retain Position’ state and then entire

program would be aborted. To see this solution implemented in the control system block

diagram, please see Figure B.6.

4.1.3 Graphical User Interface

The LabVIEW GUI allowed users to interact with the program and operate the hydraulic

cylinder positioning system. Figure 4.2 shows the final form of the hydraulic cylinder

positioning system GUI.

- 94 -

Page 111: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.1 Measurement and Control System Integration

Figure 4.2: This figure shows the GUI for the hydraulic cylinder piston positioning system.

The GUI was split into two main sections. The top section contained helpful indicators,

such as the relay status indicators, as well as drop down menus that were used to select the

GPIB port and the calibration file path. The bottom section contained the main controls of

the program with which the user would most often interact, as well as the emergency stop

button. Table 4.1 contains a brief description of each of the indicators on the GUI, while

Table 4.2 provided a description of the controls on the GUI.

- 95 -

Page 112: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.1 Measurement and Control System Integration

Table 4.1: Explanation of GUI indicators.

Indicator Name Description

Calibration Filenames Shows which files are being processed. Whenthe calibration process is over, the last calibra-tion filename remains on display. The programcan only be used once the calibration process iscomplete.

Control System Error Out Specifies whether the user entered a valid or in-valid destination position for the piston.

LabJack Error Out Outputs LabJack error information, includingan error code and the source.

Measured Position [mm] Displays the last measured position of the pis-ton.

Piston Position Along Stroke [mm] The bar fills up to give the user a sense of wherethe piston is along the stroke length. This isuseful if the cylinder is not visible to the userduring operation.

Relay 1 Turns on when relay 1 is o↵ and the pin is high.Relay 2 Turns on when relay 2 is o↵ and the pin is high.

Within 10 mm Turns on when the control system determinesthat the piston is within the 10 mm specificationof the user selected piston position

- 96 -

Page 113: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.1 Measurement and Control System Integration

Table 4.2: Explanation of GUI controls.

Control Name Description

Choose Calibration Path This folder browser allows the user to navigateto the location of the calibration files.

Choose GPIB Port This drop down menu allows the user to selectthe GPIB port corresponding to the VNA thatis going to be used to measure S11 data.

Emergency Stop Press this button to stop the pump and piston.Pressing this button when the piston is movingwill result in the piston coming to a completestop and the program being aborted. This but-ton is only for use when the piston is moving.

Go to Position Press this button to send the piston to the spec-ified user input position. This should only bepressed once the calibration process is complete,the user has selected a valid GPIB port so aVNA can be accessed and an input position isspecified.

Input Position [mm] The user enters the destination position of thepiston into this text box.

- 97 -

Page 114: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.2 Positioning System Verification and Results

4.2 Positioning System Verification and Results

Following the integration of all of the modular components of the positioning system, several

tests were performed to guarantee that the integrated system met the specifications outlined

in Table 1.1.

4.2.1 Positioning System Accuracy Verification

The accuracy of the positioning system was verified by performing ten independent tri-

als, five of which involved retraction and five that involved extension. For five randomly

generated starting positions, two target positions were also randomly generated. The end

position actually attained as measured by a laser distance finder was recorded along with

the target position. Figure 4.3 provides a plot of the intended end position versus the actual

end position compared to an ideal fit. The average di↵erence between the target position

and the actual end position was 4.1 mm, while the maximum di↵erence was 9 mm.

0 50 100 150 200 250 300 3500

50

100

150

200

250

300

350

Intended End Position [mm]

Actu

al E

nd P

ositi

on [m

m]

Positioning System Accuracy Test

Experimental DataIdeal Piston Extension10 mm Error Specification

Figure 4.3: Positioning system accuracy test.

- 98 -

Page 115: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.2 Positioning System Verification and Results

4.2.2 Positioning System Repeatability Verification

An experiment was designed such that the repeatability of the positioning system could be

tested across the range of the possible piston positions. Four target positions were randomly

selected. For each target position, four random start positions were selected, resulting in 16

total trials. The system then attempted to move the piston from each of the start positions

to the corresponding target position. Then the actual final position was measured and

recorded in Table 4.3. The maximum di↵erence between final positions after attempting to

place the piston at the same position was 15 mm, which satisfied the positioning system

repeatability specification of 20 mm.

4.2.3 Response Time Verification

The response time of the system was tested by inputting a command to the program (a

target position) and then measuring the time it took for the motor to begin running with a

stopwatch. This test was performed 10 times and the results are shown in Table 4.4. The

average of these response times was found to be 1.12 s, while the maximum time was 1.15 s.

As both the average time as well as every individual result was well below the specification

time of 10 s, this specification has been satisfied.

4.2.4 Emergency Stop Response Time Verification

The emergency stop response time was tested by pressing the emergency stop button and

measuring the length of time it took for the piston to completely stop moving. This experi-

ment was repeated 10 times, and the response time was found to be 0.77 s on average, with

a maximum time of 0.86 s. The experimental data is tabulated in Table 4.5. The emergency

stop response time was dependent on the amount of time that the piston extended after

the pump is turned o↵. The test was not carried out for the following two scenarios: (I)

- 99 -

Page 116: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.2 Positioning System Verification and Results

Table 4.3: Positioning system repeatability test results.

Attempted EndPosition [mm]

Start Position [mm] Actual End Position [mm]

294

210 300123 288337 293158 301

Maximum di↵erencebetween 2 attempts

13 mm

128

200 13196 135229 127127 127

Maximum di↵erencebetween 2 attempts

8 mm

133

344 138260 13724 13756 140

Maximum di↵erencebetween 2 attempts

3 mm

211

305 21193 214280 20442 219

Maximum Di↵erencebetween 2 attempts

15 mm

Table 4.4: Positioning system response time test results.

Test # 1 2 3 4 5 6 7 8 9 10Response time [s] 1.13 1.10 1.11 1.15 1.10 1.13 1.10 1.08 1.10 1.15

Average time [s] 1.12Maximum time [s] 1.15

- 100 -

Page 117: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 4.2 Positioning System Verification and Results

pressing the emergency stop immediately after the pump was turned on; and (II) pressing

the emergency stop button immediately after the pump turned o↵. These two scenarios

would have resulted in a response time that would have been significantly less than the

other tests, and would not have contributed to the maximum response time.

Table 4.5: Experimental results from emergency button response time tests.

Test # 1 2 3 4 5 6 7 8 9 10Emergency stop

time [s]0.67 0.75 0.68 0.81 0.81 0.86 0.68 0.80 0.75 0.85

Average time [s] 0.77Maximum time [s] 0.86

4.2.5 System Specification Results

The specifications required for this project have been met and are summarized in Table 4.6.

Table 4.6: System specifications and results.

System Feature SpecificationResults

Average Max

Measurement System Accuracy < 10 mm 1.33 mm 4 mmMeasurement System Repeatability < 20 mm 0 mm 0 mmPositioning System Response Time < 10 s 1.12 s 1.15 sPositioning System Accuracy < 10 mm 4.1 mm 9 mmPositioning System Repeatability < 20 mm 9.75 mm 15 mmEmergency Stop Response Time < 1 s 0.77 s 0.86 s

- 101 -

Page 118: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 5. Budget Summary

Chapter 5

Budget Summary

The complete list of items purchased for the project have been listed in Table 5.1. The

items have been organized into the categories of: (I) non-electronic items; (II) electronic

items; (III) software; and (IV) resources. If the cost for an item was covered by funds other

than those provided by the ECE department, the sponsor of the item is listed. The total

expenditures were $492.93, less than the $500.00 supplied by the ECE department.

- 102 -

Page 119: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System

Table 5.1: Budget summary.

Item Part # Supplier Sponsor No. Cost/Unit Sub-Total

Non-electronic itemsTie rod cylinder 8195018 Princess Auto 151Research 2 $114.99 $114.99Hydraulic pump(double acting)

Princess Auto 1 $274.99 $274.99

Hydraulic fluid 8339780 Princess Auto 151Research 1 $69.99 $0.00Car a battery 151Research 1 $99.99 $0.00Tub/kiddy pool 151Research 1 $14.99 $0.00Service cart 8096745 Princess Auto 151Research 1 $99.99 $0.00

Non-electronic items total $389.98Electronic itemsBAVA 151Research 1 $10.00 $0.00LeakSeal Rust-Oleum U of M 1 $9.96 $0.00SMA cable U of M 2 $100.00 $0.00SMA F-Fadapter

A24690 DigiKey U of M 2 $24.78 $24.78

SMA M-Fadapter

J656 DigiKey U of M 1 $23.93 $0.00

SMA M-Madapter

ACX1240 DigiKey 2 $7.19 $14.38

Power cables Princess Auto 151Research 2 $9.99 $0.00Wire connectors Princess Auto 151Research 2 $15.00 $0.00Vector networkanalyzer

E5701C Agilent U of M 1 $50,000.00 $0.00

LabJack U3board

U3-LV LabJack 151Research 1 $108.00 $0.00

LabJack RB12relay board

RB12 LabJack 151Research 1 $119.00 $0.00

G4 DC outputrelays

G4ODC5 Opto 22 151Research 2 $14.00 $0.00

Laser distancefinder

57-4585-0 Canadian Tire 151Research 1 $129.99 $0.00

Electronic items total $39.16SoftwareLabVIEW NI U of M 1 $60.00 $0.00

Software items total $0.00ResourcesMachine shoptime

U of M U of M 8 hr. $0.00

Shipping $8.00TOTAL COST OF PROJECT BEFORE TAXES $429.14

TAXES (13%) $55.79TOTAL COST OF PROJECT AFTER TAX $492.93

- 103 -

Page 120: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System 6. Conclusions

Chapter 6

Conclusions

The purpose of this project was to design and implement an automatic, electromagnetic-

based, internal hydraulic cylinder positioning system. Overall, the project was a success

as the system was able to measure and position the piston with an accuracy of less 10

mm and a repeatability of less than 20 mm. In addition to the accuracy and repeatability

specifications, the response time specifications of the positioning system and emergency

stop mechanism were significantly shorter than their individual specifications of 10 s and

1 s, respectively. Each specification was tested and verified individually, with the results

summarized in Table 4.6. In addition, the project was completed on time and on budget,

with a total expenditures of $492.93. The design of the positioning system was divided

into five modules: (I) apparatus and setup, (II) antenna design, (III) predictive algorithm

development, (IV) measurement system development, and (V) control system development.

The apparatus and setup module uncovered the bidirectionality issue with the donated

pump and the problem of drift. Knowledge of the bidirectionality problem allowed the

team to purchase a pump that satisfied the system specifications. Furthermore, a means of

mounting the cylinder that was convenient for transportation and demonstration purposes

was conceived in this project module.

- 104 -

Page 121: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System

Next, the antenna design module involved the simulation of antennas with high band-

width and directivity, as detailed in Section 3.2. A BAVA was chosen because of its ability

to maintain wideband properties when placed within a cylinder. Selection of the BAVA

also reduced antenna costs and development time because a BAVA of similar design to the

BAVA selected through simulation, designed by Dr. Majid Ostadrahimi, was readily avail-

able. Thirdly, the measurement system module developed a measurement program that

predicted the position of the piston and provided this position information to the control

system. The measurement system was capable of providing accurate (according to system

specifications) position estimates because the system was able to: (I) collect information

from the VNA in real-time; (II) collect and process previously saved S11 from CSV files;

and (III) interface with the MATLAB-based predictive algorithm through LabVIEW.

The predictive algorithm was critical to exploiting the relationship between S11 and

the position of the piston. Several design alternatives were investigated in the development

of the predictive algorithm, as discussed in Section 3.3. The nearest-neighbour algorithm

was chosen as the final predictive algorithm for the reason that it was able to satisfy the

measurement accuracy specification to within 5 mm. The interpolation algorithm was not

considered due to time constraints and problems integrating this algorithm with LabVIEW.

Lastly, a control system was developed that used current piston position information

and a user-specified position to move the piston to the desired position. After the control

system was developed independently of the measurement system feedback, which is detailed

in Section 3.5, the measurement and control systems were incorporated together. This

integration process did not encounter any issues that could not be dealt with in the scope

of this project, and the final positioning system readily passed all system verification tests.

In Section 1.2, two project objectives additional to the positioning system meeting its

system specifications were outlined. Upon review of the development and implementation

of the hydraulic cylinder positioning system, the system in its current state does not present

- 105 -

Page 122: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System

a viable alternative to the position sensing technologies currently available on the market.

Further refinement of the predictive algorithm is necessary in order to attain accuracy

and repeatability specifications that rival the current industry standards [4], and a more

conformal antenna may reduce the complexities associated with cylinder modification to

accommodate this antenna. In addition, the reliance on the VNA may be reduced by

design of dedicated hardware, which might make this electromagnetic-based positioning

technology a cost-e↵ective alternative to magnetostrictive-based position sensing cylinders.

Next, the resolution to which position can be measured in the positioning system’s current

state is directly proportional to the number of calibration points. One way to increase the

resolution without having to increase the amount of calibration points may be to implement

the interpolation algorithm that was considered in this project but was not implemented

due to communication issues in LabVIEW (Section 3.3.5). Future work would consider the

e↵ects on the positioning system due to varying temperature, load, and oil properties.

- 106 -

Page 123: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System REFERENCES

References

[1] F. Rovira-Mas, S. Han, and J. Reid, “Evaluation of automatically steered agriculturalvehicles,” in Position, Location and Navigation Symposium, 2008 IEEE/ION, May2008, pp. 473–478.

[2] M. Gelinas, “Re: Price comparison,” [3] Martin Gelinas. (2013, Sept. 25). RE: PriceComparison [Online]. Available e-mail: [email protected] Message: GetPRICE INFORMATION.

[3] 3 in. bore x 18 in. stroke tie rod cylinder. [Online]. Available: http://labjack.com/support/rb12/datasheet [Accessed: 06/03/2014]

[4] Temposonics R-Series Models RP and RH Analog Outputs Datasheet, 550992nd ed.,MTS Systems Corporation Sensors Division, 2010.

[5] Hydraulic theory. [Online]. Available: http://www.myodesie.com/index.php/wiki/index/returnEntry/id/2986 [Accessed: 04/03/2014]

[6] (2014) Basic hydraulic theory. [Online]. Available: http://www.crossmfg.com/technical/basic-hydraulic-theory==imoreoncylindertheory [Accessed: March 2014]

[7] E. E. Herceg, “Position sensors technology comparison for hydraulic cylinders,”Fluid Power Journal, 2013. [Online]. Available: http://hydraulicspneumatics.com/200/FPE/Sensors/Article/False/6440/FPE-Sensors [Accessed: 07/03/2014]

[8] “Position transducers,” Hydraulics and Pneumatics, January 2012. [Online].Available: http://hydraulicspneumatics.com/200/FPE/Sensors/Article/False/6440/FPE-Sensors [Accessed: 07/03/2014]

[9] Optical position measuring system. [Online]. Available: http://weber-hydraulik.df-kunde.de/en/produkte/?tx anwendungen products%5Bproduct%5D=123&tx anwendungen products%5Baction%5D=show&tx anwendungen products%5Bcontroller%5D=Product&cHash=cd2c8abc1a7d1e33b4db9ee4bace4578 [Accessed:06/03/2014]

[10] R. Harrington, Time-Harmonic Electromagnetic Fields, ser. IEEE Press Series on Elec-tromagnetic Wave Theory. Wiley, 2001.

- 107 -

Page 124: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System REFERENCES

[11] M. Yaccoub, A. Jaoujal, M. Younssi, A. El Moussaoui, and N. Aknin, “Rectangularring microstrip patch antenna for ultra-wide band applications,” International Journalof Innovation and Applied Studies, vol. 4, no. 2, pp. 441–446, 2013.

[12] V. G. Kasabegoudar and K. J. Vinoy, “Broadband suspended microstrip antenna forcircular polarization,” Progress In Electromagnetics Research-Pier, vol. 90, pp. 353–368, 2009.

[13] J. Bourqui, M. Okoniewski, and E. Fear, “Balanced antipodal vivaldi antenna withdielectric director for near-field microwave imaging,” Antennas and Propagation, IEEETransactions on, vol. 58, no. 7, pp. 2318–2326, 2010.

[14] (2011) Properties table of stainless steel, metals and other conductive materials.[Online]. Available: http://www.tibtech.com/conductivity.php [Accessed: 07/03/2014]

[15] M. Ostadrahimi, S. Noghanian, L. Shafai, A. Zakaria, C. Kaye, and J. LoVetri, “In-vestigating a double layer vivaldi antenna design for fixed array field measurement,”International Journal of Ultra Wideband Communications and Systems, vol. 1, no. 4,pp. 282–290, 2010.

[16] N. Yoder. (2013, December) Peakfinder. [Online]. Available: http://www.mathworks.com/matlabcentral/fileexchange/25500-peakfinder/content/peakfinder.m [Accessed:07/03/2014]

[17] J. Heaton, Introduction to Neural Networks for Java, K. Smith, Ed. Heaton Research,Inc, 2008.

[18] (2006, February) Rb12 datasheet. [Online]. Available: http://labjack.com/support/rb12/datasheet [Accessed: 07/03/2014]

[19] R. C. Dorf and R. H. Bishop, Modern Control Systems, 12th ed., A. Gilfillan and M. J.Horton, Eds. 1 Lake Street, Upper Saddle River, NJ 07458: Prentice Hall, 2011.

- 108 -

Page 125: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A. MATLAB Code

Appendix A

MATLAB Code

This appendix contains detailed explanations of the algorithms developed in Section 3.3 as

well as the associated MATLAB scripts used to develop and implement the algorithms.

A.1 Frequency Range Extraction for ANNs

The range of frequencies in which there was a distinct correlation between local minima of

S11 and piston position had to be extracted before being used in the ANN. The MATLAB

script below used prompts to determine the boundaries of this frequency range and to

eliminate local minima common to all positions of the piston.

1 %%%%%%%%%%%Isolate Resonant Frequency Range �ANN%%%%%%%%%%%%%%%%2 %3 %This script isolates the frequency range of interest to be used in4 %the neural network. The system prompts the user for getting the required5 %range.6 %Inputs:7 % input data : Resonant frequencies8 % output data: Corresponding positions of the resonant frequencies9 %Outputs:

10 % f input : Resonant frequencies within the new range11 % output data: Same data as the input12

13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

- 109 -

Page 126: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.1 Frequency Range Extraction for ANNs

14

15 clear new input16 prompt1='enter boundary for bottom in gigahertz:';17 bottom = input(prompt1);18 prompt2='enter boundary for top in gigahertz:';19 top = input(prompt2);20 bottom=bottom*10ˆ9;21 top=top*10ˆ9;22

23 %filters out all the frequencies below and above the cutoffs24 for i=1:length(input data(1,:))25 count=1;26 for j=1:length(input data(:,1))27 if input data(j,i)>=bottom&&input data(j,i)<=top28 new input(count,i)=input data(j,i);29 count=count+1;30 end31 end32 end33

34 figure35 hold on36 grid on37 grid minor38 for i=1:length(new input(1,:))39 for j=1:length(new input(:,1))40 if new input(j,i)˜=041 scatter(output data(i),new input(j,i),'b');42 end43 end44 end45

46 title('Resonant Frequency Variation');47 xlabel('Cavity Length (0 � Longest)');48 ylabel('Frequency [Hz]');49

50 %Filters out specific frequencies where resonance is caused by radius of51 %cavity52 answer=true;53 while(answer)54 prompt3='Are there any frequencies you would like removed (true or ...

false)?';55 answer = input(prompt3);56 if answer==true57 prompt4='What are these frequencies?';58 remove= input(prompt4);59 remove=remove*10ˆ9;60 removeT=remove+.005*10ˆ9;61 removeB=remove�.005*10ˆ9;62

63 %filters out all the frequencies below and above the cutoffs64 for i=1:length(new input(1,:))

- 110 -

Page 127: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.2 Artificial Neural Network Training

65 count=1; %used as counter so we dont have zeros between ...values in new element

66 for j=1:length(new input(:,1))67 if new input(j,i)>=removeT | | new input(j,i)<=removeB68 f input(count,i)=new input(j,i);69 count=count+1;70 end71 end72 end73 new input=f input;74 end75 end76 figure77 hold on78 for i=1:length(f input(1,:))79 for j=1:length(f input(:,1))80 if f input(j,i)˜=081 scatter(output data(i),f input(j,i),'b');82 end83 end84 end85 title('Resonant Frequency Variation');86 xlabel('Cavity Length (0 � Longest)');87 ylabel('Frequency [Hz]');

A.2 Artificial Neural Network Training

The MATLAB script below was used to implement the ANN approach as discussed in Sec-

tion 3.3.3. The script took an isolated range of frequencies and the corresponding positions,

and fed this data into a pattern recognizing neural network. The network would train, and

then display the error histogram and the performance plot. The code was used to train the

ANN for the entire position range, as well as a subset of the entire range when developing

the cascaded ANN algorithm.

1 %%%%%%%%%%%Artificial Neural Network%%%%%%%%%%%%%%%%2 %3 %This is the ANN training network script.4 %Inputs:5 % f input :The resonant frequencies6 % output data: Corresponding positions for f input7 %Outputs:

- 111 -

Page 128: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.2 Artificial Neural Network Training

8 % No outputs9

10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11

12 inputs= f input(1:3,:); %230 to 30013 targets = output data(1,:);14 % Create a Pattern Recognition Network15 hiddenLayerSize = 10;16 net = patternnet(hiddenLayerSize);17

18 % Choose Input and Output Pre/Post�Processing Functions19 % For a list of all processing functions type: help nnprocess20 net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};21 net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};22

23

24 % Setup Division of Data for Training, Validation, Testing25 % For a list of all data division functions type: help nndivide26 net.divideFcn = 'dividerand'; % Divide data randomly27 net.divideMode = 'sample'; % Divide up every sample28 net.divideParam.trainRatio = 70/100;29 net.divideParam.valRatio = 15/100;30 net.divideParam.testRatio = 15/100;31

32 % For help on training function 'trainscg' type: help trainscg33 % For a list of all training functions type: help nntrain34 net.trainFcn = 'trainscg'; % Scaled conjugate gradient35

36 % Choose a Performance Function37 % For a list of all performance functions type: help nnperformance38 net.performFcn = 'mse'; % Mean squared error39

40 % Choose Plot Functions41 % For a list of all plot functions type: help nnplot42 net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...43 'plotregression', 'plotfit'};44

45 % Train the Network46 [net,tr] = train(net,inputs,targets);47

48 % Test the Network49 outputs = net(inputs);50 errors = gsubtract(targets,outputs);51 performance = perform(net,targets,outputs)52

53 % Recalculate Training, Validation and Test Performance54 trainTargets = targets .* tr.trainMask{1};55 valTargets = targets .* tr.valMask{1};56 testTargets = targets .* tr.testMask{1};57 trainPerformance = perform(net,trainTargets,outputs)58 valPerformance = perform(net,valTargets,outputs)59 testPerformance = perform(net,testTargets,outputs)

- 112 -

Page 129: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.3 Nearest-Neighbour Prediction Algorithm

60

61 % Plots62 % Uncomment these lines to enable various plots.63 %figure, plotperform(tr)64 %figure, plottrainstate(tr)65 %figure, plotconfusion(targets,outputs)66 %figure, plotroc(targets,outputs)67 %figure, ploterrhist(errors)

A.3 Nearest-Neighbour Prediction Algorithm

The MATLAB code for the nearest-neighbour prediction algorithm that was discussed in

Section 3.3.4 is displayed below. The purpose of the algorithm was to predict the current

position of the piston based on received S11 data from the calling LabVIEW program

corresponding to the unknown piston position and the calibration piston positions. This

algorithm achieved this goal in 7 steps:

1. The S11 data for the unknown piston position was passed to the algorithm from the

measurement system program.

2. The parameters of the prediction algorithm and the peak-finding algorithm were set.

These parameters include:

• The frequency range in which to search for local minima

• The number of local minima to be saved into the DFV

• The DFV/DFM interval size

• The peak-finding threshold and sensitivity

3. The local minima of the S11 data were extracted using the peak-finding algorithm

[16].

4. A vector called the DFV was created that represented equal frequency intervals that

spanned the specified frequency range. The algorithm then checked the frequency

- 113 -

Page 130: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.3 Nearest-Neighbour Prediction Algorithm

value of each of the local minima, and changed the value in the corresponding DFV

interval from a 0 to a 1. This process was exactly the same as sorting the calibration

data into the DFM, as detailed in Section 3.3.4.

5. Preprocessed calibration data in DFM format was passed to the algorithm from the

measurement system program.

6. The algorithm iterated through the indices of the DFV until it found an index with

a value of 1. The algorithm then searched the DFM for calibration positions that

also had a value 1 in a specified range around the index of interest. If a calibration

position matched this criterion, a numerical value representing the ‘closeness’ of the

match was stored. This process was repeated for all of the values of ‘1’ stored in the

DFV, and the numerical ‘closeness’ values were added cumulatively.

7. The calibration position with the largest ‘closeness’ value was returned to the calling

program as the prediction piston position.

1 %%%%%%%% Nearest�Neighbour Predictive Algorithm %%%%%%%%%%%%%%%%%%%%%%%%%2 %3 %This algorithm requires S11 magnitude data acquired at the current unknown4 %position, and will return a numerical value indicating the predicted5 %position of the cylinder. This code has been modified to communicate6 %correctly with LabVIEW. This algorithm also assumes that processed7 %calibration data is available for direct access.8

9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%10

11

12 %Unknown position S11 magnitude is provided by LabVIEW13 unknown data = s11Mag;14

15

16 %%%% Set the algorithm parameters %%%%17

18 %Set the number of resonant peaks to extract19 num resonances 2 = 35;20

21

- 114 -

Page 131: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.3 Nearest-Neighbour Prediction Algorithm

22 %Select the size of the discretized frequency intervals23 intervalSize 2 = 20E6;24

25 %Set the frequency range to extract peaks26 min freq 2 = 2E9;27 stopFreq 2 = 6E9;28

29 %Set the peak�finding function parameters (See peak�finding function30 %description below for details)31 sel 2 = 0.3;32 thresh 2 = �1;33 extrema 2 = �1;34

35 %%%%%%%%%%%% Algorithm Begins %%%%%%%%%%%%%36

37

38 %Initialize the vector that will contain the frequency intervals39 test intervals 2 = zeros((stopFreq 2 � min freq 2)/intervalSize 2);40

41

42 %Intialize the index counter variable43 index 2 = 1;44

45 %Pass unknown data vector to the peak�finding function46 x0 2 = unknown data(1:length(unknown data));47

48

49 %%%%%% Peak�finding algorithm begins %%%%%%50 .51 .52 .53 %%%%%% End of peak�finding algorithm %%%%%%54

55

56 %Convert peak location indices to frequency values57 peakloc 2 = (peakloc 2(:) � 1).*(frequency(2) � frequency(1)) + frequency(1);58

59 %Initialize counters60 resonance count 2 = 1;61 loop counter 2 = 1;62

63 %Initialize variables to avoid unexpected LabVIEW errors64 peak input 2 = zeros(1);65 test input 2 = zeros(1);66

67 %Iterate through the resonance peaks in the specified frequency range until68 %the desired number have been saved69 while(resonance count 2 < num resonances 2 + 1)70

71 if(peakloc 2(loop counter 2) > min freq 2)72 peak input 2(index 2) = peakloc 2(loop counter 2);73 test input 2(resonance count 2) = peakloc 2(loop counter 2);

- 115 -

Page 132: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.3 Nearest-Neighbour Prediction Algorithm

74

75 resonance count 2 = resonance count 2 + 1;76 index 2 = index 2 + 1;77 end78

79 loop counter 2 = loop counter 2 + 1;80 end81

82

83 %start 2 represents the lower frequency bound of the current interval84 %stop 2 represents the upper frequency bound of the current interval85 start 2 = min freq 2;86 stop 2 = min freq 2 + intervalSize 2;87

88

89 %Iterate through the frequency intervals, and change the value of each90 %index to 1 if a minima is present91 for j = 1:length(test intervals 2)92 test intervals 2(j) = numel(test input 2( test input 2(:)>start 2 & ...

test input 2(:)<stop 2 ));93 start 2 = start 2 + intervalSize 2;94 stop 2 = stop 2+ intervalSize 2;95 end96

97

98

99 %This data will be provided by LabVIEW100 calibration input 2 = calibration intervals 2;101 calibration output 2 = output data;102 test input 2 = test intervals 2;103

104 %Set the size of the search range105 comparison range 2 = 3;106

107

108 % This function requires the input of a matrix containing the location of109 % the resonant peaks for each of the calibrated positions and a vector110 % mapping each column of the peak matrix to the corresponding position. The111 % test input variable is a column vector containing the peak locations ...

for a112 % single, unknown position.113 %114 % The function takes the inputs and predicts the most likely position115 % corresponding to the data in the test input variable. The predicted116 % position is returned to the calling program in the variable called117 % "prediction".118

119

120 %%%%% Prediction Section %%%%%121

122 %Iterate over the length of the test input vector to compare each peak123 %location to the calibration data

- 116 -

Page 133: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.3 Nearest-Neighbour Prediction Algorithm

124

125 proximity 2 = calibration output 2*0;126

127 for i = 1:length(test input 2)128

129 %If a peak exists at the current index, a comparison must be made130 if(test input 2(i) ˜= 0)131

132 %Compare with all of the calibration positions133 for j = 1:size(calibration input 2, 2)134 max value 2 = 0;135 %Iterate over the indices that fall in the comparison range136 index 2 = i � comparison range 2 + 1;137 while((index 2 < (i + comparison range 2)) && index 2 <= ...

length(test input 2))138

139 %If the index is less than or equal to zero it should be140 %skipped141 if(index 2 > 0)142

143 %If a peak exists at the current position and index144 if(calibration input 2(index 2, j) ˜= 0)145 distance 2 = comparison range 2 � abs(index 2 � i);146 max value 2 = max(max value 2, distance 2);147

148 end149 end150 index 2 = index 2 + 1;151 end152 proximity 2(j) = proximity 2(j) + max value 2;153 end154 end155

156 end157

158 %Plot the proximity vector if desired159 % figure160 % plot(proximity)161 % title(['Comparison Range = ', num2str(comparison range)]);162

163 %Get the indices of the maximum value in the proximity vector (i.e. find164 %out which position is closest to the tested one165 [row,column] = max(proximity 2);166

167 %The closest calibration position is returned as the prediction168 prediction = calibration output 2(column);

- 117 -

Page 134: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

A.4 Interpolation Algorithm Development

The MATLAB script below isolated the desired correlation from the measurement data and

then performed a linear interpolation on the isolated pattern. The first step in the method

was to isolate the pattern lines. To isolate the lines, the following procedure occurred:

1. Upper and lower boundaries on the frequency range were established.

2. Starting from the upper boundary and shortest piston position, the first local mini-

mum of S11 was extracted and stored in an empty row of a matrix trend line. Each

row in this matrix contained the local minima of a single line in the overall pattern.

3. The algorithm then looked for the next local minimum for the next piston position

that was within a predetermined frequency range lower than the first local minimum.

If such a minimum was found, it was stored in same row and the next column to the

right of the previous minimum from step 2 of the trend line matrix. This checking

was repeated for 3 positions ahead to make sure parts of a line were not missed. If

the method could not find a minimum satisfying this condition, or the final position

had been reached, the line was considered complete.

4. After completing a line, step 2 and 3 were repeated to obtain another line in the

correlation, with the algorithm starting at the next calibration position. Due to the

nature of this method, the same line would potentially be found multiple times.

5. Once step 4 reached the last calibration position, the method repeated steps 2 to 4.

However, the first local minimum satisfying the criteria in step 2 would be ignored,

which allowed the detection of lines that originated lower in frequency compared to

the first line. The matrix res loop determined how many iterations of this step would

have occurred (each iteration will ignore an additional local minimum that satisfies).

- 118 -

Page 135: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

The lines would now have been isolated from the original data. The next step in this

method was to reduce processing time by reducing the size of the matrix trend line.

This step involved removing duplicate lines. The method examined the matrix tend line

column by column, setting all duplicate values in a column to zero. Afterwards, any row

that had all zeros was removed from the matrix. The final matrix contained the correlation

of the local minima of S11 to position and was called final trendline.

The next step in the process inserted missing local minima of S11 on the trend lines.

During acquisition of the calibration data from the VNA, some expected data points would

not be present on the extracted lines. Therefore, local minima were inserted into the

final trendline matrix to complete the trend lines.

The final trendline matrix was then interpolated linearly between to produce data

points between the calibration set. Also, output data was interpolated linearly to produce

the corresponding positions for the interpolated local minima of S11. The new matrices

are interp freq and interp pos respectively. The amount of points created between the

original calibration data was determined through the static variable num iterations.

The final step, was to transform interp freq into the DFM format. The final matrices

returned were new pos and testDatashrink. These matrices represented the position of

the piston and the discretized local minima of S11, respectively.

1 %%%%%%%%%%%Interpolation Algorithm%%%%%%%%%%%%%%%%2 %3 %This script produces an interpolated data set of resonant frequencies and4 %piston positions. The interpolation between points is linear.5 %Inputs:6 % Measurement Data : This is the data from the VNA.7 %Outputs:8 % testDatashrink : This is the interpolated resonant frequency in ...

discretized format9 % new pos : This is the interpolated piston position

10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11

12 close all;13 clc;

- 119 -

Page 136: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

14 clear all;15

16

17 num resonances = 10;%Select the number of resonant frequencies and the18 %minimum frequency to19 peak find scale=.3;%Determines the sensitivity of peak detection in peak20 %algorithm21 res loop=3;%how many iterations of line detection. Every iteration ignores22 %n frequencies before looking for a line23 min freq = 2E9;%minimum value for the resonant frequency range24 intervalSize = 20E6;%interval size of the test data binary array25 stopFreq = 2.56E9;%max value for the resonant frequency range26 line threshold=0.05*10ˆ9;%Threshold level used when looking for downward27 %sloping lines28 num iterations=1;%This determines how many times points are linearly29 %approximated30 horizontal threshold=.05*10ˆ9;%this is the threshold for determining31 %if a line is a horizontal frequency mode determined by the cylinder radius32 row min=3;%if row has less or equal to this number, the line is considered33 %a line of no interest34 interpolation function=true;%determines whether or not a interpolation is35 %done to add points on lines where values are "missing"36 files=dir('17');%directory of data37 index = 1;38

39 count=1;40 counts=1;41 testData = zeros((stopFreq � min freq)/intervalSize, length(files) � 2);42

43 for i=3:length(files)44

45 A=importdata(files(i).name);46 B=A.data;47

48 %gets name of each file and converts it to a number49 [pathstr,name,ext] = fileparts(files(i).name);50 cylinderPos = str2num(name);51

52 %.s1p already has the magnitude and in decibels53 H=B(:,2);54

55 [peakloc ,peakmag]=peakfinder(H(1:length(H)),peak find scale,�1,�1);56

57 %Convert peak location indices to frequency values58 peakloc = (peakloc(:) � 1).*(B(2,1) � B(1,1)) + B(1,1);59

60 resonance count = 1;61 loop counter = 1;62

63 %Iterate through the resonance peaks until the desired number have been64 %saved65 while(resonance count < num resonances + 1)

- 120 -

Page 137: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

66

67 if(peakloc(loop counter) > min freq)68 peak test(index) = peakloc(loop counter);69 input data(resonance count, count) = peakloc(loop counter);70 stroke length(index) = double(cylinderPos);71 resonance count = resonance count + 1;72 index = index + 1;73 end74

75 loop counter = loop counter + 1;76 end77

78 output data(count) = double(cylinderPos);79

80

81 count=count+1;82 end83

84 input copy = input data;85 input copy(input copy > 6E9) = 0;86 peak sum = sum(input copy, 1);87 coeff = polyfit(output data, peak sum, 1);88

89 %plots the resonant frequencies vs position90 figure('position',[500 400 850 500])91 scatter(stroke length, peak test);92 title('Resonant Frequency Variation','FontSize', 18);93 xlabel('Cavity Length [mm]','FontSize', 16);94 ylabel('Frequency [Hz]','FontSize', 16);95

96

97 %%%%%%%%%%%%%%%%%% Interpolation Function%%%%%%%%%%%%%%%%%%98 bottom=min freq;99 top=stopFreq;

100 trend line=output data*0;101

102 %filters out all the frequencies below and above the cutoffs103 previous point=0;104 previous freq=1;105

106

107 %%%%%%%%%%%%%%%%%% Isolates lines%%%%%%%%%%%%%%%%%%108

109 for k=1:length(input data(1,:))110 for i=k:length(input data(1,:))111

112 for j=length(input data(:,1)):�1:1113 if input data(j,i)<top&& input data(j,i)>bottom114 if i==k%if first point then we take it as it is115 trend line(k,i)=input data(j,i);116 previous freq=input data(j,i);117 break %found our value so no need to keep checking

- 121 -

Page 138: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

118 %lower frequencies119 end120

121 %Finds a point that is smaller than the previous value and122 %It will store a point in trend line if decreasing within a123 %certain range124 if i˜=k125 if previous freq�input data(j,i)<line threshold&&...126 previous freq�input data(j,i)>0127 trend line(k,i)=input data(j,i);128 previous freq=input data(j,i);129 break;130 else131

132 end133 end134 end135 end136

137 %Some lines are missing frequencies. Checks 2�4 positions ahead of138 %current line to capture rest of line.139 if i˜=length(input data(1,:))140 if trend line(k,i)==0141

142 for j=length(input data(:,1)):�1:1143 if input data(j,i+1)<top&& input data(j,i+1)>bottom144 if i˜=1145 if previous freq�input data(j,i+1)<...146 line threshold&& previous freq�...147 input data(j,i+1)>0*10ˆ9148 trend line(k,i+1)=input data(j,i+1);149 previous freq=input data(j,i+1);150 break;151 else152

153 end154 end155 end156 end157 end158 end159 if i<length(input data(1,:))�1160 if trend line(k,i)==0&&trend line(k,i+1)==0161

162 for j=length(input data(:,1)):�1:1163 if input data(j,i+2)<top&& input data(j,i+2)>bottom164 if i˜=1165 if previous freq�input data(j,i+2)<...166 line threshold&& previous freq�...167 input data(j,i+2)>0.01*10ˆ9168 trend line(k,i+2)=input data(j,i+2);169 previous freq=input data(j,i+2);

- 122 -

Page 139: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

170 break;171 else172

173 end174 end175 end176 end177 end178 end179 if i<length(input data(1,:))�2180 if trend line(k,i)==0&&trend line(k,i+1)==0&&...181 trend line(k,i+2)==0182

183 for j=length(input data(:,1)):�1:1184 if input data(j,i+3)<top&& input data(j,i+3)>bottom185 if i˜=1186 if previous freq�input data(j,i+3)<...187 line threshold&& previous freq�...188 input data(j,i+3)>0.02*10ˆ9189 trend line(k,i+3)=input data(j,i+3);190 previous freq=input data(j,i+3);191 break;192 else193

194 end195 end196 end197 end198 end199 end200 if i<length(input data(1,:))�3201 if trend line(k,i)==0&&trend line(k,i+1)==0&&...202 trend line(k,i+2)==0&&trend line(k,i+3)==0203 for j=length(input data(:,1)):�1:1204 if input data(j,i+4)<top&& input data(j,i+4)>bottom205 if i˜=1206 if previous freq�input data(j,i+4)<...207 line threshold&& previous freq�...208 input data(j,i+4)>0.04*10ˆ9209 trend line(k,i+4)=input data(j,i+4);210 previous freq=input data(j,i+4);211 break;212 else213

214 end215 end216 end217 end218 end219 end220 if i<length(input data(1,:))�3221 if trend line(k,i)==0&&trend line(k,i+1)==0&&...

- 123 -

Page 140: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

222 trend line(k,i+2)==0&&trend line(k,i+3)==0&&...223 trend line(k,i+4)==0224 previous freq=1;225

226 break;227 end228 end229

230 end231

232 end233

234 %Repeats previous method except ignores first 'p' resonant frequency found235

236 for p=1:res loop237 %the next for loop determines if you are iterating first point or all238 %the points over239 for k=p*length(input data(1,:))+1:(p+1)*length(input data(1,:))240 h=k�p*length(input data(1,:));241 for i=h:length(input data(1,:))242 flag=0;243 for j=length(input data(:,1)):�1:1244 if input data(j,i)<top&& input data(j,i)>bottom245 if i==h%if first point then we take it as it is246 if j>p247 trend line(k,i)=input data(j�p,i);248 previous freq=input data(j�p,i);249 break %found our value no need to keep looking250 else251 flag=1;252 break253 end254 end255

256 end257 %Finds a point that is smaller than the previous value and258 %It will store a point in trend line if decreasing within a259 %certain range260 if i˜=1261 if previous freq�input data(j,i)<line threshold&&...262 previous freq�input data(j,i)>0263 trend line(k,i)=input data(j,i);264 previous freq=input data(j,i);265 break;266 else267

268 end269 end270 end271

272 if flag==1273 break

- 124 -

Page 141: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

274 end275

276 if i˜=length(input data(1,:))277 if trend line(k,i)==0278 for j=length(input data(:,1)):�1:1279 if input data(j,i+1)<top&& input data(j,i+1)>bottom280 if i˜=1281 if previous freq�input data(j,i+1)<...282 line threshold&& previous freq�...283 input data(j,i+1)>0284 trend line(k,i+1)=input data(j,i+1);285 previous freq=input data(j,i+1);286 break;287 else288

289 end290 end291 end292 end293 end294 end295 if i<length(input data(1,:))�1296 if trend line(k,i)==0 && trend line(k,i+1)==0297

298 for j=length(input data(:,1)):�1:1299 if input data(j,i+2)<top&& input data(j,i+2)>bottom300 if i˜=1301 if previous freq�input data(j,i+2)<...302 line threshold&& previous freq�...303 input data(j,i+2)>0.01*10ˆ9304 trend line(k,i+2)=input data(j,i+2);305 previous freq=input data(j,i+2);306 break;307 else308

309 end310 end311 end312 end313 end314 end315 if i<length(input data(1,:))�2316 if trend line(k,i)==0&&trend line(k,i+1)==0&&...317 trend line(k,i+2)==0318

319 for j=length(input data(:,1)):�1:1320 if input data(j,i+3)<top&& input data(j,i+3)>bottom321 if i˜=1322 if previous freq�input data(j,i+3)<...323 line threshold&& previous freq�...324 input data(j,i+3)>0.02*10ˆ9325 trend line(k,i+3)=input data(j,i+3);

- 125 -

Page 142: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

326 previous freq=input data(j,i+3);327 break;328 else329

330 end331 end332 end333 end334 end335 end336 if i<length(input data(1,:))�3337 if trend line(k,i)==0&&trend line(k,i+1)==0&&...338 trend line(k,i+2)==0&&trend line(k,i+3)==0339 if k<length(input data(1,:))�1340 for j=length(input data(:,1)):�1:1341 if input data(j,i+4)<top&& input data(j,i+4)...342 >bottom %if between boundaries343 if i˜=1344 if previous freq�input data(j,i+4)<...345 line threshold&&...346 previous freq�...347 input data(j,i+4)>0.04*10ˆ9348 trend line(k,i+4)=input data(j,i+4);349 previous freq=input data(j,i+4);350 break;351 else352

353 end354 end355 end356 end357 end358 end359 end360

361 if i<length(input data(1,:))�3362 if trend line(k,i)==0&&trend line(k,i+1)==0&&...363 trend line(k,i+2)==0&&trend line(k,i+3)==0364 previous freq=1;365

366 break;367 end368 end369 end370 end371 end372

373 %%%%%%%%%%%%%%%%%Removes Horizontal lines%%%%%%%%%%%%374 comp line=0*trend line;375

376 for i=1:length(trend line(:,1))377

- 126 -

Page 143: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

378 for j=1:length(trend line(1,:))379 if trend line(i,j)˜=0380 comparator val=trend line(i,j);381 break382 end383 end384

385 not straight=false;386 for j=1:length(trend line(1,:))387 if trend line(i,j)˜=0388 current dif=abs(trend line(i,j)�comparator val);389 if current dif>horizontal threshold390 not straight=true;391 end392 end393 end394 if not straight==false395 trend line(i,:)=0;396 end397 end398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%399

400 %%%%%%%%%%%%%Resize and Compact Trend line%%%%%%%%%%%%401 %This section rearranges and removes duplicate lines and data values402

403 for i=1:length(trend line(1,:))404 for j=1:length(trend line(:,1))405 found=false;406

407 % trend line(j,i),comp line,i408 for w=1:length(comp line(:,1))409 if comp line(w,i)==trend line(j,i);410 found=true;411 end412 end413

414 if found==0415 comp line(j,i)=trend line(j,i);416 end417 end418

419 end420

421 counter=1;422 zero row=0;423 for i=1:length(comp line(:,1))424 for j=1:length(comp line(1,:))425 if comp line(i,j)˜=0426 zero row=zero row+1;427 end428 end429 if zero row>row min

- 127 -

Page 144: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

430 for k=1:length(comp line(1,:))431 final line(counter,k)=comp line(i,k);432 end433 counter=counter+1;434 end435 zero row=0;436 end437 for i=1:counter�1438 for j=1:length(final line(1,:))439 final trendline(i,j)=final line(i,j);440 end441 end442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%443

444

445 %%%%%%%%%%%%%%%%%Plots initial trend line%%%%%%%%%%%%446 figure('position',[500 400 850 500])447 hold on448 for i=1:length(final line(:,1))449

450 scatter(output data,final line(i,:),150,'.');451 title(['Trendline of Resonant Frequency Patterns'],'FontSize', 18);452 xlabel('Cavity Length [mm]','FontSize', 16);453 ylabel('Frequency [Hz]','FontSize', 16);454 end455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%456

457 %%%%%%%%%%%%%%inserts points between missed points in calibration%%%%%%%%458 if interpolation function==true459 for i=1:length(final trendline(:,1))%goes through each line460 count=0;461 last value=final trendline(i,1);462

463 for j=1:length(final trendline(1,:))%goes through every position464

465 if count˜=0&&final trendline(i,j)˜=0466 addition=(final trendline(i,last value)�...467 final trendline(i,last value+count+1))/(count+1);468 for k=last value+1:last value+count469 final trendline(i,k)=final trendline(i,k�1)�addition;470 end471 count=0;472 end473 if final trendline(i,j)==0&&last value˜=0474 count=count+1;475 end476 if final trendline(i,j)˜=0477 last value=j;478 end479 end480 end481 end

- 128 -

Page 145: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%483

484 %%%%%%%%%%%%%interpolates linearly between lines%%%%%%%%%%%%485

486

487 %%%%%%%%%%%%%%%%%interpolates between position values%%%%%%%%%%%%%488

489 counter=1;490 for i=1:length(output data(1,:))491

492 if i˜=1493 interp pos(counter)=(output data(i)�output data(i�1))...494 /2+output data(i�1);495 counter=counter+1;496 interp pos(counter)=output data(1,i);497 counter=counter+1;498 else499 interp pos(counter)=output data(1,i);500 counter=counter+1;501 end502

503 end504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%505

506 %%%%%%%%%%%%%%%%interpolates between frequencies%%%%%%%%%%%%%%%%%%507 for i=1:length(final trendline(:,1))508 counter=1;509 for j=1:length(final trendline(1,:))510 if j˜=1511 if final trendline(i,j)˜=0&&final trendline(i,j�1)˜=0512 interp freq(i,counter)=final trendline(i,j)�...513 (final trendline(i,j)�final trendline(i,j�1))/2;514 counter=counter+1;515 interp freq(i,counter)=final trendline(i,j);516 counter=counter+1;517 else518 interp freq(i,counter)=0;519 counter=counter+1;520 interp freq(i,counter)=final trendline(i,j);521 counter=counter+1;522 end523 else524 interp freq(i,counter)=final trendline(i,j);525 counter=counter+1;526 end527 end528 end529

530 %%%%%%%%%%%%%%%%%%%%%%%Interpolation%%%%%%%%%%%%%%%%%%%%%%%%%531

532 for p=1:num iterations�1533

- 129 -

Page 146: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.4 Interpolation Algorithm Development

534 %%%%%%%%%%%%%%%%%interpolates between position values%%%%%%%%%%%%%535 counter=1;536 for i=1:length(interp pos(1,:))537

538 if i˜=1539 interp pos2(counter)=(interp pos(i)�interp pos(i�1))/2+...540 interp pos(i�1);541 counter=counter+1;542 interp pos2(counter)=interp pos(1,i);543 counter=counter+1;544 else545 interp pos2(counter)=interp pos(1,i);546 counter=counter+1;547 end548

549 end550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%551

552 %%%%%%%%%%%%%%%%interpolates between frequencies%%%%%%%%%%%%%%%%%%553 for i=1:length(interp freq(:,1))554 counter=1;555 for j=1:length(interp freq(1,:))556 if j˜=1557 if interp freq(i,j)˜=0&&interp freq(i,j�1)˜=0558 interp freq2(i,counter)=interp freq(i,j)�...559 (interp freq(i,j)�interp freq(i,j�1))/2;560 counter=counter+1;561 interp freq2(i,counter)=interp freq(i,j);562 counter=counter+1;563 else564 interp freq2(i,counter)=0;565 counter=counter+1;566 interp freq2(i,counter)=interp freq(i,j);567 counter=counter+1;568 end569 else570 interp freq2(i,counter)=interp freq(i,j);571 counter=counter+1;572 end573 end574 end575

576 interp freq=interp freq2;577 interp pos=interp pos2;578 %%%%%%%%%%%%%%%%plots new trendlines%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%579

580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%581 end582

583 figure('position',[500 400 850 500])584 hold on585 for i=1:length(interp freq(:,1))

- 130 -

Page 147: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.5 Interpolation Algorithm Prediction Test

586 scatter(interp pos,interp freq(i,:),150,'.');587

588 title(['Interpolated Trendline of Resonant Frequency Patterns'],...589 'FontSize', 18);590 xlabel('Cavity Length [mm]','FontSize', 16);591 ylabel('Frequency [Hz]','FontSize', 16);592 end593

594 new freq=interp freq;595

596 new pos=interp pos;597

598

599

600 count=1;601 testDatashrink=zeros((stopFreq�min freq)/intervalSize,length(files) � 2);602

603 %%%%%%%%%%%%testing with data interpolated604

605 for i=1:length(new pos(1,:))606 start = min freq;607 stop = min freq + intervalSize;608

609 for j = 1:size(testData, 1)610 testDatashrink(j,count) = numel(new freq( new freq(:,count)>...611 start & new freq(:,count)<stop ));612 start = start + intervalSize;613 stop = stop+ intervalSize;614 end615

616 count=count+1;617 end618

619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

A.5 Interpolation Algorithm Prediction Test

The MATLAB script below was created to test the interpolation algorithm using the air-

filled and oil-filled cylinder data. First, the data was loaded into MATLAB, and the

input data and output data matrices were extracted. The input data matrix contained

the local minima of S11; each column represented the frequencies for di↵erent positions.

The output data matrix contained the piston positions in mm. Next, the predictions from

the nearest-neighbour algorithm were loaded into a variable called prediction.

- 131 -

Page 148: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.5 Interpolation Algorithm Prediction Test

The test removed a single column from the input data matrix and the corresponding

output data column. These columns were then used as the test data to verify that the

algorithm could predict position accurately. The input data column was discretized into

the DFM format and stored in the test input matrix. Next, the calibration input and

outputs were calculated. The input and output data, without the test data point, were

interpolated to create this calibration input. Using the interpolated calibration data, the

nearest-neighbour algorithm was used to predict position. This new prediction was com-

pared with the old prediction to determine the final predicted piston position. The code for

how the two predictions are compared is found in Appendix A.6. The predicted position

was then compared to the actual position, resulting in a display of the top error and the

percentage of positions within the measurement accuracy specification of 10 mm.

1 %%%%%%%%%%%Interpolation Verification Script%%%%%%%%%%%%%%%%2 %3 %This script predicts position using the interpolation algorithm.4 %The data collected from the VNA is opened and saved in the matrices5 %input data and output data. This data is used as the calibration data.6 %For testing purposes, a data point will be removed from the calibration7 %data to be used as verification of the algorithm.8 %Inputs:9 % prediction : This is the previous prediction using the in�house

10 % algorithm. Prediction is loaded from 'trevor prediction2.mat'11 % Measurement Data : This is the data from the VNA.12 %Outputs:13 % prediction two : This is the interpolated prediction matrix for all14 % data points tested15 % toperror :This is the max error between actual and predicted position16 % percent correct : This is the number of predictions meeting 10 mm17 % specification18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%19

20 files=dir('17');%directory of data21 index = 1;22 count=1;23 min freq = 2.E9;24 intervalSize = 5E6;%interval size of the test data binary array25 stopFreq = 2.55E9;26 peak find scale=1;%Determines the sensitivity of peak detection in peak ...

algorithm27 num resonances = 20;

- 132 -

Page 149: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.5 Interpolation Algorithm Prediction Test

28 testData = zeros((stopFreq � min freq)/intervalSize, length(files) � 2);29

30 for i=3:length(files)31

32 A=importdata(files(i).name);33 B=A.data;34

35 %gets name of each file and converts it to a number36 [pathstr,name,ext] = fileparts(files(i).name);37 cylinderPos = str2num(name);38

39 %.s1p already has the magnitude and in decibels40 H=B(:,2);41

42 [peakloc ,peakmag]=peakfinder(H(1:length(H)),peak find scale,�1,�1);43

44 %Convert peak location indices to frequency values45 peakloc = (peakloc(:) � 1).*(B(2,1) � B(1,1)) + B(1,1);46

47 resonance count = 1;48 loop counter = 1;49

50 %Iterate through the resonance peaks until the desired number have been51 %saved52 while(resonance count < num resonances + 1)53

54 if(peakloc(loop counter) > min freq)55 peak test(index) = peakloc(loop counter);56 input data(resonance count, count) = peakloc(loop counter);57 stroke length(index) = double(cylinderPos);58 resonance count = resonance count + 1;59 index = index + 1;60 end61

62 loop counter = loop counter + 1;63 end64 output data(count) = double(cylinderPos);65

66 count=count+1;67 end68

69 input copy = input data;70 input copy(input copy > 6E9) = 0;71 peak sum = sum(input copy, 1);72 coeff = polyfit(output data, peak sum, 1);73

74 load('trevor prediction2.mat')%loads in�house algorithm predictions75 prediction two = 0*output data;76 comparison range = 3;77

78 for test column = 1:size(input data, 2)79 start = min freq;

- 133 -

Page 150: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.5 Interpolation Algorithm Prediction Test

80 stop = min freq + intervalSize;81

82 for j = 1:size(testData, 1)83 testData(j,1) = numel(input data( input data(:,test column)>start ...

& input data(:,test column)<stop ));84 start = start + intervalSize;85 stop = stop+ intervalSize;86 end87 test input = testData(:, test column);88 test frequencies = input data(:,test column);89

90 %int points2 is a function that interpolates the calibration data91 [calibration input,calibration output] = ...92 int points2(input data,output data,...93 test column,min freq,intervalSize,stopFreq,testData);94

95 %predicts position using interpolated data96 prev position=prediction(test column);97 prediction two(test column) = predictPosition v3(calibration input,...98 calibration output, test input,comparison range,...99 coeff, test frequencies,prev position);

100

101 end102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%103 figure104 scatter(output data, prediction)105

106 figure107 scatter(output data, prediction two)108 xlabel('Actual Position');109 ylabel('Predicted Position');110 title(['Comparison Range = ', num2str(comparison range)]);111

112 hold on113 plot(output data, output data, 'r')114

115 %calculates how many predicted positions were within specification116 num correct = 0;117 for i = 1:length(output data)118 if i== 1119 toperror=abs(prediction two(i) � output data(i));120 else121 if abs(prediction two(i) � output data(i))>toperror122 toperror=abs(prediction two(i) � output data(i));123 end124 end125

126 if(abs(prediction two(i) � output data(i)) < 10)127 num correct = num correct + 1;128 end129 end130 toperror

- 134 -

Page 151: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.6 Interpolation Prediction Using Previous Prediction

131 percent correct = num correct/length(output data)

A.6 Interpolation Prediction Using Previous Prediction

This script determined the final position extension based on the interpolation and nearest-

neighbour prediction. The nearest-neighbour prediction was used as a reference point since

the narrow range of frequencies used by the interpolation algorithm had sets of local minima

of S11 similar for multiple positions. Now, the initial interpolated prediction was compared

with the nearest-neighbour prediction. If both predictions were within 10 mm, the inter-

polated prediction was the final predicted position. The predicted position was based o↵

the column in the proximity matrix that had the maximum value. If the interpolated

prediction was not within 10 mm, the column corresponding to this max proximity was set

to zero, and the new estimated position was the next highest proximity value. This process

repeated until the prediction was within 10 mm of the nearest-neighbour prediction and

had a proximity value greater than a certain threshold value. If no value satisfied these

two requirements, the nearest-neighbour prediction was used as the final prediction of the

piston position.

1 %%Prediction based on interpolated data and nearest�neighbour algorithm ...prediction%%

2

3 z=1;%counting variable4 [˜,column] = max(proximity);%max proximity of interpolated data5 prediction = calibration output(column);%prediction of entire ...

interpolated data6

7 %finds the best prediction with the max proximity that is within 10 mm of8 %the in�house algorithm prediction9 while(z<length(proximity))

10 [˜,column] = max(proximity);11

12 if ...abs(calibration output(column)�prev position)<10&&proximity(column)>2.5

13 prediction = calibration output(column);

- 135 -

Page 152: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System A.6 Interpolation Prediction Using Previous Prediction

14 break15 else16 proximity(column)=0;17

18 end19 if z==length(proximity)�120 prediction = prev position;21 end22 z=z+1;23

24 end

- 136 -

Page 153: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B. LabVIEW Block Diagrams

Appendix B

LabVIEW Block Diagrams

This appendix contains detailed block diagrams of the measurement system, control system,

and the complete positioning system. The design of the individual systems can be found in

Sections 3.4 and 3.5, respectively, and the complete positioning system integration can be

found in Section 4.1.

B.1 Measurement System Block Diagram

The LabVIEW block diagram shown below was the final version of the measurement system

program before integration with the control system to create the final hydraulic cylinder

positioning system program. Comments are provided to aid in acquiring basic understand of

the block diagram. An explanation of the logic of the program was provided in Section 3.4.2.

- 137 -

Page 154: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.1 Measurement System Block Diagram

Figure

B.1:The

measurem

entsystem

LabV

IEW

blockdiagram

.

- 138 -

Page 155: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.2 Control System Block Diagrams

B.2 Control System Block Diagrams

The control system used several programs in the development of the final product. The

LabJack-LabVIEW interface was shown in Figure 3.41. Following this program, the next

program to be developed was the pump control program. The GUI of this program was

shown in Figure 3.42, and the LabVIEW block diagram is shown in Figure B.2. These

programs served to demonstrate the PC’s ability to control the pump.

In the development of the control system single stroke controller, the following program

was used to conduct experiments on the pump to determine the relationship between time

of extension and distance travelled, as well as time of retraction and distance travelled.

Figure B.3 shows the GUI developed for this experimental tool, and Figure B.4 shows the

actual code.

Figure B.6 shows the control system LabVIEW block diagram that resulted from the

control system development. Figure B.5 shows the user interface of this program. This pro-

gram was still independent of the measurement system, but was used to test the algorithm

and structure of the control system developed in Section 3.5.2.

- 139 -

Page 156: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.2 Control System Block Diagrams

Figure

B.2:This

was

theLabV

IEW

blockdiagram

codefor

thePum

pControl

Program

.

- 140 -

Page 157: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.2 Control System Block Diagrams

Figure B.3: This is the GUI for the Time Test program used for experiments in Section 3.5.2and Section 3.5.3

- 141 -

Page 158: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.2 Control System Block Diagrams

Figure

B.4:This

was

theblock

diagramfor

theLabV

IEW

codefor

theTim

eTest

programused

forexp

eriments

inSection

3.5.2and

Section

3.5.3

- 142 -

Page 159: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.2 Control System Block Diagrams

Figure B.5: This was the GUI for the Time Test program used for experiments in Sec-tion 3.5.2 and Section 3.5.3

- 143 -

Page 160: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.2 Control System Block Diagrams

Figure

B.6:This

was

theblock

diagramfor

theLabV

IEW

codefor

thecontrol

systemprogram

usedfor

experim

entsin

Section

3.5.2

- 144 -

Page 161: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.3 Complete System Block Diagram

B.3 Complete System Block Diagram

The LabVIEW block diagram shown below was the final version of the hydraulic cylinder

positioning system program. Comments are provided to aid in acquiring basic understand-

ing of the block diagram. More information on how the hydraulic cylinder positioning

system was created using the measurement system and control system was provided in Sec-

tion 4.1. More information on the measurement system can be found in Section 3.4.2. As

well, more information on the control system can be found in Section 3.5.

- 145 -

Page 162: Design and Implementation of an Electromagnetic-Based ...ece.eng.umanitoba.ca/.../G01_Final_Report_2014.pdf · A.2 Artificial Neural Network Training ... Hydraulic Cylinder Positioning

Hydraulic Cylinder Positioning System B.3 Complete System Block Diagram

Figure

B.7:The

hydrauliccylinder

positioning

systemLabV

IEW

blockdiagram

.

- 146 -