When I firstly, started flying long-haul planes, as a Flight-Sim enthusiast, I started wondering whether there was a “smart” way to cover long distances without having to stare at the monitor while the plane cruises with autopilot doing his things. At some point when using FSX or P3D I found this pretty sweet piece of software: Lorby Time Machine.

Problem is: I dropped FSX 10 years ago in favor of X-plane 11. So, how could I manage to compress the time when bugging from one point of the globe to the opposite?
X-plane community has developed the great `FlyWithLua`

environment to quicky write x-plane addons that suit our needs!

So, in collaboration with Fox, a very kind user from x-plane.org forum. I
decided to write the *SmartGroundAcceleration* FlyWithLua script.

The idea behind this script is simple, when navigating at cruise level I want the plane to follow the route to the T/D point, but I want it to cruise at 16 times the cruising speed.

You might think that increasing the ground speed of the plane is sufficient to keep up with the route… but what happens if you need the plane to turn at 16 times it’s cruising speed, let’s say Mach 0.7? You guessed it, the plane will drift way out of the intended route.

So how can we compress time in a *smart* way?

The solution is the following, we will run this set of actions to keep up with the route:

- Increase ground speed multiplier (let say 16 times) to the next waypoint on the flight plan
- When at a given distance from the waypoint (default is 3 NM) reset the speed multiplier to 1
- Give the plane, some time and space to catch up with the route, do the turn to the next waypoint if needed
- When last waypoint is 3 NM behind restore the multiplier to the initially requested value (16)
- Pause when reaching a given distance from the destination airport

let’s take a look at how we implement these actions in the script; let’s say we are running with multiplier set to 16, then:

```
-- Basically check whether the plane is drifting away from the intended route
if tf_TrackOffset > 0.3 then
-- restore multiplier to 1
tf_GroundCompression = 1
-- this flegs
tf_ProtectionActive = 1
end
```

Here we check whether the plane has reached the set distance from the destination:

```
if (tf_distanceToPause > 0 and tf_distanceToPause >= math.floor(tf_DistanceFromDestination+0.5) ) then
print("pause")
command_once("sim/operation/pause_toggle")
tf_GroundCompression = 1
tf_ProtectionActive = 0
tf_TurnGCOnTarget = 0
tf_scriptActivate = false
end
```

If the plane is getting close to the WP we set the multiplier back to 1

```
-- I am close to the waypoint I need to reset speed to 1
if tf_DMEDistance < tf_WPThreshold and tf_GroundCompression > 1 then
tf_GroundCompression = 1
tf_ProtectionActive = 1
end
```

When the plane is levelled, and we are past the previous WP we can increase the multiplier

```
if tf_DMEDistance > tf_WPThreshold and tf_ProtectionActive == 1 and tf_DMEDistance < tf_TurnGCOnTarget and math.abs(tf_roll) < 2 then
print("restoring: ".. tf_SelectedCompressionRate)
tf_GroundCompression = tf_SelectedCompressionRate
tf_ProtectionActive = 0
tf_TurnGCOnTarget = 0
end
```

You can find the full script here

It works with planes that use the default Laminar X-FMS, but you may try to change the Datarefs in order to adapt it to other planes, as long as navigation Datarefs are available. I used Zibo 737 to test this plugin