The memory cell, and what we can do with it

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
Post Reply
Mysteria9
Fast Inserter
Fast Inserter
Posts: 122
Joined: Sat Feb 16, 2013 9:05 am
Contact:

The memory cell, and what we can do with it

Post by Mysteria9 »

The memory cell, one of the basic foundations of many clever contraptions. Let's have a look at it!

Many players have probably already "invented" this, but for those who didn't, here's a how-to and why. And for those who already know this, I encourage you to post what you have done with it!

Image
Have a look at the image above.
We will put one item in the chest. It can be anything, but not something that our contraption will handle/transport, etc. I will refer to this item as the "bit item".
•All of the "smart parts" are connected to the same network.
•"Q" is the output signal, this will be either 1 or 0. If our bit item is inside the chest, it will output 1. If our bit item is outside the chest, it will output 0. (That is, for the specified item type. We'll get to that later)
•The blue inserters are always active and are simply there to transport our bit item between our "S" and "R" inserters. I'll get back to this further down.
•When the condition specified at inserter "S" is met, we move our bit item inside the chest and will thus get a 1 on the output signal.
•When the condition specified at inserter "R" is met, we move our bit item outside the chest and will thus get a 0 on the output signal.

So what can we do with this? Probably just about anything!
One of the first things that come to mind is item distribution (which is very useful to have when your consumption exceeds your production), I'll show you an example:
Image
This is a test setup I made, just replace the wooden chests with transport belts and it's ready to go live.
Note that all of the "smart parts" are connected to the green network, and each of the smart chests are connected only to the inserter below them with a separate red network.

Items come rolling in on the horisontal belt, and the lower row of inserters pick them up, if their conditions are met. Each of these inserters have two conditions:
•Red condition: The chest above the inserter have less items than requested. I've set the leftmost inserter to only pick up items from the belt if the corresponding chest has less than five items. The remaining inserters are set to 5, 10, 10, 1 in this test setup.
•Green condition: The output signal from the memory cell is 1.

As I mentioned, the lower inserters are set to pick up 5, 5, 10, 10, 1 items each. When this is done, the combined number of items in the smart chests will be 31. This is the "R" condition for our memory cell. (item>30)
Until we are able to pick our own integers in the conditions, we are limited to use the predefined ones. For example, we can not have a total of 27, since we can not set our condition to that. Adjust your total distribution in the system accordingly until this is implemented.

Now that our memory cell outputs 0, the lower row of inserters are turned off (since they need a 1 from the memory cell to operate).
The upper row of inserters have one condition, and that is for the memory cell to output 1. Since that is now the case, they will start emptying the smart chests and drop the items onto the belts (which are wooden chests in this image).
When all of the smart chests are empty, we need to start loading them up again. Our memory cell's "S" condition checks if there are no items in the smart chests (item<1), and if this condition is met, will set the memory cell back to 1.
The cycle restarts and the lower row of inserters starts loading the smart chests again...

I've tested this contraption extensively and it has never failed, perfect item distribution every time. It has two obvious downsides though:
•It slows down the flow of items. Luckily this is easy to solve! Simply repeat every column in the design as many times as needed, and have the extra columns connect to the same belt on the upper side. More inserters working at the same time means faster item flow!
•If one or more of the output belts are filled with items so that inserters can not drop items on them, the entire contraption will take a coffee break. To solve this, keep the wooden chests as in the image above, but blue inserters above those to feeds the belts. Then put smart inserters away from each of the buffer chests and hook them up to their corresponding chest, tell them to only take items if the number of items in the chest exceeds your preferred value. These items will then be carried away elsewhere. Either to a buffer station or to some extra "not-that-important" assembling machines.


•If you use more than one memory cell (that needs to be on the same network) in your contraption, remember to use different bit items. The type of item serves as the address of the memory cell.
•If you need faster response times with the memory cell, build it like the image below. This will eliminate the small delay that occurs while the blue inserters work.
•Also, put the poles in the middle of the memory cell for optimal space management.
Image

I appreciate any input: thoughts, opinions, questions, other versions, etc. Thank you for reading, have a good day!
/Mysteria

wrtlprnft
Fast Inserter
Fast Inserter
Posts: 155
Joined: Thu Feb 21, 2013 8:49 pm
Contact:

Re: The memory cell, and what we can do with it

Post by wrtlprnft »

Great write-up, much more detailed (and general) than mine :-)

I actually considered using just one memory cell, but decided against it because the condition can't be set precisely.
Mysteria9 wrote:•If one or more of the output belts are filled with items so that inserters can not drop items on them, the entire contraption will take a coffee break. To solve this, keep the wooden chests as in the image above, but blue inserters above those to feeds the belts. Then put smart inserters away from each of the buffer chests and hook them up to their corresponding chest, tell them to only take items if the number of items in the chest exceeds your preferred value. These items will then be carried away elsewhere. Either to a buffer station or to some extra "not-that-important" assembling machines.
I'd just feed them back to the input belt for redistribution (and make sure to give the backfed items priority over new ones, so that there can never be a congestion). An alternative approach would be to add a timer that will reset the memory cell after a while.

Mysteria9
Fast Inserter
Fast Inserter
Posts: 122
Joined: Sat Feb 16, 2013 9:05 am
Contact:

Re: The memory cell, and what we can do with it

Post by Mysteria9 »

wrtlprnft wrote:Great write-up, much more detailed (and general) than mine :-)
Thank you! :)
wrtlprnft wrote:
Mysteria9 wrote:•If one or more of the output belts are filled with items so that inserters can not drop items on them, the entire contraption will take a coffee break. To solve this (...)
I'd just feed them back to the input belt for redistribution (and make sure to give the backfed items priority over new ones, so that there can never be a congestion)
Brilliant idea, that is most likely the best solution, thank you!

Post Reply

Return to “Combinator Creations”