Académique Documents
Professionnel Documents
Culture Documents
UNDERGRADUATION THESIS
I commit:
– iii –
– iv –
Acknowledgements
I would like to thank several people who made this research possible. First, I
would like to express my deepest gratitude to my supervisor Dr. Tri Ngo Dinh
and Dr. Le Thi Minh Nghia for their continued support and guidance. Thanks
to talks and discussions with them, I was on the right way to complete this
dissertation by steps and learnt the value of enthusiasm, diligence and
excellence in research. Their high standard while observing every aspect of my
study motivated me to take extra mile in all of the works that I had done.
As a member of the UNILOS UAV team, I really appreciate all other members
for their companion and friendship. I specially thank Do Cat Tuan, who is my
co-worker in this thesis. Without his best collaboration and support, I would
never have been able to finish this dissertation. I also would like to thank
Nguyen Hai Ha, who unconditionally supported me in perfecting system
programming.
–v–
Abstract
Nowadays, there has been a variety of instruments that are studied and
developed for measuring direction and magnitude of the airflow. One of the
most common-in-use with a simplicity and maintainability in recent years is the
five-hole air-data probe. In order to solve the problem of building a low-cost
homebuilt five-hole probe, the first important step is to determine and design
size and shape of the probe and experiment rig aiming being easy to fabrication
and setup. After designing, the second step is to manufacture probe and such
frame so that the probe can measure pressures and collect data in wind tunnel.
Main objective of this thesis is to reduce data, identify and calibrate surface
fitting models for angle of attack, sideslip angle and velocity based on five holes
measured pressure data. In this thesis, the method for identification and
calibration is least-squares polynomial fitting. After that, it is critically
important to test and validate the mathematical model so that the probe can
measure angles and velocity of the airflow with the acceptable root-mean-
square errors within the operating range.
– vi –
Tóm tắt luận văn
Luận văn tập trung nghiên cứu đối tượng chính là ống đo dữ liệu không khí năm
lỗ (five-hole air data probe), được chế tạo và đo thử nghiệm thành công trong
hầm gió của Bộ môn Kỹ thuật Hàng không, Đại học Bách Khoa TPHCM.
Hiện nay, có nhiều thiết bị đo được nghiên cứu và phát triển nhằm để xác định
phương hướng và độ lớn của dòng chuyển động. Một trong những thiết bị đo
được nghiên cứu và phát triển phổ biến trong những năm gần đây là ống đo dữ
liệu không khí năm lỗ. Để giải quyết bài toán ống đo năm lỗ chi phí thấp và có
thể chế tạo trong điều kiện phòng thí nghiệm, cần phải xác định thiết kế ống đo
và bộ khung thí nghiệm với mục tiêu thiết kế là dễ chế tạo và giá thành thấp.
Sau đó, tới bước chế tạo ống đo và bộ khung thí nghiệm để đảm bảo ống đo thu
thập dữ liệu trong hầm gió hiệu quả và chính xác. Mục tiêu chính của luận văn
là hiệu chuẩn xây dựng mô hình toán cho góc tấn, góc trượt cạnh và vận tốc dựa
trên dữ liệu đo áp suất năm lỗ. Trong luận văn, mô hình toán được xác định,
nhận dạng bằng phương pháp bình phương cực tiểu hàm đa thức. Sau khi xây
dựng mô hình toán, cần phải đo kiểm tra và đánh giá mô hình toán để đảm bảo
ống đo nhận dạng được góc và vận tốc theo thời gian thực với sai số nằm trong
mức cho phép.
Từ khóa: Ống đo dữ liệu không khí năm lỗ, góc tấn, góc trượt cạnh, vận tốc,
mô hình toán bằng phương pháp bình phương cực tiểu, hàm đa thức.
– vii –
Table of Contents
.......................................................................................................... 1
Introduction.................................................................................................................. 1
1.1 Literature Review .................................................................................... 1
1.2 Objectives and Roadmap ......................................................................... 6
.......................................................................................................... 8
Design and Manufacture 5-hole Probe and Orientation System ................................. 8
2.1 Design and Manufacture 5-hole probe .................................................... 8
2.1.1 Design of probe geometry .............................................................................................. 8
2.1.2 Manufacture process of the probe................................................................................. 12
2.2 Probe Orientation Mechanism and Experimental Apparatus ................ 18
........................................................................................................ 21
Instrumentation and Data Acquisition System .......................................................... 21
3.1 Hardware Specifications ........................................................................ 21
3.1.1 Arduino Mega 2560 Microcontroller............................................................................ 22
3.1.2 Freescale Semiconductor MPXV7002DP Differential Pressure Sensors ..................... 23
3.1.3 System Schematic ......................................................................................................... 27
3.2 Programming with Arduino Mega 2560 Microcontroller ..................... 29
3.2.1 Data real-time and logging program ............................................................................. 29
3.2.2 Analog Noise and Filter Noise ..................................................................................... 30
........................................................................................................ 36
Least Square Polynomial Fit Identification and Calibration ..................................... 36
4.1 Identification and Calibration Method................................................... 36
4.1.1 Calibration Coefficients ................................................................................................ 36
4.1.2 Data Collection and Scaling Technique ....................................................................... 38
4.2 Data Reduction using Least Square Polynomial Fit .............................. 44
........................................................................................................ 55
Validation, Analysis and Discussion ......................................................................... 55
– viii –
5.1 Discrete Validation .................................................................................55
5.2 Continuous Validation ............................................................................62
5.3 Results and Discussion ...........................................................................66
........................................................................................................ 68
Conclusions and Future Work .................................................................................... 68
6.1 Achievements .........................................................................................68
6.2 Limitations and next steps ......................................................................69
References .................................................................................................................. 70
Appendix .................................................................................................................... 73
A. MATLAB Programs ...............................................................................73
B. Manufacturing Logbook .......................................................................100
C. Experiments Logbook ..........................................................................101
D. Project Timeline ...................................................................................105
– ix –
Nomenclature
Symbols
AOA Angle of attack Degree
AOS Sideslip angle Degree
𝐶𝑝𝑎𝑣𝑒 Average pressure coefficient -
𝐶𝑝𝛼 Angle of attack pressure coefficient -
𝐶𝑝𝛽 Sideslip angle pressure coefficient -
𝐶𝑝5 Fifth hole pressure coefficient -
𝑑 Hole diameter mm
𝐷 Probe diameter mm
𝐼 Turbulence intensity
𝑃 Static pressure Pa
𝑃0 Total pressure Pa
𝑃1 Pressure of hole 1 Pa
𝑃2 Pressure of hole 2 Pa
𝑃3 Pressure of hole 3 Pa
𝑃4 Pressure of hole 4 Pa
𝑃5 Pressure of hole 5 Pa
𝑅𝑀𝑆𝐸 Root-mean squared errors -
𝑅2 Coefficient of Determination -
𝑅𝑒 Reynolds number -
𝑉 Test section velocity or 𝑌 -directional mean velocity m/s
component
𝑢 Velocity components with respect to the x axes m/s
𝑣, Velocity components with respect to the y axes m/s
𝑤 Velocity components with respect to the z axes m/s
Greek Symbols
𝛼 Angle of attack Degree
𝛽 Sideslip angle Degree
𝜇 Viscosity N ⋅ s/m2
𝜈 Kinematic viscosity m2 /s
𝜌 Density of air kg/m3
–x–
List of Figures
Figure 1-2 A 5-hole air data probe and a micro air data system [18] ...........................6
Figure 2-2 A CATIA sketch of 5-hole probe at 3 views (3D, side and front views) .11
Figure 2-5 (a) Initial manufacture process. (b) Complete process .............................16
– xi –
Figure 4-2 Scale-to-P2 function of raw data for P1, P3, P4 ...................................... 39
Figure 4-8 Flowchart of five-hole conical probe data reduction scheme .................. 44
Figure 5-3 Sideslip angle at 12 m/s with 0 angle of attack overtime ........................ 59
Figure 5-4 Sideslip angle at 20 m/s with 0 angle of attack overtime ........................ 59
Figure 5-8 Actual potentiometer frame set up into 3-component balance ................ 63
– xii –
List of Tables
Table 2-3 Relevant equipment and tools used for rig construction ................. 20
– xiii –
INTRODUCTION
Introduction
B.F. Hall and T. Povey [6] employed Oxford probe, which is an open access five-
hole probe designed for experimental aerodynamic measurements. The open
access probe can be manufactured by the end user via additive manufacturing
(metal or plastic). The probe geometry, drawings, calibration maps, and software
are available under a creative commons license. The purpose is to widen access to
aerodynamic measurement techniques in education and research environments.
There are many situations in which the open access probe will allow results of
comparable accuracy to a well-calibrated commercial probe. They discuss the
applications and limitations of the probe, and compare the calibration maps for 16
probes manufactured in different materials and at different scales, but with the
same geometrical design.
S.J. Lien, et al [11] studied the problems of misalignment to flow direction and
the need to drill a tapping hole on a measurement surface to obtain total and static
pressures make the use of Preston probe in skin friction measurement in a turbulent
flow a cumbersome task. The suitability of a multi-hole pressure probe in a non-
nulling mode to overcome these problems was, therefore, investigated. The near-
wall effect on multi-hole pressure probe readings was examined both
experimentally and theoretically. The results indicate that the presence of the wall
had negligible overall effect. Experiments were carried out in a pipe, on a flat plate
and on a swept forward facing step to simulate one, two, and three-dimensional
turbulent flows. The skin friction coefficient determined using the multi-hole
pressure probe was found to have good agreement with published data.
inflow angles, static and total pressures simultaneously for a point in a flow field.
Authors defined non-dimensional pressure coefficients in various ways. Here in
this work, a new set of pressure coefficients were, which overcome the limitations
and gave less computational errors in calculating the flow parameters. In this
technique, the effect of pressure recorded by central hole is considered in
describing these coefficients. 4th order regression analysis, the average goodness
of fit was obtained for all zones as 0.9979 and 0.9910 for α and β respectively, and
which are even better than that in the all existing methods.
J.C. Gonsalez and E.A. Arrington [15] fabricated set of new five-hole flow angle
pressure probes in order to properly calibrate the test section for total pressure,
static pressure, and flow angle. The probes have nine pressure ports: five total
pressure ports on a hemispherical head and four static pressure ports located 14.7
diameters downstream of the head. The probes were calibrated in the NASA Glenn
3.5-in-diameter free-jet calibration facility. After completing calibration data
acquisition for two probes, two data prediction models were evaluated. Prediction
errors from a linear discrete model proved to be no worse than those from a full
third-order multiple regression model. The linear discrete model only required
calibration data acquisition according to an abridged test matrix, thus saving
considerable time and financial resources over the multiple regression model that
required calibration data acquisition according to a more extensive test matrix.
Uncertainties in calibration coefficients and predicted values of flow angle, total
pressure, static pressure, Mach number, and velocity were examined. These
uncertainties consider the instrumentation that will be available in the Icing
Research Tunnel for future test section.
are products from AEROPROBE Corporation [17]. However, such probes’ price
is really high (up to around 2500 USD for just a standard system including a multi-
hole probe and an air data system) corresponding to their accuracy, operating
range, response time and maintainability. However, the calibration services or data
system are usually support packages (see in [18]), which means that the total
expense for a fully completed probe system is extremely high which is completely
unsuitable for a low-cost UAV platform. This study demonstrates the in-house
inexpensive fabrication, and individual calibration and validation of a 5-hole
probe in wind tunnel with acceptable accuracy, in which the calibration based on
an inexpensive method presented later on Chapter 4 and 5.
Figure 1-2 A 5-hole air data probe and a micro air data system [18]
There has been a variety of different probe designs, especially probe’s tip
configuration that could be used to measure three-dimensional airflow. The
configurations vary from shape of the probe tip to the number of pressure holes as
well as hole geometries at tip. In [4], a numerous tip shapes have been employed
with acceptable results. Most popular ones are the cone, the pyramid and the
hemisphere. Each of these shapes have advantages and disadvantages with regard
also two common types: the forward facing holes and tip surface perpendicular.
The terms forward facing and perpendicular, as mentioned in [19], refer to whether
the axes of holes were parallel to the axis of the probe, thus facing forward into
the flow, or perpendicular to the surface of the cone. (Figure 2-1). Compare to the
forward facing probes, cone surface perpendicular ones have smaller surface area
of hole, and such probe could have similar four surrounding hole geometries
regardless of asymmetry of cone machining faults. However, that hole
configuration could lead to the expense of more complicated manufacturing that
is not suitable for a low-cost homebuilt we aim to. This is why forward facing
probe has been chosen.
outer tip diameter is 0.125, which is relatively small and comparable to the one in
[21] and fairly close to newer designs, such as those in [6] and [5], [20]. A CAD
sketch of the five-hole probe we designed is given in Figure 2-2 and Figure 2-2.
Figure 2-2 A CATIA sketch of 5-hole probe at 3 views (3D, side and front views)
couple of P1 and P3 is also called pitch measuring hole as they play an essential
role of identify pitch angle. It is similar for the couple of P2 and P4 in measuring
yaw angle. The term of pitch and yaw here is replacements for angle of attack
(AOA) and sideslip (AOS), because when probe is calibrated in wind tunnel pitch
angle is the same as AOA and so is that of yaw angle and AOS. Common
substance options, as mentioned in study of [20] [6] and commercial products of
[17], are stainless steel, therefore, such material is employed along with an encased
aluminum tube and a mechanical resin, DEVCON S5, in our probe construction
(demonstrated in Figure 2-4).
at a 45-degree incline with regard to axis of drill shaft. We decided to process tip
in two steps, in first step, tip probe would be abraded coarsely to form a regularly
conical and desired 90-degree cone angle. After that, fine grinding tip will be
conducted to ensure creating a smooth tip’s surface for decreasing aerodynamic
boundary separation phenomenon. However, after 3 trial versions, we recognized
clogging phenomenon due to abrasive dust was a huge problem rising
instantaneously whenever a continuous abrading process was conducted, where
the temperature rises at a very high value more than threshold value of glue and
high enough to create a mixture of chip and glue leading to clogging. So, an
improvement was applied when a discrete-time sharpening was compulsory and
cleaning dust was added whenever probe got cooling. The machining process was
finally completed in Figure 2-5 (b) and there was a lot notes and faults experience
during home-built manufacturing illustrated in the Manufacture Logbook
Appendix.
Some equipment and tools relevant to construction and setting up are listed in
Table 2-3
Table 2-3 Relevant equipment and tools used for rig construction
No. Names Functions Notes
Laser cutting Sketch shape of
1
machine pads on HDF pad.
Forstner
Drill AOS pivot
2 drilling bit 20
hole
mm
360 degree
6 For lower pad
ruler
Bench drilling
7
machine
Sharpening
8
machine
9 Wood cutter Cutting HDF
Abrasive
9 grinding paper Grinding pivots
P150 & P600
In our experiments setup, the Arduino Mega 2560 is powered via the USB
connection and it supplies 5V DC for all pressure sensors. Arduino receives analog
signals from pressure sensors and convert analog signal into digital signal (the
signal Analog is read by pins A0-A5). After that, Arduino Mega sends signal to
computer. We have to process digital signal to a pressure value.
Microcontroller ATmega2560
Operating Voltage 5V
SPRAM 8KB
EEPROM 4KB
at Analog, GND and +5V pins. The breakout board connected to pressure sensor
is shown in Figure 3-2.
The sensor output signal is relative to pressure input. The characteristic of sensor
is a linear line in which the output voltage is a first-order function with different
pressure. If the differential pressure increases, the output voltage of sensor will
increase.
𝑉𝑜𝑢𝑡 ± 6.25%𝑉𝐹𝑆𝑆
𝑃 (𝑘𝑃𝑎) = ( − 0.5) : 0.2
𝑉𝑠
In the data acquisition system, we have a five-hole probe for measuring pressure
at five ports and we have a pitot probe to measure velocity in order to compare
five-hole probe. Consequently, we have six pressure sensors MPXV7002DP and
an Arduino Mega. Six sensors will connect to Arduino Mega and computer will
receive signals which is transferred by Arduino Mega. (see Figure 3-6)
In this part, the schematic of Arduino Mega and six pressure sensors is presented
in Figure 3-7. The sensors are connected to Arduino Mega:
After designing schematic for Arduino Mega microcontroller and pressure sensor
arrays, the next important step is to program Arduino in order to measure pressure
data for six sensors and log data to files. This code operates for each measurement
at each combination angle location in matrix of calibration.
Secondly, the Arduino is coded in order to calculate the real pressures, which are
equal to the measured pressures minus the value offset. In this step, the Arduino
is run in loop so as that it can calculate pressures as much as possible.
Thirdly, the real pressures, which are identified before, are used to plot the
pressure graphs in real-time. In this step, there are six graphs for six sensors.
Fourth, after finishing the loop, we plot again the recorded pressure data for six
sensors.
The pressure data is very noisy that a filter is necessary to filter noise for the
measured data. And the noise filter is presented later in the next part.
Finally, the pressure data for six sensors is exported to excel file. The overall flow
of the program is presented in below block diagram (see Figure 3-8).
The pressure sensor MPXV7002DP is noisy. Its typical error is 2.5% and its
maximum error is 6.5%. Although the error is small, the result of pressure data is
affected very much. For instance, the analog signal noise is equal to 1 or 2 so that
the pressure changes about ±10𝑃𝑎 . Nevertheless, this change affects the
calibration very much. Consequently, the clutter filter is very important in out
experiment.
In our experiment, there are three clutter filters to be used in different conditions.
There are Kalman Filter, Moving Average and Low-pass Filter.
unknown variables that tend to be more accurate than those based on a single
measurement alone, by estimating a joint probability distribution over the
variables for each timeframe. [23]
For our experiments, the Kalman filter works in a three-step loop (Figure 3-9).
First, we create the initial conditions. Next is the prediction step, the Kalman filter
creates estimates of the current state variables, along with their uncertainties. The
following step is update, which is depends on measurement and prediction.
o Initial conditions
𝑥 (0), 𝑃(0) (3.1)
o Predict next state
𝑥(𝑡) = 𝐹 ∗ 𝑥(𝑡 − 1) + 𝐵 ∗ 𝑢 (3.2)
Predict next covariance
𝑥 (𝑡 ) = 𝑥 (𝑡 ) +∗ (𝑚𝑒𝑎𝑠𝑢𝑟𝑒𝑚𝑒𝑛𝑡 (𝑡 ) − 𝐻 ∗ 𝑥 (𝑡 )) (3.5)
o Update covariance estimation
𝑃(𝑡 ) = (1 − 𝐾 ∗ 𝐻 ) ∗ 𝑃(𝑡) (3.6)
𝑥 (𝑡 ) = 𝐹 ∗ 𝑥 (𝑡 − 1) + 𝐵 ∗ 𝑢 + 𝑃𝑟𝑜𝑐𝑒𝑠𝑠𝑁𝑜𝑖𝑠𝑒 (3.7)
𝑧(𝑡 ) = 𝐻 ∗ 𝑥 (𝑡 ) + 𝑂𝑏𝑒𝑟𝑣𝑎𝑡𝑖𝑜𝑛𝑁𝑜𝑖𝑠𝑒 (3.8)
- Our state vector is just the output reading of our sensor
𝑥 (𝑡 ) = [𝑠𝑒𝑛𝑠𝑜𝑟 𝑜𝑢𝑡𝑝𝑢𝑡 𝑣𝑜𝑙𝑡𝑎𝑔𝑒] (3.9)
- Assume does not vary very quickly. The value right now is the same
as a short moment ago: 𝐹 = 1
- No control input to the system: 𝐵 = 0
- Output voltage is the only observable: 𝐻 = 1
- Process noise has covariance Q
- Observation noise has covariance R
- Assume the process variance is very low set 𝑄 = 1𝑒 − 8
- Adjust it later through experimentation to obtain desired filter
performance. Determine R, the variance of Raw sensor
measurements.
After using Kalman filter, the advantage of this clutter filter is the highly accurate
result with the pressure fluctuation is equal to 1𝑃𝑎. However, the time response is
very slow, it takes many times to achieve that result.
A widely used indicator in technical analysis that helps smooth out signal by
filtering out the “noise” from random fluctuations. The moving average filter (MA
filter) is a simple Low Pass FIR (Finite Impulse Response) filter commonly used
for smoothing an array of sampled data/signal. It takes N samples of input at a
time and take the average of those N-samples and produces a single output point.
It is a very simple Low Pass Filter (LPF) structure that comes handy for scientists
and engineers to filter unwanted noisy component from the intended data.[24]
Moving average filter operates by averaging a number of points from the input
signal to produce each point in the output signal. In equation form, this is written:
𝑁−1
1
𝑦(𝑖) = ∑ 𝑥(𝑖 + 𝑗) (3.10)
𝑁
𝑗=0
where x(i) is the input signal, y(i) is the output signal, and N is the number of
points in the average (note: N is an odd number).
1) It takes M input points, computes the average of those N-points and produces
a single output point.
2) Due to the computation/calculations involved , the filter introduces a definite
amount of delay.
3) The filter acts as a Low Pass Filter (with poor frequency domain response and
a good time domain response).
As the filter length increases (the parameter N) the smoothness of the output
increases, whereas the sharp transitions in the data are made increasingly blunt.
This implies that this filter has excellent time domain response but a poor
frequency response. In other words, the moving average is an exceptionally good
smoothing filter (the action in the time domain), but an exceptionally bad low-pass
filter (the action in the frequency domain).
For our case, we need low-noise signals around a dynamics pressure values which
represent for the velocity set for the flow passing through the test section of wind
tunnel, in order to calculate an average value of the acquired array of data signals.
Therefore, a good time-domain signal is great for the case, which means the MA
filter is one of best choices. Also, MA filter is an easy and fast-response way to
apply for our Matlab program, especially for the offline post-processing part
which influences our adjustment on each experiment result of each hole. In our
program, we initially opted span N of 25 since we refer to a source code from a
Matlab webminar of smoothing signals of a temperature analog sensor and finally
we increased the value to 31 to reduce more noise due to our high sense of pressure
sensors.
After using Moving Average, the accuracy is lower than Kalman Filter’s accuracy
while the time response of Moving Average is faster than time response of Kalman
Filter.
A low-pass filter (LPF) is a filter that passes signals with a frequency lower than
a certain cutoff frequency and attenuates signals with frequencies higher than the
cutoff frequency.
One simple low-pass filter circuit consists of a resistor in series with a load, and a
capacitor in parallel with the load. The capacitor exhibits reactance, and blocks
low-frequency signals, forcing them through the load instead. At higher
frequencies the reactance drops, and the capacitor effectively functions as a short
circuit. The combination of resistance and capacitance gives the time constant of
the filter = 𝑅𝐶 . The break frequency, also called the turnover frequency or cutoff
frequency (in hertz), is determined by the time constant: (more details in [25])
1
𝜏 = 𝑅𝐶 = (3.11)
2𝜋𝑓𝑐
The effect of an infinite impulse response low-pass filter can be simulated on a
computer by analyzing an RC filter's behavior in the time domain, and then
discretizing the model. This discrete-time implementation of a simple RC low-
pass filter is:
We find that the noise is reduced and the result is better while the time response
is rapid.
3.2.2.4 Summary
After evaluating three clutter filters, we recognize that the low-pass filter is
suitable for the calibration. Furthermore, moving average is suitable for
continuous validation. (see Table 3-3)
There are two types of calibrations, one using nulling mode, which means the
probe would be aligned until at precise zero pitch and yaw angle before
calibration, and the another one using non-nulling mode, which just requires probe
placed at a fixed position within zero position’s tolerance and sees it at imperfect
zero position. For the former scenario, it is considerably costly due to spending a
huge amount of time to accurately adjust a perfect zero position. The latter
scenario, however, accepts an imperfect zero position and then calibration results
will tell how probe position was inaccurate and this still has no impact on accurate
measuring capability of the probe. This was shown to be adequate and less time-
consuming than conventional nulling mode by several studies, e.g., [3], [5], [6],
[13], [14], [20], [26]. Then, relationships between measured pressures at five holes
and true, local static and total pressure or velocity must be determined. These
During the calibration, flow direction and magnitude must be known and pressure
data will be measured and recorded at each calibrating point. Angle of attack and
sideslip angle vary on a wide range of +/- 20 degrees, in order to calculate or
identify all dimensionless coefficients for determination of flow angularities
model structures. Then, these mathematical models will be used as functions to
compute the flow angles and further flow velocity from measured pressure data in
the actual airflow. In this thesis, a convention of numbering holes of probe is
illustrated in Figure 4-1 and calibration coefficients are defined as follows (4.1),
(4.2), (4.3), (4.4), which are standard non-dimensional coefficients in [3], [14].
𝑃3 − 𝑃1
𝐶𝑃𝛼 = (4.1)
𝑃5 − 𝑃𝑎𝑣𝑒
𝑃2 − 𝑃4
𝐶𝑃𝛽 = (4.2)
𝑃5 − 𝑃𝑎𝑣𝑒
𝑃5 − 𝑃
𝐶𝑃5 = (4.3)
𝑃0 − 𝑃
𝑃𝑎𝑣𝑒 − 𝑃
𝐶𝑃𝑎𝑣𝑒 = (4.4)
𝑃0 − 𝑃
where:
𝑃1 , 𝑃2 , 𝑃3 , 𝑃4 , 𝑃5 : pressure of 5 holes
𝑃1 +𝑃2 +𝑃3 +𝑃4
𝑃𝑎𝑣𝑒 =
4
After measuring all points of the matrix, a pressure distribution was plotted
at each hole of probe to initial evaluation. A large amounts of data record was
observed and we found a huge problem as at zero AOA and AOS point, the
displayed pressure value of four holes surrounding center hole were not the same
or at least fluctuated around each other value. There were big gaps among them
and each pressure tap behaved at different range of pressure, which means that
there was definitely at least a factor influencing calibration that went wrong.
Section of 4.3 below demonstrated all influencing factors in more details and came
140 Scale to P2
y = 0.6953x - 2.9513
120 y = 1.4305x + 12.405 R² = 0.9969
R² = 0.999
Pressure of P2 (Pa)
100
80 y = 1.2867x + 9.1643
P1
R² = 0.9995
60 P3
P4
40 Linear (P1)
20 Linear (P3)
Linear (P4)
0
0 50 100 150 200
Pressure (Pa)
There must be a proper static source for each differential pressure sensor.
Proper scale functions have to be correctly utilized.
Check for probe system whether clogging or leaks in tubes happens.
Check for any electronics and electrical issues of data acquisition system,
e.g., voltage of employed Arduino microprocessor must be 5 volts,
concisely use breadboard, all wires have to be precisely connected to board.
Figure 4-7, where pressure distribution is refined by neglected bad points using
third-order polynomial fit function. From the figures, it is easier to estimate where
is actual zero-point (AOA, AOS) = (0, 0) of the probe during calibration and the
best available range of probe usage. For further evaluation related to this issue, we
need some validations that will be mentioned later in Chapter 5.
Figure 4-7, the five pressure taps of a specific probe respond to varying flow
angles. The iso-lines show arcs of increasing pressure as the hole of each tube is
oriented into the flow. The curvature of iso-lines become more circular as the
pressure increases, since the flow is more directly into the hole and exhibits greater
dependence upon the twisting of the hole with respect to mean flow. The pressure
field at Port 2 and Port 4 show how a manufacturing error while grouping these
ports since the center of arcs of the two are not at the same location while Figure
4-3 and show a perfectly symmetry of port 1 and port 3. Figure 4-4 presents the
center pressure tap (P5) response which should resemble concentric circles
centered about the probe axis. From this figure, it is easily determined that the
probe axis was not correctly aligned with the flow when AOA and AOS are both
zero. This happened when the probe was manually mounted to the transverse
system and the system to test section of wind tunnel. In fact, the probe axis is
parallel to the airflow for 𝐴𝑂𝐴 ≈ −3° and 𝐴𝑂𝑆 ≈ −2°.
The refined technique proposed by Morrison [14], however, not only is able to
smooth out the effects of bad calibration points but also does not require a
perfectly symmetrical probe. As it is pointed out in the study, the technique
consists of performing surface-fits of the entire set of calibration data which
compensate for asymmetric probes and eliminate bad data points that could
negatively affect probe measurement. Data reduction technique used in this thesis
was similar because of its advantages, but the surface-fits method employed here
is least-square polynomial surface fit. Third-order polynomial linear regression
models were established and embedded in our program by using MATLAB Curve
Fitting ToolboxTM, which is also directly applied in [15]. This calibration results
will be tested in validation and compared to rational polynomial regression models
in my co-worker’s thesis, which were built by Table Curve 3D used in [14]. Figure
4-8 shows the overall scheme of data reduction using aforementioned method,
where the process of computing airspeed will be demonstrated later.
MATLAB Curve Fitting Toolbox™ Product [29] provides a functions for fitting
curves and surfaces to data. The toolbox allows us to perform exploratory data
analysis, preprocess and post-process data, compare candidate models, and
remove outliers. We can conduct regression analysis using the library of linear and
nonlinear models provided or specify our own custom equations. The library
provides optimized solver parameters and starting conditions to improve the
quality of our fits. The toolbox also supports nonparametric modeling techniques,
such as splines, interpolation, and smoothing. After creating a fit, we can apply a
variety of post-processing methods for plotting, interpolation, and extrapolation;
estimating confidence intervals; and calculating integrals and derivatives.
The surface-fitting technique applied in the toolbox is linear least square method
to fit linear model to data, where linear models stand for calibration coefficients
of surface-fit models and data stands for AOA pressure coefficients, AOS pressure
coefficients and the combination point of AOA and AOS in the calibration matrix
at which the pressure values at five holes were measured. The linear model is
defined as an equation that is linear in the coefficients. As mentioned earlier, the
2 2 3 2 2 3
1 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽
𝐴1 𝐾𝐼
2 2 3 2 2 3
𝐴2 1 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽 𝐾𝐼𝐼
𝐴3 1 𝐶𝑃𝛼 2
𝐶𝑃𝛽 𝐶𝑃𝛼 2
𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽 3
𝐶𝑃𝛼 2
𝐶𝑃𝛼 𝐶𝑃𝛽 2
𝐶𝑃𝛼 𝐶𝑃𝛽 3
𝐶𝑃𝛽 𝐾𝐼𝐼𝐼
𝐴4 2 2 3 2 2 3 𝐾
= 1 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽 × 𝐼𝑉 (4.7)
. .
.
. .
.
. .
.
[𝐴𝑁 ] 2 2 3 2 2 3 [ 𝐾𝑁 ]
[1 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛼 𝐶𝑃𝛽 𝐶𝑃𝛽 ]
It can be written as:
[C] is the Nx10 matrix containing the flow angle pressure coefficients (i.e.,
2
𝐶𝑃𝛼 , 𝐶𝑃𝛽 , 𝐶𝑃𝛼 , …;
[A] is the Nx1 column vector containing the flow property (AOA, AOS) under
consideration and called from calibration data record. And N is the total number
of calibration data points, which is 81 points in our case as mentioned earlier.
Given the data collected from experiments measurements, this least square
problem could be solved by employing matrix algebra. The matrix algebra
required to determine the calibration coefficients is
SST is also called the sum of squares about the mean, and is defined as
𝑆𝑆𝑅 𝑆𝑆𝐸
𝑅2 = =1− (4.14)
𝑆𝑆𝑇 𝑆𝑆𝑇
And SSE is the sum of squared error and is defined as
𝑛
𝑅2 can take on any value between 0 and 1, with a value closer to 1 indicating that
a greater proportion of variance is accounted for by the model. As seen in the
Figure 4-9 and Figure 4-10, the coefficient of determination value for angle of
attack data fitting is 0.99186 and that for sideslip angle data fitting is 0.99202,
which means that the fits explain 99.186% and 99.202% of the total variation in
the flow angles data about models. These values are really good compared to
results of [5], [14], [20]. At each surface models, the root-mean-square deviations
were also computed, which is 1.2439 degree for deviations between actual AOA
and AOA models and 1.232 degree for AOS and AOS models. These could be
seen as qualitative numbers to estimate the errors in measurement ability of the
probe in discrete validation.
Next step of computing airspeed, where the airspeed 𝑉𝑎 can be computed from
static pressure 𝑃𝑠 and total pressure 𝑃𝑡 , defined as
2(𝑃𝑡 − 𝑃𝑠 )
𝑉𝑎 = √ (4.16)
𝜌𝑎𝑖𝑟
where 𝜌𝑎𝑖𝑟 denotes the air density at experiment’s level. It is possible to measure
static pressure and total pressure during calibration by using a pitot-static tube
aligned with the direction of the airflow, then these results could be used to
determined 𝐶𝑃5 and 𝐶𝑃𝑎𝑣𝑒 models, which can be finally used to computing
airspeed in the future. The relationship between static pressure/total pressure and
the two coefficients is defined as:
Table 4-2 shows the computed data at each points, which were used to build model
structure.
After the calibration, the mathematical models of the probe including AOA, AOS,
𝐶𝑃5 and 𝐶𝑃𝑎𝑣𝑒 must be validated to evaluate how good they are via goodness of fit
and value error for new data set. Such calibration results are validated in two
separate processes, one is the discrete validation and the other is continuous
validation. Therefore, we will discuss these two kinds of validation and analyze
the results as well as discuss about source of errors. There are three main sections
in this chapter:
flight, the two levels of speed correspond to two limits of typical operation of the
UAV platform. They are stall speed and maximum cruise speed, respectively. At
speed of 12 m/s, the angle of attack is varied from −20° to 20° at 5° intervals in
each sideslip, which is also varied in that range. At high speed of 20 m/s, the AOA
is just varied from −10° to 10° in 5° increments at 0° AOS, and similarly, the
sideslip is varied from −10° to 10° in 5° increments at 0° AOA. There were such
differences because, at speed of 12 m/s, the probe was calibrated at every
combination points of AOA and AOS. So, it is essentially important to re-test all
measured points. Nonetheless, at speed of 20 m/s, which is the cruise speed of the
UAV so such range of test is not only aerodynamically meaningful for real flight
tests but also less time-consuming.
𝑁
1
𝑅𝑀𝑆 = √ ∑ 𝑒𝑖2 (5.1)
𝑁
𝑖=1
where N is the number of samples, which is 500 for each speed, and 𝑒𝑖 is the 𝑖𝑡ℎ
sample of the measurement error. Assuming the error is normally distributed about
the nonzero mean value, then, for each speed, the number of samples that are
within the range ±𝑅𝑀𝑆 is equal to
1 𝑅𝑀𝑆 − 𝜇 𝑅𝑀𝑆 + 𝜇
(𝐸𝑅𝐹 ( ) + 𝐸𝑅𝐹 ( )) (5.2)
2 𝜎√2 𝜎√2
where 𝜎 is the standard deviation of the error, 𝜇 is the mean value, and 𝐸𝑅𝐹(𝜂) is
the error function defined as
𝜂
1 2
𝐸𝑅𝐹 (𝜂 ) = ∫ 𝑒 𝜉 𝑑𝜉 (5.3)
√2
−𝜂
Hence, 71.46% of the measurement error samples are within ±1.06° at the low
speed and 63.44% are in the range ±0.81° at the high speed.
5
AOA (deg)
0
0 5 10 15 20 25
-5
-10
-15
Time (s)
10
5
AOA (deg)
0
0 5 10 15 20 25
-5
-10
-15
Time (s)
10
5
AOS (deg)
0
0 5 10 15 20 25
-5
-10
-15
Time (s)
10
5
AOS (deg)
0
0 5 10 15 20 25
-5
-10
-15
Time (s)
Within this thesis’s scope, there was continuous validation for only continuously
varying angles of attack at a fixed sideslip angle location due to experimental setup
limitations. In order to carry out such test, an extra experiment frame was built
and setup in purpose of collecting data of rotating pitch angle as it acts as reference
angle of attack. This electronics frame needs to meet some requirements of
accuracy and condition of available wind tunnel employed in this dissertation.
Specifically, a potentiometer was used to measure the reference angle. This means
that the frame holding the potentiometer has to be rigid, and only potentiometer’s
knob is rotary. Based on actual wind tunnel situation Figure 5-7, which is showed
that there was a three-component balance already installed, a frame was
constructed and placed clinging to the three-component balance. Figure 5-7 and
Figure 5-8 demonstrated such sketch and the constructed frame in some views.
terminal connects to a sliding contact, called a wiper, moving over the resistive
element connecting to the analog pin of the Arduino. The position of the wiper
determines the output voltage of the potentiometer. The potentiometer essentially
functions as a variable voltage divider. The resistive element can be seen as two
resistors in series (potentiometer resistance), where the wiper position determines
the resistance ratio of the first resistor to the second resistor. In our setup, such
wiper was connected to the shaft of AOA axis of the probe so the third terminal
could display analog values while angle of attack changing. Since the
potentiometer has its characteristics curve and a full circle of wiper is not 360°,
which means that 1° of wiper wrongly shows corresponding analog value of 1° of
AOA, the next step is to calibrate the potentiometer to correctly perform and
record data of angle changes from the true angle values. The calibration was
conducted in similar way we calibrated probe that all analog values were recorded
during all angle points’ measurements and then a curve fits this data set.
300
y = -4E-15x6 + 2E-11x5 - 2E-08x4 + 2E-05x3 - 0.0068x2 + 1.3668x - 33.576
250 R² = 0.9983
200
Angle (deg)
150
-50
0 200 400 600 800 1000
Analog values
40
y = 0.1701x - 84.328
30 R² = 0.9993
20
10
Angle (deg)
-10
-20
-30
-40
300 400 500 600 700
Analog values
AOA_polynomial
(produced by the probe)
25 AOA_reference (measured
by the potentiometer)
20
15
10
AOA (deg)
5
0
0 40 80 120 160 200 240 280 320
-5
-10
-15
-20
-25
Time (s)
Given RMS errors of angles measurement in previous sections 5.1, note that these
discrepancies are due to calibration errors as well as instrumentation errors which
could lead to cumulative error of up to one degree. The calibration errors come
from non-perfect probe tip that has 4 different hole geometries. Specifically, P3
hole was initially far from the rest due to a misalignment of five holes grouping.
Such misalignment contributed to a larger area of the hole compared to the others.
This leads to higher pressure values than others. Although the scaling was
conducted to eliminate this phenomenon, it still affected the calibration results,
especially at high angles of attack and sideslip angles. Moreover, the surface of
probe tip, mostly at edge of holes, was not visibly smooth, Figure 5-13 leading to
different boundary separation of surrounding holes, especially at high angles and
low speed. This does affect the probe calibration when 𝑅𝑒 < 20 × 103 in our
case, and thus free-stream turbulence may influence the accuracy of probes that
are sensitive to Reynolds number as investigated in [19]. This is seen as big gaps
between measurements (by the probe) and reference values (by rotating
mechanism) at some bad points, i.e., 𝐴𝑂𝐴 = −10° (at 12 m/s) in Figure 5-1,
𝐴𝑂𝑆 = −10° (at 12 m/s) in Figure 5-3 and 𝐴𝑂𝑆 = −10° (at 20 m/s) in Figure 5-4.
In addition, during calibration, the reference values were visibly recorded by
reading values on protractor, which has minimum grad of one degree, so its
accuracy while reading is within 0.5° . This could lead to a case of imperfect
reference value and finally impacted calibration results. In terms of
instrumentation errors, all source of error would come from the sensitivity of
pressure sensors (as presented in Chapter 3) and potentiometer, which was used to
measure reference value during continuous validation. However, mathematical
models of the probe could be identified and calibrated to give a good surface fitting
to the data. Then, the probe could be used to measure the airspeed and the direction
of the actual flow.
6.1 Achievements
Here are some achievements of this thesis:
- The configuration design of a five-hole air data probe, which has a 90-
degree conical tip and five forward facing holes, was built based on
investigation previous available studies.
- The manufacture preparation and process were demonstrated to satisfy the
simplicity and low cost requirements. It can be clearly seen as a good shape
for such probe and target of building a home-built probe was obtained. An
effective experiment rig was also constructed.
- The instruments and data acquisition system was built with careful
consideration of all aspects including hardware specification and work flow
of programming pressure sensors and a microcontroller in order to measure
pressures of five-hole probe.
- By using least-squares polynomial fitting function for data reduction,
mathematical models (AOA, AOS and airspeed) of five-hole probe were
obtained with high goodness of fit and acceptable measured errors in
comparison with previous studies.
- The mathematical models were then evaluated by two separate validation
types (discrete and continuous), the data measurements error and goodness
of fit (for measuring angle of attack, sideslip angle and airspeed) were
computed and discussed.
- The tip probe was not smoothed and its cone angle was not abraded
perfectly. The tolerance of rotating mechanism system is ±0.50 . The
turbulence intensity of wind tunnel is about 1.758 % higher than the
standard. Because of limitations stated above, the root-mean squared errors
are still high.
- Due to the limit time in fulfilling this thesis, the five-hole probe is just
evaluated in the wind tunnel conditions, and not validated in real flight
conditions.
Future works:
[2] K. Everett, A. Gerner, and D. Durston, “Seven-hole cone probes for high
angle flow measurements: theory and calibration,” AIAA J., vol. 21, no. 7,
pp. 992–998, 1983.
[6] B. F. Hall and T. Povey, “The Oxford Probe: an open access five-hole probe
for aerodynamic measurements,” Meas. Sci. Technol., vol. 28, no. 3, p.
35004, 2017.
[8] P. Ligrani, B. Singer, and L. Baun, “Miniatrue five-hole pressure probe for
measurement of three mean velocity components in low-speed flows,” J.
REFERENCES
Appendix
A. MATLAB Programs
[Function] ‘lowpassfilter.m’
function [blo,alo]=lowpassfilter(cf,st)
% cf = cutoff frequency
% st = sampling time
% a,b = coefficients of discrete-time transfer function
% cf = 0.5;
% st = 0.01;
omega = 2*pi*cf;
num = omega;
den = [1 omega];
H = tf(num, den);
Hd = c2d(H,st);
blo = Hd.num{1}(2:2);
alo = Hd.den{1}(2:2);
[Function] ‘findsheet.m’
function [a,b,apos,bpos] = findsheet(nameofsheet)
nameofsheet = char(nameofsheet);
for i=1:length(nameofsheet)
if nameofsheet(i) == 'a'
break
end
end
for j=1:length(nameofsheet)
if nameofsheet(j) == 'b'
break
end
end
a = nameofsheet(i+1:j-1); a = str2double(a);
b = nameofsheet(j+1:length(nameofsheet)); b = str2double(b);
[~,nameofsheet] = xlsfinfo(file);
for i = 1:numberofdata
[~,range,~] = xlsread(file,i,'A2');
temp = xlsread(file,i,char(range));
[~,~,a,b] = findsheet(nameofsheet{i});
P1(a,b) = temp(1);
P2(a,b) = temp(2);
P3(a,b) = temp(3);
P4(a,b) = temp(4);
P5(a,b) = temp(5);
end
%% Connect to Arduino
% Use the arduino command to connect to an Arduino device.
clear all
clc
a = arduino;
subplot(511)
xlabel('Time')
ylabel('P1 (Pa)')
ax1 = gca;
ax1.YGrid = 'on';
% ax1.YLim = [-10 40];
axis auto
h1 = animatedline;
subplot(512)
xlabel('Time')
ylabel('P2 (Pa)')
ax2 = gca;
ax2.YGrid = 'on';
% ax2.YLim = [-10 40];
axis auto
h2 = animatedline;
subplot(513)
xlabel('Time')
ylabel('P3 (Pa)')
ax3 = gca;
ax3.YGrid = 'on';
% ax3.YLim = [-10 40];
axis auto
h3 = animatedline;
subplot(514)
xlabel('Time')
ylabel('P4 (Pa)')
ax4 = gca;
ax4.YGrid = 'on';
% ax4.YLim = [-10 40];
axis auto
h4 = animatedline;
subplot(515)
xlabel('Time')
ylabel('P5 (Pa)')
ax5 = gca;
ax5.YGrid = 'on';
% ax5.YLim = [-10 40];
axis auto
h5 = animatedline;
stop = 0;
startTime = datetime('now');
sum1=0;
sum2=0;
sum3=0;
sum4=0;
sum5=0;
for i=0:9
sensorValue1=readVoltage(a,'A1')*1024/5-512;
sensorValue2=readVoltage(a,'A2')*1024/5-512;
sensorValue3=readVoltage(a,'A3')*1024/5-512;
sensorValue4=readVoltage(a,'A4')*1024/5-512;
sensorValue5=readVoltage(a,'A5')*1024/5-512;
sum1=sum1+sensorValue1;
sum2=sum2+sensorValue2;
sum3=sum3+sensorValue3;
sum4=sum4+sensorValue4;
sum5=sum5+sensorValue5;
end
offset1=sum1/10;
offset2=sum2/10;
offset3=sum3/10;
offset4=sum4/10;
offset5=sum5/10;
Son C.T. Nguyen 76
APPENDIX
% Live data
while stop < 200
% Read analog pin
sensorValue1=readVoltage(a,'A1')*1024/5-offset1;
Vout1=(5*sensorValue1)/1024;
sensorValue2=readVoltage(a,'A2')*1024/5-offset2;
Vout2=(5*sensorValue2)/1024;
sensorValue3=readVoltage(a,'A3')*1024/5-offset3;
Vout3=(5*sensorValue3)/1024;
sensorValue4=readVoltage(a,'A4')*1024/5-offset4;
Vout4=(5*sensorValue4)/1024;
sensorValue5=readVoltage(a,'A5')*1024/5-offset5;
Vout5=(5*sensorValue5)/1024;
% Calculate pressure from voltage (based on data sheet)
P1 = (Vout1-2.5)*1000;
P2 = (Vout2-2.5)*1000;
P3 = (Vout3-2.5)*1000;
P4 = (Vout4-2.5)*1000;
P5 = (Vout5-2.5)*1000;
addpoints(h2,datenum(t),P2);
ax2.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h3,datenum(t),P3);
ax3.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h4,datenum(t),P4);
ax4.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h5,datenum(t),P5);
ax5.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
drawnow
% Check stop condition
stop = stop + 1;
% stop = readDigitalPin(a,'D12');
end
%% Plot the recorded data
[timeLogs,P1Logs] = getpoints(h1);
[timeLogs,P2Logs] = getpoints(h2);
[timeLogs,P3Logs] = getpoints(h3);
[timeLogs,P4Logs] = getpoints(h4);
[timeLogs,P5Logs] = getpoints(h5);
timeSecs = (timeLogs-timeLogs(1))*24*3600;
%% Smooth out readings with Lowpass filter and Scale
P1Logs=P1Logs';
P2Logs=P2Logs';
P3Logs=P3Logs';
P4Logs=P4Logs';
P5Logs=P5Logs';
P1f=zeros(length(P1Logs),1);
P2f=zeros(length(P2Logs),1);
P3f=zeros(length(P3Logs),1);
P4f=zeros(length(P4Logs),1);
P5f=zeros(length(P5Logs),1);
for i=2:length(P1Logs)
P1f(i) = -alo*P1f(i-1)+blo*P1Logs(i);
P2f(i) = -alo*P2f(i-1)+blo*P2Logs(i);
P3f(i) = -alo*P3f(i-1)+blo*P3Logs(i);
P4f(i) = -alo*P4f(i-1)+blo*P4Logs(i);
P5f(i) = -alo*P5f(i-1)+blo*P5Logs(i);
end
%%
% Plot the original and the low pass filtered pressure signal, and
illustrate the
% uncertainty.
figure
subplot(511)
plot(timeSecs,P1Logs,'b',timeSecs,P1f,'r--');
title('Raw vs low pass filter data');
xlabel('Elapsed time (sec)');
ylabel('P1 (Pa)');
legend('P1 raw','P1 lowpass')
subplot(512)
plot(timeSecs,P2Logs,'b',timeSecs,P2f,'r--');
xlabel('Elapsed time (sec)');
ylabel('P2 (Pa)');
legend('P2 raw','P2 lowpass')
subplot(513)
plot(timeSecs,P3Logs,'b',timeSecs,P3f,'r--');
xlabel('Elapsed time (sec)');
ylabel('P3 (Pa)');
legend('P3 raw','P3 lowpass')
subplot(514)
plot(timeSecs,P4Logs,'b',timeSecs,P4f,'r--');
xlabel('Elapsed time (sec)');
ylabel('P4 (Pa)');
Son C.T. Nguyen 78
APPENDIX
subplot(515)
plot(timeSecs,P5Logs,'b',timeSecs,P5f,'r--');
xlabel('Elapsed time (sec)');
ylabel('P5 (Pa)');
legend('P5 raw','P5 lowpass');
P4Logs(i:end),P5Logs(i:end),P1f(i:end),P2f(i:end),P3f(i:end),P4f(i:end
)...
,P5f(i:end),'VariableNames',{'Time_sec','P1_Pa','P2_Pa','P3_Pa','P4_Pa
',...
'P5_Pa','lowpassP1','lowpassP2','lowpassP3','lowpassP4','lowpassP5'});
filename = 'For_Scale_Data_Lowpass_Filter_Lan10.xlsx'; %Note: Must
create this file first!
% Write table to file
writetable(T,filename,'sheet','295Hz')
% Print confirmation to command line
fprintf('Results table with %g pressure measurements saved to file
%s\n',...
length(timeSecs),filename)
subplot(511)
xlabel('Time')
ylabel('P1 (Pa)')
ax1 = gca;
ax1.YGrid = 'on';
% ax1.YLim = [-10 40];
axis auto
h1 = animatedline;
subplot(512)
xlabel('Time')
ylabel('P2 (Pa)')
ax2 = gca;
ax2.YGrid = 'on';
% ax2.YLim = [-10 40];
axis auto
h2 = animatedline;
subplot(513)
xlabel('Time')
ylabel('P3 (Pa)')
ax3 = gca;
ax3.YGrid = 'on';
% ax3.YLim = [-10 40];
axis auto
h3 = animatedline;
subplot(514)
xlabel('Time')
ylabel('P4 (Pa)')
ax4 = gca;
ax4.YGrid = 'on';
% ax4.YLim = [-10 40];
axis auto
h4 = animatedline;
subplot(515)
xlabel('Time')
ylabel('P5 (Pa)')
ax5 = gca;
ax5.YGrid = 'on';
% ax5.YLim = [-10 40];
axis auto
h5 = animatedline;
stop = 0;
startTime = datetime('now');
sum1=0;
sum2=0;
sum3=0;
sum4=0;
sum5=0;
for i=0:9
sensorValue1=readVoltage(a,'A1')*1024/5-512;
sensorValue2=readVoltage(a,'A2')*1024/5-512;
sensorValue3=readVoltage(a,'A3')*1024/5-512;
sensorValue4=readVoltage(a,'A4')*1024/5-512;
sensorValue5=readVoltage(a,'A5')*1024/5-512;
sum1=sum1+sensorValue1;
sum2=sum2+sensorValue2;
sum3=sum3+sensorValue3;
sum4=sum4+sensorValue4;
sum5=sum5+sensorValue5;
end
offset1=sum1/10;
offset2=sum2/10;
offset3=sum3/10;
offset4=sum4/10;
offset5=sum5/10;
% Live data
tic
sensorValue2=readVoltage(a,'A2')*1024/5-offset2;
Vout2=(5*sensorValue2)/1024;%-2.5;
sensorValue3=readVoltage(a,'A3')*1024/5-offset3;
Vout3=(5*sensorValue3)/1024;%-2.5;
sensorValue4=readVoltage(a,'A4')*1024/5-offset4;
Vout4=(5*sensorValue4)/1024;%-2.5;
sensorValue5=readVoltage(a,'A5')*1024/5-offset5;
Vout5=(5*sensorValue5)/1024;%-2.5;
addpoints(h2,datenum(t),P2);
ax2.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h3,datenum(t),P3);
ax3.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h4,datenum(t),P4);
ax4.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h5,datenum(t),P5);
ax5.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
drawnow
% Check stop condition
stop = stop + 1;
Son C.T. Nguyen 81
APPENDIX
% stop = readDigitalPin(a,'D12');
end
tg =toc;
[timeLogs,P1Logs] = getpoints(h1);
[timeLogs,P2Logs] = getpoints(h2);
[timeLogs,P3Logs] = getpoints(h3);
[timeLogs,P4Logs] = getpoints(h4);
[timeLogs,P5Logs] = getpoints(h5);
timeSecs = (timeLogs-timeLogs(1))*24*3600;
P1f = zeros(length(P1Logs),1);
P2f = zeros(length(P2Logs),1);
P3f = zeros(length(P3Logs),1);
P4f = zeros(length(P4Logs),1);
P5f = zeros(length(P5Logs),1);
for i=2:length(P1Logs)
P1f(i) = -alo*P1f(i-1)+blo*P1Logs(i);
P2f(i) = -alo*P2f(i-1)+blo*P2Logs(i);
P3f(i) = -alo*P3f(i-1)+blo*P3Logs(i);
P4f(i) = -alo*P4f(i-1)+blo*P4Logs(i);
P5f(i) = -alo*P5f(i-1)+blo*P5Logs(i);
end
% Scale to P2
P1s2=1.4932.*P1f+8.8706;
P3s2=0.7035.*P3f-4.0602;
P4s2=1.2945.*P4f+8.6707;
Torigin =
table(timeSecs(i:end)',P1Logs(i:end),P2Logs(i:end),P3Logs(i:end),P4Log
s(i:end)...
,P5Logs(i:end),P1f(i:end),P2f(i:end),P3f(i:end),P4f(i:end),P5f(i:end),
...
'VariableNames',{'Time_sec','P1_Pa','P2_Pa','P3_Pa','P4_Pa','P5_Pa',..
.
'lowpassP1','lowpassP2','lowpassP3','lowpassP4','lowpassP5'});
Ts2 =
table(P1s2(i:end),P3s2(i:end),P4s2(i:end),'VariableNames',{'P1s2','P3s
2','P4s2'});
Ts2mean =
table(mean(P1s2(i:end)),mean(P2f(i:end)),mean(P3s2(i:end)),mean(P4s2(i
:end)),...
figure
% position = [2,6,8,4,5];
figure
% subplot(3,3,position(1))
fitP1 = fit([beta_arr,alpha_arr],P1_arr,'poly32') %Fit curve by
polynomial degrees 2-2
plot(fitP1,[beta_arr,alpha_arr],P1_arr,'Style', 'Contour')
colormap(jet)
title 'P1'
ylabel 'alpha'
xlabel 'beta'
axis equal
figure
% subplot(3,3,position(2))
fitP2 = fit([beta_arr,alpha_arr],P2_arr,'poly32') %Fit curve by
polynomial degrees 3-2
plot(fitP2,[beta_arr,alpha_arr],P2_arr,'Style', 'Contour')
colormap(jet)
title 'P2'
ylabel 'alpha'
xlabel 'beta'
axis equal
figure
% subplot(3,3,position(3))
fitP3 = fit([beta_arr,alpha_arr],P3_arr,'poly32') %Fit curve by
polynomial degrees 2-2
plot(fitP3,[beta_arr,alpha_arr],P3_arr,'Style', 'Contour')
colormap(jet)
title 'P3'
ylabel 'alpha'
xlabel 'beta'
axis equal
figure
% subplot(3,3,position(4))
fitP4 = fit([beta_arr,alpha_arr],P4_arr,'poly32')%Fit curve by
polynomial degrees 3-2
plot(fitP4,[beta_arr,alpha_arr],P4_arr,'Style', 'Contour')
colormap(jet)
title 'P4'
ylabel 'alpha'
xlabel 'beta'
axis equal
figure
% subplot(3,3,position(5))
fitP5 = fit([beta_arr,alpha_arr],P5_arr,'poly32') %Fit curve by
polynomial degrees 3-2
plot(fitP5,[beta_arr,alpha_arr],P5_arr,'Style', 'Contour')
colormap(jet)
title 'P5'
ylabel 'alpha'
xlabel 'beta'
axis equal
plot(AOA_arr_p,[Cpa_arr,Cpb_arr],alpha_arr)
colormap(jet)
str_AOA = ['Rsquare = ',num2str(gof_AOA.rsquare)];
str_AOA_2 = ['RMS = ',num2str(gof_AOA.rmse)];
txaoa = text(max(xlim),max(ylim),max(zlim),str_AOA);
txaoa_2 = text(max(xlim),max(ylim),max(zlim)-5,str_AOA_2);
txaoa.FontSize = 12;
txaoa_2.FontSize = 12;
txaoa.FontWeight = 'bold';
txaoa_2.FontWeight = 'bold';
title 'Surface fitting AOA vs Cpa & Cpb'
xlabel 'Cpa'
ylabel 'Cpb'
zlabel 'AOAfit'
figure
[AOS_arr_p,gof_AOS] = fit([Cpa_arr,Cpb_arr],beta_arr,'poly33') %Fit
curve by polynomial degrees 3-2
plot(AOS_arr_p,[Cpa_arr,Cpb_arr],beta_arr)
colormap(jet)
% Determine the polynomial math model of Cp5 and Cpave (depend on AOA
and
% AOS)
figure
[Cp5_arr_p,gof_Cp5] = fit([alpha_arr,beta_arr],Cp5_arr,'poly32') %Fit
curve by polynomial degrees 3-2
plot(Cp5_arr_p,[alpha_arr,beta_arr],Cp5_arr)
colormap(jet)
str_Cp5 = ['Rsquare = ',num2str(gof_Cp5.rsquare)];
% str_Cp5_2 = ['RMS = ',num2str(gof_Cp5.rmse)];
txCp5 = text(max(xlim),max(ylim),max(zlim),str_Cp5);
% txCp5_2 = text(max(xlim),max(ylim),max(zlim)-0.2,str_Cp5_2);
txCp5.FontSize = 12;
% txCp5_2.FontSize = 12;
txCp5.FontWeight = 'bold';
% txCp5_2.FontWeight = 'bold';
title 'Surface fitting Cp5 vs alpha & beta'
xlabel 'alpha'
ylabel 'beta'
zlabel 'Cp5Fit'
figure
[Cpave_arr_p,gof_Cpave] = fit([alpha_arr,beta_arr],Cpave_arr,'poly32')
%Fit curve by polynomial degrees 3-2
plot(Cpave_arr_p,[alpha_arr,beta_arr],Cpave_arr)
colormap(jet)
str_Cpave = ['Rsquare = ',num2str(gof_Cpave.rsquare)];
% str_Cpave_2 = ['RMS = ',num2str(gof_Cpave.rmse)];
txCpave = text(max(xlim),max(ylim),max(zlim),str_Cpave);
% txCpave_2 = text(max(xlim),max(ylim),max(zlim)-0.2,str_Cpave_2);
txCpave.FontSize = 12;
% txCpave_2.FontSize = 12;
txCpave.FontWeight = 'bold';
% txCpave_2.FontWeight = 'bold';
title 'Surface fitting Cpave vs alpha & beta'
xlabel 'alpha'
ylabel 'beta'
zlabel 'CpaveFit'
fCp5_arr = [];
fCpave_arr = [];
for j = 1:81
% fCp5_arr = [fCp5_arr; Cp5_arr_p(fAOA_arr_p(j),fAOS_arr_p(j))];
fCp5_arr = [fCp5_arr; Cp5_arr_p(alpha_arr(j),beta_arr(j))];
% fCpave_arr = [fCpave_arr;
Cpave_arr_p(fAOA_arr_p(j),fAOS_arr_p(j))];
fCpave_arr = [fCpave_arr; Cpave_arr_p(alpha_arr(j),beta_arr(j))];
end
% Compute static and total pressure from math model of Cp5 and Cpave
Ps_arr = (fCp5_arr.*Pave_arr - fCpave_arr.*P5_arr)./(fCp5_arr -
fCpave_arr);
Pt_arr = Ps_arr + (P5_arr - Ps_arr)./fCp5_arr;
%% Export Data
TableAOA =
table(Cpa_arr,Cpb_arr,alpha_arr,'VariableNames',{'Cpa_arr','Cpb_arr','
AOA'}); %For Table Curve
TableAOS =
table(Cpa_arr,Cpb_arr,beta_arr,'VariableNames',{'Cpa_arr','Cpb_arr','A
OS'}); %For Table Curve
TableCp5 =
table(alpha_arr,beta_arr,Cp5_arr,'VariableNames',{'alpha','beta','Cp5'
});%For Table Curve
TableCpave =
table(alpha_arr,beta_arr,Cpave_arr,'VariableNames',{'alpha','beta','Cp
ave'});%For Table Curve
Pressure =
table(alpha_arr,beta_arr,P1_arr,P2_arr,P3_arr,P4_arr,P5_arr,'VariableN
ames',{'alpha','beta','P1','P2','P3','P4','P5'});
Results =
table(alpha_arr,beta_arr,fAOA_arr_p,fAOS_arr_p,AOA_arr_r,AOS_arr_r,V_a
rr,'VariableNames',{'alpha','beta','AOA_p','AOS_p','AOA_r','AOS_r','Ve
locity'});
% writetable(TableAOA,'Data_processing_S2_Lan10.xlsx','Sheet','AOA')
% writetable(TableAOS,'Data_processing_S2_Lan10.xlsx','Sheet','AOS')
% writetable(TableCp5,'Data_processing_S2_Lan10.xlsx','Sheet','Cp5')
%
writetable(TableCpave,'Data_processing_S2_Lan10.xlsx','Sheet','Cpave')
%
writetable(Pressure,'Data_processing_S2_Lan10.xlsx','Sheet','Pressure'
)
%
writetable(Results,'Data_processing_S2_Lan10.xlsx','Sheet','Results')
%% Connect to Arduino
% Use the arduino command to connect to an Arduino device.
clear all
% clc
a = arduino;
subplot(321)
xlabel('Time')
ylabel('P0 (Pa)')
ax0 = gca;
ax0.YGrid = 'on';
% ax4.YLim = [-10 40];
axis auto
h0 = animatedline;
subplot(323)
xlabel('Time')
ylabel('P1 (Pa)')
ax1 = gca;
ax1.YGrid = 'on';
% ax1.YLim = [-10 40];
axis auto
h1 = animatedline;
subplot(325)
xlabel('Time')
ylabel('P2 (Pa)')
ax2 = gca;
ax2.YGrid = 'on';
% ax2.YLim = [-10 40];
axis auto
h2 = animatedline;
subplot(324)
xlabel('Time')
Son C.T. Nguyen 88
APPENDIX
ylabel('P3 (Pa)')
ax3 = gca;
ax3.YGrid = 'on';
% ax3.YLim = [-10 40];
axis auto
h3 = animatedline;
subplot(326)
xlabel('Time')
ylabel('P4 (Pa)')
ax4 = gca;
ax4.YGrid = 'on';
% ax4.YLim = [-10 40];
axis auto
h4 = animatedline;
subplot(322)
xlabel('Time')
ylabel('P5 (Pa)')
ax5 = gca;
ax5.YGrid = 'on';
% ax5.YLim = [-10 40];
axis auto
h5 = animatedline;
stop = 0;
startTime = datetime('now');
sum0=0;
sum1=0;
sum2=0;
sum3=0;
sum4=0;
sum5=0;
for i=0:9
sensorValue0=readVoltage(a,'A0')*1024/5-512;
sensorValue1=readVoltage(a,'A1')*1024/5-512;
sensorValue2=readVoltage(a,'A2')*1024/5-512;
sensorValue3=readVoltage(a,'A3')*1024/5-512;
sensorValue4=readVoltage(a,'A4')*1024/5-512;
sensorValue5=readVoltage(a,'A5')*1024/5-512;
sum0=sum0+sensorValue0;
sum1=sum1+sensorValue1;
sum2=sum2+sensorValue2;
sum3=sum3+sensorValue3;
sum4=sum4+sensorValue4;
sum5=sum5+sensorValue5;
end
offset0=sum0/10;
offset1=sum1/10;
offset2=sum2/10;
offset3=sum3/10;
offset4=sum4/10;
offset5=sum5/10;
% Live data
tic
sensorValue0=readVoltage(a,'A0')*1024/5-offset0;
Vout0=(5*sensorValue0)/1024;%-2.5;
sensorValue1=readVoltage(a,'A1')*1024/5-offset1;
Vout1=(5*sensorValue1)/1024;%-2.5;
sensorValue2=readVoltage(a,'A2')*1024/5-offset2;
Vout2=(5*sensorValue2)/1024;%-2.5;
sensorValue3=readVoltage(a,'A3')*1024/5-offset3;
Vout3=(5*sensorValue3)/1024;%-2.5;
sensorValue4=readVoltage(a,'A4')*1024/5-offset4;
Vout4=(5*sensorValue4)/1024;%-2.5;
sensorValue5=readVoltage(a,'A5')*1024/5-offset5;
Vout5=(5*sensorValue5)/1024;%-2.5;
addpoints(h1,datenum(t),P1);
ax1.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h2,datenum(t),P2);
ax2.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h3,datenum(t),P3);
ax3.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h4,datenum(t),P4);
ax4.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h5,datenum(t),P5);
ax5.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
drawnow
% Check stop condition
stop = stop + 1;
Son C.T. Nguyen 90
APPENDIX
% stop = readDigitalPin(a,'D12');
end
tg =toc;
P0f = zeros(length(P0Logs),1);
P1f = zeros(length(P1Logs),1);
P2f = zeros(length(P2Logs),1);
P3f = zeros(length(P3Logs),1);
P4f = zeros(length(P4Logs),1);
P5f = zeros(length(P5Logs),1);
for i=2:length(P1Logs)
P0f(i) = -alo*P0f(i-1)+blo*P0Logs(i);
P1f(i) = -alo*P1f(i-1)+blo*P1Logs(i);
P2f(i) = -alo*P2f(i-1)+blo*P2Logs(i);
P3f(i) = -alo*P3f(i-1)+blo*P3Logs(i);
P4f(i) = -alo*P4f(i-1)+blo*P4Logs(i);
P5f(i) = -alo*P5f(i-1)+blo*P5Logs(i);
end
% Tu 15Hz
% Scale to P2
P1s2=1.4932.*P1f+8.8706;
P3s2=0.7035.*P3f-4.0602;
P4s2=1.2945.*P4f+8.6707;
Pave2 = 0.25*(P1s2+P2f+P3s2+P4s2);
% Rational
AOA_r2=(-1.2254019 +16.782773*Cpa2+1.9651122*Cpb2-3.8120139*Cpb2.^2-
3.8120139*Cpb2.^3)./...
(1-
0.23637319*Cpa2+0.1017577*Cpa2.^2+0.03940954*Cpa2.^3+0.064433961*Cpb2+
0.11055663*Cpb2.^2);
AOS_r2=(-1.2697656+0.36613886*Cpa2-
0.80333996*Cpa2.^2+20.905432*Cpb2+2.2642222*Cpb2.^2-
1.8756618*Cpb2.^3)./...
(1-
0.095888709*Cpa2+0.05245401*Cpa2.^2+0.019332082*Cpa2.^3+0.10135788*Cpb
2);
a = 0; % Goc AOA
b = 0; % Goc AOS
,P5Logs(i:end),P0f(i:end),P1f(i:end),P2f(i:end),P3f(i:end),P4f(i:end),
P5f(i:end),...
'VariableNames',{'Time_sec','P1_Pa','P2_Pa','P3_Pa','P4_Pa','P5_Pa',..
.
'lowpassP0','lowpassP1','lowpassP2','lowpassP3','lowpassP4','lowpassP5
'});
Ts2 =
table(P1s2(i:end),P3s2(i:end),P4s2(i:end),'VariableNames',{'P1s2','P3s
2','P4s2'});
Ts2mean =
table(mean(P1s2(i:end)),mean(P2f(i:end)),mean(P3s2(i:end)),mean(P4s2(i
:end)),...
mean(P5f(i:end)),mean(AOA_p2),mean(AOS_p2),mean(Va2),saisoAOA2_rms,sai
soAOS2_rms,mean(saisoVa2_rms),...
'VariableNames',{'P1scale','lowpassP2','P3scale','P4scale','lowpassP5'
,'AOA','AOS','Speed','saisoAOA','saisoAOS','saisoVa'});
Tresults2 =
table(AOA_p2,AOS_p2,AOA_r2,AOS_r2,Va2,Va_ref,'VariableNames',{'AOA_p',
'AOS_p','AOA_r','AOS_r','Speed','Speed_Pitot'});
%Note: Must create this file first!
filename2 = 'Validation_Lan10_LPF_S2_18Hz.xlsx';
% Write table to file
namesheet=['a',num2str(a),'b',num2str(b)];
writetable(Torigin,filename2,'sheet',namesheet,'Range','A3');
writetable(Ts2,filename2,'sheet',namesheet,'Range','M3');
writetable(Tresults2,filename2,'sheet',namesheet,'Range','P3');
writetable(Ts2mean,filename2,'sheet',namesheet,'Range','B1');
system('taskkill /F /IM EXCEL.EXE');
%% Connect to Arduino
% Use the arduino command to connect to an Arduino device.
clear all
% clc
a = arduino;
subplot(321)
xlabel('Time')
ylabel('P0 (Pa)')
ax0 = gca;
ax0.YGrid = 'on';
% ax4.YLim = [-10 40];
axis auto
h0 = animatedline;
subplot(323)
xlabel('Time')
ylabel('P1 (Pa)')
ax1 = gca;
ax1.YGrid = 'on';
% ax1.YLim = [-10 40];
axis auto
h1 = animatedline;
subplot(325)
xlabel('Time')
ylabel('P2 (Pa)')
ax2 = gca;
ax2.YGrid = 'on';
% ax2.YLim = [-10 40];
axis auto
h2 = animatedline;
subplot(324)
xlabel('Time')
ylabel('P3 (Pa)')
ax3 = gca;
ax3.YGrid = 'on';
% ax3.YLim = [-10 40];
axis auto
h3 = animatedline;
subplot(326)
xlabel('Time')
ylabel('P4 (Pa)')
ax4 = gca;
ax4.YGrid = 'on';
subplot(322)
xlabel('Time')
ylabel('P5 (Pa)')
ax5 = gca;
ax5.YGrid = 'on';
% ax5.YLim = [-10 40];
axis auto
h5 = animatedline;
figure(2)
xlabel('Time')
ylabel('Angle (deg)')
ax6 = gca;
ax6.YGrid = 'on';
% ax5.YLim = [-10 40];
axis auto
h6 = animatedline;
stop = 0;
startTime = datetime('now');
sum0=0;
sum1=0;
sum2=0;
sum3=0;
sum4=0;
sum5=0;
for i=0:9
sensorValue0=readVoltage(a,'A0')*1024/5-512;
sensorValue1=readVoltage(a,'A1')*1024/5-512;
sensorValue2=readVoltage(a,'A2')*1024/5-512;
sensorValue3=readVoltage(a,'A3')*1024/5-512;
sensorValue4=readVoltage(a,'A4')*1024/5-512;
sensorValue5=readVoltage(a,'A5')*1024/5-512;
sum0=sum0+sensorValue0;
sum1=sum1+sensorValue1;
sum2=sum2+sensorValue2;
sum3=sum3+sensorValue3;
sum4=sum4+sensorValue4;
sum5=sum5+sensorValue5;
end
offset0=sum0/10;
offset1=sum1/10;
offset2=sum2/10;
offset3=sum3/10;
offset4=sum4/10;
offset5=sum5/10;
% Live data
tic
sensorValue1=readVoltage(a,'A1')*1024/5-offset1;
Vout1=(5*sensorValue1)/1024;%-2.5;
sensorValue2=readVoltage(a,'A2')*1024/5-offset2;
Vout2=(5*sensorValue2)/1024;%-2.5;
sensorValue3=readVoltage(a,'A3')*1024/5-offset3;
Vout3=(5*sensorValue3)/1024;%-2.5;
sensorValue4=readVoltage(a,'A4')*1024/5-offset4;
Vout4=(5*sensorValue4)/1024;%-2.5;
sensorValue5=readVoltage(a,'A5')*1024/5-offset5;
Vout5=(5*sensorValue5)/1024;%-2.5;
%Potentionmeter
pot_analog_value = readVoltage(a,'A6')*1024/5;
angle = pot_analog_value*0.1681-84.647; %Calibration from -30 -> 30
addpoints(h1,datenum(t),P1);
ax1.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h2,datenum(t),P2);
ax2.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h3,datenum(t),P3);
ax3.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h4,datenum(t),P4);
ax4.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h5,datenum(t),P5);
ax5.XLim = datenum([t-seconds(30) t]);
datetick('x','keeplimits')
addpoints(h6,datenum(t),angle);
ax6.XLim = datenum([t-seconds(30) t]);
Son C.T. Nguyen 96
APPENDIX
datetick('x','keeplimits')
drawnow
% Check stop condition
stop = stop + 1;
% stop = readDigitalPin(a,'D12');
end
tg =toc;
P0f = smooth(P0Logs,25);
P1f = smooth(P1Logs,25);
P2f = smooth(P2Logs,25);
P3f = smooth(P3Logs,25);
P4f = smooth(P4Logs,25);
P5f = smooth(P5Logs,25);
Pot = smooth(Potentionmeter,25);
% Tu 15Hz
% Scale to P2
P1s2=1.4932.*P1f+8.8706;
P3s2=0.7035.*P3f-4.0602;
P4s2=1.2945.*P4f+8.6707;
Pave2 = 0.25*(P1s2+P2f+P3s2+P4s2);
%% Plot the original and the low pass filtered pressure signal, and
illustrate the
% uncertainty.
figure(3)
subplot(323)
plot(timeSecs,P1Logs,'b',timeSecs,P1f,'r--',timeSecs,P1s2,'g--');
title('Raw vs low pass filter data');
xlabel('Elapsed time (sec)');
ylabel('P1 (Pa)');
legend('P1 raw','P1 low pass filtered','P1 lpf scale')
subplot(325)
plot(timeSecs,P2Logs,'b',timeSecs,P2f,'r--');
xlabel('Elapsed time (sec)');
ylabel('P2 (Pa)');
legend('P2 raw','P2 low pass filtered')
subplot(324)
plot(timeSecs,P3Logs,'b',timeSecs,P3f,'r--',timeSecs,P3s2,'g--');
xlabel('Elapsed time (sec)');
ylabel('P3 (Pa)');
legend('P3 raw','P3 low pass filtered','P3 lpf scale')
subplot(326)
plot(timeSecs,P4Logs,'b',timeSecs,P4f,'r--',timeSecs,P4s2,'g--');
xlabel('Elapsed time (sec)');
ylabel('P4 (Pa)');
legend('P4 raw','P4 low pass filtered','P4 lpf scale')
subplot(322)
plot(timeSecs,P5Logs,'b',timeSecs,P5f,'r--');
xlabel('Elapsed time (sec)');
ylabel('P5 (Pa)');
legend('P5 raw','P5 low pass filtered');
subplot(321)
plot(timeSecs,P0Logs,'b',timeSecs,P0f,'r--');
xlabel('Elapsed time (sec)');
ylabel('P0 (Pa)');
legend('P0 raw','P0 low pass filtered');
figure(4)
plot(timeSecs,Potentionmeter,'b');
xlabel('Elapsed time (sec)');
ylabel('Angle (deg)');
legend('Potentionmeter');
% Rational
AOA_r2=(-0.39594992 +17.644205*Cpa2+0.68876656*Cpb2+2.3146267*Cpa2.^2-
5.4772663*Cpb2.^2+0.036251293*Cpa2.*Cpb2)./...
(1+0.014074689*Cpa2+0.11382881*Cpb2+0.079427094*Cpa2.^2+0.23705264*Cpb
2.^2+0.036232922*Cpa2.*Cpb2);
AOS_r2=(-1.132527+2.4886463*Cpa2+20.881162*Cpb2+0.23468287*Cpa2.^2-
0.7543408*Cpb2.^2+2.4706064*Cpa2.*Cpb2)./...
(1+0.055357355*Cpa2-
0.0077806289*Cpb2++0.088378771*Cpa2.^2+0.06409505*Cpb2.^2++0.051033568
*Cpa2.*Cpb2);
a = 0; % Goc AOA
b = 0; % Goc AOS
,P5Logs(i:end),P0f(i:end),P1f(i:end),P2f(i:end),P3f(i:end),P4f(i:end),
P5f(i:end),...
'VariableNames',{'Time_sec','P1_Pa','P2_Pa','P3_Pa','P4_Pa','P5_Pa',..
.
'lowpassP0','lowpassP1','lowpassP2','lowpassP3','lowpassP4','lowpassP5
'});
Ts2 =
table(P1s2(i:end),P3s2(i:end),P4s2(i:end),'VariableNames',{'P1s2','P3s
2','P4s2'});
Ts2mean =
table(mean(P1s2(i:end)),mean(P2f(i:end)),mean(P3s2(i:end)),mean(P4s2(i
:end)),...
mean(P5f(i:end)),mean(AOA_p2),mean(AOS_p2),mean(Va2),saisoAOA2_rms,sai
soAOS2_rms,mean(saisoVa2_rms),...
'VariableNames',{'P1scale','lowpassP2','P3scale','P4scale','lowpassP5'
,'AOA','AOS','Speed','saisoAOA','saisoAOS','saisoVa'});
Tresults2 =
table(AOA_p2,AOS_p2,AOA_r2,AOS_r2,Va2,Va_ref,Pot(i:end),...
'VariableNames',{'AOA_p','AOS_p','AOA_r','AOS_r','Speed','Speed_Pitot'
,'Angle'});
B. Manufacturing Logbook
C. Experiments Logbook
Experiment for determine scale function (10th measurements)
Use code realtime_lowpass_filter_for_scale Lần đo này để tạo hàm scale mới (scale trên dải vận tốc từ 8 - 20 m/s)
Dây cắm USB ngắn đảm bảo điện áp cấp cho sensor Vận tốc lần này là khoảng 12-29.5 Hz Lấy I từ 40 timesecs
Sampling Fan So lan thi
STT Date Time start Time End AOA AOS Static port
Mearsurement Frequency nghiem
1 18-11-17 16:00 16:05 0 0 200 12 Connect to static port of pitot dai 1
2 18-11-17 16:10 16:15 0 0 200 15 Connect to static port of pitot dai 1
3 18-11-17 15:55 16:00 0 0 200 18 Connect to static port of pitot dai 1
4 18-11-17 16:18 16:20 0 0 200 21 Connect to static port of pitot dai 1
5 18-11-17 16:23 02:24 0 0 200 23.5 Connect to static port of pitot dai 1
6 18-11-17 16:21 16:22 0 0 200 26.8 Connect to static port of pitot dai 1
7 18-11-17 16:23 16:25 0 0 200 29.5 Connect to static port of pitot dai 1
82 20-11-17 10:23 10:24 0 0 250 18.01 Connect to static port of pitot dai 1
83 20-11-17 10:25 10:26 5 0 250 18.02 Connect to static port of pitot dai 1
84 20-11-17 10:27 10:28 10 0 250 18.01 Connect to static port of pitot dai 1
85 20-11-17 10:31 10:32 15 0 250 18.02 Connect to static port of pitot dai 1
86 20-11-17 10:33 10:34 20 0 250 18.03 Connect to static port of pitot dai 1
87 20-11-17 10:36 10:37 -5 0 250 18.02 Connect to static port of pitot dai 1
88 20-11-17 10:39 10:40 -10 0 250 18.02 Connect to static port of pitot dai 1
89 20-11-17 10:41 10:42 -15 0 250 18.02 Connect to static port of pitot dai 1
90 20-11-17 10:44 10:45 -20 0 250 18.02 Connect to static port of pitot dai 1
91 20-11-17 10:47 10:48 0 5 250 18.03 Connect to static port of pitot dai 1
92 20-11-17 10:50 10:51 5 5 250 18.01 Connect to static port of pitot dai 1
93 20-11-17 10:52 10:53 10 5 250 18.01 Connect to static port of pitot dai 1
94 20-11-17 10:54 10:55 15 5 250 18.01 Connect to static port of pitot dai 1
95 20-11-17 10:56 10:57 20 5 250 18.01 Connect to static port of pitot dai 1
96 20-11-17 10:58 10:59 -5 5 250 18.02 Connect to static port of pitot dai 1
97 20-11-17 11:01 11:02 -10 5 250 18.02 Connect to static port of pitot dai 1
98 20-11-17 11:03 11:04 -15 5 250 18 Connect to static port of pitot dai 1
99 20-11-17 11:05 11:06 -20 5 250 18 Connect to static port of pitot dai 1
100 20-11-17 11:08 11:09 0 10 250 18 Connect to static port of pitot dai 1
101 20-11-17 11:10 11:11 5 10 250 18 Connect to static port of pitot dai 1
102 20-11-17 11:13 11:14 10 10 250 18.01 Connect to static port of pitot dai 1
103 20-11-17 11:15 11:16 15 10 250 18.02 Connect to static port of pitot dai 1
104 20-11-17 11:17 11:18 20 10 250 18.01 Connect to static port of pitot dai 1
105 20-11-17 11:20 11:21 -5 10 250 18 Connect to static port of pitot dai 1
106 20-11-17 11:22 11:23 -10 10 250 18 Connect to static port of pitot dai 1
107 20-11-17 11:24 11:25 -15 10 250 18.03 Connect to static port of pitot dai 1
108 20-11-17 11:26 11:27 -20 10 250 18 Connect to static port of pitot dai 1
109 20-11-17 11:30 11:31 0 15 250 18.02 Connect to static port of pitot dai 1
110 20-11-17 11:32 11:33 5 15 250 18.02 Connect to static port of pitot dai 1
111 20-11-17 11:34 11:35 10 15 250 18 Connect to static port of pitot dai 1
112 20-11-17 11:36 11:37 15 15 250 18 Connect to static port of pitot dai 1
113 20-11-17 11:38 11:39 20 15 250 18 Connect to static port of pitot dai 1
114 20-11-17 11:41 11:42 -5 15 250 18 Connect to static port of pitot dai 1
115 20-11-17 11:44 11:45 -10 15 250 18 Connect to static port of pitot dai 1
116 20-11-17 11:46 11:47 -15 15 250 18 Connect to static port of pitot dai 1
117 20-11-17 11:48 11:49 -20 15 250 18 Connect to static port of pitot dai 1
D. Project Timeline