Page 1 of 1

Trains and Circuits

Posted: Mon Aug 24, 2020 3:20 pm
by rcp27
I'm giving a rail based setup my first serious attempt, and I'm trying to go with a "wait at a central depot" method of dispatching trains. The way I have it set up is every source of a given product has a station with the same name and every destination likewise, for example "iron plates pickup" and "iron plates drop-off". I have a dedicated refuelling station and a set of "wait here" depot stations. The trains are scheduled like this:

refuelling (inactivity) > depot (circuit condition) > pickup (full cargo) > depot (circuit condition) > drop-off (empty cargo).

I have combinators to count the items in the chests at each station and if a pickup station has enough for a full train, it generates a signal, likewise for drop-off stations if it has enough space to accept a full train. I put the signals on wires that span the whole rail network, and the pickup and drop-off stations are set to activate/deactivate based on the signal, and the same signal is used for the depot circuit condition.

Apart from the odd bit of traffic jam, everything works except for one thing. When a signal is sent to open a station, the train receives the signal but sees the station as "closed", so skips that stop on its schedule. My guess is that because the station takes 1 "tick" to register as open and the train and station receive the signal at the same instant, the station is still closed at the moment the train activates, it skips the stop.

I figured a way to fix this would be to pass the signal wire between the wider network and the depot station through an arithmetic combinator set to each * 1 = each, so that there is a one tick delay in sending the signal to the train. This does not appear to be fixing the problem. Am I misunderstanding what is going on? Is there a better way to achieve what I want (I am aware of mods like LTN, but I would rather make this work in vanilla).

Re: Trains and Circuits

Posted: Mon Aug 24, 2020 4:38 pm
by torne
Is the global signal connected directly to the pickup/dropoff train stops, or are there combinators involved? If there's any combinators you might need to delay by more than one tick, since each combinator delays the signal by one more tick.

Re: Trains and Circuits

Posted: Mon Aug 24, 2020 6:10 pm
by rcp27
The system is set up with all the chests for a single car at a station on the green wire as input to a decider combinator. That combinator reads the contents and if the levels are right to trigger the station, it sends a green square on the red wire. The red wire for the whole station is input to a second decider combinator by the station that, if it receives x green squares where x is the number of cars, sends a signal for the relevant item. To keep it simple, for supply stations 1x the item being supplied, for demand I pick a letter or colour signal and send that. The output signal for the station is connected to the station with a red wire and to the global network with a green wire, so that signals on the global network won't feed the local station. The station is set to activate on the signal, and at the depot station, the global wire is connected to the station, and the trains are set to depart when signal > 0, where the signal is the relevant item for the part of the journey for the particular train. Basically the signal is sent to the station to be activated and to the train to be dispatched with no other intermediate combinators or circuit logic

Re: Trains and Circuits

Posted: Mon Aug 24, 2020 6:19 pm
by sparr
Do you have a plan to prevent multiple trains from being dispatched to service the same need?

Re: Trains and Circuits

Posted: Mon Aug 24, 2020 6:25 pm
by rcp27
I have thought about setting it up so that the second train is dispatched with the signal is >=2 and the third on >=3 etc, so far I haven't done that as the train network is coping with the extra traffic of just sending them all out, but that might become an issue as I scale up