123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- .TH "ACalc" 3 "Mon Jul 11 2022" "openPilotLog" \" -*- nroff -*-
- .ad l
- .nh
- .SH NAME
- ACalc \- The \fBACalc\fP 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\&.
- .SH SYNOPSIS
- .br
- .PP
- .SS "Classes"
- .in +1c
- .ti -1c
- .RI "struct \fBNightTimeValues\fP"
- .br
- .RI "The \fBNightTimeValues\fP struct encapsulates values relating to night time that are needed by the \fBNewFlightDialog\fP\&. "
- .in -1c
- .SS "Functions"
- .in +1c
- .ti -1c
- .RI "double \fBradToDeg\fP (double rad)"
- .br
- .RI "radToDeg Converts radians to degrees "
- .ti -1c
- .RI "double \fBdegToRad\fP (double deg)"
- .br
- .RI "degToRad Converts degrees to radians "
- .ti -1c
- .RI "double \fBradToNauticalMiles\fP (double rad)"
- .br
- .RI "radToNauticalMiles Convert Radians to nautical miles "
- .ti -1c
- .RI "double \fBgreatCircleDistance\fP (double lat1, double lon1, double lat2, double lon2)"
- .br
- .RI "greatCircleDistance Calculates Great Circle distance between two coordinates, return in Radians\&. "
- .ti -1c
- .RI "double \fBgreatCircleDistanceBetweenAirports\fP (const QString &dept, const QString &dest)"
- .br
- .RI "\fBACalc::greatCircleDistanceBetweenAirports\fP Calculates Great Circle distance between two coordinates, return in nautical miles\&. "
- .ti -1c
- .RI "QVector< QVector< double > > \fBintermediatePointsOnGreatCircle\fP (double lat1, double lon1, double lat2, double lon2, int tblk)"
- .br
- .RI "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\&. "
- .ti -1c
- .RI "double \fBsolarElevation\fP (QDateTime utc_time_point, double lat, double lon)"
- .br
- .RI "Calculates solar elevation angle for a given point in time and latitude/longitude coordinates\&. "
- .ti -1c
- .RI "int \fBcalculateNightTime\fP (const QString &dept, const QString &dest, QDateTime departureTime, int tblk, int nightAngle)"
- .br
- .RI "Calculates which portion of a flight was conducted in night conditions\&. "
- .ti -1c
- .RI "bool \fBisNight\fP (const QString &icao, QDateTime event_time, int night_angle)"
- .br
- .ti -1c
- .RI "QString \fBformatTimeInput\fP (QString user_input)"
- .br
- .RI "\fBACalc::formatTimeInput\fP 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\&. "
- .ti -1c
- .RI "void \fBupdateAutoTimes\fP (int acft_id)"
- .br
- .RI "\fBACalc::updateAutoTimes\fP When the details of an aircraft are changed, this function recalculates deductable times for this aircraft and updates the database accordingly\&. "
- .ti -1c
- .RI "void \fBupdateNightTimes\fP ()"
- .br
- .RI "\fBACalc::updateNightTimes\fP updates the night times in the database, used when changing night angle setting for example\&. "
- .in -1c
- .SH "Detailed Description"
- .PP
- The \fBACalc\fP 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\&.
- .SH "Function Documentation"
- .PP
- .SS "int ACalc::calculateNightTime (const QString & dept, const QString & dest, QDateTime departureTime, int tblk, int nightAngle)"
- .PP
- Calculates which portion of a flight was conducted in night conditions\&.
- .PP
- \fBParameters\fP
- .RS 4
- \fIdept\fP - ICAO 4-letter code of Departure Airport
- .br
- \fIdest\fP - ICAO 4-letter Code of Destination Airport
- .br
- \fIdepartureTime\fP - QDateTime of Departure (UTC)
- .br
- \fItblk\fP - Total block time in minutes
- .br
- \fInightAngle\fP - the solar elevation angle where night conditons exist\&. Default -6 (end of civil evening twilight)
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- Total number of minutes under night flying conditions
- .RE
- .PP
- .SS "double ACalc::degToRad (double deg)\fC [inline]\fP"
- .PP
- degToRad Converts degrees to radians
- .PP
- \fBParameters\fP
- .RS 4
- \fIdeg\fP
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- radians
- .RE
- .PP
- .SS "QT_DEPRECATED QString ACalc::formatTimeInput (QString user_input)"
- .PP
- \fBACalc::formatTimeInput\fP 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\&.
- .PP
- \fBParameters\fP
- .RS 4
- \fIuserinput\fP from a QLineEdit
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- formatted QString 'hh:mm' or Empty String
- .RE
- .PP
- .SS "double ACalc::greatCircleDistance (double lat1, double lon1, double lat2, double lon2)"
- .PP
- greatCircleDistance Calculates Great Circle distance between two coordinates, return in Radians\&.
- .PP
- \fBParameters\fP
- .RS 4
- \fIlat1\fP Location Latitude in degrees -90:90 ;S(-) N(+)
- .br
- \fIlon1\fP Location Longitude in degrees -180:180 W(-) E(+)
- .br
- \fIlat2\fP Location Latitude in degrees -90:90 ;S(-) N(+)
- .br
- \fIlon2\fP Location Longitude in degrees -180:180 W(-) E(+)
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- .RE
- .PP
- The purpose of the following functions is to provide functionality enabling the Calculation of night flying time\&. EASA defines night as follows:
- .PP
- ‘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\&.
- .PP
- This is the proccess of Calculating night time in this program:
- .PP
- 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)
- .PP
- 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\&.
- .PP
- 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\&.
- .SS "double ACalc::greatCircleDistanceBetweenAirports (const QString & dept, const QString & dest)"
- .PP
- \fBACalc::greatCircleDistanceBetweenAirports\fP Calculates Great Circle distance between two coordinates, return in nautical miles\&.
- .PP
- \fBParameters\fP
- .RS 4
- \fIdept\fP ICAO 4-letter Airport Identifier
- .br
- \fIdest\fP ICAO 4-letter Airport Identifier
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- Nautical Miles From Departure to Destination
- .RE
- .PP
- .SS "QVector< QVector< double > > ACalc::intermediatePointsOnGreatCircle (double lat1, double lon1, double lat2, double lon2, int tblk)"
- .PP
- 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\&.
- .PP
- \fBParameters\fP
- .RS 4
- \fIlat1\fP Location Latitude in degrees -90:90 ;S(-) N(+)
- .br
- \fIlon1\fP Location Longitude in degrees -180:180 W(-) E(+)
- .br
- \fIlat2\fP Location Latitude in degrees -90:90 ;S(-) N(+)
- .br
- \fIlon2\fP Location Longitude in degrees -180:180 W(-) E(+)
- .br
- \fItblk\fP Total Blocktime in minutes
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- coordinates {lat,lon} along the Great Circle Track
- .RE
- .PP
- .SS "double ACalc::radToDeg (double rad)\fC [inline]\fP"
- .PP
- radToDeg Converts radians to degrees
- .PP
- \fBParameters\fP
- .RS 4
- \fIrad\fP
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- degrees
- .RE
- .PP
- .SS "double ACalc::radToNauticalMiles (double rad)\fC [inline]\fP"
- .PP
- radToNauticalMiles Convert Radians to nautical miles
- .PP
- \fBParameters\fP
- .RS 4
- \fIrad\fP
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- nautical miles
- .RE
- .PP
- .SS "double ACalc::solarElevation (QDateTime utc_time_point, double lat, double lon)"
- .PP
- 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
- .PP
- 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++\&.
- .PP
- Darin C\&. Koblock: https://www.mathworks.com/matlabcentral/profile/authors/1284781 Kevin Godden: https://www.ridgesolutions.ie/index.php/about-us/
- .PP
- \fBParameters\fP
- .RS 4
- \fIutc_time_point\fP - QDateTime (UTC) for which the elevation is Calculated
- .br
- \fIlat\fP - Location Latitude in degrees -90:90 ;S(-) N(+)
- .br
- \fIlon\fP - Location Longitude in degrees -180:180 W(-) E(+)
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- elevation - double of solar elevation in degrees\&.
- .RE
- .PP
- .SS "void ACalc::updateAutoTimes (int acft_id)"
- .PP
- \fBACalc::updateAutoTimes\fP When the details of an aircraft are changed, this function recalculates deductable times for this aircraft and updates the database accordingly\&.
- .PP
- \fBParameters\fP
- .RS 4
- \fIacft\fP An aircraft object\&.
- .RE
- .PP
- \fBReturns\fP
- .RS 4
- .RE
- .PP
- .SH "Author"
- .PP
- Generated automatically by Doxygen for openPilotLog from the source code\&.
|