Simple circuit problem

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Karelipoeg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Aug 28, 2016 1:00 am
Contact:

Simple circuit problem

Post by Karelipoeg »

Hey,

I'm kinda new to circuits.
The situation: There are 2 chests with inserter between them facing from left to right.
What I want to happen: When the chest on the left has certain amount of resources in it (400 on the picture), the inserter takes the extra resources and puts them to the other chest.
What I tried: I connected the chest on the left with a red wire to the inserter, and selected condition as " > 400 ".
The problem: The inserter does not start working, unless I choose the certain type of item to count within the condition. The thing is that this chest will have various resources mixed.
The question: How can I make the inserter work while there is more than a certain number of resources in the chest, regardless of the resource type?

Thanks for help!
Attachments
2017-12-21.png
2017-12-21.png (500.76 KiB) Viewed 1803 times

User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: Simple circuit problem

Post by impetus maximus »

wire the chest on the left to the input of an arithmetic combinator.
input each + 0, output E or whatever signal you want.
this will total the items and give you a signal to use.

wire the output to the inserter enable if E or your signal is > 400.

Engimage
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Wed Jun 29, 2016 10:02 am
Contact:

Re: Simple circuit problem

Post by Engimage »

Alternatively if your chest contains various resources but only one at a time (say this is universal design for a buffer) than you can use *(Any) > 400 which will trigger whenever any resource in a chest is > 400 (as opposed to a total number of mixed resources)

Karelipoeg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Aug 28, 2016 1:00 am
Contact:

Re: Simple circuit problem

Post by Karelipoeg »

PacifyerGrey wrote:Alternatively if your chest contains various resources but only one at a time (say this is universal design for a buffer) than you can use *(Any) > 400 which will trigger whenever any resource in a chest is > 400 (as opposed to a total number of mixed resources)
Thanks! But my chest does contain various resources at the same time.
impetus maximus wrote:wire the chest on the left to the input of an arithmetic combinator.
input each + 0, output E or whatever signal you want.
this will total the items and give you a signal to use.

wire the output to the inserter enable if E or your signal is > 400.
Thanks! I got it working.

Now I'm improving on the project:
2017-12-21 (1).png
2017-12-21 (1).png (1.03 MiB) Viewed 1768 times
I just used '> 300' instead of '>400' but the idea is the same. Here I use 2 Arithmetic Combinators instead of 1, because the system I want to create eventually is going to have 5 resources: Iron Ore, Copper Ore, Coal, Stone, Crude Oil Barrel. Since I actually care about the number of the stacks in the chest instead of the number of the resources, and Crude Oil Barrel stack size is smaller (10 instead of 50), then what I did is that one Combinator takes the number of all the resources and gives the same number of output 'A' (220 in the example), and the other Combinator takes the number Crude Oil Barrels and multiplies is by 4 (80 in the example because it was already included in first Combinator once), and then the Inserter just considers the amount of all resources value (300), while Crude Oil Barrels give out a value of 5.

The system works but since we are playing Factorio, we are perfectionists, and since we are perfectionists, we want to improve the system.
Right now the system works with the number of resources over 300 (given that Crude Oil Barrels have value of 5). What I would want to do is make it work based on the number of stacks in the chest. If I had only full stacks, it gives me 6 stacks, so 7th would be lifted out. But if there were 2 stacks with 20 resources, and total of 7 stacks including those, then there would be 290 resource value and none lifted. What I would want to do is always have the Inserter work when there are more than 6 stacks (regardless of being full or half stacks) in the chest.

So the new problem to solve: How to get the exact number of stacks as output?
I could easily get the number of full stacks by using a Combinator for each resource separately and then dividing the number by 50 (or by 10 for Crude Oil Barrel), but this does not count half stacks.

Thanks!

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

Re: Simple circuit problem

Post by DaveMcW »

Karelipoeg wrote:So the new problem to solve: How to get the exact number of stacks as output?
I could easily get the number of full stacks by using a Combinator for each resource separately and then dividing the number by 50 (or by 10 for Crude Oil Barrel), but this does not count half stacks.

Code: Select all

N   N/50 Stacks
0    0     0
1    0     1
2    0     1 
48   0     1
49   0     1
50   1     1
51   1     2
52   1     2
98   1     2
99   1     2
100  2     2
101  2     3
As you can see, the result of N/50 is shifted from the result you want by 49. So do "Each + 49 → Each" before dividing by 50.

Post Reply

Return to “Gameplay Help”