Your problem is a function of distance,not time. You can do it without a timer. Assuming the train runs only in one direction. On the tunnel entrance install 2 reed switches off set so that a magnet on the engine trips one and a magnet on the caboose trips the other. Then get 2 relays, a DPDT (relay 1) and a SPDT (relay 2). Engine magnet trips reed switch 1 which energizes relay 1 coil circuit. Relay 1 coil circuit latches through one of it's C-NO contact sets in series with the C-NC contacts on relay 2.
So when the engine rolls over the it's reed switch relay 1 is latched. When the caboose runs over it's reed switch (2) it energizes coil 2 circuit which opens its contact set and breaks the latch on relay 1.
Use the second set of contacts on relay 1 to cut power off an insulated center rail section down the track.
When the train approaches the tunnel relay 1 is latched by engine. Power is off far down the track, If the caboose uncouples the train will stop on that section when it arrives. If the caboose is on the train it will energize relay 2 when it gets there which unlatches relay 1. Power will be on that distant section when the train arrives.
You can use 12 or 24VAC relays for this application. 24 volt ones will work off 18VAC. You can also use DC ones with a rectifier,but do not use a capacitor across the relay coil. You will need a separate transformer tap to work the relay circuit.
You can also use a twin coiled latch relay,which will have memory when power is shut off.
Dale H