From 3b94d49b2983c673d8082557cb488610225dcd27 Mon Sep 17 00:00:00 2001 From: Eric Oden Date: Wed, 6 Nov 2013 03:49:33 -0600 Subject: [PATCH 1/2] Added MACHNUMBER which returns mach number. --- VesselTarget.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/VesselTarget.cs b/VesselTarget.cs index 40d8f68..39bd592 100644 --- a/VesselTarget.cs +++ b/VesselTarget.cs @@ -102,6 +102,7 @@ public override object GetSuffix(string suffixName) if (suffixName == "APOAPSIS") return target.orbit.ApA; if (suffixName == "PERIAPSIS") return target.orbit.PeA; if (suffixName == "SENSOR") return new VesselSensors(target); + if (suffixName == "MACHNUMBER") return (double)target.srf_velocity.magnitude / (Math.Sqrt(1.4 * (FlightGlobals.getExternalTemperature((float)target.altitude, target.mainBody) + 274.15) * 287)); // Is this a resource? double dblValue; From 74ee20349cec26a21b064264fa39511f8cc09abf Mon Sep 17 00:00:00 2001 From: Eric Oden Date: Wed, 6 Nov 2013 12:52:23 -0600 Subject: [PATCH 2/2] Fix a typo and add explanation of teh calculation. --- VesselTarget.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VesselTarget.cs b/VesselTarget.cs index 39bd592..0b64cc3 100644 --- a/VesselTarget.cs +++ b/VesselTarget.cs @@ -102,7 +102,8 @@ public override object GetSuffix(string suffixName) if (suffixName == "APOAPSIS") return target.orbit.ApA; if (suffixName == "PERIAPSIS") return target.orbit.PeA; if (suffixName == "SENSOR") return new VesselSensors(target); - if (suffixName == "MACHNUMBER") return (double)target.srf_velocity.magnitude / (Math.Sqrt(1.4 * (FlightGlobals.getExternalTemperature((float)target.altitude, target.mainBody) + 274.15) * 287)); + // airSpeed / (sqrt(gamma 1.4 * (temp at current altitude + zero Kelvin(273.15)) * 287 J/kg K)) gamma being heat exchange ratio of air + if (suffixName == "MACHNUMBER") return (double)target.srf_velocity.magnitude / (Math.Sqrt(1.4 * (FlightGlobals.getExternalTemperature((float)target.altitude, target.mainBody) + 273.15) * 287)); // Is this a resource? double dblValue;