Hi!
After a short reading your code I detected one error.
This line is wrong :The division by 2 should NOT be inside the arcsin but
D := arcsin(sqrt(dx**2 + dy**2 + dz**2) / 2) * diameter;
D := arcsin(sqrt(dx**2 + dy**2 + dz**2) ) * diameter/2;
And please: Don't compute miles. Since 1975 the rule for scientific work is to use metrics.
The last time the NASA did not respect that rule the "Mars Climate Orbiter" missed the Mars. And 200 Million $ vanished in the universe.
Winni
@winni
Function EarthDistance (const long1, lat1, long2 , lat2 : single): single; inline; // km
I don't know how to call the function. I understand the lat1 and lat2 but not the long1, and long2.
The cruse of the airplane is 609 miles per hour or 10.15 miles a min.
So 567 / 60 = 9.45 MP min.yeah, no wonder things are going wrong ;)
5699 / 7.45 * 60 = 45,879
It gives me 2346.44922 {KM}A mile is about 1.6 KM so if that 2346.44922 {KM} is your distance between Osaka and Amsterdam expressed in KiloMetres then there seems to be something off.
Is that anywhere close?
A mile is about 1.6 KM so if that 2346.44922 {KM} is your distance between Osaka and Amsterdam expressed in KiloMetres then there seems to be something off.
[...] 42 KM longer than my original 5699 miles. [...]Over such large distances it should matter that the earth is not a sphere but an ellipsoid. Does you distance calculation take care of that? And how is that officially handled?
I just need a reasonable approximation of the distance [...]In this case forget my post. The calculation based on the spherical surface does in fact provide a "reasonable" distance value for most practical means. Except, maybe, for a very ambitious frequent flyer who could feel cheated if the airline company would calculate flight miles based on the spherical model.
So I have tried a different shorter route. Phx to KME:
PHX Fri 03-Jul-2020 05:14PM MST to MKE Fri 03-Jul-2020 10:42PM CDT
Actial Flight Time 3 hrs 28 min posted by the airline. This was in a Boeing 737 Cruise 523
It's 1458 miles div 8.71 = 167.393799 min or about 180 min / 3 hours. Factor in Taxi and decent and it's pretty close to the actual.
Airplane is landing before start time?Oh, my :-[
Airplane is landing before start time?Oh, my :-[
Glad that at least someone is awake... I completely overlooked that part :-[
I don't know how to do this. Is there another way of solving the problem like a table lookup or something?I'm just a quick visitor of this thread (haven't read everything), you mean like a timezone database where you are able to look up the local time offsets ?
What you get is the following:No idea what "opr" is but, that is not important for us right now.
opr Dept Arrv Plane EPOCH time Lat Lon
AAL KMKE KPHX B787 1592610243 33.4333 -111.999
What I need to do is determine the Local time at the departure airport and the local time at the arrival airport regardless of the position of the aircraft.(*1)
I have a file of 45,000 airports with the lat/lon timezone offset.That is an important piece of information on which things can be build.
In addition I have the FAA Aircraft designated table with all the airplanes of the world and there cruising speed.As you already discovered with regards to your questions on the forum, you can calculate the approx duration of a flight by using that information, based on the lat/lon of the departure/arrival locations (again keep in mind flights flying in opposite direction is a possibility).
"No idea what "opr" is but, that is not important for us right now."
...
The offset of KMKE is -300.
Real-world airline schedules are computed using approximate date. They add 10 min. for taxi out, 7 to 11 min to climb out, and maybe 15 min to descent and landing. Each carrier has their own standards.I have left out the additional time 'wasters' for convenience (they can easily be added to the equation). Take that into account when looking at the results, e.g. earlier for departure later for arrival.
"At this point you have all necessary data, only in UTC time and not in local time, for that we need the timezones (actually their offsets to UTC), and you would need to know if daylight saving time is active or not at the departure and arrival locations.
Local time = UTC time + timezone offset + DST (when active)
i.o.w. you use universal time as an absolute measurement, and after you're done calculating convert those universal times to their corresponding local times.
And I think I'm using UTC time throught the process except for the UniversialTimetoLocal function and DateTimeToString. PHX offset is -420I think you're not exactly doing that...
For PHX I use UnisToDateTime to turn the EPOCH time into a TDateTime. At Phoenix all I have to do is turn the EPOCH time number into Local time UniversalTimeLocal then DateTimeToString.You should not be using EPOCH time for PHX, e.g. it is not UTC. I believe that is where things go wrong with regards to your calculations.
For KMKE it's PHX EPOCH time 1592610243 - 688500... and again, EPOCH....
UnixtoDateTime then UniversalTimetoLocal and then DateTimeToStr. The offset of KMKE is -300.
Takeoff
Departure
ICAO : KMKE
name : General Mitchell International Airport
lat,lon : 42.94720000,-87.89659800
Arrival
ICAO : KPHX
name : Phoenix Sky Harbor International Airport
lat,lon : 33.43429900,-112.01200100
Flight
ICAO : B787
name : AAL AA2164
lat,lon : 33.43330000,-111.99900000
Distance
KMKE <--> B787 : 2345.584727 km (1457.546350 miles)
B787 <--> KPHX : 1.211528 km (0.752843 miles)
KMKE <--> KPHX : 2346.524925 km (1458.130588 miles)
Duration
KMKE <--> B787 : 174.90 min (2.91 hour)
B787 <--> KPHX : 0.09 min (0.00 hour)
KMKE <--> KPHX : 174.97 min (2.92 hour)
Timetable
Location ICAO UTC Local UTC+ DST+
Departure KMKE 2020-06-19 20:49:09 2020-06-19 15:49:09 -360 60
Flight B787 2020-06-19 23:44:03 - 0 0
Arrival KPHX 2020-06-19 23:44:08 2020-06-19 16:44:08 -420 0
========================================
Departure
ICAO : RJBB
name : Kansai International Airport
lat,lon : 34.42729900,135.24400300
Arrival
ICAO : EHAM
name : Amsterdam Airport Schiphol
lat,lon : 52.30860100,4.76389000
Flight
ICAO : B77W
name : ??? ??????
lat,lon : 63.62000000,38.28000000
Distance
RJBB <--> B77W : 6947.509362 km (4317.182318 miles)
B77W <--> EHAM : 2302.411254 km (1430.718353 miles)
RJBB <--> EHAM : 9241.280512 km (5742.531710 miles)
Duration
RJBB <--> B77W : 456.82 min (7.61 hour)
B77W <--> EHAM : 151.39 min (2.52 hour)
RJBB <--> EHAM : 607.65 min (10.13 hour)
Timetable
Location ICAO UTC Local UTC+ DST+
Departure RJBB 2020-06-19 16:17:02 2020-06-20 01:17:02 540 0
Flight B77W 2020-06-19 23:53:52 - 0 0
Arrival EHAM 2020-06-20 02:25:15 2020-06-20 04:25:15 60 60
Landing
Thanks, I'll Work the code up in a demo to see if it matches what I now have.NP, and please take your time to see how I did things. In case of question then feel free to ask.
But I can't trust the results. This is on the flight from KMEK to KPHX.Yours or mine ? :P
I'm departing at 15:23:30 and arriving at 16:44:03. It's about an hour and 16 difference.An hour and 16 difference between two different timezones. Look at my time-table for that flight, specifically at the UTC times. That is the real duration of the flight (well, theoretically).
But then there is 2 hours difference between KMEK and KPHX. So then I'm wondering.Again take a closer look at my timetable if you will.
Location ICAO UTC Local UTC+ DST+
Departure KMKE 2020-06-19 20:49:09 2020-06-19 15:49:09 -360 60
Flight B787 2020-06-19 23:44:03 - 0 0
Arrival KPHX 2020-06-19 23:44:08 2020-06-19 16:44:08 -420 0
UTC offset for KMKE = -360 min (= -6 hours)That's the only time I get is a Lat/Lon and a Unix/GMT but I suspect the time is actually UTC.tbh it was my first thought ;)
QuoteThat's the only time I get is a Lat/Lon and a Unix/GMT but I suspect the time is actually UTC.tbh it was my first thought ;)
I get lost among all those different datas - please give again the data of the flight Japan-Amsterdam plus the tempory Lat/Long and time of the airplane.I needed to construct that myself:
opr Dept Arrv Plane EPOCH time Lat Lon CallSign
??? RJBB EHAM B77W 1592610832 63.62 38.28 ????
It seems to be this flight: https://www.klm.de/flight-status/flight-details?date=20200620&originAirportCode=KIX&destinationAirportCode=AMS&flightNumber=KL0868Departure
ICAO : RJBB
name : Kansai International Airport
lat,lon : 34.42729900,135.24400300
Arrival
ICAO : EHAM
name : Amsterdam Airport Schiphol
lat,lon : 52.30860100,4.76389000
Flight
ICAO : B77W
name : ??? ??????
lat,lon : 63.62000000,38.28000000
The rest of my data are calculations based on that information. Feel free to retrieve your own to verify my airport data.Timetable
Location ICAO UTC Local UTC+ DST+
Departure RJBB 2020-06-19 16:17:02 2020-06-20 01:17:02 540 0
Flight B77W 2020-06-19 23:53:52 - 0 0
Arrival EHAM 2020-06-20 02:25:15 2020-06-20 04:25:15 60 60
I don't want to spoil the party, but ......Yeah, i saw that flight as well.... very strange indeed. Perhaps they were unable to get clearance for that day (in time) ?
The times are aa little different I think for 3 reasons.There is a difference indeed.
I'm using a different Haversine function than you. One supplied by Winni.You can swap the haversine function with whatever works best for you. I got mine from Rosetta-code and is based on KM's (I live in a decimal country ;) )
My waste time is differentCorrect, I have not accounted for waste time in my calculations/assumptions whatsoever. My code could easily be adapted for that though.
and I haven''t figured out the speed you are using for either aircraft and we may be different there.Because I live in country where we work with the decimal system, everything I use is calculated in KiloMetre for distance and KiloMetre per hour for speed.
I can see the advantage of staying in UTC time.If you would calculate with local times, e.g. needing to take into account the timezone offsets and DST's without using some sort of absolute reference, then you are for sure going to drive yourself insane :)
There is a website that documents the ADS data. I went thru it and it's a little confusing.Feel free to share in case its public accessible. So far, I was unable to locate any documentation with regards to those records (but I haven't had a good search for it yet either)
I actually called the provide to ask about the time stamp. He said it was EPOCH/Unix GMT of the Lat/Lon position of the aircraft. He also stated it in an email. I looked and no longer have the email.Although I am far from knowledgeable on the subject, that sounds like rubbish.
I can and have programed all of those and I don't remember KM or meter in any. So that's why I did my calculations in miles.No problem, it is all public knowledge. I do not know anything about knots and miles so had to look that up in order to calculate things in units that I am able to understand, so I guess that makes us even :D
You have to pass a physical every year to remain current. I failed my first physical 3 years ago and did not submit to the appeals board. I still have my lic. but it's not current.I'm sorry to hear that. I take it that is due to age related (health) issues ?
In the attachment KLM 868 flight.Yes yes, that is the one that is weird. I was referring to https://www.flightradar24.com/data/aircraft/ph-bhe#24d390ac which looks much healthier to me.
Screenshoot reduced to get below the 250 k restriction to bad quality.
I tried to discuss that problem but they are all stuck in the 80s.
No - that is not a great circle. No, no ...
Winni
There are about 20 additional data points but nothing that I can use.So you say. No reason to doubt that statement but I do wonder.
Those supplieres are allways greedy.It is the other way around.
Winni
@winni:
With regards to the Osaka - Amsterdam flight: Yeah, there seems to be something strange that happened that day. Of course it is always possible there was some sort of NATO exercise or some temporary air-space lock (as you suggested) or perhaps something else going on that day that prohibited airlines to use their normal flight-plans. I have no idea, as aviation isn't really my thing.
On topic: ADS receivers rely on a simple protocol which is open , so why all the fuss? just do it yourself.1. I don't think if I would install such a receiver that I am able to to receive all data from all flights from the whole world. Not sure, but an educated guess ;)
Yea I can get better data at about $1,225 a month with a yearly subscription.*ouch*
No good deed goes unpunished.Seems that way :)
Because this data is going to be used in a Flight Simulator product (X-Plane 11 and World Traffic-3) we don't have to be that accurate.Of course, only you can be the real judge of that. I only report what seems to be obvious for/to me.
But there we have the problem that we do not know which exact part of the 'waste'-time should be added to the departure or arrival because it depends whether or not the plane has already partaken in a specific action (that belongs to the waste-time) or not (and for how long the plane is already doing so).
Perhaps minor details but, for sure has a bigger impact when just fumbling around.
Right now, with the information provided, it is just a pure guessing game which (waste) time should be added where exactly. (and I am sorry for keep calling it waste, as I simply lack better wording for it so that it depicts both departure and arrival locations activities done before the plane is actual cruise-flight state).