Circuit network help?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Krinkovic
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat May 28, 2016 11:55 am
Contact:

Circuit network help?

Post by Krinkovic »

I'm trying to better understand the circuit network, so I am trying out different solutions for problems in my base.
One such was that (before i updated to laser turrets) I had belts with ammo going from a factory in the center, out all around the base, resulting in alot of ammo just lying there not used .
So I thought with belts now being connectable to the circuit network, I would try to solve this by setting a chest by the turrets saying for instance that there should alwas be 25 ammo in it.
And in the ammo factory the ammo is loaded in a chest and unloaded to the belt only when ther is less than 25 in the turrets chest, and only enough to fill it up to 25 again.

Was trying to connect the first tile of belt after the factorys chest to the network and setting it up to count how much ammo passes through and telling the inserter to stop when enough has passed through to fill the turret chest to 25, but I never got it working properly. How should I do this to make it work?

If I am overcomplicating things, please share a better way of doing this, but would also like to make it work the way I planned, too, as it would add more knowledge to my very lacking understanding of the circuit network :)
Case
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Jun 28, 2016 9:25 am
Contact:

Re: Circuit network help?

Post by Case »

The belt counter works a bit iffy :(. In hold mode he counts the same item multiple times (as long as the item is on the belt tile - so multiple ticks) I'm not sure how to count the items. I guess we have to wait for the circuit gurus till they come up with a solution :)
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Circuit network help?

Post by ratchetfreak »

You can count the number of items going into the belt and the number of items the inserters load into the supply chests.

So a counter getting a +1 pulse for each item entering the belt and a -1 pulse (using a arithmetic combinator) for each item the loading inserters pick up would output all items on the belt.

Add this to the number of items in all the chests and you have how much ammo is in the system.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3717
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Circuit network help?

Post by DaveMcW »

Krinkovic wrote:I had belts with ammo going from a factory in the center, out all around the base, resulting in alot of ammo just lying there not used.
So hook up every belt, and count the ammo sitting on belts! You will need to make a circular belt, so the ammo you do leave will eventually be used.
SpeedDaemon
Fast Inserter
Fast Inserter
Posts: 124
Joined: Fri May 22, 2015 3:31 pm
Contact:

Re: Circuit network help?

Post by SpeedDaemon »

You might be able to use an additional chest as a metering device:
Ammo production -> buffer chest -> inserter A -> meter chest -> inserter B -> belt to turrets (loop?)

Attach inserters A and B to the output of a latch such that A's "enable condition" is equal to NOT (B's enable condition) so they always have opposite states.

Construct a clock that triggers at the interval that you want to check your ammo inventories. If (total desired ammo - current total stock) > 0, set the latch to enable inserter A until the meter chest contains (total desired ammo - current total stock), then reset the latch once that level is reached, which will put the metered ammo onto the distribution belt. Reset the timer.

This won't be exact, but it's just ammo, so a few extra floating around the belt isn't the end of the world.

Actual implementation is left as an exercise to the reader. :) (but check viewtopic.php?f=18&t=14556 for how to build clocks, S-R latches, etc.)
Lupoviridae
Fast Inserter
Fast Inserter
Posts: 155
Joined: Mon Apr 20, 2015 6:26 pm
Contact:

Re: Circuit network help?

Post by Lupoviridae »

With inserters now being able to pulse items they pick up to the network, a meter chest should no longer be necessary. Basically you need to create a running count of the number of items on the belt. Supply inserter pulses add to this count, while inserters pulling from the belt detract from it. Then take (Total # of chests) * (Ammo desired per chest), subtract (total ammo in chests) + (total ammo on belt). If the number is <0, the supply inserter activates. There will be a little leakage since at the moment an inserter takes off the belt the total will drop below zero for about 0.5s. This can be rectified with an inserter placed just after the supply point set to activate when the count is >0.
SpeedDaemon
Fast Inserter
Fast Inserter
Posts: 124
Joined: Fri May 22, 2015 3:31 pm
Contact:

Re: Circuit network help?

Post by SpeedDaemon »

After thinking about this some more, an even simpler way to do it, if you don't care about pinpoint accuracy, is to have, say, a 30 second timer, and when it triggers look at the value of (desired - current), then just run an inserter for a period of time to put about that many items on the belt, then reset the timer (or, as Lupo pointed out, use the new behavior to count directly). The delay timer just needs to be long enough for something to travel the length of the belt.
Lupoviridae
Fast Inserter
Fast Inserter
Posts: 155
Joined: Mon Apr 20, 2015 6:26 pm
Contact:

Re: Circuit network help?

Post by Lupoviridae »

I made a no overflow version with four combinators. Here's what I did: (All inserter are set to pulse what they pick up)
1) Red network connects every inserter that takes OFF the belt to an arithmetic combinator set to ammo * -1.
2) The output of this AC and the inserter that grabs from the supply are connected (red) to a decider set to output (input count of ammo). Connect the output to the input to create a counter for # of items on the belt.
3) Connect each of the turret chests to it's attached inserter by a green wire. Set inserter to activate if ammo < 25.
4) Create 2 more decider combinators. String all the turret chests together with red wire and attach to the inputs of both. Also connect the counter's output (from step 2) to both inputs using green wire. Set one to output a red signal when ammo <50 (f25 * # of turrets), and the other to output green when ammo >50.
5) With green wire, connect the red signal DC output to the inserter drawing from the supply chest, set this inserter to activate when red = 1. Connect the green signal DC output to an inserter that takes off the belt and returns ammo to the supply chest (to capture overflow) Set to activate when green = 1.

Here's a picture:
Capture.PNG
Capture.PNG (284.57 KiB) Viewed 7966 times
Basically:
The top right combinator is the counter for the number of items on the belt. The bottom right one connects to inserters removing from the belt to multiply their pulses by -1. The left two combinators add the signals from the belt counter and the turret chests.
The Eriksonn
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Jun 08, 2016 6:16 pm
Contact:

Re: Circuit network help?

Post by The Eriksonn »

My attempt:
2016-07-01 (1).png
2016-07-01 (1).png (855.09 KiB) Viewed 7883 times
Krinkovic
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat May 28, 2016 11:55 am
Contact:

Re: Circuit network help?

Post by Krinkovic »

ratchetfreak wrote:You can count the number of items going into the belt and the number of items the inserters load into the supply chests.

So a counter getting a +1 pulse for each item entering the belt and a -1 pulse (using a arithmetic combinator) for each item the loading inserters pick up would output all items on the belt.

Add this to the number of items in all the chests and you have how much ammo is in the system.
After sleeping on it I came up withthis solution as well, will try it next time I play
Bata
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Aug 04, 2016 11:38 am
Contact:

Re: Circuit network help?

Post by Bata »

Hi,

I made a super simple solution, which works perfectly in my opinion.

I use only one chest as a main storage near magazine factory. Simple circuit network is used to limit the number of magazines to 100. I have three separate belt subsystems in three battlefronts, each of them served by one inserter from the main storage chest.

Looped belts are used as local storage near turrets instead of chests. Magazines travelling in each of the belt systems is limited to 10 by counting number of magazines inserted from main storage and decreasing number of magazines inserted to turrets. Turrets take 10 magazines automatically from belt by nature. Every time magazine is used by a turret one magazine is inserted from main storage to corresponding belt system.

Setup of one looped belt subsystems is described below:

Every turret inserter is connected to red circuit network
  • Setup to read hand contents, pulse
    Mode of operation is none
Arithmetic combinator A (input) is connected to main storage inserter
  • Input set to [signal A] + [magazines]
    Output set to [signal A]
    Output connected to it's own input by red wire (note: this is needed to make signal A count the running amount)
Arithmetic combinator B (input) is connected to red circuit network (note: where turret inserters are also connected)
  • Input is set to [signal B] + [magazines]
    Output to [signal B]
    Output connected to it's own input (note: running amount)
Arithmetic combinator C (input) is connected to arithmetic combinators A (output) and B (output) by green wire
  • Input set to [signal A] - [signal B]
    Output set to [signal C]
    Output is connected to main storage inserter by green wire
Main storage inserter is setup
  • Mode of operation is enable/disable
    Enabled condition set to [signal C] < 10 (note: change to whatever number of magazines you want to be travelling in the system)
    Read hand contents, pulse
Hope this helps, comments are appreciated!
Post Reply

Return to “Gameplay Help”