Repeating Counter help

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
unknownzzzz
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Nov 20, 2020 10:51 pm
Contact:

Repeating Counter help

Post by unknownzzzz »

I am trying to launch a rocket while there is still science in silo, but less than 1000 to prevent waste.

I found that filling a silo up to 2000 science, then launching a rocket every time 1000 science is removed keeps it fluctuating between 700 and 1700 science internally.

I do this my counting the science removed by inserters. What I need help with is making this counter more efficient/smaller - while keeping the counter from going to infinity.

I ran into the major issue that an Arithmetic Combinator's "Pulse" is actually "2-4 Pulses" by default. So I had to add an extra pulse generator section.

https://imgur.com/a/aisM0Oc
Image

0eNrNmFuOmzAUhvfi18IIc02Q+tIt9LEaIQInE2uCQbYZNRqxgO6iL91YV1Ib0gkQAybpZV4Smcvv4/Od/xh4RbtjDRUjVKD4FZGspBzFX14RJ080Papj4lQBihERUCAL0bRQIy4AjnZ2AC5QYyFCc/iKYtxYi3emjIhDAYJkdlYWO0JTUbKehts8WgioIIJAF0o7OCW0LnbA5CTaICxUlVzeU1I1s9SxcRg8BBY6odh3/YegUbGNpNyeVJo924RyYEKe0an5AzUL5YRB1l0idWTiBCuPyQ4O6QuRK5L3ZYRlNRGJPJe/ie0J4yK5StILYaKWRy4RtVfYn1VqFBWRKkTtTEWVsjZrMfqImu487WLhShKrHwZ5P3tEjrBjvcXUjpvHRpcWzzjD3lKGfWOp7ZtUqJcKjKU2S1LhGu6XwKKW+xzposwhKfdJWYEk1Mp4l5wzSPPkkNJcVYSQMUlagtUwQfCJAdAxw2iCWbRmSZt3taSwtxw13k4scWNcANFSAWzXZCt6ZwUwzBbGZqZW5j+vOYeM5MD6/VfbPns5HLS7UJ+Ds+yl3fG/0e8sVNaiqjWSox2qSjOweUaAyn85eO6Uq5MMsKYi2bOySAiVUmcI5o3UHTPwhwzaPUxLD3tXV8pp3UnaxnTxwgY7vz9uhoB9PeCLshljEyAclFRyIS7LtGce9OEu4Gs2R2zKcDum70wyNZgHj9VcQ+LuWj/7A9x3O9jMbr+xYsdxRl7++e3HDNyFBqG18T49criL+byv8TzZ6y6gJ+fd4FVvZTNe8OrAb1ce7GD1bWj/aRvOtDzDp1TsrzWA9+8NcE6tcXV/6qp74JLv/9sl7kLHCq6ATe1+wapO6azrlJN+C27wm7tYK+9tN5wpqTWwp1ueHqlv6NbwhjfBjf7pHUc3vApOad3yVtFqySJvkca9TygWegHGu28CG+xH/jYKI+yEQdg0vwAIo+s2

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

Re: Repeating Counter help

Post by DaveMcW »

unknownzzzz wrote:
Fri Nov 20, 2020 11:04 pm
an Arithmetic Combinator's "Pulse" is actually "2-4 Pulses" by default. So I had to add an extra pulse generator section.
This only happens if the arithmetic combinator has low power. Try putting it on an isolated electric network with a solar panel and an accumulator to make sure it is always fully powered.

unknownzzzz
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Nov 20, 2020 10:51 pm
Contact:

Re: Repeating Counter help

Post by unknownzzzz »

DaveMcW wrote:
Sat Nov 21, 2020 12:10 am
unknownzzzz wrote:
Fri Nov 20, 2020 11:04 pm
an Arithmetic Combinator's "Pulse" is actually "2-4 Pulses" by default. So I had to add an extra pulse generator section.
This only happens if the arithmetic combinator has low power. Try putting it on an isolated electric network with a solar panel and an accumulator to make sure it is always fully powered.
The main topic is to receive help with making a more compact and efficient design for the current looping/repeating counter.
https://imgur.com/a/aisM0Oc

0eNrNmFuOmzAUhvfi18IIc02Q+tIt9LEaIQInE2uCQbYZNRqxgO6iL91YV1Ib0gkQAybpZV4Smcvv4/Od/xh4RbtjDRUjVKD4FZGspBzFX14RJ080Papj4lQBihERUCAL0bRQIy4AjnZ2AC5QYyFCc/iKYtxYi3emjIhDAYJkdlYWO0JTUbKehts8WgioIIJAF0o7OCW0LnbA5CTaICxUlVzeU1I1s9SxcRg8BBY6odh3/YegUbGNpNyeVJo924RyYEKe0an5AzUL5YRB1l0idWTiBCuPyQ4O6QuRK5L3ZYRlNRGJPJe/ie0J4yK5StILYaKWRy4RtVfYn1VqFBWRKkTtTEWVsjZrMfqImu487WLhShKrHwZ5P3tEjrBjvcXUjpvHRpcWzzjD3lKGfWOp7ZtUqJcKjKU2S1LhGu6XwKKW+xzposwhKfdJWYEk1Mp4l5wzSPPkkNJcVYSQMUlagtUwQfCJAdAxw2iCWbRmSZt3taSwtxw13k4scWNcANFSAWzXZCt6ZwUwzBbGZqZW5j+vOYeM5MD6/VfbPns5HLS7UJ+Ds+yl3fG/0e8sVNaiqjWSox2qSjOweUaAyn85eO6Uq5MMsKYi2bOySAiVUmcI5o3UHTPwhwzaPUxLD3tXV8pp3UnaxnTxwgY7vz9uhoB9PeCLshljEyAclFRyIS7LtGce9OEu4Gs2R2zKcDum70wyNZgHj9VcQ+LuWj/7A9x3O9jMbr+xYsdxRl7++e3HDNyFBqG18T49criL+byv8TzZ6y6gJ+fd4FVvZTNe8OrAb1ce7GD1bWj/aRvOtDzDp1TsrzWA9+8NcE6tcXV/6qp74JLv/9sl7kLHCq6ATe1+wapO6azrlJN+C27wm7tYK+9tN5wpqTWwp1ueHqlv6NbwhjfBjf7pHUc3vApOad3yVtFqySJvkca9TygWegHGu28CG+xH/jYKI+yEQdg0vwAIo+s2

I was not planning on discussing the multiple pulse issue, but here is my research showing the multiple pulses. If you find a solution it might help with the main topic's solution.
Example was running on infinite power. I also tried it with plenty of normal power (solar/accumulators) to rule out an infinite power issue.
Here is blueprint to showing that each loop is sending 2 or 3 pulses (see image as well).

https://imgur.com/a/SO51Ikw

0eNrtm9FyqzYQht+F29pnkJBA+KIv0jnjwVg5YWqDB0TaTMYP0Afpi/VJKnAbk0R/JK0zcy6Sm2Rw4PMCu7+Wf8lTsjuM+tQ3rUk2T0lTd+2QbH57SobmR1sdps/M40knm6Qx+piskrY6TltDd6j69alq9SE5r5Km3es/kw07f18lujWNafQFM288btvxuNO93cEJWCWnbrDHdO30fZazzoX8JlfJ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GbA5CxU7MQTnVxLSAZyfIkxh0PmpeLOUOc1SRTBLGTCuFMEsRRmqbjNLefoZzVLlMUtL+f7fWSre7XOVxy1VMqwPVpJs9aivUVb43X9/lKUCvW2V3+TOzKX48Q+e3qt6S1V64OimuC+zjLstZWgRUZwYpNyECSNUbsqEkQO7qaRMGCEsftHkzpFDSVg0YVCERZMDQ60UBL8JBkYWac6+/HiHPrM0D7WfVJQhr4INeZYGiktJsIxhIhGECma4oogLequwpIgLel8rTePVJXOTCFNInqGwKFrFEYwy8MOhCdqEdA7v505IVeDoZS64W55jxJdr/0a0sG6WMkY3g9VwVu5bWuDscw4oy+DrS1kioKwQmlmsePGvqXDwvjhhsMglevmcskTAN9kJnieOjDDjwpER3sXlOYLJ+FELhuXxsxYMK+KHLRim4qctGFbGj1sgLPg19OUCCGEsfuCCYTx+4oJhWfzIBcNE/MwFw2T80AXDKI8IM8yu3vMys1n8a9oqedD9cHH0FBOFKIu8sOuuzM/nfwGZuMZI

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

Re: Repeating Counter help

Post by DaveMcW »

I see. You have a memory cell that outputs a signal every tick (not a 1-tick pulse). Then when you calculate it is time to reset it, the reset signal lasts for several ticks until a new calculation is finished.

The solution is to make a self-resetting memory cell. Instead of "science + 0 → science", use "science % 1000 → science".

Then the condition to launch the rocket is "science >= 1000". This condition will only last for 1 tick before it resets. Note that you must read the memory cell input and output on the same wire, since the memory cell itself will never output more than 999.

unknownzzzz
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Nov 20, 2020 10:51 pm
Contact:

Re: Repeating Counter help

Post by unknownzzzz »

DaveMcW wrote:
Sat Nov 21, 2020 1:22 am
I see. You have a memory cell that outputs a signal every tick (not a 1-tick pulse). Then when you calculate it is time to reset it, the reset signal lasts for several ticks until a new calculation is finished.

The solution is to make a self-resetting memory cell. Instead of "science + 0 → science", use "science % 1000 → science".

Then the condition to launch the rocket is "science >= 1000". This condition will only last for 1 tick before it resets. Note that you must read the memory cell input and output on the same wire, since the memory cell itself will never output more than 999.
After testing:

Memory cell won't work:
If the output got stuck on 999 the rocket would keep on firing - wasting lots of resources.
If the rocket is not ready to fire and the 999 comes the inserter will not inset the satellite and the memory cell will continue to the 1000 marker reset. Then the rocket won't ever fire.

My counter that pulses and resets every 1000 science will not work either:
If the rocket is not ready to fire and the 1000 science pulse comes the inserter will not inset the satellite and the rocket won't ever fire.


I found a solution!!!!:
> Counter for Science unloaders.
> Satellite Inserter when Science >= 1000
> Satellite Inserter pulse causes Science Counter to -1000.

> Extra: Shift "Satellite Inserter when Science >= 1000" 2000 to the left so it inserts 2 satellites by default.
Now: "> Satellite Inserter when Science >= -1000"

Works great.
2 Arithmetic combinator and 1 Decider combinator

https://imgur.com/a/UoXG7nr


unknownzzzz
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Nov 20, 2020 10:51 pm
Contact:

Re: Repeating Counter help

Post by unknownzzzz »

Found issue.

Minor Blueprint issue.
If satellite inserter is set to insert "Science >= -1000" it will keep insert satellites by default.
If the rocket is ready to fire and the circuit is not 100% built bad things happen. Rockets can continuously launch - wasting science.

Safest method is to place the rocket silo(s) last or have all the circuit materials close-by.

-------------

If there was a way to set the counter value to an initial 2000 in a blueprint that would work, but I don't think it's possible without Constant combinators (Which make bad things happen if left on, and are an extra unnecessary component).

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Repeating Counter help

Post by Zavian »

unknownzzzz wrote:
Sat Nov 21, 2020 2:59 am
Safest method is to place the rocket silo(s) last or have all the circuit materials close-by.
If you want safety, why use a complicated circuit? Just use a stack inserter to unload the silo into a chest, than wire the chest to the satellite inserter with a condition like, "space science flask < 500". With max stack inserter research the stack inserter removing the science is faster than a max beaconed silo, so science won't overflow. (Also I don't turn on the auto-launch with satellite setting until after I have limited satellite insertion. That way even if something is delayed during building, nothing will overflow).

unknownzzzz
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Nov 20, 2020 10:51 pm
Contact:

Re: Repeating Counter help

Post by unknownzzzz »

Zavian wrote:
Sat Nov 21, 2020 3:14 am
unknownzzzz wrote:
Sat Nov 21, 2020 2:59 am
Safest method is to place the rocket silo(s) last or have all the circuit materials close-by.
If you want safety, why use a complicated circuit? Just use a stack inserter to unload the silo into a chest, than wire the chest to the satellite inserter with a condition like, "space science flask < 500". With max stack inserter research the stack inserter removing the science is faster than a max beaconed silo, so science won't overflow. (Also I don't turn on the auto-launch with satellite setting until after I have limited satellite insertion. That way even if something is delayed during building, nothing will overflow).
Safety for building is a factor, but not a critical factor. I want to "have my cake and eat it too".
  • Inserting satellites when Rocket Silo is Empty (unloaders are not holding sciences) brings my Factory production at ~490 Science per second.
  • Using Counter to keep rocket silo internal buffer from going empty brings production to ~540 Science per second. An 8% increase with no need for increasing factory footprint.
  • Using chests as a buffer would be nice - but by adding chests, the factory footprint increases by over 22%. Adding more factory blocks with an 8% loss is more efficient than the 22% footprint loss. But on the other hand, there is 0% science wastage from unexpected launches during the build process (unless the chest(s) overfill.).
For UPS.
  • Circuit counter updates on inserter pulse. So 2 actions per inserter unloading.
  • For buffer chests, "inserter -> chest -> inserter" is still 2 actions per unloading.
I would prefer a way to add safety to the circuit network without adding overhead. In code I would set the initial counter value = 2000, but here it's always 0.
Last edited by unknownzzzz on Sat Nov 21, 2020 4:18 am, edited 1 time in total.

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

Re: Repeating Counter help

Post by DaveMcW »

In your latest blueprint, you are effectively multiplying the satellite pulse by -1000. You can do that more directly by using an arithmetic combinator.

unknownzzzz
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Nov 20, 2020 10:51 pm
Contact:

Re: Repeating Counter help

Post by unknownzzzz »

DaveMcW wrote:
Sat Nov 21, 2020 4:17 am
In your latest blueprint, you are effectively multiplying the satellite pulse by -1000. You can do that more directly by using an arithmetic combinator.
WOW, WOW, WOW!!! Thank you!!! Thank you!!! Thank you!!!
Why didn't I think of that!
Removing 1/3 of the circuit logic with that one step! No more Decider combinator needed.


Updated image and print.

https://imgur.com/a/VOH9KyY


Post Reply

Return to “Gameplay Help”