![]() |
VR-Forces Developer's Guide
|
The DtAdsbDataManager loads and manages Automatic Dependent Surveillance - Broadcast (ADS-B) data, which is used to track and monitor real world aircraft. This data can be used to create and simulate clutter entities in a simulation.

Public Types | |
| typedef std::unordered_map < DtIcaoAddress, DtAdsbTrack * > | DtAdsbTrackMap |
Public Types inherited from DtAdsbDataServiceInterface | |
| using | DtIcaoAddress = int |
| using | DtIcaoAddrSet = std::set< DtIcaoAddress > |
Public Member Functions | |
| DtAdsbDataManager (DtSimulationServices *simServices) | |
| virtual | ~DtAdsbDataManager () override |
| virtual bool | init () |
| virtual double | simTime () |
| virtual void | tick () |
| virtual bool | isDataLoading () const override |
| virtual bool | isFileLoadError () const override |
| virtual DtAdsbDataJob::Ptr | findTracksInArea (const DtVertexList &areaVertices, bool unownedOnly=true) override |
| virtual DtAdsbDataJob::Ptr | findTracksInAreaDuringTime (const DtVertexList &areaVertices, double startSimTime, double endSimTime, bool unownedOnly) override |
| virtual DtTrackHandlePtr | trackHandleForAddress (DtIcaoAddress trackId) const override |
| virtual const DtAdsbTrack * | trackObject (DtIcaoAddress trackId) const |
| virtual DtAdsbTrack * | trackObject (DtIcaoAddress trackId) |
| virtual DtAdsbDataJob::Ptr | requestOwnershipOfTracks (const DtIcaoAddrSet &trackIds, const double lastSimTime) override |
| virtual DtAdsbDataJob::Ptr | releaseOwnershipOfTracks (const DtIcaoAddrSet &trackIds) override |
| virtual double | adsbTimeFromSimTime (double simTime) const override |
| virtual std::string | stringForEpochTime (double t) const override |
| virtual double | simTimeFromAdsbTime (double adsbTime) const override |
| virtual double | finalDataSimTime () const override |
| virtual DtPointHandlePtr | firstPointAfterTime (const DtTrackHandlePtr track, double simTime) const override |
| virtual DtPointHandlePtr | firstPointAfterTime (const DtAdsbTrack *track, double simTime) const |
| virtual DtPointHandlePtr | lastPointBeforeTime (const DtTrackHandlePtr track, double simTime) const override |
| virtual DtPointHandlePtr | lastPointBeforeTime (const DtAdsbTrack *track, double simTime) const |
| virtual void | updateSquawkChangedTimestamp (const int icaoAddress, const double &simTime) override |
| virtual DtPointHandlePtr | clonePoint (const DtPointHandlePtr p) const override |
| virtual double | barometricAltitudeAdjustment (const DtVector &localPosition, const double simTime) const override |
| virtual void | resetData () override |
| virtual void | loadAdsbData (const double startSimTime, const double endSimTime) |
| virtual int | trackToDebug () const |
| virtual void | stop () |
| virtual bool | timeToStop () |
Public Member Functions inherited from DtAdsbDataServiceInterface | |
| DtAdsbDataServiceInterface () | |
| virtual | ~DtAdsbDataServiceInterface () |
Static Public Member Functions | |
| static void | tickCallback (void *usr) |
Protected Types | |
| enum | DtIntervalResult { Before, Inside, After } |
| typedef tbb::spin_mutex | QueryQueueMutex |
| typedef std::list < DtAdsbDataJob::Ptr > | JobQueue |
Protected Member Functions | |
| virtual void | performDataReset () |
| virtual void | getDataFileName (const int dayOfWeek, const int hourOfDay, char *fName) |
| virtual void | getNextFileDayAndHour (int &day, int &hour) |
| virtual void | getPreviousFileDayAndHour (int &day, int &hour) |
| virtual bool | secondTimeGreaterThanFirst (const int day1, const int hour1, const int day2, const int hour2) |
| virtual void | updateSquawkChangedTimestamp (DtAdsbTrack &track, const double simTime) |
| virtual DtIntervalResult | getDayHourForFileContainingTime (const double simTime, int &day, int &hour) |
| virtual bool | readInfoFile () |
| virtual void | startAdsbDataLoad (const double startTime, const double endTime) |
| virtual void | calculateTrackTimeOffset () |
| virtual bool | readOneDataFile (const int day, const int hour) |
Private Member Functions | |
| DtAdsbDataManager (const DtAdsbDataManager &orig) | |
| DtAdsbDataManager & | operator= (const DtAdsbDataManager &other) |
Friends | |
| class | DtAdsbDataManagerJob |
| typedef std::unordered_map<DtIcaoAddress, DtAdsbTrack*> DtAdsbDataManager::DtAdsbTrackMap |
|
protected |
|
protected |
|
protected |
| DtAdsbDataManager::DtAdsbDataManager | ( | DtSimulationServices * | simServices | ) |
Constructs the ADSB data manager.
|
overridevirtual |
The destructor.
|
private |
copy constructor not defined
|
virtual |
Initializes the ADSB data manager.
|
virtual |
Provide current sim time.
|
static |
Static tick method that is registered with DtSimulationServices callbacks. Calls tick().
|
virtual |
Tick the ADSB data manager. Determines whether tracks have entered or exited areas of interest and calls registered functions to notify them of the change.
|
overridevirtual |
Returns true if ADSB data has been loaded.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Indicates that there was an error during the reading of data files, and the data manager cannot provide data.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Starts a query for all tracks in the specified area. The last point in a track before the current sim time must be in the area for the track to be considered in the area.
If unownedOnly is true (the default) then only unowned tracks are returned. areaVertices are in geocentric coordinates.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Starts a query for all tracks in the specified area. A track must cross the area between the given sim times for the track to be considered in the area. Note that if the startSimTime is before the current sim time, the Data Service may no longer have that path data available.
If unownedOnly is true (the default) then only unowned tracks are returned. areaVertices are in geocentric coordinates.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
This will actually return a DtAdsbManagerTrackHandle.
Implements DtAdsbDataServiceInterface.
|
virtual |
Not part of the service interface. Gets the underlying track storage structure from an ID. Used by adsb manager jobs.
|
virtual |
|
overridevirtual |
Request ownership of the specified given tracks.
| trackIds | is the set of track IDs that the requester would like to own. |
| lastSimTime | is the last time of interest for these tracks. This time is used to determine what data to read from files, if the data is not already in memory. |
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Release ownership of the specified tracks.
Implements DtAdsbDataServiceInterface.
Converts a sim time to ADSB data time. Needed to understand how sim time relates to the timestamps in the ADSB track data.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Provides a string for the "adsb time" in a path point time stamp. This is useful in finding points in the source ADSB data for debugging.
Implements DtAdsbDataServiceInterface.
Converts the ADSB data time to sim time. Needed to understand how sim time relates to the timestamps in the ADSB track data.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Returns the sim time for the last point of ADSB data available.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Find the first point in the track's path that occurs after (or at) the specified sim time. If no points meet this criteria, an empty pointer is returned. (The caller of this function should check that result.get() != nullPtr before using the result.)
Implements DtAdsbDataServiceInterface.
|
virtual |
This version of the function is used by manager jobs; it is not part of the adsbDataServiceInterface.
|
overridevirtual |
Find the last point in the track's path that occurs before (or at) the specified sim time. If no points meet this criteria, an empty pointer is returned. (The caller of this function should check that result.get() != nullPtr before using the result.)
Implements DtAdsbDataServiceInterface.
|
virtual |
This version of the function is used by manager jobs; it is not part of the adsbDataServiceInterface.
|
overridevirtual |
Find the first point in the track's path that occurs after the specified sim time that contains a new squawk code and update the track's mySquawkChangedTimestamp value. If no points meet this criteria, the track's mySquawkChangedTimestamp value is set to infinity, indicating there is no new squawk code in the path points thus far.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Makes a new point handle that refers to the same path point as p. The original or new handle can later be changed (e.g., with the ++ operator) without affecting the other handle.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Returns barometric altitude adjustment. This is a distance in meters that is added to the pressure altitude data in ADSB to determine an altitude in the simulation. Ideally this function would use the measured sea level pressure at the (2D) location at the given time compared to the Standard Atmosphere to calculate the offset. The default function just returns a constant, however.
Implements DtAdsbDataServiceInterface.
|
overridevirtual |
Marks ADSB data to be reset. This is called in the cgf module when a scenario is rewound, rolled back, or closed.
Since as a scenario plays, ADSB data is incrementally deleted from memory, a scenario rewind in general requires that data files be re-read. Therefore this function clears and resets everything in the ADSB data manager so that it reads all files again.
Implements DtAdsbDataServiceInterface.
|
virtual |
Loads the ADSB data.
|
inlinevirtual |
|
virtual |
|
virtual |
|
protectedvirtual |
Resets all ADSB data to be unowned. Resets status so that data files must all be read again. Clears all data.
|
protectedvirtual |
Uses myBaseFileName and the two arguments to construct a string which is the name of an ADSB data file to read. Puts the string in fName.
Given a day and hour, adds one myDataFileInterval and changes day and hour to reflect the new time. Day may increase without bound, but hour is always 0 - 23. The day and hour are expected to be valid values corresponding to an input data file; the result will be the next data file in time.
|
protectedvirtual |
Like getNextFileDayAndHour, but the day and hour are decremented by myDataFileInterval. The day may decrease without bound (i.e. to negative values).
|
protectedvirtual |
Returns true if the second day-hour time is greater than the first.
|
protectedvirtual |
This version of the function is not part of the adsb service interface, but is used internally by the adsb data manager.
|
protectedvirtual |
Given a day of the week and an hour of the day, find the day and hour of a data file that contains this time. The file day and hour are passed back to the caller in the function arguments. The function uses the conversion from sim time to ADSB data time computed when the info file was read, and it uses myFirst/Final DataAdsbTime computed then as well to determine if the input simTime is in the range covered by the data. If not, false is returned and the day and hour arguments are not set. (Otherwise, true is returned.) The function starts day and hour with the values in myFirsDatafileDayOfWeek/Hour of Day and increments forward by myDataFileTimeInterval to generate day and hour values that correspond to data files.
|
protectedvirtual |
Reads the info file for the ADSB data files, which is expected to be in the same directory as the data files and have the name adsbInfo.txt. This file starts with these lines (with the appropriate values):
Data version: 01.00
Start day of week: 0
Start hour of day: 0
Time interval in each file: 6
File name base: adsbData.ads
This data is read into myFirstInputFileDayOfWeek, myFirstInputFileHourOfDay, myDatafileTimeInterval, and myBaseFileName.
|
protectedvirtual |
Spawns a thread to begin loading ADSB data.
|
protectedvirtual |
Calculates and sets #myTrackTimeAtSimTime0, which is used to translate between sim time and ADSB track data time.
Read the data file for the give day and hour.
|
private |
assignment operator not defined
|
friend |
|
protected |
Index into the track data by ICAO address.
|
protected |
List of the subset of tracks that are not in use. An unordered set of addresses.
|
protected |
List of the subset of tracks that are in use.
|
mutableprotected |
|
mutableprotected |
|
protected |
These jobs are new, and haven't been checked to see if they can execute immediately or not.
|
protected |
These jobs are waiting for more data to be loaded.
|
protected |
These jobs can be executed without loading more data.
|
protected |
Information read from the info text file that is accompanies the flight track files. The DoW and HoD, when combined with the baseName, indicate the name of the first and last flight track files. The interval (in hours), determines the name of succeeding files. Note that the firstDataFileDayOfWeek is in [0-6], but the lastDataFileDayOfWeek is >= 0 (should be >= myFirstDataFiledayOfWeek + 6).
|
protected |
|
protected |
|
protected |
|
protected |
ADSB Epoch time of beginning of day for first data.
|
protected |
|
protected |
|
protected |
Even if the data is reset and reused, the info file doesn't have to be re-read. This flag also indicates that no data has been read yet (when it is false).
|
protected |
Indices for last file read.
|
protected |
|
protected |
|
protected |
|
protected |
This is the dateTime at the beginning of the hour of the first ADSB time.
|
protected |
Computed from above.
|
protected |
This is the dateTime of the end of the last ADSB data file.
|
protected |
Computed from above.
|
protected |
The latest end time of all data requests received (sim time).
|
protected |
The latest time of all data loaded. (sim time)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
For debugging. Optionally read in from info file in data. An ICAO address.
|
protected |