Jump to content


* * * * - 3 votes

% complete flight


  • Please log in to reply
74 replies to this topic

#1 fsx

fsx

    Member

  • Members
  • PipPip
  • 28 posts

Posted 21 June 2011 - 06:41 AM

how can I get this?

Posted Image

#2 James142

James142

    Tá mé mór leipreachán

  • Members
  • PipPipPip
  • 661 posts
  • LocationIreland

Posted 21 June 2011 - 11:36 AM

Its something I have being trying to work out for a while now. No one seems to be able to give me the code for the total flight distance of a route in the acars map. Then Lorathon decides to add it to his website while im still trying to work out how to show the total distance for a route..
James Barrett

#3 stuartpb

stuartpb

    Advanced Member

  • Members
  • PipPipPip
  • 327 posts
  • LocationSouth Yorkshire, UK

Posted 21 June 2011 - 01:27 PM

View PostJames142, on 21 June 2011 - 11:36 AM, said:

Its something I have being trying to work out for a while now.

I've been scratching my head on this one too  :P  I have tried and failed a few times on it. Would be very cool if the code could be shared.

#4 lorathon

lorathon

    Advanced Member

  • Moderators
  • 1378 posts
  • LocationRiverside, California

Posted 21 June 2011 - 01:51 PM

I can not share my code since I use much more data then the standard phpVMS does.  I have modified mine so much that my code no longer works with the standard.  But I can point in the right direction,

It is actually quite simple when you think about it.  You need two distances.  TD = Total Distance (depicao to arricao).  And AD = Actual distance (A/C to arricao) this is already in the ACARS table (distremain).  The TD can be calculated using the SchedulesData::distanceBetweenPoints($lat1, $lng1, $lat2, $lng2) function.  The departure lat/lng and arrival lat/lng are already pulled for the map.  Now you have the two distances.  The calculation for percentage is  ((TD-AD)/TD)*100.  Now you have the percent complete.  Use the ACARS module to load the data into the json needed for the ACARS Map (Inside of the foreach loop).  

The data can now be used inside of the template.

NOTE - You have to do some checks on the TD.  If a zero ('0') is returned you have to skip the calc or you will get a divide by zero error!
Posted Image
Custom ACARS - PIREP Filing / ACARS Live Map Update / Full Flight Log / Flight info / Aircraft info / Many More Options
NEW - phpVMS Modules - Auto Pilot Deletion / Auto Awards / Google Earth

#5 stuartpb

stuartpb

    Advanced Member

  • Members
  • PipPipPip
  • 327 posts
  • LocationSouth Yorkshire, UK

Posted 21 June 2011 - 02:06 PM

Thanks Jeff. I'm going to have another go at it later.  B)

#6 stuartpb

stuartpb

    Advanced Member

  • Members
  • PipPipPip
  • 327 posts
  • LocationSouth Yorkshire, UK

Posted 21 June 2011 - 04:05 PM

Jeff, would the code to go in the ACARS module's for each loop go like this:


$td = SchedulesData::distanceBetweenPoints($depicao->lat, $depicao->lng, $arricao->lat, $arricao->lng);
$percentleft = (($TD-$c['distremaining'])/$TD)*100;


#7 lorathon

lorathon

    Advanced Member

  • Moderators
  • 1378 posts
  • LocationRiverside, California

Posted 21 June 2011 - 04:19 PM

I did it like this

$totaldistance = round(SchedulesData::distanceBetweenPoints($flight->deplat, $flight->deplng, $flight->arrlat, $flight->arrlng));
$percomplete = ABS(number_format(((($totaldistance - $flight->distremain) / $totaldistance) * 100), 2));
$c['percomplete'] = $percomplete;

This will give you a nice number to work with.
Posted Image
Custom ACARS - PIREP Filing / ACARS Live Map Update / Full Flight Log / Flight info / Aircraft info / Many More Options
NEW - phpVMS Modules - Auto Pilot Deletion / Auto Awards / Google Earth

#8 stuartpb

stuartpb

    Advanced Member

  • Members
  • PipPipPip
  • 327 posts
  • LocationSouth Yorkshire, UK

Posted 21 June 2011 - 04:26 PM

Thanks Jeff, much appreciated :)

+1 rep to you!

#9 James142

James142

    Tá mé mór leipreachán

  • Members
  • PipPipPip
  • 661 posts
  • LocationIreland

Posted 21 June 2011 - 04:28 PM

Finally! Thanks :D
James Barrett

#10 stuartpb

stuartpb

    Advanced Member

  • Members
  • PipPipPip
  • 327 posts
  • LocationSouth Yorkshire, UK

Posted 21 June 2011 - 04:38 PM

Well I did give you rep Jeff, but someone's playing silly peeps with the repping :rolleyes:

#11 lorathon

lorathon

    Advanced Member

  • Moderators
  • 1378 posts
  • LocationRiverside, California

Posted 21 June 2011 - 04:48 PM

No problem.  Guess someone is out to get me :)
Posted Image
Custom ACARS - PIREP Filing / ACARS Live Map Update / Full Flight Log / Flight info / Aircraft info / Many More Options
NEW - phpVMS Modules - Auto Pilot Deletion / Auto Awards / Google Earth

#12 James142

James142

    Tá mé mór leipreachán

  • Members
  • PipPipPip
  • 661 posts
  • LocationIreland

Posted 21 June 2011 - 05:01 PM

View Postlorathon, on 21 June 2011 - 04:48 PM, said:

No problem.  Guess someone is out to get me :)

Sorry guys that was me, I tried to give you both +1 but for some reason I hit the -1 by mistake.
I gave you both +1 in your second posts though

Again sorry about that Posted Image
James Barrett

#13 stuartpb

stuartpb

    Advanced Member

  • Members
  • PipPipPip
  • 327 posts
  • LocationSouth Yorkshire, UK

Posted 21 June 2011 - 05:50 PM

:P No worries, and thanks for the rep! Have some back.

#14 James142

James142

    Tá mé mór leipreachán

  • Members
  • PipPipPip
  • 661 posts
  • LocationIreland

Posted 21 June 2011 - 06:01 PM

View Poststuartpb, on 21 June 2011 - 05:50 PM, said:

:P No worries, and thanks for the rep! Have some back.

Haha thanks :)
James Barrett

#15 joeri

joeri

    Advanced Member

  • Moderators
  • 2134 posts
  • Locationbelgium

Posted 21 June 2011 - 06:05 PM

lets all have some reps  :lol:
Posted Image
Posted Image

#16 James142

James142

    Tá mé mór leipreachán

  • Members
  • PipPipPip
  • 661 posts
  • LocationIreland

Posted 21 June 2011 - 06:07 PM

View Postjoeri, on 21 June 2011 - 06:05 PM, said:

lets all have some reps  :lol:

action failed: you have reached your quota of positive votes for the day

D: I'll do it tomorrow
James Barrett

#17 stuartpb

stuartpb

    Advanced Member

  • Members
  • PipPipPip
  • 327 posts
  • LocationSouth Yorkshire, UK

Posted 21 June 2011 - 06:16 PM

There you go Joeri B)

#18 joeri

joeri

    Advanced Member

  • Moderators
  • 2134 posts
  • Locationbelgium

Posted 21 June 2011 - 07:20 PM

View PostJames142, on 21 June 2011 - 06:07 PM, said:

action failed: you have reached your quota of positive votes for the day

D: I'll do it tomorrow
haha i had the same  :lol:
Posted Image
Posted Image

#19 Ahmad

Ahmad

    Advanced Member

  • Members
  • PipPipPip
  • 57 posts

Posted 21 June 2011 - 09:53 PM

can someone please post the code here so we can also take advantage as we are not much expert in modifying codes i will really appreciate it.

Thanx in advance

#20 fsx

fsx

    Member

  • Members
  • PipPip
  • 28 posts

Posted 22 June 2011 - 07:01 AM

Hi everybody,

@lorathon
If I click on the map plane, appears out a table shows (Time Altitude Heading LAT LNG Fuel Phase V SPD SPD G)it is from these data that run  the mathematical operation ? or it is an additional table ?