The most common usage of
terminate is to give a more appropriate stopping criteria for terminating a simulation than a fixed point in time. The terminate function takes a single argument of type String, which is used to indicate the reason for a successful termination. This is exemplified in the terminate statement within the when-statement in MoonLanding.

1 Celestial Body

2 Rocket

3 MoonLanding

When using this terminate condition the simulation stops when the moon lander touches the ground on the moon.

4 MoonLanding Simulation

When we simulate the MoonLanding class from 0 to 230 we get a message that the simulation ended before reaching 230. In the dslog.txt file we see that the simulation is terminated at T = 218.

Vertical velocity relative to the lunar surface and Altitude of the Apollo rocket over the lunar surface.