src/AircraftTrajectories/Models/Optimisation/FlightSimulator.cs
/// <summary>
/// Update the position of the aircraft for 1sec
/// </summary>
Update the position of the aircraft for 1sec
Update the position of the aircraft for 1sec
protected void updatePosition()
        {
            double currentThrust = CurrentThrust();
            double currentDrag = _aircraft.Drag(_speed, _height);
            updateAngle(currentThrust, currentDrag);
            updateSpeed(currentThrust, currentDrag);
            UpdateBankAngle();
            _height += _speed * 1.6878099 * Math.Sin(_angle);
            _heading += (9.81 / _speed * 0.514444444 * Math.Tan(_bankAngle));
            _heading = (_heading + (2*Math.PI)) % (2 * Math.PI);
            double dX = _speed * 0.514444444 * Math.Cos(_angle) * Math.Sin(_heading);
            _x += dX;
            double dY = _speed * 0.514444444 * Math.Cos(_angle) * Math.Cos(_heading);
            _y += dY;
            distance += dX + dY;
            double consumedFuel = _aircraft.FuelFLow(currentThrust, _speed, _height);
            _aircraft.Mass -= consumedFuel;
            fuel += consumedFuel;
        }
protected void updatePosition ( ) { double currentThrust = CurrentThrust ( ) ; double currentDrag = _aircraft . Drag ( _speed , _height ) ; updateAngle ( currentThrust , currentDrag ) ; updateSpeed ( currentThrust , currentDrag ) ; UpdateBankAngle ( ) ; _height += _speed * 1.6878099 * Math . Sin ( _angle ) ; _heading += ( 9.81 / _speed * 0.514444444 * Math . Tan ( _bankAngle ) ) ; _heading = ( _heading + ( 2 * Math . PI ) ) % ( 2 * Math . PI ) ; double dX = _speed * 0.514444444 * Math . Cos ( _angle ) * Math . Sin ( _heading ) ; _x += dX ; double dY = _speed * 0.514444444 * Math . Cos ( _angle ) * Math . Cos ( _heading ) ; _y += dY ; distance += dX + dY ; double consumedFuel = _aircraft . FuelFLow ( currentThrust , _speed , _height ) ; _aircraft . Mass -= consumedFuel ; fuel += consumedFuel ; }
Update the position of the aircraft for 1sec
Update the position of the aircraft for 1sec
//Console.WriteLine(_x + " " + _y + " " + _heading); /*
            if (_height >= 0) {
                Console.WriteLine(_aircraft.TakeOffThrust(160, 1640));
                Console.WriteLine(currentThrust + " " + currentDrag);
                Console.WriteLine(_aircraft.FuelFLow(currentThrust, _speed, _height));
            }
            */