Benchmark & race your trains with this lap timer for trains

Smart setups of railway stations, intelligent routing, solutions to complex train-routing problems.
Please provide - only if it makes sense of course - a blueprint of your creation.
Post Reply
naknak
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Oct 29, 2017 10:57 pm
Contact:

Benchmark & race your trains with this lap timer for trains

Post by naknak » Fri Nov 10, 2017 2:23 am

Blueprint on pastebin
mrkTrn v1 by naknak.txt
(8.74 KiB) Downloaded 34 times
Image

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!
  1. install the Nixie Tubes mod.
  2. 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.
  3. 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.
  4. 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.
  5. "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.
  6. reset by turning the power off and on again.
You can use an existing signal instead of the one in the blueprint; just connect it to one of the rail signal combinators (top or bottom) with red wire. Ensure your signal has default settings ("read signal" checked, red light=red signal).

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.

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).
mrkTrn v1 by naknak.txt
(8.74 KiB) Downloaded 34 times
Blueprint on pastebin

Post Reply

Return to “Railway Setups”

Who is online

Users browsing this forum: XYZT