Speed matching CSX 2121 and 2738

Two locomotives running as a pair need the same speed at each throttle step. This is how AI timed both over the detection blocks and corrected 2738’s decoder to match 2121.

The job

CSX 2121 and 2738 run as a pair, so 2738’s decoder had to match 2121’s speeds.

What AI did

A program running inside JMRI (Java Model Railroad Interface) sets a locomotive to a throttle step, lets it run through the block sensors and times each block, step after step, with no hands on the throttle. Block lengths now come from the track plan and were checked against timed passes. Both locomotives were measured in both directions on 13 November 2026, 2738 was adjusted to match 2121, and the two were compared stopping.

Try it on your layout

Two prompts to paste into an AI coding agent such as Claude Code are on the speed matching prompts page. One works out block lengths you do not know from timed runs and one known loop length, which is how the lengths here were found. The other starts a speed-matching job: what you need first, the decoder checks, the safety rules for programming on the main, and the steps.

The 13 November 2026 runs

2738 now runs within 4 per cent of 2121 at every step from 24 up, in both pairings of the two locomotives (most steps within 2 to 3 per cent). Step 16 is 2 per cent fast in one pairing and 6 per cent fast in the other. The locomotives face away from each other in a consist, so 2121 forward runs with 2738 reverse and the other way round.

Speed in mm/s by throttle step, and 2738 against 2121
Step2121 fwd2121 rev2738 fwd2738 rev2738 rev vs 2121 fwd2738 fwd vs 2121 rev
850.650.960.361.4+21%+18%
16156.3161.9171.8159.6+2.1%+6.1%
24261.7272.8270.0253.2−3.2%−1.0%
32338.8358.7354.1341.9+0.9%−1.3%
48429.0440.5447.6419.4−2.2%+1.6%
64454.1493.7484.5472.0+3.9%−1.9%
96453.4484.6479.3466.1+2.8%−1.1%
126465.0499.9490.3466.3+0.3%−1.9%

Speeds are in mm/s, as written to the roster. The viewer flags a step outside 3 per cent, and a step within 5 per cent is accepted: one step repeats to about 2 per cent between runs, and to 6 per cent at the slowest steps. Step 8 is creep, where 2738 is about 20 per cent fast and stays so.

2121 ran 3 to 10 per cent faster in reverse than forward, while 2738 ran evenly both ways. Raising only 2738’s forward trim brought 2738 forward up to 2121 reverse; the other pairing already matched.

2738 decoder settingOldNew
CV66, forward trim128135
CV69, speed table entry 35051
CV70, speed table entry 47374

Stopping from step 32 and from step 96 on the same track, with the same trigger, every block lit within 0.2 seconds of the other locomotive, and both came to rest in the same block. 2121 slows more gently than its settings predict, and 2738 matches it. The test of the coupled pair did not run cleanly, so the solo match stands for it.

Both roster entries now hold the measured speed profile, eight points each. 2121 was not changed.

The first run, 8 November 2026

The first program set each locomotive to a throttle step and timed laps of the whole loop. Both topped out at about the same speed, but 2738 ran at only 47 to 74 per cent of 2121’s speed through the lower steps. Its settings explained why: the speed table was switched off and it had no momentum.

2738 was matched to 2121, momentum included, with a calculated speed table programmed on the programming track; every value read back correctly. Measured again at steps 24, 48 and 126 it ran within 1.2 per cent of 2121, and about 5 per cent fast at step 12. At step 96 the two stopped within a tenth of a second of each other and started within three tenths. The two were timed running in opposite directions then, which the 13 November runs corrected.

CSX 2738 against CSX 2121, by throttle step A chart of the speed of CSX 2738 as a percentage of CSX 2121 at each throttle step. Before programming, shown dashed, 2738 starts at 74 per cent at step 8, falls to 47 per cent at step 32, then climbs to 100 per cent at step 96 and about 101 per cent at the top. After programming, shown solid, it measures 105 per cent at step 12 and between 99 and 101 per cent at steps 24, 48 and 126. A shaded band marks 97 to 103 per cent, the repeatability of the measurements. 100% 80% 60% 40% 0 32 64 96 126 Throttle step 2121 = 100% Before: 2738 runs slow After: matched
2738 as a share of 2121’s speed. Dashed with open circles is before programming, solid with squares is after. The after line was measured at four steps only, on 8 November. The shaded band is the 3 per cent the measurements repeat to.

Every recorded run

Every recorded run of the two locomotives on 13 November 2026, newest first. Pick a run to see its readings, the speed curve and the comparison, as the live dashboard drew them while the run was under way. Replay plays the run back as it happened, sped up, and Show the result returns to the finished run. Each run says whether the final profile used it. Two are marked: the 11:43 run of 2738 forward is not used, because before a fix the locomotive ran the opposite way to the one asked, and the 12:51 run of 2738 forward is superseded by the run after the CV66 change.

Recorded runs

Loading the recorded runs.

Speed curve

mm/s by throttle step

2738 against 2121

outside 3% is flagged

All runs

click to open

Events

    The chart and the comparison show the latest run of each loco and direction up to the one picked, as the live page would have at that moment. The faint dotted lines are the 2026-11-08 result scaled to the corrected loop length. Times are Eastern. The raw logs are not published.

    How well it went

    What came out

    A matched pair, ready to be tried coupled, and a method to repeat for the other fifteen locomotives.

    Verdict
    • Worked well: hours of unattended, repeatable measuring, a speed table worked out from the measured numbers, and one trim setting that matched both directions.
    • Be honest about: step 8 stays about 20 per cent apart, and step 16 is 6 per cent apart in one pairing. Block lengths now come from the track plan and were checked against timed passes; both directions were measured. Some loop 2 lengths are still estimates, so scale miles an hour is approximate. A block lighting again behind the locomotive can be taken as the next block, which is not fixed. The coupled stop test has not run cleanly.

    See it: Speed matching and the measure table (the Short Track Rail Road club’s procedure, PDF, 37 pp, which HART is adapting for HO) · Speed matching prompts (GitHub)