本文整理汇总了C#中TheAirline.Model.AirportModel.Airport.addDestinationCargoRate方法的典型用法代码示例。如果您正苦于以下问题:C# Airport.addDestinationCargoRate方法的具体用法?C# Airport.addDestinationCargoRate怎么用?C# Airport.addDestinationCargoRate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TheAirline.Model.AirportModel.Airport
的用法示例。
在下文中一共展示了Airport.addDestinationCargoRate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDestinationCargo
public static void CreateDestinationCargo(Airport airport, Airport dAirport)
{
//origin airport out
double originMassPerDay = GetAirportCargoMass(airport) / 2;
double originDemand = (originMassPerDay * CargoFactors[dAirport.Profile.Cargo]) / Airports.CargoAirportsSizes[dAirport.Profile.Cargo];
//destination airport in
double destinationMassPerDay = GetAirportCargoMass(dAirport) / 2;
double destinationDemand = (destinationMassPerDay * CargoFactors[airport.Profile.Cargo]) / Airports.CargoAirportsSizes[airport.Profile.Cargo];
double distance = MathHelpers.GetDistance(airport, dAirport);
double distanceFactor = distance > 5000 ? 1 : 0.5;
double sameCountryFactor = airport.Profile.Country == dAirport.Profile.Country ? 0.75 : 1;
double sameRegionFactor = sameCountryFactor == 1 && airport.Profile.Country.Region == dAirport.Profile.Country.Region ? 0.5 : 1;
double minMass = Math.Min(originMassPerDay, destinationMassPerDay);
double volume = minMass / distanceFactor;
volume = volume / sameCountryFactor;
volume = volume / sameRegionFactor;
//converts to pounds of cargo
volume *= 35.1;
if (volume >= 1)
airport.addDestinationCargoRate(new DestinationDemand(dAirport.Profile.IATACode, (ushort)volume));
}