Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

vipin

local lib = {};
-- formula Bangladesh Unitrate from weight tier
-- lib.distance_method = Distance_method.great_circle;

function lib:getIndexFirstHigher(arr, value)
	for idx=1, #arr do
		if(arr[idx]>value) then
			return idx
		end
	end
end

function lib:unitrateFromWeight(mtom)
	local xaxis_weight  = {5000, 10001, 20001, 50001, 100001, 200001, 300001, 999999}
	local unitRateFromWeightTab = {0.0,30.0,75.0,150.0,300.0,420.0,450.0}
	local x_index = self:getIndexFirstHigher(xaxis_weight, mtom)
	return unitRateFromWeightTab[x_index];
end
function lib:estimate(flight_context)
  return self:unitrateFromWeight(flight_context.mtom);
end
function lib:calculate(flight_context, route_context)
  return self:estimate(flight_context);
end
return lib;

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.