public void TestTrimControl() { FlightControlSystem fcs = new FlightControlSystem(); fcs.trimControl = true; fcs.TrimCollective = 0.5; fcs.CollectiveInput = 0.5; fcs.Update(0.01); Assert.AreEqual(0.75, fcs.Collective, 0.001); fcs.TrimCollective = -0.5; fcs.CollectiveInput = -0.5; fcs.Update(0.01); Assert.AreEqual(-0.75, fcs.Collective, 0.001); fcs.TrimCollective = -0.5; fcs.CollectiveInput = 0.5; fcs.Update(0.01); Assert.AreEqual(0.25, fcs.Collective, 0.001); fcs.TrimCollective = 0.5; fcs.CollectiveInput = -0.5; fcs.Update(0.01); Assert.AreEqual(-0.25, fcs.Collective, 0.001); }
public override Helicopter LoadDefault() { Mass = 750; Inertia = Matrix <double> .Build.DenseOfDiagonalArray(3, 3, new double[] { 1000, 3000, 3000 }); foreach (var rotor in Rotors) { rotor.LoadDefaultTailRotor(); } Rotors[0].Translation = Vector <double> .Build.DenseOfArray(new double[] { 2, 2, -1 }); Rotors[1].Translation = Vector <double> .Build.DenseOfArray(new double[] { -2, 2, -1 }); Rotors[2].Translation = Vector <double> .Build.DenseOfArray(new double[] { -2, -2, -1 }); Rotors[3].Translation = Vector <double> .Build.DenseOfArray(new double[] { 2, -2, -1 }); Rotors[0].direction = Rotors[2].direction = Rotor.Direction.CounterClockwise; Rotors[1].direction = Rotors[3].direction = Rotor.Direction.Clockwise; FCS = new FlightControlSystem().LoadDefault(); Engine = new Engine().LoadDefault(); GearBox = new GearBox().LoadDefault(); Fuselage = new Fuselage(); return(this); }
public void NullZone_AboveNegative_Scales() { FlightControlSystem fcs = new FlightControlSystem(); fcs.latNullZone = 0.2; fcs.LatInput = -0.8; fcs.Update(0.01); Assert.AreEqual(-0.75, fcs.LatCyclic, 0.001); }
public void NullZone_BelowNegative_Returns0() { FlightControlSystem fcs = new FlightControlSystem(); fcs.longNullZone = 0.5; fcs.LongInput = -0.2; fcs.Update(0.01); Assert.AreEqual(0.0, fcs.LongCyclic, 0.001); }
public void CollectiveNullZone_NotTrimControl_DoesNotApply() { FlightControlSystem fcs = new FlightControlSystem(); fcs.trimControl = false; fcs.collectiveNullZone = 0.2; fcs.CollectiveInput = 0.8; fcs.Update(0.01); Assert.AreEqual(0.8, fcs.Collective, 0.001); }
public void CollectiveNullZone_TrimControl_Applies() { FlightControlSystem fcs = new FlightControlSystem(); fcs.trimControl = true; fcs.collectiveNullZone = 0.2; fcs.CollectiveInput = 0.8; fcs.Update(0.01); Assert.AreEqual(0.75, fcs.Collective, 0.001); }
public override Helicopter LoadDefault() { Mass = 2450; Inertia = Matrix <double> .Build.DenseOfArray(new double[, ] { { 1762, 0, 1085 }, { 0, 9167, 0 }, { 1085, 0, 8687 } }); MainRotor = new Rotor().LoadDefault(); MainRotor.Translation = Vector <double> .Build.DenseOfArray(new double[] { 0.0071, 0, -1.5164 }); MainRotor.Rotation = Matrix <double> .Build.RotationY(-6.3 *Math.PI / 180.0); TailRotor = new Rotor().LoadDefaultTailRotor(); TailRotor.Translation = Vector <double> .Build.DenseOfArray(new double[] { -7.5, 0, -0.8001 }); TailRotor.Rotation = Matrix <double> .Build.DenseOfArray(new double[, ] { { 1, 0, 0 }, { 0, 0, -1 }, { 0, 1, 0 } }); HorizontalStabilizer = new Stabilizer().LoadDefaultHorizontal(); HorizontalStabilizer.Translation = Vector <double> .Build.DenseOfArray(new double[] { -5.8, 0, -0.5 }); HorizontalStabilizer.Rotation = Matrix <double> .Build.RotationY(5 *Math.PI / 180.0); VerticalStabilizer = new Stabilizer().LoadDefaultVertical(); VerticalStabilizer.Translation = Vector <double> .Build.DenseOfArray(new double[] { -7.3, 0, -1.5 }); VerticalStabilizer.Rotation = Matrix <double> .Build.RotationX(90 *Math.PI / 180.0) * Matrix <double> .Build.RotationY(5 *Math.PI / 180.0); Fuselage = new Fuselage().LoadDefault(); Fuselage.Translation = Vector <double> .Build.DenseOfArray(new double[] { 0.0178, 0, 0.0127 }); FCS = new FlightControlSystem().LoadDefault(); Engine = new Engine().LoadDefault(); GearBox = new GearBox().LoadDefault(); return(this); }