Beispiel #1
0
        void runSimulations()
        {
            if (((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate)) &&
                (nextSimulationDelayMs == 0 || nextSimulationTimer.ElapsedMilliseconds > nextSimulationDelayMs))
            {
                Stopwatch   s = Stopwatch.StartNew();
                double      surfaceGravity;
                List <Part> parts;
                if (part.vessel == null)
                {
                    parts          = EditorLogic.SortedShipList;
                    surfaceGravity = 9.81;
                }
                else
                {
                    parts          = part.vessel.parts;
                    surfaceGravity = part.vessel.mainBody.GeeASL * 9.81;
                }
                ffa.analyze(parts, surfaceGravity, FuelFlowAnalyzer.Environment.ATMOSPHERE, out timePerStageAtmo, out deltaVPerStageAtmo, out twrPerStage);
                ffa.analyze(parts, surfaceGravity, FuelFlowAnalyzer.Environment.VACUUM, out timePerStageVac, out deltaVPerStageVac, out twrPerStage);
                s.Stop();

                nextSimulationDelayMs = 10 * s.ElapsedMilliseconds;
                nextSimulationTimer.Reset();
                nextSimulationTimer.Start();
            }
        }
        void runSimulations()
        {
            if (((TimeWarp.WarpMode == TimeWarp.Modes.LOW) || (TimeWarp.CurrentRate <= TimeWarp.MaxPhysicsRate)) &&
                (nextSimulationDelayMs == 0 || nextSimulationTimer.ElapsedMilliseconds > nextSimulationDelayMs))
            {
                Stopwatch   s = Stopwatch.StartNew();
                double      surfaceGravity;
                double      atmos = 1.0;
                List <Part> parts;
                bool        cur_thrust = true;
                if (part.vessel == null)
                {
                    cur_thrust = false;
                    parts      = EditorLogic.SortedShipList;
                    if (_planitron != null)
                    {
                        surfaceGravity = 9.81 * _planitron.gravity();
                        atmos          = _planitron.atmos();
                    }
                    else
                    {
                        surfaceGravity = 9.81;
                    }
                }
                else
                {
                    parts          = part.vessel.parts;
                    surfaceGravity = part.vessel.mainBody.GeeASL * 9.81;
                    atmos          = vesselState.atmosphericDensity;
                }
//                ffa.analyze(parts, (float)surfaceGravity, 1.0F, false, out timePerStageAtmo, out deltaVPerStageAtmo, out twrPerStage);
                ffa.analyze(parts, (float)surfaceGravity, 0.0F, false, out timePerStageVac, out deltaVPerStageVac, out twrPerStage);
                ffa.analyze(parts, (float)surfaceGravity, (float)atmos, cur_thrust, out timePerStageCur, out deltaVPerStageCur, out twrPerStageCur);
                s.Stop();

                nextSimulationDelayMs = 1000;// 10 * s.ElapsedMilliseconds;
                nextSimulationTimer.Reset();
                nextSimulationTimer.Start();
            }
        }