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


C# Stats.ComputeTimeStepDeltaV方法代码示例

本文整理汇总了C#中Stats.ComputeTimeStepDeltaV方法的典型用法代码示例。如果您正苦于以下问题:C# Stats.ComputeTimeStepDeltaV方法的具体用法?C# Stats.ComputeTimeStepDeltaV怎么用?C# Stats.ComputeTimeStepDeltaV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stats的用法示例。


在下文中一共展示了Stats.ComputeTimeStepDeltaV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SimulateTimeStep

        //Simulate a single time step, and return stats for the time step.
        // - desiredDt is the requested time step size. Often the actual time step size
        //   with be less than this. The actual step size is reported in dt.
        public Stats SimulateTimeStep(float desiredDt, float throttle, float atmospheres, out float dt)
        {
            Stats stats = new Stats();

            foreach (FuelNode n in nodes) n.ResetDrainRates();
            foreach (FuelNode n in nodes) n.SetConsumptionRates(throttle, atmospheres);

            stats.startMass = VesselMass();
            stats.startThrust = VesselThrust(throttle);

            List<FuelNode> engines = FindActiveEngines();

            if (engines.Count > 0)
            {
                foreach (FuelNode n in engines) n.AssignResourceDrainRates(nodes);
                //foreach (FuelNode n in nodes) n.DebugDrainRates();

                float maxDt = nodes.Min(n => n.MaxTimeStep());
                dt = Mathf.Min(desiredDt, maxDt);

                //Debug.Log("Simulating time step of " + dt);

                foreach (FuelNode n in nodes) n.DrainResources(dt);
            }
            else
            {
                dt = 0;
            }

            stats.deltaTime = dt;
            stats.endMass = VesselMass();
            stats.maxAccel = stats.startThrust / stats.endMass;
            stats.ComputeTimeStepDeltaV();

            t += dt;

            return stats;
        }
开发者ID:Raf04,项目名称:MechJeb2,代码行数:41,代码来源:FuelFlowSimulation.cs

示例2: SimulateTimeStep

        //Simulate a single time step, and return stats for the time step.
        // - desiredDt is the requested time step size. Often the actual time step size
        //   with be less than this. The actual step size is reported in dt.
        public Stats SimulateTimeStep(float desiredDt, float throttle, double staticPressure, double atmDensity, double machNumber, out float dt)
        {
            Stats stats = new Stats();

            for (int i = 0; i < nodes.Count; i++)
            {
                nodes[i].ResetDrainRates();
            }
            for (int i = 0; i < nodes.Count; i++)
            {
                nodes[i].SetConsumptionRates(throttle, atmDensity, machNumber);
            }

            stats.startMass = VesselMass(simStage);
            stats.startThrust = VesselThrust(throttle, staticPressure, atmDensity, machNumber); // NK

            List<FuelNode> engines = FindActiveEngines();

            if (engines.Count > 0)
            {
                for (int i = 0; i < engines.Count; i++)
                {
                    engines[i].AssignResourceDrainRates(nodes);
                }
                //foreach (FuelNode n in nodes) n.DebugDrainRates();

                float maxDt = nodes.Min(n => n.MaxTimeStep());
                dt = Mathf.Min(desiredDt, maxDt);

                //print("Simulating time step of " + dt);

                for (int i = 0; i < nodes.Count; i++)
                {
                    nodes[i].DrainResources(dt);
                }
            }
            else
            {
                dt = 0;
            }

            stats.deltaTime = dt;
            stats.endMass = VesselMass(simStage);
            stats.resourceMass = stats.startMass - stats.endMass;
            stats.maxAccel = stats.endMass > 0 ? stats.startThrust / stats.endMass : 0;
            stats.ComputeTimeStepDeltaV();
            stats.isp = stats.startMass > stats.endMass ? stats.deltaV / (9.80665f * Mathf.Log(stats.startMass / stats.endMass)) : 0;

            t += dt;

            return stats;
        }
开发者ID:CliftonMarien,项目名称:MechJeb2,代码行数:55,代码来源:FuelFlowSimulation.cs


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