A workshop exercise for LunCoSim, an open-source co-simulator for space missions. Install a nightly build, then clone this repository and open one of the two Twins.
Two complete Twins of the same mission. start/ is what the students get.
solved/ is one answer to compare with, not the only one. The mission and its
four requirements are in BRIEF.md inside each Twin.
| Measured result | R1 distance | R2 battery | R3 tilt | R4 estimator error | Verdict |
|---|---|---|---|---|---|
start/ (12 Ah, straight over the ridge) |
504 m | 2.8% | 26.0 deg | 45.4 points | FAIL |
solved/ (15 Ah, around the ridge) |
521 m | 26.6% | 8.5 deg | 4.3 points | PASS |
Open the folder start with File -> Open Folder/Twin... The drive starts by
itself after two seconds. It takes about 10 minutes at normal speed, so use the
headless run for checking. That takes about a minute:
luncosim test --scene /full/path/to/start/scene.usda --max-ticks 80000
- Run
startand read the verdict. Which requirements fail, and why? - R3, route. Move route points
P1andP2inscene.usdaso the rover goes around the ridge. The ridge covers x from -30 to 30. - R4, model. In
models/EnergyEstimator.mo, replace the two TODO lines. Use the charge spent so far and the distance left. A good first job for the AI. - R2, trade study. Find the smallest battery that passes:
open
sweep.usda(see below), or runpython3 sweep.py start 12 13 14 15 16. - Change one thing at a time and keep each verdict as evidence.
Open sweep.usda from either Twin. Five rovers drive your route side by side with
12 to 16 Ah batteries. Each result appears on screen as PASS or FAIL for R2 and
R3, then the smallest battery that passes. It reuses scene.usda, so your route
changes apply by themselves. To try other sizes, edit the inputs:capacity
values in sweep.usda.
The script asks for 8x speed. How fast it really runs depends on the computer: one run took 6.5 minutes in the window on a busy machine, and about 3.5 minutes headless:
luncosim test --scene /full/path/to/start/sweep.usda --max-ticks 80000
This is also the pattern for a startup script: a Program prim in the scene
that points to a .rhai file runs when the scene opens. See Sweep at the end
of sweep.usda and scenarios/tests/battery_sweep.rhai.
scene.usda:P1andP2at x = 45;inputs:capacity15 instead of 12.models/EnergyEstimator.mo: average charge per metre, times the metres left.- The name and description in
twin.toml.
Trade study on solved/: 13 Ah fails (15.3% left), 14 Ah passes (21.4%),
15 Ah passes (26.6%). The smallest passing size of those is 14 Ah; 15 Ah is
used for margin.
Possible follow-ups: make the estimator account for the climb at the end; slow
down with inputs:cruise_throttle; add solar generation; change the rover.
input.json in each Twin binds the key T to the RunLint command. Change
the key or the command to make your own controls.
The results above are from headless runs on 3 December 2026 with a development build of LunCoSim. Run both Twins on your own build before relying on them.
MIT, see LICENSE.

