Пример #1
0
        void CalculateLosses(Vessel vessel)
        {
            if (vesselState.mass == 0)
            {
                return;
            }

            double fwdAcceleration = Vector3d.Dot(vessel.acceleration, vesselState.forward.normalized);
            double GravityDrag     = Vector3d.Dot(vesselState.gravityForce, -vessel.obt_velocity.normalized);
            double TimeInterval    = Time.time - FlyTimeInterval;

            FlyTimeInterval     = Time.time;
            HorizontalDistance += Vector3d.Exclude(vesselState.up, vesselState.orbitalVelocity).magnitude *TimeInterval;
            VelocityLost       += ((vesselState.thrustCurrent / vesselState.mass) - fwdAcceleration) * TimeInterval;
            DragLoss           += vesselState.drag * TimeInterval;
            GravityDragLoss    += GravityDrag * TimeInterval;

            double VectorDrag = vesselState.thrustCurrent - Vector3d.Dot(vesselState.thrustVectorLastFrame, vessel.obt_velocity.normalized);

            VectorDrag  = VectorDrag / vesselState.mass;
            VectorLoss += VectorDrag * TimeInterval;
            TotalBurn  += vesselState.thrustCurrent / vesselState.mass * TimeInterval;

            double GravityDragLossAtAp = GravityDragLoss + vessel.obt_velocity.magnitude - vessel.orbit.getOrbitalVelocityAtUT(vessel.orbit.timeToAp + Planetarium.GetUniversalTime()).magnitude;

            TotalLoss = DragLoss + GravityDragLossAtAp + VectorLoss;
            if (vessel.CriticalHeatPart().CriticalHeat() > MaxHeat)
            {
                MaxHeat = vessel.CriticalHeatPart().CriticalHeat();
            }

            Message = string.Format(
                "Air Drag:\t\t{0:0.00} m/s²\n" +
                "GravityDrag:\t{1:0.00} m/s²\n" +
                "Thrust Vector Drag:\t{5:0.00} m/s²\n" +
                "Air Drag Loss:\t{2:0.00} m/s\n" +
                "Gravity Drag Loss:\t{3:0.00} -> {4:0.00} m/s @AP\n\n" +
                "Total Vector Loss:\t{6:0.00} m/s\n" +
                "Total Loss:\t{7:0.00} m/s\n" +
                "Total Burn:\t\t{8:0.0}\n\n" +
                "Apoapsis:\t\t{9}\n" +
                "Periapsis:\t\t{10}\n" +
                "Inclination:\t\t{11:0.0} °\n\n" +
                "Dynamic Pressure:\t{12:0.00} Pa\n" +
                "Max Q:\t\t{13:0.00} Pa\n\n",
                vesselState.drag,
                GravityDrag,
                DragLoss,
                GravityDragLoss, GravityDragLossAtAp,
                VectorDrag,
                VectorLoss,
                TotalLoss,
                TotalBurn,
                OrbitExtensions.FormatOrbitInfo(vessel.orbit.ApA, vessel.orbit.timeToAp),
                OrbitExtensions.FormatOrbitInfo(vessel.orbit.PeA, vessel.orbit.timeToPe),
                vessel.orbit.inclination,
                vesselState.dynamicPressure,
                vesselState.maxQ
                );
        }
Пример #2
0
 public void UpdateMap(Vessel vessel)
 {
     double yScale;
     if (vessel.mainBody.atmosphere)
         yScale = vessel.mainBody.atmosphereDepth;
     else
         yScale = turner.DestinationHeight * 1000;
     double MetersPerPixel = yScale / texture.height;
     double x = turner.HorizontalDistance / MetersPerPixel % texture.width;
     double y = vessel.altitude / MetersPerPixel % texture.height;
     float red = (float)(vessel.CriticalHeatPart().CriticalHeat());
     float green = (float)turner.vesselState.drag / 5;
     float blue = (float)(turner.vesselState.thrustCurrent / turner.MaxThrust);
     texture.SetPixel((int)x, (int)y, new Color(red, green, blue));
     texture.Apply();
 }
Пример #3
0
        public void UpdateMap(Vessel vessel)
        {
            double yScale;

            if (vessel.mainBody.atmosphere)
            {
                yScale = vessel.mainBody.atmosphereDepth;
            }
            else
            {
                yScale = turner.DestinationHeight * 1000;
            }
            double MetersPerPixel = yScale / texture.height;
            double x     = turner.HorizontalDistance / MetersPerPixel % texture.width;
            double y     = vessel.altitude / MetersPerPixel % texture.height;
            float  red   = (float)(vessel.CriticalHeatPart().CriticalHeat());
            float  green = (float)turner.vesselState.drag / 5;
            float  blue  = (float)(turner.vesselState.thrustCurrent / turner.MaxThrust);

            texture.SetPixel((int)x, (int)y, new Color(red, green, blue));
            texture.Apply();
        }
Пример #4
0
        void CalculateLosses(Vessel vessel)
        {
            double fwdAcceleration = Vector3d.Dot(vessel.acceleration, vesselState.forward.normalized);
            double GravityDrag = Vector3d.Dot(vesselState.gravityForce, -vessel.obt_velocity.normalized);
            double TimeInterval = Time.time - FlyTimeInterval;
            FlyTimeInterval = Time.time;
            HorizontalDistance += Vector3d.Exclude(vesselState.up, vesselState.orbitalVelocity).magnitude * TimeInterval;
            VelocityLost += ((vesselState.thrustCurrent / vesselState.mass) - fwdAcceleration) * TimeInterval;
            DragLoss += vesselState.drag * TimeInterval;
            GravityDragLoss += GravityDrag * TimeInterval;
            double VectorDrag = vesselState.thrustCurrent - Vector3d.Dot(vesselState.thrustVectorLastFrame, vessel.obt_velocity.normalized);
            VectorDrag = VectorDrag / vesselState.mass;
            VectorLoss += VectorDrag * TimeInterval;
            TotalBurn += vesselState.thrustCurrent / vesselState.mass * TimeInterval;
            double GravityDragLossAtAp = GravityDragLoss + vessel.obt_velocity.magnitude - vessel.orbit.getOrbitalVelocityAtUT(vessel.orbit.timeToAp + Planetarium.GetUniversalTime()).magnitude;
            TotalLoss = DragLoss + GravityDragLossAtAp + VectorLoss;
            if (vessel.CriticalHeatPart().CriticalHeat() > MaxHeat)
                MaxHeat = vessel.CriticalHeatPart().CriticalHeat();
            launchdb.RecordLaunch();
            Message = string.Format(
@"Air Drag: {0:0.00}m/s²
GravityDrag: {1:0.00}m/s²
Thrust Vector Drag: {5:0.00}m/s²
Air Drag Loss: {2:0.00}m/s
Gravity Drag Loss: {3:0.00} -> {4:0.00}m/s (at AP)
Total Vector Loss: {6:0.00}m/s
Total Loss: {7:0.00}m/s
Total Burn: {8:0.0}",
                vesselState.drag,
                GravityDrag,
                DragLoss,
                GravityDragLoss, GravityDragLossAtAp,
                VectorDrag,
                VectorLoss,
                DragLoss + GravityDragLossAtAp + VectorLoss,
                TotalBurn
                );
        }