How to filter train content based on train content

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
RenewU
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 08, 2017 11:26 pm
Contact:

How to filter train content based on train content

Post by RenewU »

Hello factorio forum!

I've been playing Bob's and Angel's mods now, with a lot of new fun ores! However, maybe a bit tricky to handle...

I was thinking of making a "Mixed ores" drop off station where I would read the content of the train into a memory (latch) to set filter inserters to filter the current stationed (or just departed) trains' content. However, when a new train arrives with a new type of ore, I don't know how to switch the latched ore type in the memory. I've been the latch part from https://wiki.factorio.com/Tutorial:Circ ... ok#Latches but currently without any working reset. I try to use "each" or "anything" to read the content of the train, instead of setting up a big number of decision combinators outputting a,b,c... for each different ore type and getting the filter latched from that, but I don't know how to get this to work. Any help would be appreciated as I'm quite new to the bit more advanced circuit network stuff.

Thanks! -RenewU

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

Re: How to filter train content based on train content

Post by DaveMcW »

RenewU wrote:I try to use "each" or "anything" to read the content of the train, instead of setting up a big number of decision combinators outputting a,b,c... for each different ore type and getting the filter latched from that, but I don't know how to get this to work.
I assume you are trying to take a set of signals, and assign a unique signal to each inserter?

This really is as hard as you think. viewtopic.php?t=42902

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: How to filter train content based on train content

Post by Optera »

A latch like that can only store on/off states as it'd start counting the moment you set it to anything: value.

If all you need is a reset trigger you can hook up a signal reading red while a train is in the station.
The latch can then be set to green = 0: anything: 1.

When using train id from the stop you will need an inverter so it doesn't start self holding with trainid.
Inverter: TrainID = 0: R: 1
and latch: R=0: anything: 1

Edit: I don't see why you would use an SR-Latch for this though.

RenewU
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 08, 2017 11:26 pm
Contact:

Re: How to filter train content based on train content

Post by RenewU »

Humm... I may be completely wrong using an SR latch. My idea was to use an SR latch to remember the last signal (ore type) from the current/previous train and then somehow make the signal reset to a new ore type with the next train. Maybe an SR latch, which as mentioned, is basically used for on/off control.

A reset trigger could be that a train arrives as the problem with reading stationed train would probably reset the filter signal as soon as the train leaves.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: How to filter train content based on train content

Post by Optera »

To filter Bobs and Angels I'd unload either to active provider chests or large "chests" like 6x6 warehouses, wide chest, asf and filter from there either by loader or filter stack inserters.

RenewU
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 08, 2017 11:26 pm
Contact:

Re: How to filter train content based on train content

Post by RenewU »

Optera wrote:To filter Bobs and Angels I'd unload either to active provider chests or large "chests" like 6x6 warehouses, wide chest, asf and filter from there either by loader or filter stack inserters.
Of course it could be done with individually made filter inserters to filter each ore one at a time along a belt or something, but that's not what I'm after here.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1027
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: How to filter train content based on train content

Post by quyxkh »

edit: hang on while I fix this, I apparently overwrote my blueprint, the one here doesn't handle emptying chests while unloading and I'm not sure yet how I broke that.edit 2: fixed.

Here's a working proof-of-concept, it works well in all my easy tests. The main weakness I've found is, don't unload multiple chests too quickly while items are still being unloaded; there's a delay propagating the exclusions which I handle by staggering the startup. My attempts to reduce the delay add lots more combinators, and I think nothing can actually eliminate it so I think emptying multiple chests simultaneously while the wagon's still unloading will always be risky.

The idea is, during unload items are in exactly one of the wagon, the inserter hand, or the chest. The sum of items-in-hand+items-in-chest+items-in-wagon will be larger than items-in-wagon if and only if the item's being unloaded, so cascade a >0 filter on the difference to drive further filter selection. You can eliminate the back-propagation isolator if you never empty more than one chest while the wagon's still unloading.

The save game has read-train-contents turned off, turn it back on to start. Edit: The save game overrides the stack size to 1, which doesn't work reliably. Hang on while I fix that.edit: fixed when I fixed the blueprint earlier. We apologise for the faults fixing the messages about fixing things. Those responsible have been sacked.
Blueprint
Screenshot from 2017-09-18 10-55-32.jpg
Screenshot from 2017-09-18 10-55-32.jpg (666.25 KiB) Viewed 6289 times
Automatic separate unload.zip
(3.76 MiB) Downloaded 116 times

RenewU
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 08, 2017 11:26 pm
Contact:

Re: How to filter train content based on train content

Post by RenewU »

Awwwww yes! This is exactly what I was looking for! Thanks so much. really a perfect design in my little world! No worries about any delay, it's definitely quick enough :)

quyxkh
Smart Inserter
Smart Inserter
Posts: 1027
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: How to filter train content based on train content

Post by quyxkh »

This works _very_ much better if you run a red wire from each inserter to its chest, connecting the hand readout into the filter propagation.circuit.

AsherMaximum
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue Mar 08, 2016 12:44 am
Contact:

Re: How to filter train content based on train content

Post by AsherMaximum »

I was looking to do exactly what you described, and I came up with a solution. The key was a single pulse generator, that takes a constant signal and creates a single pulse every time that signal appears. I used this one that I found, and added the rest of what I needed. Storing what was in the last train was easy, simply a combinator set to T > 0, output everything. The pulse generator is configured to turn the arrival of a train to a single pulse of -1G value on T, which clears what was saved in the combinator from the last train.

My problem was that I also needed to determine if the last train was empty, which required a bit more circuitry. If you don't need this, you can just remove the 5 combinators on the right. As I configured it, if the last train was empty, there will be an 'E' signal.

The pulse generator is on the left, the single combinator that stores what was in the train is in the center, and what I created to also save if the train was empty is on the right. The final signal is output on the pole to the right.

Image
Blueprint

Edit: I compacted the logic a good bit. Now the logic to add a condition for last train empty only adds one combinator and a constant signal generator. Plus I reduced the pulse generator by one combinator.

Image
Blueprint

Post Reply

Return to “Gameplay Help”