Accumulator charge/discharge indicator

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
vedrit
Filter Inserter
Filter Inserter
Posts: 292
Joined: Sun Aug 03, 2014 2:25 am
Contact:

Accumulator charge/discharge indicator

Post by vedrit »

Heyall!
I made a charge level indicator, which is super simple, but I wanted to challenge myself.
Can I make a circuit that will show whether the accumulators are charging or discharging?

As it turns out, yes. I can.

Image

So, it's bit hard to see, what with wires going everywhere. Basically, I have 2 'cells' that hold a value. The right one is checked when charge increases, the left is checked when charge drops. If the charge is increasing, the right one will send a green signal to the lamps and update to the new charge value, and sets the left side to charge - 1 . When the charge is dropping, the left side sends a red signal, updates to the new charge value and sets the right side to charge + 1. That way, when the charge changes, the corresponding side will be of an appropriate level to compare against.

Sorry if that was a confusing explanation. I'm a bit sleep deprived and this was rather mentally draining.

Here's the string

Code: Select all

0eNrtWllu2zAQvUrBz1YORGrxAjRAPnuGIjBkmUkIaANFpTUMHaD3aC/Wk5SSnMSRRZGjOLWV5McAJXJIvvdmOEN5i1ZRQTPOEoEWW8TCNMnR4vsW5ew2CaLqmdhkFC0QEzRGFkqCuGqtacjWlE/CNF6xJBApR6WFWLKmP9ECl5bWQMCZuIupYGG3DdJp455xUcgnj2aaHhNO13tjHdDYW05psjfaLa8tRBPBBKMNFnVjs0yKeEW53N6ThTiIogmNaCi43EiWRlSaz9Jcjk2Tam5pz7bQBi0mflmtqmWKtExFQZwpLXhyjZIfwdNouaJ3wT2TiMkeIeNhwcRSvls/DrthPBdLYxCuUGM8F0GlBLtqxFnAa1YW6LJ6XeRUzhGlXKIieEGbEYncPKtVs0W4+qm42EONrXeE7LX98rrsgsMxgmOCx44HaeHhKvBwQXi4b0YfngIPD+Iu44XDbcExVcDhG8HxBryle/tTyPbHqwavpQZstx/IsPmwjT68ZhDvcUaL11yLF1YANAeF2/EiNDsEpPWAmCkK2xAXfDuAqQIyHpYa4uEraYud4OfMtZklyqUTTWqu9AP7QnW0PBl64jZ/Obly3jSjktp6Leiz7J8WIisAFut6oTSHHbuHDmEhooxACowdKMYjhnhXVkFA9iAgK4Xs9hWpKhVjJcI7I0eAN6eVDfNBGxpF6Y+GmL1Y9nUAGTt6s43cRpGI5Q1P4yVLpI1dKARkYzaEpfZJojp6sQdi7YM0IGkYRJpjSJoPczXnwqt5q3LxNePNuusy5nU5VOcFQ2jZZ/gY3OCp5sj2D7izUBNdtZZ6WZ627fbPq1TBdJgKnLNRweVpnRP7GgHYxgLQWSKgMOAbVgEz4InbLQDy/wSATyiAbuLmSmI6+xPX0Dfn4KyeNCH6xBnnl2GMHCeP6aZoZgY5sYfkn+54Upm/v36fVzLTVeMqAmTHWdoXAOf9E2FX835qKBkMkow9PsX8Oa+aBesuwPokNANJyNNoVSMh4hlKiMAk9K5zsG5ePeB5YOrcDogZ0l0jkfddI2ndZGaaIndlTmr3Ja6mRjJNCtxBInDORgSX53Z/0eLh8MZCxb+jOQpA4Z0Yfnoj3rCb31On4ZPXT8MxsPIxvFAkPrjyebiY8Iy87qgEDE+0Xlo0PVh6wX0F7BahxzVtQ2qnQ76y+YAN6m5gsParm2LlM6goSbcm/Q9N6gOxedju0WQns7J3/W/Gxd6/Jy0UBSsqt4euwrCIi6gi9NM3yUK4o/ae8rxhz3WJZ8/nxHfL8h9b7EVP

SuicideJunkie
Fast Inserter
Fast Inserter
Posts: 123
Joined: Wed Aug 23, 2017 10:17 pm
Contact:

Re: Accumulator charge/discharge indicator

Post by SuicideJunkie »

I think you might have done too much computer science and not enough cheating :)
Congrats on sticking it out and actually making legit memory cells that work - you can probably work that into an actual computer.

If you don't need to know the exact values, and just want to know if the last change was positive or negative, the easiest way only takes two combinators (and 4 wires) if you exploit the game physics.

Code: Select all

Accum         Arithmetic   Decider
A _____________ (A*-1) ___ (A>0 ? A=1)
 \_____________________/ \____________/
The input to the decider is nominally zero (A plus -A).
However, because the multiplication takes one tick to calculate, when the charge goes from 50 to 51, there will be one tick of A= 51 + (-50) = +1 before it returns to zero.

The decider combinator latches on that, and will feed itself an A=1 to maintain the a constant "Charging" signal of A= +1.

When the charge goes from 100 to 99 later, you'll get one tick of A=-1 thanks to the multiplication delay again. The -1 and the +1 from the latched decider reduce A to zero, and the decider unlatches.
It then maintains a A=0 for a constant "Discharging" signal.

vedrit
Filter Inserter
Filter Inserter
Posts: 292
Joined: Sun Aug 03, 2014 2:25 am
Contact:

Re: Accumulator charge/discharge indicator

Post by vedrit »

SuicideJunkie wrote:I think you might have done too much computer science and not enough cheating :)
Congrats on sticking it out and actually making legit memory cells that work - you can probably work that into an actual computer.

If you don't need to know the exact values, and just want to know if the last change was positive or negative, the easiest way only takes two combinators (and 4 wires) if you exploit the game physics.

Code: Select all

Accum         Arithmetic   Decider
A _____________ (A*-1) ___ (A>0 ? A=1)
 \_____________________/ \____________/
The input to the decider is nominally zero (A plus -A).
However, because the multiplication takes one tick to calculate, when the charge goes from 50 to 51, there will be one tick of A= 51 + (-50) = +1 before it returns to zero.

The decider combinator latches on that, and will feed itself an A=1 to maintain the a constant "Charging" signal of A= +1.

When the charge goes from 100 to 99 later, you'll get one tick of A=-1 thanks to the multiplication delay again. The -1 and the +1 from the latched decider reduce A to zero, and the decider unlatches.
It then maintains a A=0 for a constant "Discharging" signal.
Interesting. Next time I get the urge to play Factorio, I'll see if I can make this work.
The setup I posted did need to know the values, since it was meant to be used alongside a charge level indicator. But what you suggest would likely be a simpler, more compact design if someone doesn't need the values.

SuicideJunkie
Fast Inserter
Fast Inserter
Posts: 123
Joined: Wed Aug 23, 2017 10:17 pm
Contact:

Re: Accumulator charge/discharge indicator

Post by SuicideJunkie »

I haven't played enough to get into arcane uses, but:
- Emergency steam power rules.
If accum charge is going up, never declare emergency. (although an existing emergency state can continue, since the charge is probably going up because of the emergency power)
- Morning shift Factories.
if Accum + (25 * isCharging) > 75. (power switch closes when power is over 50% and increasing during the morning, but cuts off at 75% during the evening for safety). Needs just the one extra multiplier on top of the direction indicator to make it more weighty than the default 1%.
Can also be done by dividing the accumulator's reading before feeding into the system, so the natural +1 of the latch is applied against a smaller denominator (eg 3/5 +1 instead of 60/100 +1*20)
- Final Emptying of ore patches;
If the ore available in the buffer boxes goes up, then mining is ongoing and the increment detector sets a chained latch. A clock sends a pseudo decrement pulse once in a while (~1kilotick). The first decrement pulse clears the increment detector, but the residual set signal from it during the tick keeps the second latch set. If there are no subsequent increments to set the detector again, then the next decrement pulse is able to clear the secondary latch. That secondary latch unlocking changes the station from open if ore>trainload to open if ore >0. One last train will come by to pick up the fractional load, and then the station will close "forever" since its ore is now zero. For some patches, depending on the terrain and how tree-friendly I'm trying to be, I may need to destroy and rebuild some drills to truly finish off the patch. In those cases, the increment detector will trip and reopen the station with appropriate settings again. (1math+1comp for the direction detector, 2math+1comp for the clock signal, 1 comp for the second latch, and one more math for the trainload factor = 4math+3comp)

Post Reply

Return to “Combinator Creations”