Counter + Reset?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Spades68
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Jun 26, 2020 12:08 am
Contact:

Counter + Reset?

Post by Spades68 »

Train logic problem. One of the 'When' statements need a permanent counter circuit that can take increments and decrements, and the other 'When' statement needs a permanent counter that gets reset upon outputting a value.

Problem: I have an infinite amount of trains in a lane, waiting to be released into the train stop area.

The train stop area has 5 stops (T-5).

When: 1 train is released into the train stop area, a 'counter' is incremented by 1 (++)
When: 1 train arrives at a train stop, when the rail signal for that stop goes from RED (train entered stop) -> GREEN (train fully left stop), now decrement 'counter' by 1 (--)

IF T-5 >= counter THEN the rail signal that releases the trains == GREEN

Is this possible? Examples if so please, trying to learn :)

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3160
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Counter + Reset?

Post by DaveMcW »

Your specific problem can be solved without using a counter.

Set each train station to read train ID, and attach it to a decider combinator that outputs 1 if the ID is greater than 0. The output from the 5 decider combinators is your train count.

Spades68
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Jun 26, 2020 12:08 am
Contact:

Re: Counter + Reset?

Post by Spades68 »

DaveMcW wrote:
Mon Jul 06, 2020 2:03 am
Your specific problem can be solved without using a counter.

Set each train station to read train ID, and attach it to a decider combinator that outputs 1 if the ID is greater than 0. The output from the 5 decider combinators is your train count.
The problem I run into is when a train isn't in a slot, the filter will allow infinite trains through the queue UNTIL a train arrives at that slot. I need to the system to COUNT IN and COUNT OUT before allowing more in.

So for example: The train slot and the queue entrance are like 1 mile apart, so the amount of time between the first train getting released from the queue, until it fills that slot, the system will keep de-queuing as many trains as it can.

Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: No registered users