This is a lap timer for trains. I created it so that I could compare efficiencies of various train lengths.
This is my first big circuit creation and I've made it as foolproof as I know how. I hope it is useful to others. Comments and critique are extremely welcome!
- install the Nixie Tubes mod.
- drop the blueprint on a piece of track that has your train running on it. Usually a station entrance or exit works best, so that unrelated trains don't pollute the results. Delete the unwired signals, if you like.
- specify how many laps and/or minutes to run for, by setting the L and M signals to max laps and max minutes in the top-right combinators. Skip this step if you want; the defaults are reasonable.
- turn on the Power combinator top-center (it's off by default). The "power" and "waiting" lights will come on. Lap #1 begins when your train passes the wired signal.
- "last lap" lights up when max laps or max minutes are reached, or if you turn off the power combinator. Timers will run until a train completes the last lap.
- reset by turning the power off and on again.
To link multiple timers, connect their power combinators with red wire. Even number of active power combinators = power off; odd number = power on. If you want them to use the same max minutes / max laps settings, connect those combinators as well, and turn all off except one.
To have the train stop until you turn on the power, condition a rail signal to be closed when P=0. To have it stop at the end, use condition A=1. Use a new signal, not the already-wired signal.
If you'd like to extend or adapt this design, I've made a note of all the signals in use on the primary green wire.
Blueprint on pastebin
Code: Select all
Green-wire Globals __________________________ A - After benchmark; set to true (1) from last lap until power cycle (Q). This is one of three main states the timer can have. The others are G (go) and J (just started). B - Best (fastest) lap time, in ticks C - Current lap time, in ticks D - Delayed version of the F signal. At n ticks after an F pulse, its value is 2^n, up to a maximum of n=31. 2,7 - boolean pulses that lag the F pulse by 2 and 7 ticks, respectively. They are used to update some timers that depend on other timers, for which the F signal arrives too soon (before dependencies have updated). F - Finish line; 0 except on end of lap. At end of lap (wired signal turns red) it pulses 1 for a single tick. This impulse controls the lap timers; every combinator between it and the timer will delay lap cycling by one tick. G - Go; true (1) while the benchmark is running. At each lap end, G acquires the current value of H, which will be false on reaching max laps (L) or max time (M) or turning off power (P). Along with J and A, G is one of three main states the timer can have. H - running state on next Higher lap; At lap end, Go acquires the current value of H. I - In-progress lap number; equal to K plus G. J - Just started; set to true (1) from power-on (Q) to first crossing of the finish line (F). Along with A and G, J is one of three main states the timer can have. K - Kompleted laps; increments on every crossing of the finish line while in "Go" state. L - max Laps; configured in MAX box M - max Minutes of runtime as configured in MAX box; is specified in minutes but converted to ticks (minutes * 3600) for the signal bus; actual runtime will extend to completion of the final lap N - Net accumulated lap time in ticks; updated on each lap end, used to calculate average lap time and equal to Unfinished timer minus Current Timer P - Power; 1 if timers and counters should time and count, controlled by turning on the PWR constant combinator. Shutting off power will end the benchmark at next crossing of the finish line. Turning power on (from off) resets timers and counters. For immediate reset, turn the power off and on again. Q - Quiesce; 1 at most times, pulses 0 when power transitions from off to on. Used to reset latches. R - most Recent lap time, in ticks U - overall time including current Unfinished lap, in ticks; runs as long as timer state is "Go" V - aVerage lap time, in ticks W - Worst (slowest) lap time, in ticks X,Y,Z - reserved for transient local variables that are never put on the green wire, but may be read by combinators that have green AND red inputs. If you put X,Y, or Z on the green bus, you will break these combinators. colors - unused but will interfere with lamps that are connected to the green bus (and would otherwise get colors from a red wire).