public override void PreUpdate(double dt) { // Update sub-model atmospheric properties foreach (var rotor in Rotors) { rotor.Density = Atmosphere.Density; rotor.HeightAboveGround = Height - rotor.Translation[2]; } // Update sub-model controls foreach (var rotor in Rotors) { rotor.Collective = FCS.Collective; if (rotor.Translation.x() > 0) { rotor.Collective -= FCS.LongCyclic; } if (rotor.Translation.x() < 0) { rotor.Collective += FCS.LongCyclic; } if (rotor.Translation.y() > 0) { rotor.Collective -= FCS.LatCyclic; } if (rotor.Translation.y() < 0) { rotor.Collective += FCS.LatCyclic; } if (rotor.direction == Rotor.Direction.CounterClockwise) { rotor.Collective += FCS.Pedal; } if (rotor.direction == Rotor.Direction.Clockwise) { rotor.Collective -= FCS.Pedal; } if (rotor.Collective > 1.0) { rotor.Collective = 1.0; } if (rotor.Collective < -1.0) { rotor.Collective = -1.0; } } // Update engine and drivetrain if (UseEngineModel) { if (Engine.phase == Engine.Phase.START && GearBox.autoBrakeRPM > 1e-5) { GearBox.BrakeEnabled = false; } GearBox.MainRotorLoad = 0; GearBox.MainRotorInertia = 0; foreach (var rotor in Rotors) { if (!rotor.Enabled) { continue; } GearBox.MainRotorLoad += Math.Abs(rotor.ShaftTorque); GearBox.MainRotorInertia += rotor.Inertia; } GearBox.TailRotorLoad = 0; GearBox.TailRotorInertia = 0; GearBox.Update(dt); Engine.load = GearBox.Load; Engine.inertia = GearBox.Inertia; Engine.Update(dt); GearBox.RotspeedDrive = Engine.RotSpeed; foreach (var rotor in Rotors) { rotor.RotSpeed = rotor.Enabled ? GearBox.MainRotorSpeed : 0; } } }