Jump to content
Parkho

Fuel Calculator V_1.1

Recommended Posts

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

Share this post


Link to post
Share on other sites
OmerAslan    5

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.

Share this post


Link to post
Share on other sites
Iraklis    2

is there a way to short the airplanes?? for example our va has 4 A318, 4 A320 etc..in the dropdown menu is it possible to saw only one A318???

Share this post


Link to post
Share on other sites
Parkho    154

is there a way to short the airplanes?? for example our va has 4 A318, 4 A320 etc..in the dropdown menu is it possible to saw only one A318???

It's already there. There must be a slight difference between the aircraft names that causes that.

Share this post


Link to post
Share on other sites
Melli    0

i uploaded all files. - O.K.

made database import. - O.K.

but:

Make a link to access it by <?php echo url('fuelcalculator');?> for your pilots.

Where should i make a link...in which file?

Share this post


Link to post
Share on other sites
Parkho    154

i uploaded all files. - O.K.

made database import. - O.K.

but:

Make a link to access it by <?php echo url('fuelcalculator');?> for your pilots.

Where should i make a link...in which file?

layout.php in your top nav menu

Share this post


Link to post
Share on other sites
OWA001    0
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

Share this post


Link to post
Share on other sites
Parkho    154
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

Share this post


Link to post
Share on other sites
Txmmy83    29
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?

Share this post


Link to post
Share on other sites
Parkho    154
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×