Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

Implementation of a Miniature Autonomous

Directional Drilling Rig


Jarle Ness
June 2022

MASTER THESIS
Department of Engineering Cybernetics
Norwegian University of Science and Technology

Supervisor: Lars Struen Imsland


Executive Summary

Several industries, including the oil and gas industry, are moving toward digitalization and
automated systems in an effort to improve safety and efficiency. The Society of Petroleum
Engineers (SPE) and Drilling System Automation Technical Section (DSATS) promote
the growth of drilling automation in the industry by hosting the Drillbotics® competition
at the university level. Students will be encouraged to think creatively in order to develop
a completely autonomous tiny drilling rig capable of boring a directional hole through a
rock mass and hitting various targets.

Since 2017, Norwegian University of Science and Technology (NTNU) has participated
in this contest, and the teams have developed over each other’s experience. The com-
petition’s aim for 2021/2022 was to design and build a completely autonomous drilling
rig capable of directed drilling to intersect one or more target sites within a rock sample
using up to 30-degree inclination and 15-degree azimuth modifications from the starting
position.

This master’s thesis concentrated on how to obtain the best Miniature Autonomous Dir-
ectional Drilling Rig for the competition. I have accomplished this by resolving existing
control system faults, introducing new functionality, and improving the existing system.
The main problem from last year’s competition was that when given target points in the
Y-axis, the azimuth would steer the drill bit in the opposite direction of the target is
solved. We have researched the opportunity to improve the accelerometer calibration and
use a magnetometer for yaw estimation. Implemented the Dubins Curve for a better well
path generation and the additional features in the GUI for more awareness for the operator
since human factors have been a new concept introduced in this year’s competition.

The plan was to implement Nonlinear Attitude Observer using Reference Vectors, but
since the magnetometer is a dependency for generating reference vectors, it was concluded
not to implement it. By running a lot of drilling runs, we have been able to solve existing
errors and optimize the current system by tuning the Nonlinear Model Predictive Control
(NMPC). Shared challenges and lessons learned will contribute to the following year’s
team by saving time and helping them if they face similar challenges.
Acknowledgment

First and foremost, I want to acknowledge the student team of Henrik Helgeland, Mikaela
Solberg, and Luis C Alvarez for their understanding, knowledge, and devotion in making
this interdisciplinary project achievable. In addition, I want to thank my supervisor, Lars
Struen Imsland, for his help and guidance during the project. I would like to thank project
leader Alexey Pavlov and the petroleum supervisor support team for their assistance in
discussing ideas and concepts at biweekly meetings.

I would also like to acknowledge and thank Lab Engineers Noralf Vedvik and Torkjell
Breivik for their essential contributions to this project. Thank you for your aid in the
design, building and troubleshooting a various lab components, as well as your assistance
in comprehending the rig and preparing lab tests.

The Drillbotics competition is hosted and organized by DSATS and SPE. This year’s
challenge has been exciting. I am convinced that everyone who took part in Drillbotics
learnt a lot and is better equipped for their future employment.

Thank you very much to our sponsors BRU21, Equinor, and Lyng Drilling for making
this initiative possible via financial support and sponsorship.
Table of Contents

Abbreviations i

List of Figures ii

List of Tables v

1 Introduction 1

2 Theory 3

2.1 Drillbotics 2022 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1.1 Competition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1.2 Competition Groups . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.1.3 This year competition . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.1.4 Student Team . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.1.5 Supervisors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.1.6 Project Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.1.7 Sponsors and Contributions . . . . . . . . . . . . . . . . . . . . . . 6

2.1.8 GitHub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2 Rig Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2.1 NTNU Miniature Drilling Rig . . . . . . . . . . . . . . . . . . . . . 6

2.2.2 BHA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2.3 Bit System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2.4 Hoisting System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

iv
2.2.5 Azimuth System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2.6 Rotary System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.3 Control Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.3.1 Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.3.2 Extended Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . 15

2.3.3 MPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.3.4 NMPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.4 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.4.1 Downhole Sensor - Arduino Nano 33 BLE Sense . . . . . . . . . . . 17

2.4.2 Accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2.4.3 Magnometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.4.4 Gyroscope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.4.5 New computer - Dell Optiplex 7090 . . . . . . . . . . . . . . . . . . 23

2.5 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

2.5.1 MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

2.5.2 Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

2.5.3 Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

2.6 Digital Twin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

2.6.1 Simulation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

2.6.2 Modelled build rate . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

2.6.3 Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

2.7 Autonomous Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

2.8 Downhole Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

2.8.1 Position estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

2.8.2 Orientation estimation . . . . . . . . . . . . . . . . . . . . . . . . . 35

2.8.3 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

3 Implementations in the high level control system 38


3.1 Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

3.1.1 Accelerometer calibration . . . . . . . . . . . . . . . . . . . . . . . 38

3.1.2 Magnometer calibration . . . . . . . . . . . . . . . . . . . . . . . . 41

3.1.3 Yaw estimation with magnetometer . . . . . . . . . . . . . . . . . . 44

3.2 Dubins Curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

3.3 Human factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

3.4 Y axis error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

3.4.1 Description of the problem . . . . . . . . . . . . . . . . . . . . . . . 48

3.4.2 Methodology for solving the problem . . . . . . . . . . . . . . . . . 48

3.5 Nonlinear Attitude Observer using Reference Vectors . . . . . . . . . . . . 51

4 Testing 55

4.1 Testing the system and solving errors . . . . . . . . . . . . . . . . . . . . . 55

4.2 NMPC tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

5 Challenges and Lessons Learned 62

5.1 Merging high and low level control system in to one control system . . . . 62

5.2 Installing the DAQ for the new computer . . . . . . . . . . . . . . . . . . . 63

5.3 Load cell and Hoisting motor . . . . . . . . . . . . . . . . . . . . . . . . . 63

5.4 Implementation of Low Level Computer . . . . . . . . . . . . . . . . . . . 64

5.5 Simulink Data Acquisition Problem . . . . . . . . . . . . . . . . . . . . . . 64

5.6 Big deviation in roll and pitch . . . . . . . . . . . . . . . . . . . . . . . . . 66

6 Conclusion and Recommendations for Further Work 69

6.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

6.2 Recommendations for Further Work . . . . . . . . . . . . . . . . . . . . . . 70

Bibliography 71
Abbreviations

BHA Bottom Hole Assembly.

DAQ Data Acquisition.

DLS Dogleg Severity.

DSATS Drilling System Automation Technical Section.

EMI Electromagnetic Interference.

GUI Graphical User Interface.

HSE Health, Safety and Environment.

IGP Department of Geoscience and Petroleum.

IMU Inertial Measurement Unit.

INS Inertial Navigation System.

ITK Department of Engineering Cybernetics.

MD Measured Depth.

NED North-East-Down.

NMPC Nonlinear Model Predictive Control.

NTNU Norwegian University of Science and Technology.

ROP Rate Of Penetration.

RPM Revolutions Per Minute.

SPE Society of Petroleum Engineers.

TVD True Vertical Depth.

UDP User Datagram Protocol.

WOB Weight On Bit.

i
List of Figures

2.1 NTNU Drillbotics team members[4]. . . . . . . . . . . . . . . . . . . . . . 5

2.2 Overview of the rig[5]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3 Hoisting system[26]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.4 Azimuth control system[5]. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.5 Hollow shaft gearbox[2]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.6 Components of an azimuth servo motor[2]. . . . . . . . . . . . . . . . . . . 10

2.7 Overview of gearbox[2]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.8 T-shaft[2]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.9 Torque sensor[2]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.10 The whole rotary system. It is made up of the top drive motor, drill chuck,
T-shaft, azimuth motor, torque sensor, and hydraulic swivel from top to
bottom.[2]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.11 Top drive connection and drill chuck [2]. . . . . . . . . . . . . . . . . . . . 13

2.12 Arduino Nano 33 BLE Sense umodified and modified [5]. . . . . . . . . . . 18

2.13 Accelerometer structure[22]. . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.14 Hall Effect Illustration[30]. . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.15 Magnetic Distortion influencing magnetometer readings[1]. . . . . . . . . . 22

2.16 A mechanical gyroscope[11] . . . . . . . . . . . . . . . . . . . . . . . . . . 23

2.17 Overview of Simulink GUI. . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

2.18 Simulation pace configuration[24]. . . . . . . . . . . . . . . . . . . . . . . . 25

2.19 Inputs of the Rate Transition block are used to downsample a higher fre-
quency input signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

ii
2.20 MATLAB App Designer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

2.21 Arduino IDE overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

2.22 Scaling factors for various q values with azimuth rotation[5]. . . . . . . . . 32

2.23 System state flow diagram[5]. . . . . . . . . . . . . . . . . . . . . . . . . . 33

2.24 Inertial coordinate frame as seen from the workstation of the drilling oper-
ator. The zero point is shown in red. All units are in cm. . . . . . . . . . . 35

3.1 Accelerometer set in different static positions for calibration measurements[3]. 40

3.2 Magneto Software was used to calibrate the accelerometer[3]. . . . . . . . . 40

3.3 Calibrated vs. uncalibrated accelerometer data in various perspectives[3]. . 41

3.4 The impact of soft and hard iron on magnetometer readings[3]. . . . . . . . 42

3.5 Magneto is used to generate the calibration matrix A and vector B[3]. . . . 42

3.6 Magneto findings for magnetometer data that has been calibrated[3]. . . . 43

3.7 Magnetometer data in several perspectives, calibrated and uncalibrated[3]. 43

3.8 Sensor including housing and without[3]. . . . . . . . . . . . . . . . . . . . 44

3.9 CCC and CSC families [21] . . . . . . . . . . . . . . . . . . . . . . . . . . 45

3.10 Distance to Next Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

3.11 Information about the target point . . . . . . . . . . . . . . . . . . . . . . 48

3.12 High level GUI with human factors. . . . . . . . . . . . . . . . . . . . . . . 48

3.13 NED frame vs not NED frame . . . . . . . . . . . . . . . . . . . . . . . . . 49

3.14 Y axis error. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

3.15 Y axis error solved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

3.16 The nonlinear quaternion-based attitude observer by Mahony et al. (2008)[12]. 52

4.1 No azimuth changes after Drill Vertically state is finished. . . . . . . . . . 55

4.2 The result when changing the azimuth to positive clockwise. . . . . . . . . 56

4.3 Target points in negative Y-axis. . . . . . . . . . . . . . . . . . . . . . . . 57

4.4 Target points in negative Y-axis, when pitch and roll estimation is fixed. . 57

4.5 Target points in positive Y-axis, when pitch and roll estimation is fixed. . . 58

iii
4.6 Target points in positive X-axis. . . . . . . . . . . . . . . . . . . . . . . . . 58

4.7 Target points in negative X-axis. . . . . . . . . . . . . . . . . . . . . . . . 59

4.8 Target points in negative X-axis when azimuth starts in 180°. . . . . . . . 59

4.9 Target points in negative X-axis, when negative pitch is fixed. . . . . . . . 60

5.1 Error for high level GUI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

5.2 When 0 kg WOB is applied during static circumstances, the load cell meas-
urement is incorrect[3]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

5.3 How to make Matlab accept data from other devices[3]. . . . . . . . . . . . 64

5.4 Simulink does not received data from the sensor . . . . . . . . . . . . . . . 65

5.5 Simulink is receiving data from the sensor. . . . . . . . . . . . . . . . . . . 65

5.6 Big deviation in roll and pitch. . . . . . . . . . . . . . . . . . . . . . . . . . 66

5.7 SurveyEnabled constant high. . . . . . . . . . . . . . . . . . . . . . . . . . 67

5.8 SurveyEnabled is activated. . . . . . . . . . . . . . . . . . . . . . . . . . . 68

iv
List of Tables

3.1 First simulation, target points in X and Y axis . . . . . . . . . . . . . . . . 46

3.2 Second simulation, target points in X axis . . . . . . . . . . . . . . . . . . 46

3.3 Third simulation, target points in Y axis . . . . . . . . . . . . . . . . . . . 46

3.4 Fourth simulation, competition targets from last year . . . . . . . . . . . . 47

4.1 Simulations when target point is X = 5.9 cm. . . . . . . . . . . . . . . . . 61

v
Chapter 1

Introduction

The oil and gas business is continually looking for ways to improve essential features
such as Health, Safety and Environment (HSE), efficiency, and carbon emission control.
Process automation has shown to be an inventive, simple-to-implement, low-cost method
for meeting these needs.

Automation in drilling operations enables organizations to cut the number of man-hours


spent on repetitive jobs. As a result, workers may concentrate on more complicated
tasks. Another advantage of eliminating employees from regular tasks is that it cuts
down on time spent in high-risk regions like as the drill floor or between the mud pumps
in the circulation system. Additionally, automation can result in increased efficiency and
accuracy.

The Society of Petroleum Engineers (SPE) established the Drilling System Automation
Technical Section (DSATS) in 2008 to accelerate drilling automation in the oil and gas
business. SPE want to support the development, implementation, and research of the
new drilling automation technology and methods.

To promote these benefits among students in the oil and gas business, DSATS launched
the Drillbotics® competition in 2015. Students from all around the world are welcome
to contribute ideas for improving the fully automated miniature rig capable of drilling a
direction well through a rock sample.

The NTNU Drillbotics student team worked on a completely autonomous directional


drilling rig between the fall of 2021 and the spring of 2022. The team competes in DSATS’s
annual Drillbotics competition, in which universities create a completely autonomous
miniature size drilling rig. The goal this year was to intersect one or more target locations
along a deviated well path with up to a 15-degree azimuth orientation and a 30-degree
inclination variation between the points.

One of the petroleum students and I will explore the possibility of more accurate measure-
ments by researching accelerometer calibration. Since the yaw estimation using azimuth
angle is inaccurate, the case of using a magnetometer for yaw estimation is investigated.

1
To improve the well path, a comparison of the Dubins curve and Bezier curve should
be performed. This year for the Drillbotics competition, human factors have been intro-
duced, and I should modify the GUI to follow the principles of human factors should be
done in the GUI. Investigate why the azimuth is going in the wrong direction for Y-axis
coordinates. Explore the possibility of using Nonlinear Attitude Observer using Reference
Vectors in the high-level control system. See how the existing system is functioning and
optimize it with tuning. Share challenges and lessons learned to help the following year’s
team if they face similar challenges.

An essential part of the Drillbotics project involves a lot of practical work and how to
learn about the petroleum engineer part of the project. A lot of time has been used for
fixing components and understanding the system.

This thesis is based on research and experimentation from the ”NTNU Design Report -
Drillbotics 2022 Phase I”[4]. The thesis titled ”Design and Implementation of a Mini-
ature Rig for Autonomous and Directional Drilling”[3] produced by the team’s petroleum
students is often cited.

Each chapter is described briefly below:

• Chapter 1: Introduction: Already been through

• Chapter 2: Theory: The Drillbotics, Rig Specifications, Control Theory, Hard-


ware, Software, Digital Twin, Autonomous Operation and Downhole Sensor

• Chapter 3: Implementation in the high level control system: The new


implementations in the high level system, calibration and Y-axis error

• Chapter 4: Testing: Testing the current system and tuning the NMPC

• Chapter 5: Challenges and Lessons Learned: Describe the challenges en-


countered by working on this project

• Chapter 6: Conclusion and Recommendations for Further Work: Sum-


marize the key achievements and recommendation for what to do next

2
Chapter 2

Theory

2.1 Drillbotics 2022

NTNU Drillbotics is a student project that designs and builds an autonomous drilling
rig to compete in the annual Drillbotics competition. The Department of Geoscience
and Petroleum (IGP) is in charge of the project, with assistance from the Department of
Engineering Cybernetics (ITK). The project’s primary goal is to investigate and accelerate
digital innovation in the petroleum business.

2.1.1 Competition

Since 2015, the Drilling Systems Automation Technical Section (DSATS) has held the
Drillbotics competition, which challenges students to construct a completely autonom-
ous drilling rig. DSATS is a subgroup of the Society of Petroleum Engineers (SPE), a
non-profit organization dedicated to gathering and exchanging technical information in
the petroleum sector for the benefit of the public[27]. Since the 2015/2016 competition,
NTNU has competed every year.

Early in the autumn, DSATS and the Drillbotics committee will release a set of guidelines
outlining the aim, rules, guidelines, and assessment criteria for next year’s competition.
Every year, guidelines are updated, and a major alteration is usually made once a student
team has mastered the competition objectives. All teams are limited to a budget of $
10,000 USD and a maximum of five student team members. The guidelines can be found
at Drillbotics homepage[28].

3
2.1.2 Competition Groups

The Drillbotics is divided into group A and group B competitions. Group A is the virtual
rig simulation, and group B is a physical rig competition. The Drillbotics 2021/2022
team has decided to participate in group B. We compete against two other teams stated
in Germany and Norway.

2.1.3 This year competition

This year competition will be held in a hybrid format on June 16th at the NTNU Drill-
botics lab in Trondheim, Norway.

2.1.4 Student Team

The team of four students will compete in the Group B physical rig Drillbotics compet-
ition on behalf of NTNU. Three of the participants are pursuing a master’s degree in
petroleum engineering at the Department of Geoscience and Petroleum (IGP), with a fo-
cus on drilling. The last student is pursuing a master’s degree in robotics and cybernetics
at Department of Engineering Cybernetics (ITK).

4
Figure 2.1: NTNU Drillbotics team members[4].

2.1.5 Supervisors

Professors from IGP and ITK have been closely following the project and assisting with
problem solving, planning, knowledge transfer, and thesis guidance, among other tasks.
Supervisors have been available for consultation at biweekly meetings and on demand.
The supervisors have been following the project for some years and have extensive un-
derstanding of petroleum and cybernetics, as well as how these fields of expertise can be
merged.

2.1.6 Project Resources

The team has access to a miniature scale drilling rig, the rig has been modified by previ-
ous teams. The goal is to improve the rig in support of the Drillbotics competition and
research. In IGP department the student team has it own dedicated office space. Next to
the office, mechanical and automation engineers are available for consultation.
For the machining of mechanical components, IGP has an in-house workshop with trained
people. The workshop employs full-time workers who designed the majority of the pro-

5
ject’s specialized mechanical components. An in-house workshop has enabled rapid design
changes and little downtime while repairing broken parts.

2.1.7 Sponsors and Contributions

The BRU21 project provides the majority of the financial support. BRU21 is a research
and innovation initiative aimed at speeding up digitalization and automation in the pet-
roleum sector[8]. The program brings together academic and industrial professionals in
fields such as cybernetics, petroleum, computer engineering, robotics and data science, to
name a few. PhD and postdoctoral research initiatives are at the heart of the program.

Lyng Driling is a Schlumberger subsidiary located near Trondheim. The firm assisted the
student team in designing and manufacturing drilling bits. The team has visited Lyng
Drilling and got a fundamental course in how the bits are designed and manufactured.
The last financial contributor is Equinor.

2.1.8 GitHub

GitHub is a source control solution that facilitates code management and collaboration
when numerous software engineers are involved.[13]. GitHub is particularly advantageous
when numerous individuals make modifications to the same section of code, since updates
from various sources may be instantly merged. Code is separated into repositories and
then into branches.

Within the repository, branches include code that is at various stages of development. This
project was led by a single developer. GitHub remained valuable for moving code between
several machines, backing up data, documenting changes and rolling back changes. The
link to the GitHub repository is here: ”https://github.com/nesssen/NTNU-Drillbotics”.

2.2 Rig Specifications

This section will go through the rig and its key components.

2.2.1 NTNU Miniature Drilling Rig

The rig framework dates back to 2017, when NTNU competed in the competition for the
first time. Since then, new NTNU Drillbotics teams have acquired the rig and are working
to improve it to suit new competition rules. The derrick, drill floor, rock sample floor, and
computer table are the framework’s key components. Steel is the primary material used
in the rig structure, which is made up of steel beams that are both welded and fastened

6
together with nuts for a strong construction. All drilling and electrical components needed
in rig setup are housed in the framework.The rig is 2.85 meters in height, 0.75 meters in
breadth, and 1.65 meters in length. The rig’s overall weight is around 170 kg. The rig
can handle rock samples up to 0.85 m in height and 0.6x0.6 m in base.

Figure 2.2: Overview of the rig[5].

2.2.2 BHA

The Bottom Hole Assembly (BHA) is the component of the drilling system that holds
the bit. The BHA is attached to the drill pipe and features a propulsion rod in the
middle that provides torque to rotate the bit. The BHA is made up of five key parts:
a bend angle, a sensor housing, a drive shaft, a bit sub and an upper stabilizer. The
upper stabilizer of the BHA acts as a point of contact with the well path. This portion is
somewhat bigger in diameter than the rest of the BHA and features surface grooves for
enhanced stability. The drill pipe is linked to a friction attachment on the stabilizer’s top.

The sensor sub is located beneath the top stabilizer and contains a compartment for
the downhole sensor. The component safeguards the sensor against mechanical stress and
wetness. The downhole sensor cable is routed via a hole in the upper stabilizer and out
the top of the housing. Screws at the top and bottom keep the threads in place when
rotating. The bend angle connects the drilling rod to the drive shaft, which provides
torque to the bit. Set screws secure the rod to an exible joint. The opposite end of the
joint is connected to the drive shaft, which travels through the bottom stabilizer and into
the bit sub.

7
2.2.3 Bit System

In terms of drilling performance, the drill bit is critical. Drilling factors such as Rate Of
Penetration (ROP), stability, and steerability will increase with one that meets the proper
standards. Each team will be given a PDC drill bit by DSATS. However, as indicated
in the criteria, teams may create and utilize their own bit for the final competition[28].
Previous experiences from the NTNU Drillbotics teams reveal that specially designed
drill bits developed with the assistance of Lyng Drilling exceed any other tested bits.
This year’s team has done the same and designed our own bit.

2.2.4 Hoisting System

Its major function is to vertically shift the rotary drilling machine up and down. When
the system is hoisted down, it produces Weight On Bit (WOB), which, when paired with
Revolutions Per Minute (RPM), produces a Rate Of Penetration (ROP). A ball screw
operated by an AC motor hoists the equipment up and down. A load cell is connected to
the lower end of the ball screw and is used to measure the WOB. The hoisting system is
depicted in Figure 2.3. The hoisting motor and the load cell are the system’s two most
sophisticated, technologically advanced, and critical components.

Figure 2.3: Hoisting system[26].

2.2.5 Azimuth System

The closed-loop steering mechanism requires a precise azimuth control system. It is


necessary to accurately align the drill string and determine the yaw angle of the drill bit.

8
Figure 2.4 depicts the whole azimuth control mechanism of the small rig. It is made
comprised of a hollow shaft gearbox with a rotating table in the center, beneath the
upper plate of the brass T-shaft. On the left is the azimuth servo motor, and on the
right are two different gearboxes. The blue torque sensor can also be located beneath the
hollow shaft gearbox.

Figure 2.4: Azimuth control system[5].

Hollow Shaft Gearbox with Rotary Table

The hollow shaft gearbox with rotary table is used to orient the drill string while enabling
the titanium rod inside the drill pipe to move freely. Figure 2.5 depicts the Hypoid GSH
60-30K-SV1 model that was employed. With a 1:30 gear ratio, it can deliver a torque of
30 Nm and an output rotational speed of 2500 RPM to the azimuth control system.

Figure 2.5: Hollow shaft gearbox[2].

9
Azimuth Servo Motor and Gearboxes

As shown in Figure 2.6a, the azimuth servo motor delivers torque to the system and is
attached to the hollow shaft gearbox. The motor and drive models are SM0402AE4-KCD-
NNV and M2DV-1D82IP, respectively, as illustrated in Figure 2.6b. The motor’s rated
power output is 0.1 kW, and it has an output rotational speed of 3000 RPM and a rated
torque of 0.32 Nm for the system. As shown in Figure 2.7b, two additional right-angled

(a) Azimuth servo motor connected to the hol-


(b) Azimuth servo drive and motor.
low shaft gearbox.

Figure 2.6: Components of an azimuth servo motor[2].

gearboxes with a 3:1 gear ratio are added to the hollow shaft gear box. These are essential
to limit rotating speed in order to accurately align the drill string. Figure 2.7b shows a
gearbox of the model GSZ042-03K-SV with a maximum input speed of 2500 RPM and
a permitted torque of 12 Nm. With all of these components, the hollow shaft gearbox
achieves a gear ratio of 1:270, which is sufficient for the competition’s requirement for an
azimuth control system.

T-shaft

The hollow brass T-shaft depicted in Figure 2.8 conveys the azimuth system’s rotating
motion to the drill pipe while securing internal room for the rod. The T-shaft is attached
to the gear box and passes through the rotary table and torque sensor before being
fastened into the hollow shaft of the swivel. This shaft includes a 4 mm inner channel
that allows the rod to freely spin while preventing water migration from the hydraulic
part below.

10
(b) Gearboxes attached to a hollow shaft gear-
(a) Right-angled gearbox. box.

Figure 2.7: Overview of gearbox[2].

Figure 2.8: T-shaft[2].

Torque Sensor

The static torque is measured between a mechanical reference shelf and the static compon-
ent of the azimuth control gearbox system. This will calculate the torque forces acting
on the drill pipe as it rotates. The sensor, type TAT200 from HT Sensor Technology,
monitors torque in the ±30Nm range and has an IP67 classification[29].

11
Figure 2.9: Torque sensor[2].

2.2.6 Rotary System

Figure 2.10 depicts the whole rotary system. During drilling, the components of the rotary
system provide rotation and stability to the drill bit. It comprises of a top drive motor
transmitting rotating torque to a titanium rod situated inside the drilling system. Only
when the azimuth is altered will the drill pipe revolve. This technique is similar to the
drilling procedure known as ”slide drilling” in the industry.

Figure 2.10: The whole rotary system. It is made up of the top drive motor, drill chuck,
T-shaft, azimuth motor, torque sensor, and hydraulic swivel from top to bottom.[2].

12
Top Drive Motor

The torque necessary to drill the formation is provided by the top drive motor. The
rotating force is supplied to the drill bit through a universal joint after being transferred
to the secured titanium rod that travels freely inside the drill string.

The motor is located at the top of the drilling system and is coupled to the carriage mount
through an adaptor plate, as seen in Figure 2.10. It is made up of a Lenze motor and
a gearbox of type G500-H45 MF 063-42. It has a 1:2.597 gear ratio and can produce an
output torque of 5 Nm and a rotating speed of 1309.2 RPM to the drilling mechanism.

Top Drive Connection and Drill Chuck

A top drive connection and drill chuck are required to deliver torque from the top drive
motor to the titanium rod. The connection depicted in Figure 2.11a is made up of a
stainless steel adapter that connects the drill chuck to the top drive motor.

The drill chuck has three jaws that hold the titanium rod in place. As seen in Figure 2.11b,
these jaws are tightened with a specific key, and a screw is used to secure the rod in
place. These extra precautions are required to keep the rod stable and prevent it from
loosening while the system is vibrating from the drilling process. This form of attachment
is inexpensive, effective, and allows for the rapid and safe replacement of the titanium
rod. The drill chuck specs are available in Figure 2.11b

(a) Overview of top drive connection: Top drive motor, (b) Drill chuck with key and screw.
adaptor and drill chuck.

Figure 2.11: Top drive connection and drill chuck [2].

13
Rod

The drilling system’s compact and cylindrical rod is fixed in the drill chuck jaws and
extends down to the universal joint in the bent housing. It is composed of titanium and
is 1.42 m in length with an outer diameter of 4 mm.

Drill Pipe

The hollow cylinder drill pipe has an exterior diameter of 9.53 mm, an inner diameter
of 7.04 mm, and a length of 90 cm. Because the forming and breaking of drill pipe
connections is not needed, the length might be customized to drill the competition run in
one go. The Drillbotics rules allow for the use of aluminum and stainless steel as drill pipe
materials. It is critical to select the most durable material, and attention has been taken
to guarantee that the drill pipe can work within its elastic limitations. The aluminum
alloy 7075-T6 passes the competition specifications and is chosen as the material for the
drill pipe this year.

2.3 Control Theory

This section will explain the theory behind Kalman Filter and Model Predictive Control.

2.3.1 Kalman Filter

A Kalman Filter is known as a state estimator for stochastic systems. In each system,
there will always be some measurement and process noise uncertainty. The Kalman filter
provides sensor fusion by combining a model estimate with several sensor readings. The
covariance dictates how each estimate is weighted. If the noise has a Gaussian distribution,
the Kalman filter can select the estimate with the least covariance and, consequently, the
ideal state estimate.

The Kalman filter estimated the system model and compared it to the system’s output.
The Kalman Filter’s state space model is as follows:

x̂k = Ax̂k−1 + Buk + Kk (yk − C(Ax̂k−1 + Buk )) (2.1)

The next estimate is a forecast based on the previous state, and it is known as the prior
estimated and is indicated as x̂−
k.

x̂−
k = Ax̂k−1 + Buk (2.2)

14
The predicted covariance is determined by the system matrix, process noise covariance
Q, and past covariance.

Pk− = APk−1 AT + Q (2.3)

The Kalman filter is an iterative time-step algorithm. The Kalman gain, Kk , is calculated
to minimize the variance of the optimal state estimation. As the measurement noise
covariance R grows, the Kalman gain will decrease.

Pk− C T
Kk = (2.4)
CPk− C T + R

The past estimate and the current measurement are used to calculate the new estimated
state.

x̂k = x̂− −
k + Kk (yk − C x̂k ) (2.5)

The error covariance matrix of the current best estimate is constructed using the anticip-
ated covariance and the Kalman gain.

Pk = (I − Kk C)Pk− (2.6)

The error covariance matrix can be used to track the expected deviation in state es-
timation. The variance is equal to the square of the expected deviation. The diagonal
components indicate the state estimation fluctuations.

2.3.2 Extended Kalman Filter

Nonlinear system models are utilized to enhance estimation of orientation and position.
A linear state-space model is required for linear Kalman filters. Some models will have a
close linear approximation around an operational point but will not have a precise linear
estimation across the complete range of states and inputs. This is shown in Equation 2.7.

f (x) ≈ f (x̂) + f ′ (x)(x − x̂) (2.7)

To be an optimum estimator, linear Kalman filters require noise levels to have a Gaussian
distribution. In general, passing noise values via a non-linear function will not result in
a Gaussian output distribution. Kalman filters might assume that the noise is approxim-
ately linearly distributed, which is referred to as additive noise as in Equation 2.8 and in
Equation 2.9. is referred to as nonadditive noise[25].
xk = f (xk−1 , uk ) + wk , yk = g(xk ) + vk (2.8)

15
xk = f (xk−1 , uk , wk ), yk = g(xk , vk ) (2.9)

With x representing the state, u representing the input, and y representing the output,
and w and v representing the noise values for states and outputs, respectively. State and
output equations with additive and nonadditive combinations can be utilized interchange-
ably. By employing the Jacobian of the state and input, the linearization can be applied
directly in the state-space modelled Kalman filter.

∂f ∂g
F = |x̂ ,u , G= |x̂ (2.10)
∂x k−1 k ∂x k

If either the states or the outputs are linear, the state-space matrix can be employed
instead of the Jacobian approximation. The Jacobians can estimate a new Kalman com-
patible model if both the states and the inputs are nonlinear.

∆xk ≈ F ∆xk−1 + wk , ∆yk ≈ G∆xk + vk (2.11)

If the Jacobian can be determined analytically, using an extended Kalman filter instead
of a normal Kalman filter incurs just a little computing penalty.

2.3.3 MPC

The Model Predictive Control optimizes the control for each step by starting with the
current state. Before adding new input to the system, the MPC constructs a prediction
horizon of length N. For the system to converge to the reference inside the input sequence,
the prediction horizon must be sufficiently long. To achieve convergence, the horizon
should be at least twice as long as the number of inputs. The ability to change and impose
limits on state and input will considerably increase control performance in particular
control applications. Specific applications cannot utilise it efficiently due to its high
processing expenses.

Using varied sized time-steps throughout your optimization will aid in lowering the total
computing cost. Smaller time increments often describe the early half of the input se-
quence. The size of the time steps increases to reduce the computational cost. When the
system has already converged, the demand for control precision is reduced. The states
further into the future will likewise be less accurate due to accumulated simulation error.
Long-term planning capabilities are compromised in order to make longer predictions at
lower computing costs.

16
2.3.4 NMPC

By using Nonlinear MPC, the critical differences from MPC are: nonlinear prediction
models with time-varying parameters are possible, the inequality and equality constraints
can exist, the cost function for minimizing the scalar can be a non-quadratic function,
closed-loop control of nonlinear plants with nonlinear costs and restrictions are then sim-
ulated, solve an open-loop restricted nonlinear optimization problem to find optimal tra-
jectory[23].

2.4 Hardware

This section will outline the Arduino Nano 33 BLE Sense and its most essential sensors.
Also, a new computer will be introduced.

2.4.1 Downhole Sensor - Arduino Nano 33 BLE Sense

The Arduino Nano 33 BLE Sense is an advancement of the Arduino Nano, but with a much
more powerful processor, the nRF52840 from Nordic Semiconductors, a 32-bit ARM®
Cortex®-M4 CPU operating at 64 MHz. This allows you to create larger programs than
with the Arduino Uno (it has 1MB of program memory, which is 32 times larger), as well
as programs with a lot more variables (the RAM is 128 times bigger). Other remarkable
features of the main processor include Bluetooth® connection through NFC and super
low power consumption modes[7].

This model includes a built-in IMU sensor, which is useful. The Arduino has a width of
18mm and a length of 45mm. The width exceeds the 16mm restriction for fitting inside
the BHA sensor housing. By cutting each side of the Arduino, the length can be reduced
to 16mm.

17
Figure 2.12: Arduino Nano 33 BLE Sense umodified and modified [5].

2.4.2 Accelerometer

The accelerometer is used to detect linear acceleration in the x, y, and z directions utilizing
capacitance change and a specified spring constant. Each axis has its own proof mass,
which is held in place by springs in a base structure. In the proof masses, a moveable
plate symbolizes capacitors and is put between the base construction and the permanent
plate. The capacitance difference is used to measure the deflection of proof masses, and
many moveable and fixed plates are used to enhance the difference. Figure 2.13 shows
an example of this. The linear acceleration is calculated by combining the known spring
constant with the observed capacitance difference[22].

18
Figure 2.13: Accelerometer structure[22].

Measurement noise

High frequency oscillations arise on the measuring signal as a result of electrical disruption
from Electromagnetic Interference (EMI) or electrical equipment.

Process noise

Heavy vibrations are produced during a drilling operation with the existing rig configur-
ation, and the vibrations travel up the drillstring to the remainder of the rig. Process
noise is the term used to describe these dynamic motions.

Earth’s Gravitation

The gravitational acceleration of the earth has a constant direction and magnitude of
around 9.81m/s2 or 1g perpendicular to the earth’s surface (with minor changes depending
on location). This continuous acceleration can be utilized as a reference direction for the
accelerometer to identify whether it is moving up or down.

19
2.4.3 Magnometer

The magnetometer use the hall effect to determine the intensity of the magnetic field. To
quantify the magnetic field intensity, the hall effect uses two magnetic properties: flux
density and polarity. To deliver low current through the semiconductor, a closed loop
circuit comprised of a p-type semiconductor and a DC power source is used. When a
hall element (semiconductor) is put in a magnetic field, passing electrons are deflected
to the semiconductor’s corresponding side. If the electron density is larger on one side,
a potential difference may be recorded and defined as the hall voltage, which can then
be used to calculate the intensity of the magnetic field[30]. Figure 2.14 illustrate the hall
effect.

Figure 2.14: Hall Effect Illustration[30].

The measurement noise is the same as for the accelerometer.

20
Process noise

External magnetic influences cause distortions in the Earth’s magnetic field, which are
classified as either a hard-iron or a soft-iron effect. If there is no distorting impact,
spinning a magnetometer through a minimum of 360° and charting the resultant data as
x-axis vs. y-axis results in a circle centered around (0, 0). The hard-iron effect may cause
the circle to be offset from the (0,0) reference point. A in the event of the soft-iron effect,
the circle may distort and generate an ellipsis[10].

Hard-Iron Distortion is created by materials that generate a magnetic field. As long as


the magnet’s orientation and location relative to the sensor remain unchanged, the offset
created remains constant. The downhole sensor will be in a fixed orientation during a
survey, however other materials, such as the rig frame, will not move relative to the sensor.
To enhance this, all magnetic materials and electrical equipment in close proximity to the
sensor should be replaced with non-magnetic materials. The team discovered that the
stainless steel material utilized for the BHA is magnetic, by using a magnet.

Soft-Iron Distortion is caused by material that distorts a magnetic field but does not
necessarily create one. Iron and nickel, for example, will cause a soft-iron deformation[10].
Unlike hard-iron distortion, which is constant regardless of orientation, soft-iron distortion
is depending on the orientation of the material relative to the sensor and the magnetic
field. As a result, it cannot be accounted for by using a constant. A more sophisticated
technique would be necessary in the event of a soft-iron deformation.

Figure 2.15 depicts ideal distortion-free magnetometer data in which the output is centered
about (0,0) and circular in form, as shown in blue. The red circle is magnetometer data
demonstrating hard-iron distortion with a constant offset for both the x- and y-axes. The
soft-iron effect bends the ideal circle into an elliptical form, which is illustrated by the
black ellipsis in Figure 2.15.

21
Figure 2.15: Magnetic Distortion influencing magnetometer readings[1].

2.4.4 Gyroscope

A gyroscope is a component that measures or maintains orientation based on the concept


of angular momentum conservation. The main component, a rather heavy spinning rotor,
is attached with virtually frictionless bearings inside two concentric lightweight rings
(gimbals), each of which is likewise mounted with identical bearings inside the next outer
ring, or, in the case of the outer ring, the support frame. This is seen in Figure 2.16.

The rotor and the two rings are positioned in such a way that their planes of rotation
are perpendicular to the planes of rotation of the other two. Because of the angular
momentum of the wheel, the spinning rotor naturally resists changes in orientation. This
phenomena is also known as gyroscopic inertia or spatial stiffness in physics. Because
of the rotor’s unique support in the nested gimbals, it can maintain a virtually constant
orientation even when the support frame alters its orientation[11].

22
Figure 2.16: A mechanical gyroscope[11]

2.4.5 New computer - Dell Optiplex 7090

The Dell Optiplex 7090 computer has a eight-core Intel Core i7-10700T processor and
64GB of RAM. As described in Section 5.1, the plan was to run both high and low level
control system on the new computer, but since problem with Simulink implementation.
This computer will replace the low-level data since the low-level control system is the
most computational demanding.

2.5 Software

MATLAB, Simulink, and Arduino IDE are the most used software in the project, and
their key functions will be outlined in this section.

2.5.1 MATLAB

MATLAB is a programming and numerical computing platform that millions of engin-


eers and scientists use to analyze data, design algorithms, and build models[18]. Machine
learning, robotics, measurements and control systems can all be created using MAT-
LAB. The documentation for the language is vast, and there are active assistance forums.
Toolboxes can be used to expand MATLAB’s capabilities. Control system expansions,
optimization, signal processing, and machine learning are examples of regularly utilized
toolboxes[18]. The preferred programming language for a range of courses is MATLAB
and is quite familiar to NTNU students studying cybernetics.

23
2.5.2 Simulink

Simulink is a MATLAB add-on that enables you to model and simulate systems via the
use of block diagrams. Toolboxes such as MATLAB are available to expand functionality.
MATLAB function blocks allow MATLAB code to be used in Simulink simulations, and
variables may be accessed directly from the MATLAB workspace. Code generation auto-
mates the creation of efficient C++, C, or HDL code from a model by utilizing a series
of blocks and MATLAB methods[20].

Figure 2.17: Overview of Simulink GUI.

Simulation Configurations

Simulink has the ability to simulate both discrete and continuous systems. Simulink will
automatically offer a solution based on the recognized system dynamics. The user has
the option to override the solver’s selections. Other configuration options can be used to
improve performance, debug, and specify how blocks interact with one another[20].

Continuous Solver Setup: A continuous time solution is required for system dynamics
simulations. The solution has variable step size because it is more efficient and accurate
than a fixed step solver.

Control System Solver Setup: Control system measurements are made at distinct
time intervals. Due to the fact that the control system makes no effort to mimic any
states, the solver may be set to discrete mode with no continuous states.

24
Simulation Pacing

By default, a Simulink model will run immediately. External hardware may exhibit a
range of behaviors depending on the model execution time. Simulation pacing can be
used to minimize execution time so that it does not exceed real time.

Figure 2.18: Simulation pace configuration[24].

Performance Profiling

Simulink has debugging features for determining the time required to execute a block.
The execution time of blocks is used to determine whether blocks should be enhanced or
have a lower sampling rate. To prevent overloading the control system, resources must
be allocated to achieve the maximum level of overall control. Historically, system profiles
have been run for 60 seconds to reduce the influence of differences in setup times between
runs while being brief enough for fast-paced testing.

Code Generation

Certain MATLAB functions provide code generation, which allows the creation and ex-
ecution of MATLAB Function blocks and Simulink blocks as efficient C or C++ code.
Otherwise, the functions will be executed by the MATLAB interpreter. To make use
of compiled code, the model’s execution time must be set to accelerated[17]. LCC is the
standard MATLAB compiler. Due to a problem with the previous team’s inability to build
MATLAB functions such as Modbus, the prior year’s team switched to the recommended
MinGW-w64 compiler.

Data Transfer

To make the greatest use of available computing resources, atomic subsystems are sampled
at varied speeds. Transferring data between blocks with varying sampling rates necessit-
ates the use of a Rate Transition block, since the inputs and outputs of Simulink’s atomic
subsystems must have the same sample rate. The system’s sample rates are designed to
be multiples of one another to guarantee predictable data transmissions[19].

25
If the transition block’s sample rate is configured to be greater than the rate of the input,
the same input will be sent numerous times to the succeeding subsystem with a higher
sampling rate. Down conversion buffers high-frequency inputs and outputs the most recent
value from the lower sample rate block upon request. The Rate Transition block’s top
left corner indicates the operation mode. Synchronization of data flows across tasks may
require a unit step delay. Tasks should be allocated in such a way that latency-sensitive
functionality is not impacted by unit delays.

Figure 2.19: Inputs of the Rate Transition block are used to downsample a higher fre-
quency input signal.

GUI

MATLAB has an App Designer tool for creating graphical user interfaces. The Design
View generates graphical user interfaces using a simple drag-and-drop interface, while the
Code View generates logic using MATLAB syntax. Components created in the Design
View may be associated with handlers that trigger function calls when the state of a
component changes. The logic included in the Code View can be utilized to interact with
a Simulink model.

Figure 2.20: MATLAB App Designer.

26
Simulink Interface: MATLAB commands may be used to connect an App Designer
graphical user interface to a Simulink model. While the simulation is running, Simulink
constants and display block values may be modified. The set param command is used to
modify a constant, while the get param command reads a display.

The current Simulink system’s top-level model is returned by bdroot[16]. Inputs may
be taken only after they have been converted to a string and assigned to a constant. The
constant block’s value argument is the one that will be updated. To have access to the
display values while a simulation is running, a RuntimeObject is required[15].
1 %Write t o c o n s t a n t i n t h e subsystem AppInput c a l l e d InputConstant
2 s e t p a r a m ( [ bdroot , ' / AppInput / InputConstant ' ] , ' Value ' ,
3 num2str ( i n p u t V a l u e ) ) ;
4 ...
5 %Read from d i s p l a y i n subsystem AppOutput c a l l e d OutputDisplay
6 r t o = get param ( [ bdroot , ' /AppOutput/ OutputDisplay ' ] ,
7 ' RuntimeObject ' ) ;

Input Data Update: The majority of App Designer’s graphical user interface com-
ponents allow user input. When a component event occurs, these components’ callback
routines are executed. The Graphical User Interface (GUI) makes use of button, switch,
edit field, and slider components to collect user input data. The component’s input val-
ues may be sent to the event functions. The Simulink model is handled using the App
Designer GUI by modifying the constant blocks that are connected to the rest of the
model’s blocks. Constant blocks need numeric inputs as string values. Even after the
Simulink model is terminated, constant blocks retain their values. This must be carefully
considered while adding new features to prevent unexpected behavior upon model restart.
1 % DummyConstant i s t h e c o n s t a n t bock and AppInput t h e subsystem
2 s e t p a r a m ( [ bdroot , ' / AppInput /DummyConstant ' ] , ' Value ' ,
3 num2str ( dummyValue ) ) ;

Output Data Update: A PostOutput event causes the GUI to poll data from output
Display blocks. For intialize the app, the function InitFc is used.
1 % DummyDesignerApp i s t he name f o r t h e app f i l e without
2 % f i l e extension
3 hApp = DummyDesignerApp ;

The trigger for the model’s StartFcn event is linked to a publicly accessible GUI function.
1 % I n i t i a l i z e p o s t output t r i g g e r f o r output d i s p l a y
2 % AppOutput i s a subsystem c o n t a i n i n g th e output d i s p l a y
3 s e t ( 0 , ' ShowHiddenHandles ' , on ) ;

27
4 b l k = ' DummyDesignerApp/AppOutput/ OutputDisplay ' ;
5 e v e n t = ' PostOutputs ' ;
6 l i s t e n e r = @( app , e v e n t ) updateGUI (hApp ) ;
7 h = a d d e x e c e v e n t l i s t e n e r ( blk , event , l i s t e n e r ) ;

For a particular poll rate, event-based polling assures the shortest possible latency between
the production of a new model value and the GUI refresh.

Plotting

Plot instructions are identical to those used in MATLAB scripts. The UIAxes component
renders charts in two dimensions and three dimensions. The first plot command specifies
the kind of plot. Initialization instructions are executed by the GUI initialized callback.
It is possible to alter plots once they have been established.
1 % 2D p l o t i n i t i a l i z a t i o n by l i n k i n g t he GUI element t o o b j e c t
2 % b s p e c i f i e s th e c o l o r o f t he p l o t and handle v i s i b i l i t y
3 d i s a b l e s legend
4 app . p l o t O b j e c t L i n e = p l o t ( app . UIAxesObject , nan , nan ,
5 'b ' , ' HandleVisibility ' , ' o f f ' ) ;
6 % 3D p l o t i n i t i a l i z a t i o n
7 app . p l o t 3 O b j e c t L i n e = p l o t 3 ( app . UIAxesObject , nan , nan , nan ,
8 'b ' , ' HandleVisibility ' , ' o f f ' ) ;

Because plotting in App Designer requires a significant amount of resources, keep the
plot count and update frequency low. The Simulink Profiler revealed that extending the
plot, altering the axes, and recreating the plot object each GUI update cycle resulted in
a significant processing cost. After initializing the plot, you may edit it by updating the
plot object’s axis data. The data in the plot object is stored from the previous iteration
and does not need to be modified if it is identical to the data in the previous update.
1 % Update th e data i n p l o t o b j e c t
2 app . p l o t O b j e c t L i n e . XData = dummyXData ;
3 app . p l o t O b j e c t L i n e . YData = dummyYData ;
4 % I f 3D p l o t
5 app . p l o t O b j e c t L i n e . ZData = dummyZData ;

28
2.5.3 Arduino IDE

The microcontroller is programmed in a code editor specifically created for Arduino


devices, with the goal of making it simple to get started. A new project is divided
into two parts: setup and loop.

1 void setup ( ) {
2 // put your s e t u p code here , t o run once :
3

4 }
5

6 void loop ( ) {
7 // put your main code here , t o run r e p e a t e d l y :
8

9 }

The IDE includes a text editor, compiler, debugger, and package support. The language
is based on C and has a well-documented community.

Figure 2.21: Arduino IDE overview.

Libraries

The IMU sensor makes use of a driver that is installed in the Arduino IDE library man-
agement.

29
• ArduinoLSM9DS1.h : Interaction with the IMU sensor. Configuration and data
sampling functionality for the sensor[6].

Data Sampling

The microcontroller sends sample commands to the sensor via function calls to the Ardu-
ino LSM9DS1 library. A separate function call is provided for sampling the accelerometer,
magnetometer, and gyroscope in all three axes. To sample more than once, sample in-
structions can be included in the code’s loop section.
1 #i n c l u d e <Arduino LSM9DS1 . h>
2 // D e f i n e v a r i a b l e s
3 float x, y, z ;
4 f l o a t accX , accY , accZ ;
5 f l o a t gyrX , gyrY , gyrZ ;
6 f l o a t magX, magY, magZ ;
7

8 void setup ( ) {
9 i f ( ! IMU . b e g i n ( ) ) {
10 // S e r i a l . p r i n t l n ( ” F a i l e d t o i n i t i a l i z e IMU ! ” ) ;
11 while ( 1 ) ;
12 }
13 // Sample t h e s e n s o r data
14 IMU . r e a d A c c e l e r a t i o n ( accX , accY , accZ ) ;
15 IMU . readGyroscope ( gyrX , gyrY , gyrZ ) ;
16 IMU . r e a d M a g n e t i c F i e l d (magX, magY, magZ ) ;

Serial Data Transfer

A connected serial connection can be used to transfer data. When using the Arduino
IDE, serial does not require any libraries.
1 void setup ( ) {
2 // S t a r t s e r i a l with baud r a t e as parameter
3 S e r i a l . begin (115200);
4 // Ensure s e r i a l p o r t i s ready .
5 while ( ! S e r i a l ) ;
6 // Send a r b i t r a r y message o v e r s e r i a l
7 S e r i a l . p r i n t l n ( ” H e l l o world ” ) ;
8 // I f th e r e c e i v e r e x p e c t s a 4 byte f l o a t v a l u e i n s t e a d
9 f l o a t value = 1.2345;
10 S e r i a l . w r i t e ( ( byte ∗)& value , 4 ) ;
11 }

30
2.6 Digital Twin

It is useful to be able to test controllers and position estimates without having to enter the
rig. A digital twin simulation enables rapid controller and estimator prototyping. Con-
trollers may be evaluated and debugged in simulation before being deployed to the actual
rig, which is a critical function. The digital twin simulation is built on a physics model
of predicted movement behavior based on the rig’s mechanical parameters. Simulink is
used to implement the digital twin.

2.6.1 Simulation Model

The model assumes that the BHA will continue to travel in the same direction as it is
now, at the rate of lifting movement in Measured Depth (MD). The rate of orientation
change is determined by the bend angle of the BHA and is denoted as DLS. The BHA’s
modelled motions are relative to its own frame. Rotation matrices can be used to convert
the BHA frame orientation to the inertial frame. Euler angles are used to characterize
the orientation of the frame in roll, pitch, and yaw.

ϕ̇BHA = 0 (2.12a)

θ̇BHA = DLS · d˙ (2.12b)

ψ̇BHA = ψ̇I (2.12c)

The shift in hoisting position and azimuth direction is shown as d˙ and ψ̇I . All motions
in Equation 2.12 are relative to the BHA’s zero point. To make additional computations
easier, angular velocity may be expressed as a vector.

 
ϕ̇BHA
ωBHA =  θ̇BHA  (2.13)
ψ̇BHA

Rotation matrices can be used to translate movements in the BHA frame to the inertial
frame. Because the system model assumes no roll movement relative to the BHA, the
rotation matrix can be reduced. The orientation of the Euler angle is related to the
inertial frame.

cos(θ) sin(ϕ) · sin(θ) cos(ϕ) · sin(θ)


 
1 
ωI = 0 cos(ϕ) · cos(θ) − sin(ϕ) · cos(θ) ωBHA (2.14)
cos(θ)
0 sin(ϕ) cos(ϕ)

31
The orientation is obtained by integrating the angular velocity throughout the drilling
process. The BHA is supposed to travel in the direction it is oriented with a rate of
change in MD equal to the hoisting system’s velocity.

     
0 0 0
I I I
p˙I = RBHA · 0 + ṘBHA · 0 ≈ RBHA · 0 (2.15)
d˙ d d˙

The orientation matrix’s rate of change is small and is predicted to be zero.

2.6.2 Modelled build rate

Dogleg Severity (DLS) is a petroleum industry measurement that defines how much angle
a bent sub will develop over a given distance. In this method, DLS is defined as the
predicted ratio of angle build rate to movement in MD in degrees. As the BHA advances
in MD in the direction of the bend sub orientation, inertial orientation will accrue.

αbr
DLSnom = (2.16)
360

The experimental findings revealed a substantial association between the azimuth system’s
rotation velocity and the reduction in construction rate. Given the present rotational
velocity, a model for DLS was created using the normal distribution formulae.

ψ̇I2
DLS = DLSnom exp(− ) (2.17)
q

With q being a configurable constant for the construction profile and DLSnom being the
build rate without rotation. Figure 2 depicts the distribution for several values of q.

Figure 2.22: Scaling factors for various q values with azimuth rotation[5].

32
2.6.3 Simulink

For more complex computations, the model is built as a block diagram containing MAT-
LAB function blocks. Simulink will utilize the variable step ode23t solver by default for
continuous time estimates. For continuous systems, variable step solvers are often more
efficient and accurate than fixed step solutions.

2.7 Autonomous Operation

The system has a total of seven states. Each state denotes a specific mode of functioning.
Figure 2.23 depicts a flowchart of the states.

Figure 2.23: System state flow diagram[5].

• Init: The automated operation is awaiting human input before it can begin. All
movement is disabled.

• Drill Vertically: From where the drill bit touch the rock, a 4 inch vertical well
path is drilled.

• Target Intersection: Using the NMPC from the high-level control system to steer
the azimuth to follow the well path generated. When the z position of the final target
is passed, a state transaction happens.

• Drill Towards Exit: When the final target point is reached and the TVD is not
near to the rock’s edge, the drilling towards exit mode is initiated.

• Rock Exit Detection: The rock exit detector is engaged when the bit approaches
the edge of the rock.

• Completed: The drilling operation has been finished successfully. Disable all
motions while you await operator input.

• Unexpected Termination: The procedure was cut short due to a major occur-
rence. Please wait for operator input.

33
2.8 Downhole Sensor

For a safe and productive drilling operation, it is of the utmost essential that the assess-
ment of the Bottom Hole Assembly (BHA) location downhole is precise. Miscalculations
in this regard may have disastrous results, such as missing the target, the wellbore en-
tering a faulted zone, or colliding with a neighbouring well. Because of this, efforts have
been undertaken to enhance downhole positioning technologies.

Once the BHA has been within the well for a few hundred meters in the oil and gas
business, it is hard to assess its location without specialist instruments for position and
orientation measurement. Even when using the most advanced technology currently avail-
able, the computed estimates will be subject to error and uncertainty. This is due to a
number of factors associated with the tools and their working environment[14]. These
instruments often have several sensors that are utilized to determine the location and
direction of the BHA. The accelerometer and magnetometer are two of the most often
utilized sensors in the business.

Importantly, even though the team is attempting to use ideas from the actual oil and gas
business, the available tools are inadequate for a precise location assessment of the BHA
downhole in this project’s case study. The issue arises from the need of estimating the
location of the sensor by integrating the acceleration of the system twice in time. This
method is known as dead reckoning. This approach is effective for immediate location
estimates, but for continuous estimates, the time-related inaccuracy begins to grow expo-
nentially. Consequently, the estimated location will begin to deviate, even if the sensor
remains still.

As a result, the technique recommended by the previous team is to estimate the orientation
of the BHA and use this in conjunction with the surface displacement of the hoisting
system to estimate the downhole position. If the direction of the BHA is known, then
its course may be projected by converting the vertical displacement of the drillpipe into
the deviated route downhole, using the bent sub geometry and orientation. The team
determined that the Arduino Nano 33 BLE is the best available sensor card that can fit
inside the restricted area of the BHA.

2.8.1 Position estimation

The center of the top of the rock sample is designated as the system’s zero point. The
reference frame for the inertial coordinate frame is North-East-Down (NED). It is difficult
to measure absolute location inside the rock with a high degree of precision. The projected
position is based on the premise that the BHA will move in the direction of its present
orientation at the rate of the hoisting motion.

34
Figure 2.24: Inertial coordinate frame as seen from the workstation of the drilling operator.
The zero point is shown in red. All units are in cm.

2.8.2 Orientation estimation

While drilling, it is difficult to precisely measure the location of the BHA. To maintain
a decent approximation of orientation throughout the drilling operation, process noise
and an imprecise position model need closed-loop observations. Deviations in the estim-
ated orientation and BHA orientation will result in a position estimation inaccuracy that
accumulates over time.

The pitch and roll is estimated based from the accelerometer measurements.
ay [k]
ϕ̂[k] = arctan( ) (2.18)
az [k]

ax [k]
θ̂[k] = − arctan( ) (2.19)
az [k]

Yaw may be estimated using magnetometer measurements. The magnetometer measuring


vector will point towards magnetic north if the magnetic field is inclined. The magnetic
north direction is calculated using the x and y components of the magnetometer reading.

35
my [k]
ψ̂north [k] = arctan(− ) (2.20)
mx [k]

It is impractical to align the rig with the magnetic north direction. As a bias, an offset is
imposed between magnetic north and the inertial x-axis[5].

ψ̂[k] = ψ̂north [k] − ψ̂of f set (2.21)

2.8.3 Model

Since sensor data is gathered at discrete time intervals, a discrete time model is required.
To estimate the position in the inertial frame, the model is based on continuous time
model from Section 2.6.1.

ϕ̂BHA [k + 1] = ϕ̂BHA [k] = 0 (2.22a)

˙ + θ̂BHA [k]
θ̂BHA [k + 1] = ∆t · DLS · d[k] (2.22b)

ψ̂BHA [k + 1] = ∆t · ψ˙I [k] + ψ̂BHA [k] (2.22c)

To make following computations easier, write Equation 2.22 as a vector.

 
ϕ̂BHA [k + 1]
Θ̂BHA [k + 1] =  θ̂BHA [k + 1]  (2.23)
 
ψ̂BHA [k + 1]

The rate of change in the BHA frame must be converted to the changes that occur in the
inertial frame. The rate of change of the rotation matrix is expected to be zero.

 
cos(θ̂[k]) sin(ϕ̂[k]) · sin(θ̂[k]) cos(ϕ̂[k]) · sin(θ̂[k])
1 
Θ̂I [k+1] = 0 cos(ϕ̂[k]) · cos(θ̂[k]) − sin(ϕ̂[k]) · cos(θ̂[k]) Θ̂BHA [k+1]+Θ̂I [k]


cos(θ̂)
0 sin(ϕ̂[k]) cos(ϕ̂[k])
(2.24)

Estimated orientation is in the inertial frame. The current orientation estimate is obtained
by integrating the change in orientation.

36
 
0
I  
pI [k + 1] = ∆t · R̂b · 0 + pI [k] (2.25)

This model is used between the surveys, since it is too much noise for the accelerometer
to estimate an accurate pitch and roll.

37
Chapter 3

Implementations in the high level


control system

In this chapter, the calibration section is done in collaboration with one of the petroleum
engineers. The Dubins Curve code was generated by one of the petroleum students and
implemented by me. The Y-axis error, Nonlinear Attitude Observer Using Reference
Vectors, and Human Factors I work alone.

3.1 Calibration

Calibration section is done in collaborate with the one of the petroleum engineers. To
use the sensor readings to estimate the attitude of the downhole tools, it is important
to calibrate the sensors beforehand. Uncalibrated data can contain noise, be affected by
bias and disturbances due to the working environment. Since the gyroscope is an inertial
tool, while static it will measure no angular velocity. For this reason, it only becomes
useful while rotating the downhole tool to determine its orientation. Since the report from
last year team describes that the readings of the gyroscope are highly affected by noise
due to downhole vibrations while drilling, these readings are not considered for attitude
estimation.

3.1.1 Accelerometer calibration

At rest, the accelerometer will only measure the vector of the earth’s gravitational pull.
This value is believed to be constant, despite the possibility of large-scale variations based
on the place where measurements are made. The average gravitational acceleration is es-
timated to be 9.80665 sm2 . Commonly, in an effort to simplify gravity-related measurements,
acceleration is expressed as ”Gs,” where 1G = 9.80665 sm2 [12].

Following this premise, regardless of the sensor’s location or orientation, the readings of

38
the accelerometer under static circumstances will be the breakdown of the gravity vector
into the sensor’s three axis of inertia, xbacc , ybacc , zbacc . As a result, the standard deviation
of the values on these axes should equal 1 G, as illustrated in Equation 3.1. If this is not
true for the measurements, the conclusion is that the sensor is not properly calibrated[12].

p
xb2acc + yb2acc + zb2acc = 1G (3.1)

If this requirement is not met, the sensor’s calibration must be conducted. Knowing that
the sensor measurement range for every axis Gi, where I = (x, y, z) is between -1 and
1 Gs. The data on the three axes would then be shown in three dimensions as a sphere
with radius r = 1 and center on 0, 0, 0. Miscalibration of this sensor will cause the origin
of the sphere to shift and may also cause the figure to take on a non-spherical form due
to the cloud of points. The calibration matrix A and bias correction vector B are used
to calibrate the uncalibrated data h. Equation 3.2 describes the equation used to acquire
calibrated data hcal [12]:

hcal = A−1 (h − b) (3.2)

Magneto®, a free program, was used to compute the correction matrix A and vector B.
This program enables the user to enter uncalibrated data points and calculates correction
factors.

Then, a summary of the methodology applied:

1. Data collection: Special care was required for accelerometer calibration since the
accelerometer had to remain totally motionless when obtaining the uncalibrated
points, provided that the norm of the observed acceleration vector [x, y, z] ≈ 1.
Any movement or vibration in the sensor during measurements will introduce bogus
values into the calibration, biasing the findings. As a result, a simple set was
constructed to take numerous measurements in all of the sensor’s primary locations
and orientations, as shown in Figure 3.1:

39
(a) Calibration in horizontal position.
(b) Calibration in inclined position

Figure 3.1: Accelerometer set in different static positions for calibration measurements[3].

2. Correction generation Matrix A and vector B: After obtaining the data set of points,
the program Magneto was used with the points and the normalized magnitude that
the data points should have of 1. The program then computes the matrix A and
vector B, as shown above Figure 3.2:

Figure 3.2: Magneto Software was used to calibrate the accelerometer[3].

3. Once the correction factors were established, they were added to the raw measure-
ments. They are displayed as shown in Figure 3.3 to demonstrate the difference
between calibrated and uncalibrated data.

40
(a) Measurements in XY plane. (b) Measurements in YZ plane.

(c) Measurements in XZ plane. (d) Measurements in 3D plot.

Figure 3.3: Calibrated vs. uncalibrated accelerometer data in various perspectives[3].

To summarize, the original sensor readings prior to calibration may provide ac-
ceptable results, but it is preferable to utilize calibrated data for greater accuracy.
Because the gravity vector in a given region is largely stable in both time and space,
sensor calibration can only be done once.

3.1.2 Magnometer calibration

Magnetometer data, unlike accelerometer readings, are very vulnerable to magnetic per-
turbations in the sensor’s surroundings. These magnetic perturbations are generally in-
duced by ”hard iron” and ”soft iron” effects. When performing many measurements in
different directions and rotations with a properly calibrated sensor, a cloud of dots with
a spherical shape will arise, with the center in coordinates of origin 0, 0, 0. If ”soft iron”
disturbances are present, the resultant form of the cloud of points will be an ellipsoid
rather than a sphere. Furthermore, if ”hard iron” disrupts the sensor’s readings, the cen-
ter of the measurements will be pushed away from the origin. In these cases, the sensor
must be calibrated to eliminate these effects[12]. These impacts can be seen in Figure 3.4:

41
(a) The influence of soft iron on magnetometer
(b) The impact of hard iron on magnetometer
readings
readings

Figure 3.4: The impact of soft and hard iron on magnetometer readings[3].

The calibration process is fairly similar to that of the accelerometer. The initial step is
to spin the sensor in various directions and orientations to generate a cloud of raw data
points. The raw data is then examined using the Magneto program. Data from a magnetic
observatory station in Trondheim was utilized to determine the magnetic field strength
magnitude required for the program. Once Magneto has enough data, the algorithm is
executed, and the correction matrix A and vector B are computed as Figure 3.5.

Figure 3.5: Magneto is used to generate the calibration matrix A and vector B[3].

The correction factors are then added to the raw data to get the calibrated results. To
ensure that the calibration was done successfully, rerun the Magneto program with the
calibrated data. The subsequent rectification Matrix A should be a 1 diagonal matrix,

42
and vector B’s elements should be zero, as seen in Figure 3.6.

Figure 3.6: Magneto findings for magnetometer data that has been calibrated[3].

The large disparity between the two clouds of points may be noticed by showing the data
before and after calibration, as shown in Figure 3.7.

(a) Measurements in XY plane. (b) Measurements in YZ plane.

(c) Measurements in XZ plane. (d) Measurements in 3D plot.

Figure 3.7: Magnetometer data in several perspectives, calibrated and uncalibrated[3].

Given the significant unpredictability of magnetic perturbances, this calibration must be


performed on a frequent basis.

43
Additional magnetic tests

Additional testing was carried out in order to have a better knowledge of the magneto-
meter. The goal of the experiment was to properly mimic the circumstances in which the
sensor would operate while drilling. The sensor was placed within the sensor housing in
the BHA to do this. The BHA was then placed into a pre-drilled vertical hole in one of
the cement blocks previously used for drilling testing.

This cement block was placed underneath the drilling equipment and wrapped around
the metal frame. Once the setup was complete, the sensor was allowed to read under
static circumstances for the duration of the night. A second sensor, five meters distant
from the drilling rig and free of any housing or metallic pieces, was used as a control to
compare the effects of the metallic surroundings on the magnetometer. The sensor setup
with and without the housing is depicted in Figure 3.8. This sensor was also allowed to
read overnight. The magnetic observatory outside Trondheim provided the values for the
real magnetic field magnitude.

(a) Sensor located inside the housing. (b) Sensor in the absence of housing.

Figure 3.8: Sensor including housing and without[3].

The data for the sensor with no metal around, the sensor within the BHA, and the actual
magnetic field magnitude behavior were compared. The sensor readings were clearly
impacted by the surroundings and magnetic disturbances caused by the housing, the rig,
and the metal frame that surrounded it. Calibration may be useful in these situations,
but since it is very difficult to freely move and rotate the sensor within the BHA after
it is inside the well, the calibration is done inside the metal frame, ignoring the cement
block’s contribution to the disturbances.

3.1.3 Yaw estimation with magnetometer

The mechanism for estimating yaw was introduced when the sensors were correctly cal-
ibrated. Yaw is estimated using the approach described in Section 2.8.2. This was done
in Simulink, where the accelerometer values were used to estimate roll and pitch angles,

44
which were then combined with magnetometer readings to estimate yaw. Even after calib-
ration and with the sensor standing still under consistent surrounding circumstances, the
data from the magnetometer changed regularly, despite the fact that the accelerometer
measurements were steady and trustworthy.

Last year, the team used a similar strategy and claimed comparable findings[5]. Experts in
the area gave further help at the institution, claiming that the magnetometer’s operating
environment was excessively loud in terms of magnetic disturbances. For the reasons
stated above, no more work on using magnetometer for estimate yaw, and alternative
solutions will be considered.

3.2 Dubins Curve

The Dubins curve is a technique for estimating the optimal path. Dubins created the
shortest two dimensional path by combining three maximum curvature circular arcs or
two maximum curvature circular arcs with a single straight line. These curves are classi-
fied as belonging to the curve-curve-curve CCC or curve-straight-curve CSC families. The
circular arc is represented by C, whereas the straight line is represented by S. Further-
more, the turning movements of the curves in each family distinguish them. The letter R
denotes a right turn, whereas the letter L denotes a left turn. Figure 3.9 displays the LRL
and RLR curves from the CCC family, as well as the RSR, LSL, RSL, and LSR curves
from the CSC family. One of these six designs will provide the overall minimal path with
curvature limitations between two directional points[21].

Figure 3.9: CCC and CSC families [21]

Dubins curve has long been utilized in the autopilot sector to design automobile and robot
trajectories. The drilling industry, on the other hand, has neglected the opportunities

45
and advantages of employing these curves to construct the ideal well trajectory. A PhD
student at NTNU has submitted a study on the use of the 3D CSC Dubins curve in the
drilling business. Dubins curve features are advantageous for drilling because they not
only give the shortest well route, but they also lower the inclination of the straight section
by limiting the length of the curved sections. The CCC family is not considered since
it requires several turning angles in the trajectory, which is unsuitable for drilling. The
framework developed by the PhD student for optimizing the well route using the Dubins
curve will serve as the foundation for the Dubins curve applied in the high level control
system[21].

The Dubins curve was designed by the Petroleum Engineers using the computer pro-
gram MATLAB. For testing if the Dubins curve is better than our current Bezier curve,
simulations in the Digital Twin was performed.

Bezier Dubins Reference


Pos X 5.022 5.332 8.3
Pos Y 1.033 1.03 2.1
Pos Z 52.3 52.3 52.7

Table 3.1: First simulation, target points in X and Y axis

First simulation with target points in X and Y axis, as show in Table 3.1, there are
almost identical in Y position and Dubins have 6% better accuracy then Bezier curve in
X position.

Bezier Dubins Reference


Pos X 5.025 5.525 8.3
Pos Y -0.166 -0.151 0
Pos Z 53 53 52.7

Table 3.2: Second simulation, target points in X axis

Second simulation using X-axis goal points, as depicts in Table 3.2, similar in Y position
and Dubins curve is 10% more accurate than Bezier in X position.

Bezier Dubins Reference


Pos X 2.265 2.212 0
Pos Y 4.031 4.211 8.3
Pos Z 53.9 53.9 52.7

Table 3.3: Third simulation, target points in Y axis

Third simulation shown in Table 3.3 is close to identical in X position and 4% better in
Dubins Curve compared to Bezier.

46
Bezier Dubins Reference
Pos X 2.127 1.448 0
Pos Y 5.524 5.795 5.9
Pos Z 60.5 60.5 60.2

Table 3.4: Fourth simulation, competition targets from last year

Fourth simulation shown in Table 3.4, Dubins is much superior than Bezier in the X
position and a little more accurate in Y position.

From the simulations, there is clear evidence that the Dubins curve is better than our
existing Bezier curve. Therefore the team has decided to implement it into our system.

3.3 Human factors

Humans will always be engaged in automated big engineering projects in some manner.
However, the level of engagement will vary widely depending on the system’s necessity
and scope. If a system is entirely reliant on people to perform well, the likelihood of
failure over time is quite high. This is understandable given that putting people in charge
of monitoring systems often results in mistakes due to deviant behavior. In situations like
these, people have a tendency to make rash judgments that lead to failure. Furthermore,
a human’s capacity to make judgments may be impacted by other events, which in some
situations can also be the source of the failure[4].

Human interaction issues are becoming more important in today’s business as complicated
technical technology advances. As jobs grow more complicated, those that are suited for
automation should be assigned to it[28]. Since the Drillbotics competetion this year have
focused on Human factors, the team decied to implement more human awareness into the
GUI.

The first implementation shown in Figure 3.10 is about how far away from the target
points the drill bit is. The distance to the target point will give the system operator more
awareness about if the systems are heading in the right direction. And take the necessary
actions to correct it.

Figure 3.10: Distance to Next Target

The second solution, which can be seen in Figure 3.11, sends a notification to the operator
after the predetermined point has been achieved. The purpose of this is to heighten the
operator’s awareness of the location of the drill bit.

47
Figure 3.11: Information about the target point

In Figure 3.12 you can see the implementation in the high level GUI.

Figure 3.12: High level GUI with human factors.

3.4 Y axis error

3.4.1 Description of the problem

When the target points are located along the y-axis, the controller’s last iteration looks
to have a flaw that prevents it from working properly. When the reference route is
taken into consideration, the controller will output the maximum orientation velocity
in the opposite direction of what would make the most sense. The behavior does not
manifest itself in simulations of the digital twin, which lends credence to the hypothesis
that the flaw is due to an inaccurate rotational matrix or an orientation value that has
been flipped. A reversed roll estimate or the azimuth adjustment mechanism for BHA
orientation displacement are also possibilities for what may have caused the error[5].

3.4.2 Methodology for solving the problem

1. Go through every rotation matrix and compare it with the thesis:


The rotation matrix in the high-level control system is in the ”orientationEstimate” block
and the ”PositionEstimatePositionDelta” block. I started by going step-wise through the
”orientationEstimate” block. The first block is ”SensorOrientationCorrection” where the

48
system corrects for the orientation offset since the wire protrudes from the BHA and the
direction of the bend.

The block consists of a rotation matrix around the z-axis, which looks fine. The next
one is the Kalman Filter’s model function that is activated when there are no surveys. A
survey is when the drill bit stops to measure the roll and pitch accurately. This function
is explained in Section 2.8.3, the rotation matrix is the same as the thesis. Going to
the ”PositionEstimatePositionDelta” block, the first is the ”Inertial2BHARotation” block
that performs a transformation from the Eulers angle in the inertial frame to the BHA
frame. Using the Rz ∗ Ry ∗ Rx transformation. All the matrices are correct.

2. Go through every orientation value:


The first orientation value is when calculating roll and pitch based on the accelerometer
measurements. The formulas is correct according to the thesis.

3. Check the azimuth compensation system for BHA orientation displacement:


This is inside the Kalman Filter’s model and was checked with step 1(rotation matrices).

4. Compare the Digital Twin and the high level control system:
Since the Digital Twin does not contain the Y axis error, it made sense to compare
it against the high level control system. By going through blocks step by step, it was
completely the same except the input. The input to the high level control system is the
sensor and the Digital Twin is based on the function described in Section 2.8.2.

5. Check the coordinate frame:


By going through every coordinate frame for the sensor input to the GUI, it was observed
that the GUI did not follow the NED frame as it should. Seen in Figure 3.13a this is
a NED frame and Figure 3.13b is our GUI. The problem was that Y axis was in wrong
direction.

(a) NED frame[9].


(b) High Level GUI.

Figure 3.13: NED frame vs not NED frame

This was solved by going in to the GUI properties and flip the axis.

6. Run simulation in Digital Twin with just coordinates in Y axis and do the
same drilling test with the physical rig:
Using the exact Y-axis coordinates in the Digital Twin and the physical led to a better

49
understanding of the problem and saw that in the Digital Twin, the azimuth is positive
clockwise. And in the physical rig, it is positive anticlockwise. The Y-axis error happens
since the NMPC gives the wrong direction to the azimuth in the physical rig since the
NMPC and the high-level control system is based on the Digital Twin.

The Figure 3.14 shows the y axis error. What is happening is that the target points are
X = 0cm, Y = 5.9cm, and the azimuth is going in the wrong direction resulting in a Y
position around -6 and an X position around two centimeters shown in the graph.

4
X
Y
2

-2

-4

-6

-8
0 500 1000 1500 2000 2500

(a) Position, target points: X = 0cm, Y = 5.9cm.

400
Azimuth
300

200

100

0
X 2075.68
Y -102.313
-100

-200

-300

-400
0 500 1000 1500 2000 2500

(b) Azimuth.

Figure 3.14: Y axis error.

By doing these two actions:

• Change the azimuth in the low level system to positive clockwise

50
• Flip the Y axis to NED frame by going to the GUI properties

The results of these actions are seen in Figure 3.15 where the azimuth goes the right way
for positive Y-axis. The red line is the path where the drill bit went, and the green line
is the optimal path to get through the target points.

Figure 3.15: Y axis error solved

To conclude that the Y-axis error is solved, the exact coordinates are used for a drilling
test in the negative Y-axis. The result was similar to the positive Y. Hence I can conclude
that the y axis error is solved.

3.5 Nonlinear Attitude Observer using Reference Vec-


tors

Nonlinear Attitude Observer is used in Inertial Navigation System (INS). Inertial nav-
igation algorithms rely on acceleration and angular rate sensors to determine the craft’s
location, velocity, and attitude. It consists of two main components:

• Inertial Measurement Unit (IMU): consists of multiple sensors. To maintain


the same relative orientation, the sensors are linked to the permanent base.

• Navigation computer: To maintain an estimate of the craft’s position, velocity,


and attitude, the computer must calculate gravity acceleration (which acceleromet-
ers do not measure) and integrate acceleration and angular rate data[12].

51
In this case the strapdown system is used, where accelerometers are permanently attached
parallel to the vehicle’s body axis. There are some scientifically papers for Nonlinear
Attitude Observer, but will focus on the Mahony et al. (2008). The nonlinear attitude
observer updates the states directly from accelerometer and magnetometer readings. This
is accomplished by developing a nonlinear injection term that compares the directions
of measurement vectors in the presumed approximative inertial frame {n} to reference
vectors in the body-fixed frame {b}[12].

Figure 3.16: The nonlinear quaternion-based attitude observer by Mahony et al.


(2008)[12].

n
b
X ki b b T
ωmes = −vex( (vi (v̂i ) − v̂ib (vib )T )) (3.3)
i=1
2

q̂˙bn = T (qˆbn )(ωimu


b
− b̂bars + Kp ωmes
b
) (3.4)

˙
b̂bars = −Ki ωmes
b
(3.5)
˙
Where vib and v̂ib goes from i = 1 to n and are sets of n true. The b̂bars is the ARS bias
estimate represented in {b}. For I = 1,...,n, the reference vectors are weighted by tunable
gains Ki for larger than zero. The inverse of the cross product operator S(a) is denoted
by the operator vex: SO(3) −→ R3 .

a × b = S(a)b (3.6)

52
vex(S(a)) = a (3.7)

By using the following transformation, the reference vectors are given in {b}

vib = RT (qbn )v0i


n
(3.8)

Assuming that just the direction of the measurement is of interest to the observer, all
n
measurements are assumed to be normalized so that ||v0i || = 1. The corresponding es-
b
timate of vi is calculated as
n
v̂ib = RT (q̂bn )v0i (3.9)
Where q̂bn is an approximation of the unit quaternion vector. If q̂bn = qbn , then the differ-
ence between 3.8 and 3.9 is zero[12].

b
The measurement of the IMU-specific force fimu expressed in {b} is

f b := fimu
b
− b̂bacc = −RT (θnb )g n (3.10)

where the predicted acceleration bias b̂bars is a corrective term that is optional. The
normalized force vectors are selected as

fb
v1b = − (3.11)
g(µ)
 
1
b T n 
v̂1 = R (q̂b ) 0  (3.12)
0
using the World Geodetic System (1984) ellipsoidal gravity formula to get g(mu). The
n
downward-pointing reference vector v01 = [0, 0, 1]T is selected as the normalized gravity
vector.

The measurement from the magnometer mbmag expressed in {b} is

mb := mbmag − b̂bmag − b̂bmag (3.13)

and the estimated magnetomer bias b̂bmag is a corrective term that is optional. The vectors
of the normalized magnetic field are selected as
Πmb mb
v2b = (3.14)
||Πmn mn ||

Πmn mn
v̂2b = RT (q̂bn )) (3.15)
||Πmn mn ||
∀x ∈ R3 represents the orthogonal projection on the plan orthogonal to x when Πm =
||x||I3 − xxT . It is assumed that the intensity and direction of the magnetic field mn

53
denoted in {n} are constant for a particular place and time period. The numerical values
may be determined by averaging the magnometer readings over a specific time period
with the roll and pitch angles kept close to zero.

The Mahony et al. (2008) stability proof presupposes that the reference vector v is
constant. This ensures almost global asymptotic stability[12].

I want to implement it in a Miniature Autonomous Directional Drilling Rig and see how
well it functions for Directional Drilling. The Mahony et al. (2008) is the version that will
be implemented. Since Simulink does not have a block for Nonlinear Attitude Observer,
the block must be generated as a subsystem in Simulink. The subsystem consists of the
inputs from the magnetometer and accelerometer.

The equation for calculating the angular velocity in the body frame consists of the meas-
urements given from the accelerometer and magnetometer. The angular speed from the
IMU is then subtracted to ARS bias estimate and added the gain Kp multiplied with
angular velocity measurement.

The equation described is Equation 3.3, then multiplied with a transformation matrix into
the quaternion. We want to convert it to Euler Angels from quaternion to understand the
orientation better. After making the subsystem in Simulink by following the structure of
the Figure 3.16. The next step is implementing the Nonlinear Attitude Observer block
into the high-level control system. The plan now is to run physical rig tests to compare
it against the Kalman Filter.

The experimental part has to choose some scenarios where the orientation is spread
throughout the ranges of values that we can except it to be. By using low and high
inclination on every axis, we will cover most of the values that the pitch and roll can be.
It will be eight test runs since, for each axis, it will be one high and one low inclination
run. After collecting the data from all the runs, we will compare it against the Kalman
Filter, where the same tests have run through.

Since we cannot implement the magnetometer described in Section 3.1.3, the Nonlinear
Attitude Observer is not able to generate reference vectors. And without reference vectors,
there is no point in implementing it into the physical rig. It is up to further work to find
another method for calculating the reference vectors.

54
Chapter 4

Testing

Testing has been a big part of getting the rig ready for the competition in June 2022. At
the beginning of the test phase, we had a system that did not go where we wanted it to
go. By solving the system’s errors and optimizing the tuning, the result of the system has
significantly improved. When drilling with the physical rig, I always had the assistance
of one of the petroleum engineers.

4.1 Testing the system and solving errors

In the first test run show in Figure 4.1, the azimuth would not change after the Drill
Vertically state described in Section 2.7 was done. The result was that the drill bit went
in the same direction for the whole run and did not respond against the NMPC action to
for getting the drill bit closer to the target points.

400
Azimuth

300

200

100

X 704.32
Degrees

Y -0.3132
0

-100

-200

-300

-400
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Time

Figure 4.1: No azimuth changes after Drill Vertically state is finished.

After following the NMPC signal, the error was discovered that the NMPC signal was not
sent to the low-level control system because of the firewall in the low-level computer. The
error is described in Section 5.4. Since the azimuth did not get any input, it was logical

55
to be zero the whole time.

In the second test run, the point was to see if it helped to flip the Y-axis since the current
GUI was not suitable according to the NED frame. The result from the test run was that
the azimuth still went opposite direction of the target point on Y-axis.

After simulating the desired system response in the Digital Twin, the changes in azimuth
were observed. The result from the observation was that the azimuth is defined as positive
clockwise, but in the physical rig, it is defined as positive anti-clockwise.

In the third test run, by changing the azimuth to positive clockwise, the result is promising,
as shown in Figure 4.2. The drill bit goes in the right direction on the Y-axis. The target
points are X = 0, Y = 5.9. There is an offset in the X and Y position. And the desired
angle for yaw is not as wanted with 50°. The optimal yaw value is 90°, and the azimuth
will only go in the positive Y direction.

Figure 4.2: The result when changing the azimuth to positive clockwise.

We wanted to test if the negative Y-axis was good too for the fourth test run, with the
same target points only in the negative: X = 0, Y = −5.9. The azimuth behaves as
wanted with an angle of −88°, going almost straight in the negative Y-axis. The drilling
was in the right direction by observing the rock, and the drill bit moved at least 5cm
in the negative Y-axis. As seen in the Figure 4.3, the GUI shows that the drill bit goes
straight down and almost does not change in the Y position. The problem was a big
deviation in the roll and pitch, forcing the position to go forward and backward. This
further described in Section 5.6.

56
Figure 4.3: Target points in negative Y-axis.

After fixing the error with poor estimation of the pitch and roll, we wanted to examine
whether we could obtain a better outcome by drilling the identical target spots in the
negative Y-axis. As shown in Figure 4.4, the result compared to the previous drilling has
significantly improved. The Y position is only 0.1cm from the target point, and an offset
in the X position is logical since the azimuth starts in 0° and has to rotate anti-clockwise
to 90°. The roll and pitch estimation is stable and in the range, −5° to 15° compare to
−50° to 50° on the last drilling session.

Figure 4.4: Target points in negative Y-axis, when pitch and roll estimation is fixed.

The next step is to see if the pitch and roll error fixed will improve the positive Y-axis
compared to the previous drilling in that direction. The result enhances the X position
from 3.7cm to 6.4, and the target point is 5.9. The X position is 0.2cm closer than the
last drilling. In Figure 4.5, is the result for this drilling session.

57
Figure 4.5: Target points in positive Y-axis, when pitch and roll estimation is fixed.

Since the system works well on the positive and negative Y axis, it is time to check how
it responds to the X-axis. First, start with the positive X-axis; it follows the well path
quite well seen in Figure 4.6. The target point is still 5.9cm, and the deviation is not too
bad at 1.4cm. Since the azimuth is 15° it makes sense that Y position is 0.7cm instead of
0cm.

Figure 4.6: Target points in positive X-axis.

The next to test now is the negative X-axis. As seen in the Figure 4.7, it is far away from
the target points. This is because the azimuth starts in 0° and have to rotate to 180°. At
the end of the drilling the azimuth is 117°, and that gives sense for the X and Y position
to the drill bit. For solving this problem we must start the azimuth in 180°.

58
Figure 4.7: Target points in negative X-axis.

I went into the low-level control system in Simulink to find out what file said that the
azimuth should start with 0°. I discovered that azimuth was constantly set to 0° azimuth.
The reason was that the low-level control system’s target points were located on the
positive X-axis of the low-level control system. Changing the target points in the low
level allowed the azimuth to start in 180° for the negative X-axis. As show in Figure 4.8,
the azimuth starts with the correct value. The target point for this drilling session is
X = −12.9cm and Y = 0cm for the last target point. The deviation in X position is big
with 8.1cm this is due to the pitch is negative for every survey measurement.

Figure 4.8: Target points in negative X-axis when azimuth starts in 180°.

For fixing the problem with negative pitch in the surveys, I went into the Simulink block
and show that the inversion of the pitch was commented out. That was supposed to be a
part of the code. By removing the comment from the code, the result for negative X axis
improved significant show in Figure 4.9.

59
Figure 4.9: Target points in negative X-axis, when negative pitch is fixed.

All axes is now tested and the result is within satisfactory levels after fixing errors in the
system. By running a lot of test runs I have developed a check list to go through before
starting the autonomous system. By solving errors I have gained a better understanding
of the system compared with if everything was working.

60
4.2 NMPC tuning

For the NMPC tuning, the most effective was to simulate in the Digital Twin since a
physical drilling session takes around one to hours. The tuning consists of changing
these variables: Prediction model sample time (MPCTs), Build Rate Distribution Tun-
ing Parameter (q), Dogleg Severity (DLS). The simulation result is shown in Table 4.1.
Simulation 1 started with the default settings, and the update time for the NMPC was
slow. I changed to a faster sample rate by setting MPCTs to 10 seconds.

Simulation Pos X MPCTs q DLS


1 7.7 15 5 0.0056
2 7.2 10 5 0.0056
3 5.3 10 3.33 0.0037

Table 4.1: Simulations when target point is X = 5.9 cm.

Simulations 1 to 2 resulted in an improvement in Y-position from 7.7 cm to 7.2 cm. In the


second simulation, the estimated build rate in the NMPC was too high and reduced by
2/3. The new values for the parameters was now: q = 3.33 and DLS = 0.0037. Tuning
these variables resulted in a significant improvement in Y-position from 7.2 cm to 5.3 cm.
The deviation from the target points is only 0.6 cm. For further work, the next year’s
team can do additional tuning to improve the position further.

61
Chapter 5

Challenges and Lessons Learned

Talking about the challenges encountered lets me reflect on what I could have done dif-
ferently. And help the future Drillbotics team if they face the same challenges.

5.1 Merging high and low level control system in to


one control system

At the beginning of the semester, the plan was to combine high and low-level control
systems into one system and implement it on the new computer. One control system
will facilitate troubleshooting, decrease sources of failure and delay, simplify automation
protocols and reduce hardware integration.

The first take was to remove the communication protocol between Simulink computers.
And connect them straight together after eliminating unnecessary blocks and combining
the two systems into one. It was time to try to run it on the physical rig. There were
many errors to solve when trying to run the system in the physical rig. Such as different
sample times, the original model will not run without a reference model, and problem
with GUI running seen in Figure 5.1.

Figure 5.1: Error for high level GUI.

After being stuck on an error for a day, the next step was to reach out to MATLAB
support to ask for guidance to fix the error. Since they could not reproduce the error
on their side, they want me to send over the whole control system, but for running the
control system, they need the hardware equipment in the physical rig. It would not help
to send it over since they will not manage to run the system. The team decided that we

62
had used enough time for this task and decided to continue on it if we had time at the
end of the semester.

5.2 Installing the DAQ for the new computer

When implementing the new computer, all the software and drivers on the existing com-
puters had to be installed by looking up a forum for finding the software version for
our MATLAB version. The website discussion said that the 19.5 version of NI(National
Instrument) DAQ should be compatible with the MATLAB R2021a version. After the
installation was completed and trying to connect the DAQ to MATLAB, the error mes-
sage ”Can’t find your DAQ hardware” arose. Found a troubleshooting guide for DAQ
connecting with MATLAB. Following all the steps in the manual did not help. I decided
to send an email to MATLAB support to get an idea of what to do next. They replied
that the 19.5 version was not correct and advised me to install the 21.1.1 version for
MATLAB R2021a version. After reinstalling the correct version, the DAQ was up and
running without a problem.

5.3 Load cell and Hoisting motor

When the drilling tests began in March, there were issues with the load cell. The load
cell sensor readings began to wander and did not converge to a fixed value as they should.
This occurred most notably under static settings with no WOB applied. After some time,
the measurements dropped to -9.4 kg, as indicated in Figure 5.2. Because the whole
control system and inputs are reliant on the WOB values from the load cell, this was a
top priority to address.

Figure 5.2: When 0 kg WOB is applied during static circumstances, the load cell meas-
urement is incorrect[3].

Together with one of the senior electrical engineers, the team invested time and effort
attempting to resolve this issue. The load cell was detached from the hoisting motor and
tested independently of the other components with a known weight. Following extensive
troubleshooting, it was determined that there was nothing wrong with the load cell itself.
As a result, the issue could only be caused by the hoisting motor. When the hoisting
motor was configured to be at rest under static circumstances, it imposed a force on the
system that was collected and recorded by the load cell. Following consultation with the

63
lab engineers at NTNU, They advised contacting the motor’s manufacturer to resolve the
issue. It was determined, with the assistance of Nordic Automation, that implementing
a hysteria in the motor software might solve the issue. Fortunately, the implementation
resulted in the load cell providing the right values for the WOB once again.

5.4 Implementation of Low Level Computer

Two independent computers operate the high and low level control systems. As a result,
User Datagram Protocol (UDP) is utilized to transfer data between the two systems.
During the deployment of the new low level computer, the low level system was unable to
receive or analyze any data from the high level computer. This had a significant influence
on the rig’s overall drilling performance since the NMPC controller, which drives the BHA
in the right direction, was not working. As a result, significant resources were devoted
in determining the reason of this. After inspecting the computer’s network settings, it
was determined that the Windows Firewall was preventing Matlab from receiving data
from unfamiliar computers. After adding Matlab to the Windows Firewall whitelist, as
seen in Figure 5.3, The communication issue was resolved, and the computers were able
to transmit data amongst themselves.

Figure 5.3: How to make Matlab accept data from other devices[3].

5.5 Simulink Data Acquisition Problem

Simulink has consistently failed to get data from the downhole sensor. Figure 5.4 depicts
the incoming data port when no data is obtained from the sensor.

64
Figure 5.4: Simulink does not received data from the sensor

It was difficult to determine why this occurred at random. Troubleshooting was com-
menced, and numerous possibilities were attempted in order to rectify the mistake. After
turning off all electrical components on the rig and downloading the same program to the
sensor card, Simulink was able to receive data once again. In hindsight, it’s impossible
to tell if the mistake was addressed as a result of this or as a result of coincidences or a
system bug. As an example, Figure 5.4 depicts how the port should appear when Simulink
is receiving data.

Figure 5.5: Simulink is receiving data from the sensor.

65
5.6 Big deviation in roll and pitch

When running the autonomous system, the NMPC will start going forward and back-
wards. And ending up far away from the desired yaw. With the same target points in the
Digital Twin this does not occur, comparing the values against the physical rig. Observed
at big deviation in the roll and pitch show in figure 1, this will influence the NMPC since
the computation is based on the input from the position and orientation states.

(a) Roll noise. (b) Pitch noise.

Figure 5.6: Big deviation in roll and pitch.

The error is that the autonomous system uses the measurements from the accelerometer
to estimate roll and pitch between surveys. It should use the Kalman Filter models
function described in Section 2.8.2 between the surveys. The next step now was to produce
solutions to fix the problem.

• 1. Find out if the model is active during drilling.

• 2. Set the measurement under survey constantly to the next survey.

• 3. Try to tune the Kalman Filter, is not tuned between surveys.

• 4. Set the model constantly if there is noise there.

Started by looking in to solution 1, by following the ”surveyEnable” variable, it was


discovered that the Kalman Filter was always activated since the ”surveyEnable” variable
was constant high seen in Figure 5.7.

66
Figure 5.7: SurveyEnabled constant high.

This lead to an unfiltered measurement from the accelerometer in between the surveys.
By changing the manual switch in the Simulink to the ”surveyEnable” function the roll
and pitch estimation was much better as seen in Figure 5.8.

67
15
Roll

10

-5

-10

-15
0 200 400 600 800 1000 1200 1400 1600 1800 2000

(a) Roll with orientation model between surveys.

50
Pitch

40

30

20

10

-10

-20

-30
0 200 400 600 800 1000 1200 1400 1600 1800 2000

(b) Pitch with orientation model between surveys.

Figure 5.8: SurveyEnabled is activated.

68
Chapter 6

Conclusion and Recommendations


for Further Work

6.1 Conclusion

A fully autonomous drilling rig has successfully been improved. I have accomplished this
by resolving existing control system faults, introducing new functionality, and improving
the existing system.

• I solved the main problem from last year, where the azimuth would steer the drill
bit in the opposite direction when the target points were on Y-axis.

• Implemented Dubins curve that improved the deviation from the target points.
Added additional features in the GUI for more awareness for the operator since
Human Factors has been a new concept introduced in this year’s competition.

• By running a lot of drillings sessions, I have been able to resolve existing control
system errors, gained a much better understanding of the autonomous system, and
optimize the current system by tuning the NMPC.

• Shared challenges and lessons learned would contribute to the following year’s team
by saving time and helping them if they face similar challenges.

• The intention was to implement the Nonlinear Attitude Observer using Reference
Vectors, but it was concluded not to do so due to the magnetometer’s reliance on
producing reference vectors.

• One of the petroleum students and I have explored the possibility of strengthening
accelerometer calibration and using a magnetometer for yaw estimation

• After thorough testing and validation, the rig is completely adjusted to suit the
criteria of the Drillbotics 2022 competition, which will be held in a hybrid format
on June 16th at the NTNU Drillbotics lab in Trondheim, Norway.

69
6.2 Recommendations for Further Work

Recommendations for future work is:

• Control system integration: With integrating the high and low level control
system together. Will make the troubleshooting easier, improve the points of failure
and latency, and reduce automation protocols and hardware integration

• GUI improvements: The present GUI implementation is quite resource intensive.


For example plots in particular, limit the system’s maximum total sampling frequen-
cies. Finding a better GUI implementation can result in significant computational
cost savings.

• Downhole Sensor: The technique of placing the micro controller into the BHA
and sealing it with Plasti Dip and epoxy is problematic. It should be investigate
finding a more reliable solution for implementing the micro controller into the BHA.

• Real-Time System: With the exception of the DAQ, it is anticipated that the
control system can be implemented as a Simulink Desktop Real-Time system.

• Hardware Communication: When utilizing the integrated MATLAB function,


the existing Modbus TCP interfacing has a relatively high computational cost. It
is believed that a manual Modbus TCP implementation utilizing Simulink TCP
communication blocks will reduce computational load.

• Position To eliminate cumulative position error, methods of directly estimating the


position or using other methods for estimating the yaw described in the Petroleum
master.

70
Bibliography

[1] A. S. Jakobsen et al. Design and Optimization of an Autonomous Laboratory-Scale


Drilling Rig and Bit Design for Directional Drilling. Master’s thesis in Petroleum
Engineering, 2020.
[2] G. Hånsnar et al. Design and Implementation of a Minitature Rig for Autonomous
and Directional Drilling. Master’s thesis in Petroleum Geoscience and Engineering,
2021.
[3] H. Helgeland et al. Design and Implementation of a Minitature Rig for Autonomous
and Directional Drilling. Master’s thesis in Petroleum Geoscience and Engineering,
2022.
[4] L. Alvarez et al. Design Report NTNU - Drillbotics™ 2022 Phase I. Department of
Geoscience and Petroleum, 2021.
[5] M. Steinstø et al. Implementation of a Miniature Autonomous Directional Drilling
Rig With Nonlinear Model Predictive Trajectory Control. Master’s thesis in Indus-
trial Cybernetics, 2021.
[6] Arduino. Arduino LSM9DS3 library. url: https://www.arduino.cc/reference/en/
libraries/arduino lsm9ds1/. Accessed: 26.04.2022.
[7] Arduino. Arduino Nano 33 BLE Sense. url: https://store-usa.arduino.cc/products/
arduino-nano-33-ble-sense. Accessed: 18.04.2022.
[8] BRU21. BRU21: Research and Innovation Program in Digital and Automation Solu-
tions for the Oil and Gas Industry. url: https://www.ntnu.edu/bru21. Accessed:
11.03.2022.
[9] DJI. Flight Control. url: https : / / developer . dji . com / mobile - sdk / documentation /
introduction/flightController concepts.html. Accessed: 25.05.2022.
[10] FIERCE Electronics. Compensating for Tilt, Hard-Iron, and Soft-Iron Effects. url:
https://www.fierceelectronics.com/components/compensating-for-tilt-hard-iron-and-
soft-iron-effects. Accessed: 18.04.2022.
[11] New World Encyclopedia. Gyroscope. url: https://www.newworldencyclopedia.org/
entry/Gyroscope. Accessed: 18.04.2022.
[12] T.I. Fossen. Handbook of Marine Craft Hydrodynamics and Motion Control. Wiley-
Blackwell, 2021.

71
[13] Inc GitHub. The tools you need to build what you want. url: https://github.com/
features. Accessed: 28.04.2022.
[14] Halliburton. Compass Software Release 5000.1.7 Training Manual. Halliburton, 2011.
[15] The MathWorks Inc. Access Block Data During Simulation. url: https : / / se .
mathworks . com / help / simulink / ug / accessing - block - data - during - simulation . html.
Accessed: 27.04.2022.
[16] The MathWorks Inc. Bdroot. url: https://se.mathworks.com/help/simulink/slref/
bdroot.html. Accessed: 27.04.2022.
[17] The MathWorks Inc. Code Generation from MATLAB Code. url: https : / / se .
mathworks.com/help/robotics/ug/code-generation-from-matlab-code.html. Accessed:
27.04.2022.
[18] The MathWorks Inc. MATLAB. url: https://se.mathworks.com/products/matlab.
html.. Accessed: 20.04.2022.
[19] The MathWorks Inc. Rate Transition. url: https : / / se . mathworks . com / help /
simulink/slref/ratetransition.html. Accessed: 27.04.2022.
[20] The MathWorks Inc. Simulink. url: https://se.mathworks.com/products/simulink.
html.. Accessed: 26.04.2022.
[21] Haoge Liu. Subsea field layout optimization (Part I) – directional well trajectory
planning based on 3D Dubins Curve. url: https://ntnuopen.ntnu.no/ntnu- xmlui/
bitstream / handle / 11250 / 2827431 / Subsea % 5C % 2bfield % 5C % 2blayout % 5C %
2boptimization % 5C % 2b % 5C % 2528part % 5C % 2bI % 5C % 2529 % 5C % 2b --- %5C %
2bdirectional%5C%2bwell%5C%2btrajectory%5C%2bplanning%5C%2bbased%5C%
2bon % 5C % 2b3D % 5C % 2bDubins % 5C % 2bCurve . pdf ? sequence = 2 & isAllowed = y.
Accessed: 21.05.2022.
[22] S. E. Lyshevski. Mems and Nems: systems, devices and structures. CRC Press LLC,
2002.
[23] MathWorks. Nonlinear MPC. url: https : / / se . mathworks . com / help / mpc / ug /
nonlinear-mpc.html. Accessed: 18.04.2022.
[24] MathWorks. Simulation Pacing. url: https://www.mathworks.com/help/simulink/
ug/simulation-pacing.html. Accessed: 26.04.2022.
[25] MathWorks. Understanding Kalman Filters: Nonlinear state estimators. url: https:
//www.mathworks.com/videos/understanding-kalman-filters-part-5-nonlinear-state-
estimators-1495052905460.html. Accessed: 10.04.2022.
[26] M.B. Nåmdal. Design and Implementation of an Autonomous Miniature Drilling
Rig for Directional Drilling. Thesis. Department of Engineering Cybernetics, 2019.
[27] Society of Petroleum Engineers. About Us. url: https://www.spe.org/en/about/.
Accessed: 25.02.2022.

72
[28] Society of Petroleum Engineers (SPE) and Drilling Systems Automation Technical
Section (DSATS) ed. Drillbotics™Guidelines. url: https : / / drillbotics . com / wp -
content / uploads / simple - file - list / Guidelines / Guidelines - 2022 / 2022 - Drillbotics -
Guidelines-Rev-1-Group-B.pdf. Accessed: 20.03.2022.
[29] HT Sensor. Static torque senso with range TAT200. url: http://www.htc- sensor.
com/products/187.html. Accessed: 05.04.2022.
[30] Electronics Tutorials. Hall Effect Sensor and How Magnet Make It work. url:
https://www.electronics- tutorials.ws/electromagnetism/hall- effect.html. Accessed:
18.04.2022.

73

You might also like