当前位置: 首页>>代码示例>>C#>>正文


C# Airport.addDestinationCargoRate方法代码示例

本文整理汇总了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));
        }
开发者ID:tehknox,项目名称:tap-desktop,代码行数:26,代码来源:PassengerHelpers.cs


注:本文中的TheAirline.Model.AirportModel.Airport.addDestinationCargoRate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。