Jump to content

Fuel Calculator V_1.1


Parkho

Recommended Posts

  • 2 weeks later...

1ST SEARCH in this post 3rd page its this:

So ... we have in CORE/COMMON/FSCalculator/FCalculator.class.php :

<?php

class FCalculator extends CodonData

{

public function findaircraft()

{

$sql = "SELECT DISTINCT name FROM".TABLE_PREFIX."aircraft";

return DB::get_results($sql);

}

You must edit /replace the RED line with : $sql = "SELECT * FROM phpvms_aircraft";

And thats all !! Hope to be a solution for all and not only for my ..PC/phpvms sistem

Link to comment
Share on other sites

1ST SEARCH in this post 3rd page its this:

So ... we have in CORE/COMMON/FSCalculator/FCalculator.class.php :

<?php

class FCalculator extends CodonData

{

public function findaircraft()

{

$sql = "SELECT DISTINCT name FROM".TABLE_PREFIX."aircraft";

return DB::get_results($sql);

}

You must edit /replace the RED line with : $sql = "SELECT * FROM phpvms_aircraft";

And thats all !! Hope to be a solution for all and not only for my ..PC/phpvms sistem

working now. thanks.

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
  • 5 months later...
On 19/11/2013 at 10:42 PM, maaneken_pis said:

Hello guys ....

I had the same problem ... no aircrafts listed at "SET PARAMETERS".

I solved in my way ... and at lest for me ..works !

So ... we have in CORE/COMMON/FSCalculator/FCalculator.class.php :

<?php

class FCalculator extends CodonData

{

public function findaircraft()

{

$sql = "SELECT DISTINCT name FROM".TABLE_PREFIX."aircraft";

return DB::get_results($sql);

}

You must edit /replace the RED line with : $sql = "SELECT * FROM phpvms_aircraft";

And thats all !! Hope to be a solution for all and not only for my ..PC/phpvms sistem

Thanks now ready there worked

Link to comment
Share on other sites

  • 5 months later...
  • Moderators
11 hours ago, Txmmy83 said:

what would be the right multiplicator for a 1hour 15 fuelreserve?

Open fuelcalculator.php in module folder and look for the following:

$flndg = $fuelhr * 3/4;

1 hr 15 minutes would be 75 minutes which is "$fuelhr * 1.25 ", so change "fuelhr * 3/4" to that every where you see the code line

Link to comment
Share on other sites

On 13.9.2013 at 4:03 PM, mischka said:

You can get the fuel flow from your own PIREPS. Once you have 20-30 pireps per aircraft type it should be reliable enough. Obviously the more pireps the more reliable the calculations will be.

I use the following code to update a field "fuelflow" in my aircraft table:

 


function CalcFuelFlows ()
{
 $sql="select icao, count(icao) amount, sum(fuelused) totalfuelused, sum(duration) totalduration, sum(fuelused)/sum(duration) average from  (";
 $sql=$sql." SELECT aircraft,  icao, fuelused, flighttime_stamp, hour(flighttime_stamp)+ (minute(flighttime_stamp)/60) duration";
 $sql=$sql." FROM `ACS_pireps`, ACS_aircraft";
 $sql=$sql." WHERE ACS_pireps.aircraft=ACS_aircraft.id and ACS_aircraft.fuelflow<>0) pireps group by icao";
 $averages = DB::get_results($sql);

 foreach($averages as $aircraft)
  {
   $sql="update `ACS_aircraft` set fuelflow=".$aircraft->average." WHERE icao='".$aircraft->icao."'";
   DB::query($sql);
   echo "<br>".$sql;
  }
 return "success";
}
 

 

That will set the average fuel flow for each aircraft type. You can then calculate the amount of fuel you need depending on the trip length plus an hour reserve and some hold/taxi fuel.

Note that if your phpvms counts fuel in Lb than these values will be in Lb, if you set it in KG it'll be in KG.

Note also if you want to use this for your system you must change the tablename prefix from ACS_ to whatever you have.

where to put this function?

Link to comment
Share on other sites

  • Moderators
8 hours ago, Txmmy83 said:

where to put this function?

I would put this in "FCalculator.class.php" and then call the function in "FuelCalculator.php" in module folder inside index() function like the following:

 

FCalculator::CalcFuelFlows();

This way every time anyone opens the module the table gets updated.

Cheers

Link to comment
Share on other sites

  • 2 months later...
  • Moderators
On 12/21/2017 at 5:00 AM, Booagce said:

Could you explain in english for me please lol  where do i put this "FCalculator::CalcFuelFlows();"   in the Fuelcalculator.php in module inside index()

do i just paste this in or do i add it as a $param = FCalculator::CalcFuelFlows();

 

thank you

No! just paste it as is. Just so you know, if you assign it to a parameter then it will not be executed on page load. Basically, you would assign a value to a parameter to use it somewhere else :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...