local coefficientWgtDist = { -- Wgt, dst1, dst2, dist3 {139, { ["700"] = 3, ["1000"] = 6, ["99999"] = 12} }, {199, { ["700"] = 10, ["1000"] = 20, ["99999"] = 40} }, {269, { ["700"] = 14, ["1000"] = 28, ["99999"] = 56} }, {349, { ["700"] = 18, ["1000"] = 36, ["99999"] = 72} }, {439, { ["700"] = 22, ["1000"] = 44, ["99999"] = 88} }, {9999, { ["700"] = 25, ["1000"] = 50, ["99999"] = 100} } } local tom = 72 local dst = 1100 for idx=1, #coefficientWgtDist do if(coefficientWgtDist[idx][1]>=tom) then for k,v in pairs(coefficientWgtDist[idx][2]) do if(tonumber(k)>dst) then print(k) print(v) break end end break end end local lib = {}; lib.distance_method = Distance_method.great_circle; function lib:calculate(flight_context, route_context, distance) return self:estimate(flight_context, distance); end function lib:estimate(flight_context, distance) return self.unit_rate * coefficenFromtWgtDistArray; end return lib;
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more