This is the sixth and the last part of modelling instrument flight simulator in MATALB tutorial series. I will be talking about the turn coordinator subsidised by full MATLAB code. The turn coordinator is a flight instrument that helps pilots perform a coordinated turns, the instrument displays both turn rate and ‘slip’ or ‘skid’ rate if the aircraft is losing height or turn during the manoeuvre.
Model Turn Coordinator written in OpenGL C++
The turn coordinator consists of:
1- Frame
2- Two sets of strips indicating the turn rate.
3- Ball inside tube indicating the slip rate.
4- Aircraft lateral axis reference
The Frame
The Frame is represented graphically by 2 circles at different diameters.
| Code: |
%Frame
A = linspace(0,pi+pi,100);
XFrameOut = 8*cos(A);
YFrameOut = 8*sin(A);
XFrameIn = 7*cos(A);
YFrameIn = 7*sin(A);
plot (XFrameOut,YFrameOut,'w','linewidth',3);
hold on
plot (XFrameIn,YFrameIn,'w','linewidth',3);
|
Please refer to
[ Modelling Flight Instrument | Altimeter] for more detailed explanation about the code.
Strips
The Strips are static markers indicating turn rates of 0 and 3 degrees/second. We will follow the same procedures used in plotting radial strips in the
[ Modelling Flight Instrument | Attitude Indicator 2]
| Code: |
% Stips Located at 0 and 3 deg/sec
Xstrips = [cosd(0.0) cosd(3*scale)];
Xstrips = [7*Xstrips;8*Xstrips];
Xstrips = [Xstrips -Xstrips];
Ystrips = [-sind(0.0) -sind(3*scale)];
Ystrips = [7*Ystrips;8*Ystrips];
Ystrips = [Ystrips Ystrips];
% Plot the strips
line(Xstrips,Ystrips,'Color','w','LineWidth',2);
% Text Labels
text(7.20*cosd(4*scale),-7.5*sind(4*scale),'R','color','w')
text(-7.80*cosd(4*scale),-7.5*sind(4*scale),'L','color','w')
|
Skid rate indicator (Ball + tube)
This component will be represented by circle (ball), box (tube) and line markers at the middle. These component will be plotted using
patch and
line MATLAB functions as we did in the
[ Modelling Flight Instrument | Attitude Indicator 2], in which the box will modelled using the
patch function, the ball will be modelled using the
fill function, using a dimensions of our choice to best represent these component.
The is a dynamic component that will be moving to indicate the slip rate, so a variable (slip_rate) will be added to the function to displace the ball along x axis as the slip rate change.
| Code: |
% Slip Rate Box
Xstripsox = [-5 5 5 -5];
Ystripsox = [-4 -4 -2 -2];
patch (Xstripsox,Ystripsox,'w');
% Ball
fill(1.0*cos(A)+slip_rate,1.0*sin(A)-3,[0.5,0.5,0.5]);
% Markers
line([-1.5 1.5; -1.5 1.5],[-4 -2; -2 -4],'Color','black','LineWidth',4)
|
Aircraft lateral axis reference
Consisting of rotating line which represent the wings and a static circle located at the centre which represents the aircraft body, we will follow the same rotation formula in
[ Modelling Flight Instrument | Attitude Indicator 3]
| Code: |
% Aircraft Lateral Reference
phi_dot = phi_dot *scale;
Xaircraft = [-6.0 0.0];
Yaircraft = [6.0 0.0];
% Rotation Matrix
Mrot = [cosd(phi_dot) -sind(phi_dot); sind(phi_dot) cos(phi_dot)];
Xaircraft = Xaircraft*Mrot;
Yaircraft = Yaircraft*Mrot;
% Line which represent the aircraft wing
line([Xaircraft(1) Yaircraft(1)],[Xaircraft(2) Yaircraft(2)],'Color','g','LineWidth',4);
% Circle which represents the aircraft body
fill(1.0*cos(A),1.0*sin(A),'w');
|
Now we have a fully functioning Turn Coordinator that can be used for simulation purposes. Here is the full MATLAB Code
Something is hidden for guests. Please log in or register to see it.