public static double SpeedTransform(SpeedRef refMode, AsstVesselModule avm) { switch (refMode) { case SpeedRef.Indicated: double stagnationPres = Math.Pow(((avm.vesselRef.mainBody.atmosphereAdiabaticIndex - 1) * avm.vesselRef.mach * avm.vesselRef.mach * 0.5) + 1, avm.vesselRef.mainBody.atmosphereAdiabaticIndex / (avm.vesselRef.mainBody.atmosphereAdiabaticIndex - 1)); return(Math.Sqrt(avm.vesselRef.atmDensity / 1.225) * stagnationPres); case SpeedRef.Equivalent: return(Math.Sqrt(avm.vesselRef.atmDensity / 1.225)); case SpeedRef.True: default: return(1); } }
public void ChangeSpeedRef(SpeedRef newRef) { if (ThrtActive) { switch (CurrentThrottleMode) { case ThrottleMode.Speed: double currentSpeed = AsstList.Speed.GetAsst(this).target_setpoint / Utils.SpeedTransform(speedRef, vesModule); AsstList.Speed.GetAsst(this).UpdateSetpoint(currentSpeed * Utils.SpeedTransform(newRef, vesModule)); break; case ThrottleMode.Acceleration: double currentAccel = AsstList.Acceleration.GetAsst(this).target_setpoint / Utils.SpeedTransform(speedRef, vesModule); AsstList.Acceleration.GetAsst(this).UpdateSetpoint(currentAccel * Utils.SpeedTransform(newRef, vesModule)); break; } } speedRef = newRef; adjustedSpeed = Vessel.srfSpeed * Utils.SpeedTransform(speedRef, vesModule); adjustedAcceleration = 0; throttleModeChanged(CurrentThrottleMode, ThrtActive, false); }