Page 1 of 1

Equalising 3 train unloader

Posted: Wed Jun 13, 2018 8:23 pm
by jarifle
I've got a train station consisting of 3 unload bay. i would like a circuit system to check what bay is least filled and open the signal corrisponing to that bay.
How would i go about doing this? I'm really bad at circuit networks.
Knipsel.PNG
Knipsel.PNG (1.12 MiB) Viewed 3485 times
As you can see in the picture i have 3 lanes.
Say
lane 1 has 1000 ore
Lane 2 has 2000 ore
Lane 3 has 0 ore

Then i want all trains to go to 3

Re: Equalising 3 train unloader

Posted: Wed Jun 13, 2018 8:45 pm
by Kinson25
Posting a picture of your setup, and maybe a save file would really help the forums help you.

Re: Equalising 3 train unloader

Posted: Thu Jun 14, 2018 6:40 pm
by jarifle
Kinson25 wrote:Posting a picture of your setup, and maybe a save file would really help the forums help you.
See edit for picture

Re: Equalising 3 train unloader

Posted: Thu Jun 14, 2018 7:25 pm
by quyxkh
You get a simpler circuit and good results by opening the stops with below-average content, and an even simpler circuit and better results by opening only stops that have less than 44 stacks of content in the buffers.

Re: Equalising 3 train unloader

Posted: Thu Jun 14, 2018 8:33 pm
by jarifle
quyxkh wrote:You get a simpler circuit and good results by opening the stops with below-average content, and an even simpler circuit and better results by opening only stops that have less than 44 stacks of content in the buffers.
That is true but i't not what i want.
Reason being is that every station corresponds to 1 line on my main bus and i want every line to be at least partially full for maximum throughput.

Re: Equalising 3 train unloader

Posted: Thu Jun 14, 2018 9:12 pm
by thedarkbunny
Calculating maximum or minimum out of a group of signals is, generally speaking, a pain. Simplifying to "below average" saves a lot of combinators, with relatively little risk of starving one of your stations.

Re: Equalising 3 train unloader

Posted: Thu Jun 14, 2018 9:45 pm
by jarifle
thedarkbunny wrote:Calculating maximum or minimum out of a group of signals is, generally speaking, a pain. Simplifying to "below average" saves a lot of combinators, with relatively little risk of starving one of your stations.
Oke and how would i go about this?

Re: Equalising 3 train unloader

Posted: Thu Jun 14, 2018 11:01 pm
by DaveMcW
3 is a small enough number that you can calculate an exact answer.

Decider combinator: Iron ore (station 1 chests + negative station 2) ≤ 0 → Green = 1
Decider combinator: Iron ore (station 1 chests + negative station 3) ≤ 0 → Green = 1
Signal 1: Green = 2
Arithmetic combinator: Each (station 1 chests) * -1 → Each (negative station 1)

Decider combinator: Iron ore (station 2 chests + negative station 1) ≤ 0 → Green = 1
Decider combinator: Iron ore (station 2 chests + negative station 3) ≤ 0 → Green = 1
Signal 2: Green = 2
Arithmetic combinator: Each (station 2 chests) * -1 → Each (negative station 2)

Decider combinator: Iron ore (station 3 chests + negative station 1) ≤ 0 → Green = 1
Decider combinator: Iron ore (station 3 chests + negative station 2) ≤ 0 → Green = 1
Signal 3: Green = 2
Arithmetic combinator: Each (station 3 chests) * -1 → Each (negative station 3)

Use green wires for positive numbers and red wires for negative numbers. All 3 red wires need dedicated electric poles to prevent them from touching. If you try to scale this beyond 3, the combinators required is equal to the number of stations squared.

Re: Equalising 3 train unloader

Posted: Fri Jun 15, 2018 4:07 am
by quyxkh
You can get this down to 3N-3 combinators if you're willing to go a little old-school on it.

After the first stop, each new stop feeds the previous least amount and the current stop into a comparator, Each-to-Each *-1, <0, -0. The previous value's redwired to the first (negator) and third (isolator) inputs, the current stop's value is greenwired and the negator output is redwired to the decider's input, whose output's greenwired to the isolator's input. So the decider gets the current stop minus the previous value, and if that's less than zero, the difference is subtracted from the previous value producing either the previous value or this one, whichever's less. The final isolator is a *-1, its output's redwired to the entry signal at each stop, which is also greenwired to the buffer chests and is set to close if anything > 0. So only the stop(s) with the least amount can be green, put them behind a chain signal and the trains will do what you want.

edit: fixed braino'd isolator constant.

Re: Equalising 3 train unloader

Posted: Fri Jun 15, 2018 7:31 am
by aober93
This is what i solved with this circuit, only 3 combinators per bay.
viewtopic.php?f=193&t=44038&hilit=train+balancer

But since 0.15 i am shutting down the station instead of the signal, to avoid rare deadlocks. Ive changed it abit, i can upload it if u want.