ACalc(3)

NAME
ACalc - The ACalc namespace provides various functions for calculations that are performed outside of the database. This includes tasks like converting different units and formats, or functions calculating block time or night time.

SYNOPSIS

  Classes
struct NightTimeValues
The NightTimeValues struct encapsulates values relating to night time that are needed by the NewFlightDialog.

  Functions
double radToDeg (double rad)
radToDeg Converts radians to degrees
double degToRad (double deg)
degToRad Converts degrees to radians
double radToNauticalMiles (double rad)
radToNauticalMiles Convert Radians to nautical miles
double greatCircleDistance (double lat1, double lon1, double lat2, double lon2)
greatCircleDistance Calculates Great Circle distance between two coordinates, return in Radians.
double greatCircleDistanceBetweenAirports (const QString &dept, const QString &dest)
ACalc::greatCircleDistanceBetweenAirports Calculates Great Circle distance between two coordinates, return in nautical miles.
QVector< QVector< double > > intermediatePointsOnGreatCircle (double lat1, double lon1, double lat2, double lon2, int tblk)
Calculates a list of points (lat,lon) along the Great Circle between two points. The points are spaced equally, one minute of block time apart.
double solarElevation (QDateTime utc_time_point, double lat, double lon)
Calculates solar elevation angle for a given point in time and latitude/longitude coordinates.
int calculateNightTime (const QString &dept, const QString &dest, QDateTime departureTime, int tblk, int nightAngle)
Calculates which portion of a flight was conducted in night conditions.
bool isNight (const QString &icao, QDateTime event_time, int night_angle)
QString formatTimeInput (QString user_input)
ACalc::formatTimeInput verifies user input and formats to hh:mm if the output is not a valid time, an empty string is returned. Accepts input as hh:mm, h:mm, hhmm or hmm.
void updateAutoTimes (int acft_id)
ACalc::updateAutoTimes When the details of an aircraft are changed, this function recalculates deductable times for this aircraft and updates the database accordingly.
void updateNightTimes ()
ACalc::updateNightTimes updates the night times in the database, used when changing night angle setting for example.

Detailed Description

The ACalc namespace provides various functions for calculations that are performed outside of the database. This includes tasks like converting different units and formats, or functions calculating block time or night time.

Function Documentation

  int ACalc::calculateNightTime (const QString & dept, const QString & dest, QDateTime departureTime, int tblk, int nightAngle)

Calculates which portion of a flight was conducted in night conditions.

Parameters
    dept - ICAO 4-letter code of Departure Airport
    dest - ICAO 4-letter Code of Destination Airport
    departureTime - QDateTime of Departure (UTC)
    tblk - Total block time in minutes
    nightAngle - the solar elevation angle where night conditons exist. Default -6 (end of civil evening twilight)

Returns
    Total number of minutes under night flying conditions

  double ACalc::degToRad (double deg) [inline]

degToRad Converts degrees to radians

Parameters
    deg

Returns
    radians

  QT_DEPRECATED QString ACalc::formatTimeInput (QString user_input)

ACalc::formatTimeInput verifies user input and formats to hh:mm if the output is not a valid time, an empty string is returned. Accepts input as hh:mm, h:mm, hhmm or hmm.

Parameters
    userinput from a QLineEdit

Returns
    formatted QString 'hh:mm' or Empty String

  double ACalc::greatCircleDistance (double lat1, double lon1, double lat2, double lon2)

greatCircleDistance Calculates Great Circle distance between two coordinates, return in Radians.

Parameters
    lat1 Location Latitude in degrees -90:90 ;S(-) N(+)
    lon1 Location Longitude in degrees -180:180 W(-) E(+)
    lat2 Location Latitude in degrees -90:90 ;S(-) N(+)
    lon2 Location Longitude in degrees -180:180 W(-) E(+)

Returns

The purpose of the following functions is to provide functionality enabling the Calculation of night flying time. EASA defines night as follows:

‘Night’ means the period between the end of evening civil twilight and the beginning of morning civil twilight or such other period between sunset and sunrise as may be prescribed by the appropriate authority, as defined by the Member State.

This is the proccess of Calculating night time in this program:

1) A flight from A to B follows the Great Circle Track along these two points at an average cruising height of 11km. (~FL 360)

2) Any time the Elevation of the Sun at the current position is less than -6 degrees, night conditions are present. 3) The Calculation is performed for every minute of flight time.

In general, input and output for most functions is decimal degrees, like coordinates are stowed in the airports table. Calculations are normally done using Radians.

  double ACalc::greatCircleDistanceBetweenAirports (const QString & dept, const QString & dest)

ACalc::greatCircleDistanceBetweenAirports Calculates Great Circle distance between two coordinates, return in nautical miles.

Parameters
    dept ICAO 4-letter Airport Identifier
    dest ICAO 4-letter Airport Identifier

Returns
    Nautical Miles From Departure to Destination

  QVector< QVector< double > > ACalc::intermediatePointsOnGreatCircle (double lat1, double lon1, double lat2, double lon2, int tblk)

Calculates a list of points (lat,lon) along the Great Circle between two points. The points are spaced equally, one minute of block time apart.

Parameters
    lat1 Location Latitude in degrees -90:90 ;S(-) N(+)
    lon1 Location Longitude in degrees -180:180 W(-) E(+)
    lat2 Location Latitude in degrees -90:90 ;S(-) N(+)
    lon2 Location Longitude in degrees -180:180 W(-) E(+)
    tblk Total Blocktime in minutes

Returns
    coordinates {lat,lon} along the Great Circle Track

  double ACalc::radToDeg (double rad) [inline]

radToDeg Converts radians to degrees

Parameters
    rad

Returns
    degrees

  double ACalc::radToNauticalMiles (double rad) [inline]

radToNauticalMiles Convert Radians to nautical miles

Parameters
    rad

Returns
    nautical miles

  double ACalc::solarElevation (QDateTime utc_time_point, double lat, double lon)

Calculates solar elevation angle for a given point in time and latitude/longitude coordinates. It is based on the formulas found here: http://stjarnhimlen.se/comp/tutorial.html#5

Credit also goes to Darin C. Koblick for his matlab implementation of various of these formulas and to Kevin Godden for porting it to C++.

Darin C. Koblock: https://www.mathworks.com/matlabcentral/profile/authors/1284781 Kevin Godden: https://www.ridgesolutions.ie/index.php/about-us/

Parameters
    utc_time_point - QDateTime (UTC) for which the elevation is Calculated
    lat - Location Latitude in degrees -90:90 ;S(-) N(+)
    lon - Location Longitude in degrees -180:180 W(-) E(+)

Returns
    elevation - double of solar elevation in degrees.

  void ACalc::updateAutoTimes (int acft_id)

ACalc::updateAutoTimes When the details of an aircraft are changed, this function recalculates deductable times for this aircraft and updates the database accordingly.

Parameters
    acft An aircraft object.

Returns

Author

Generated automatically by Doxygen for openPilotLog from the source code.