[0.16] Rail Signal Counter

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
b_d
Inserter
Inserter
Posts: 22
Joined: Sat Jul 13, 2019 2:49 pm
Contact:

[0.16] Rail Signal Counter

Post by b_d »

I don't like using Dual trains back and forth.
I know i have to create Parking Lanes.

Is there a way to use the Combinators to Count the trains that pass by and when it counts two trains passes by and stores it and subtracts it from the other end or make it reset when or after the two trains exit.

I'm guessing it uses an RS/SR Latch and can't get a counter to work cause if the Train Passes the signal it counts continually in the Input Count. i guess Binary Counter is the solution. but how to do it? i have no electrical engineering experience and Logic programming is Poor. i can only try to read a completed Circuit to see how it works.

Serenity
Smart Inserter
Smart Inserter
Posts: 1000
Joined: Fri Apr 15, 2016 6:16 am
Contact:

Re: [0.16] Rail Signal Counter

Post by Serenity »

You probably need some kind of edge detector to only count when the signal switches from green to red

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: [0.16] Rail Signal Counter

Post by slippycheeze »

b_d wrote:
Wed Aug 28, 2019 9:04 am
I don't like using Dual trains back and forth.
I know i have to create Parking Lanes.

Is there a way to use the Combinators to Count the trains that pass by and when it counts two trains passes by and stores it and subtracts it from the other end or make it reset when or after the two trains exit.

I'm guessing it uses an RS/SR Latch and can't get a counter to work cause if the Train Passes the signal it counts continually in the Input Count. i guess Binary Counter is the solution. but how to do it? i have no electrical engineering experience and Logic programming is Poor. i can only try to read a completed Circuit to see how it works.
A standard memory works here: an arithmetic combinator with <signal> + 0 => <signal>, or <each> + 0 => <each>, wired from input to output.

Then wire the "in" signal directly to the input of that combinator, and the "out" signal to an arithmetic <red> * -1 and then to the input.

Your output will have the current count of trains between the two signals, to a first approximation. You can also have one signal emit <red> and <green>, then use an arithmetic combinator with <green> * -1 => <red> to get a single signal to do both parts of the counting, if you want.

Beyond that, though, if you are not comfortable with combinators I suspect you will shortly find yourself very annoyed at them. I'd personally try and work out how to design the network so that trains simply work out passing like that on their own. Usually, as long as you ensure they own all the signals the whole length of a two-way track it'll sort that out.

Also of potential use, viewtopic.php?t=53937 – "how to: two way rails" – which covers that in more detail.

b_d
Inserter
Inserter
Posts: 22
Joined: Sat Jul 13, 2019 2:49 pm
Contact:

Re: [0.16] Rail Signal Counter

Post by b_d »

I understand the 2 In&Out RAIL Standard Solution. like using a Basic Train & 4 Wagon instead of a Train & 5+plus Wagon setup.
The Imgur links are not loading. i wonder if the problem is at my end only or the links are Dead?

I want the single rail set up for the small patches i find. i use a 2x(Train-4/+ xWagon) combo per single rail setup and do a parking lanes that can be alot easier to be extended.

As i understand your instructions:
  1. Rail signal to Arithmetic Combinator Setup 1 looped into itself.
  2. Setup1:[<each> + 0 ~> <Each>]looped & Connected to Arithmetic Setup2.
    (I still see the CONTINUOUS signals Stacking to each other as just one train passes; Like if the Train is just parked on that rail BLOCK it continually sends the signal and stacks the Red signal to #K as it keeps counting as long as the train is occupying the Block. {the time it takes for that train to exit the block it already has 400+red signals }
  3. Setup2 :[Red * -1 ~> -RED] Connected to Setup 1
    (My guess is to Delete all the excess signal from the 1st setup; since Setup1-RED ={should equal to}= ZERO/1?) Cause i don't see it; ALL i get is the Setups 1&2 having epileptic seizures. Do i need a Decider Combinator to stabilizing the output to a <signal>~>1
  4. I'm using this, to learn how combinators work. I was thinking since the signal is continuous do i use it as an on signal for an "inserter Counter"
    [Fill one chest with 2 Logs and hope the time it transfers the log to the other container and it transfers the all the two logs back] using the Storage as the counter.

b_d
Inserter
Inserter
Posts: 22
Joined: Sat Jul 13, 2019 2:49 pm
Contact:

HELP!

Post by b_d »

:oops: Can anyone solve this?

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: [0.16] Rail Signal Counter

Post by disentius »

Here. A concept train counter.
1. make sure the train signal only outputs red signal (middle click on the others to remove them)
2. Counters/memory cells only work reliable with 1-tick pulses. The pulse generator blocks all incoming signals after one tick, and keeps blocking as long as it receives a signal (which is why step 1 is important) :D .

Display cell -> DaveMcW

simple train counter.png
simple train counter.png (2.1 MiB) Viewed 2115 times


Post Reply

Return to “Gameplay Help”