1 // FGTower - a class to provide tower control at towered airports.
3 // Written by David Luff, started March 2002.
5 // Copyright (C) 2002 David C. Luff - david.luff@nottingham.ac.uk
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <simgear/compiler.h>
25 #include <simgear/math/point3d.hxx>
26 #include <simgear/misc/sgstream.hxx>
27 #include <simgear/math/sg_geodesy.hxx>
37 //#include "ATCmgr.hxx"
40 //DCL - a complete guess for now.
41 #define FG_TOWER_DEFAULT_RANGE 30
43 // Structure for holding details of a plane under tower control.
44 // Not fixed yet - may include more stuff later.
50 TowerPlaneRec(string ID);
51 TowerPlaneRec(Point3D pt);
52 TowerPlaneRec(string ID, Point3D pt);
56 double eta; // minutes
57 double dist_out; // miles from theshold
60 // ought to add time cleared to depart so we can nag if necessary
61 bool longFinalReported;
62 bool longFinalAcknowledged;
64 bool finalAcknowledged;
66 // enum type - light, medium, heavy etc - we need someway of approximating the aircraft type and performance.
69 typedef list < TowerPlaneRec* > tower_plane_rec_list_type;
70 typedef tower_plane_rec_list_type::iterator tower_plane_rec_list_iterator;
71 typedef tower_plane_rec_list_type::const_iterator tower_plane_rec_list_const_iterator;
74 class FGTower : public FGATC {
85 void RequestLandingClearance(string ID);
86 void RequestDepartureClearance(string ID);
87 void ReportFinal(string ID);
88 void ReportLongFinal(string ID);
89 void ReportOuterMarker(string ID);
90 void ReportMiddleMarker(string ID);
91 void ReportInnerMarker(string ID);
92 void ReportGoingAround(string ID);
93 void ReportRunwayVacated(string ID);
95 // Parse a literal message to decide which of above it represents.
96 // (a long term project that eventually will hopefully receive the output from voice recognition software.)
97 void LiteralTransmission(string trns, string ID);
99 inline void SetDisplay() {display = true;}
100 inline void SetNoDisplay() {display = false;}
102 inline string get_trans_ident() { return trans_ident; }
103 inline atc_type GetType() { return TOWER; }
105 // Make a request of tower control
106 //void Request(tower_request request);
110 void IssueLandingClearance(TowerPlaneRec* tpr);
111 void IssueGoAround(TowerPlaneRec* tpr);
112 void IssueDepartureClearance(TowerPlaneRec* tpr);
114 bool display; // Flag to indicate whether we should be outputting to the ATC display.
115 bool displaying; // Flag to indicate whether we are outputting to the ATC display.
117 // Need a data structure to hold details of the various active planes
118 // or possibly another data structure with the positions of the inactive planes.
119 // Need a data structure to hold outstanding communications from aircraft.
121 // Linked-list of planes on approach ordered with nearest first (timewise).
122 // Includes planes that have landed but not yet vacated runway.
123 // Somewhat analagous to the paper strips used (used to be used?) in real life.
124 tower_plane_rec_list_type appList;
126 // List of departed planes
127 tower_plane_rec_list_type depList;
129 // List of planes waiting to depart
130 tower_plane_rec_list_type holdList;
132 // List of planes on rwy
133 tower_plane_rec_list_type rwyList;
135 // Ground can be separate or handled by tower in real life.
136 // In the program we will always use a separate FGGround class, but we need to know
137 // whether it is supposed to be separate or not to give the correct instructions.
138 bool separateGround; // true if ground control is separate
139 FGGround* groundPtr; // The ground control associated with this airport.
142 // for failure modeling
143 string trans_ident; // transmitted ident
144 bool tower_failed; // tower failed?
146 friend istream& operator>> ( istream&, FGTower& );
149 #endif //_FG_TOWER_HXX