Combinators: Volatile memory

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Nulluhrzehn
Inserter
Inserter
Posts: 21
Joined: Sun Jul 03, 2016 7:20 pm
Contact:

Combinators: Volatile memory

Post by Nulluhrzehn »

Hi,

I am looking for help with creating volatile memory.

I had this idea about sending filled light-oil barrels to a mining outpost via transport belts and sending the empty barrels back to the oil processing site in the main base via another transport belt. The transport belts are supposed to be set on "PULSE"-setting, and a combinator network is supposed to store the number of barrels that are in transit to and from the mining site. Like this, I could implement an inserter who only puts filled light-oil barrels onto the conveyer belt, if less than 30 barrels are in transit, for example. So I am trying to store a variable named "Barrels in transit" in combinators, which gets increased by 1 every time the output belt detects something rolling over it and which gets decreased everytime the input belt detects a barrel rolling over it.

-> How could I store this variable in combinators? I don't get it.

To have such a thing as volitale memory or EEPROM in my factory I used to give signals into combinators and shut the combinator down via power switch. Like that I made sure he would give his same output from then on, no matter if the input changed, until I would activate the power switch again. I found this to be a kind of workaround over the real way to store values in combinator networks.
I'm wondering how I could do that. I just don't get it. Can someone explain a possible solution, please? :?

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

Re: Combinators: Volatile memory

Post by DaveMcW »

Arithmetic combinator that does nothing, like Each + 0 → Each.

Connect both ends together with a wire.

Nulluhrzehn
Inserter
Inserter
Posts: 21
Joined: Sun Jul 03, 2016 7:20 pm
Contact:

Re: Combinators: Volatile memory

Post by Nulluhrzehn »

Wow, thanks, that worked wonders :mrgreen:

This is what I actually ended up implementing:
The ore transporting train has one slot reserved for light oil barrels and one slot reserved for empty barrels.
The combinator network tracks the number of oil barrels that are currently at the mining site.
I put the filter inserter on the bottom to only activate at light oil barrels < 10.
So in the future the inserter will only load off light oil barrels if the flamethrowers need oil and there won't be loads of oil and steel (as barrels) resting on the belts.
Maybe I'll even reduce the condition to "light oil barrels = 0" in the future.
Attachments
Light oil.jpg
Light oil.jpg (269.79 KiB) Viewed 2255 times

Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: Combinators: Volatile memory

Post by Aeternus »

It's an interesting design, but isn't there a far simpler solution?

Place an Assembler to unload the barrels at the train stop, with inserters coming from and going to the wagon. From the Assembler station, add a pump that feeds into a storage tank. Circuit connect the pump to the storage tank to cut off flow if you have enough fuel in the buffer. If you need to run a longer pipeline to multiple guns, add a pump at the exit from the tank as well to ensure the pipe feeding the turrets remains at high pressure. A simple "Light oil <5000" condition on the pump switches the pump feeding the tank off once it's 20% full, which prevents the assembler from unloading more fuel barrels. No barrels on belts anywhere, and room/resource wise you're probably off cheaper with this design - where there are red belts now, you'd be running underground pipes, and less of them, the fast inserter and filter inserter can be replaced with a standard yellow one, the deciders are removed in favor of one or two pumps and a storage tank. Looks like you've got plenty of room by the station for this to work..

Nulluhrzehn
Inserter
Inserter
Posts: 21
Joined: Sun Jul 03, 2016 7:20 pm
Contact:

Re: Combinators: Volatile memory

Post by Nulluhrzehn »

Yes, you are right. That's way better. Why didn't I think of that. Should work without pumps, too.

I was just wondering how to create volatile memory for months, most of the time you can build things just fine without it. But this time it really bugged me, so I had to ask.

Post Reply

Return to “Gameplay Help”