## Nuclear over coal priority; slow switch with hysteresis.

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.
bartekltg
Inserter
Posts: 45
Joined: Fri Feb 06, 2015 12:40 pm
Contact:

### Nuclear over coal priority; slow switch with hysteresis.

Playing in 0.15.x I was able to gather a big pile of uranium ore, enough to save 40 U-235 for 'Kovarex', so I thought to reduce coal consumption with one small reactor. But I was surprised that power from steam engines and steam turbines was consumed in equal proportions.

Lets say I had installed 160W in coal fed steam engines and 40MW of atomic energy, At the moment base was consuming 100MW, half of max performance. I assumed nuclear reactor give me 40MW and coal setup 60MW. But steam is steam, regardless of temperature, so no priorities:) Consumption was 20 and 80 MW, half of U-235 wasted.

First idea: a switch driven by energy level in accumulators. I knew they have limit on power input/output and need 3 acc per steam engine to absorb whole power. It worked. The problem was that... the switch was ringing! It was changing on and off with frequency 10Hz.
Yes, I checked:)
tick analizer1.png (290.42 KiB) Viewed 2576 times
Combinators only pass the signal, if B>0: out = B.

I suppose combinators compute results in one tick. 2 tick 'on', 4 tick 'off', 6 total -> 0.1s. Charging time is probably just one tick, second one is a delay on the comparator.
lamp analyzer blueprint
I read here it may hit performance and, what is more important, it was ugly!

So what to do? We want to turn power on when energy level in accumulator (signal A) is x, and turn off when it is y, but y>x. Combinators can send output to its own input. But sending 1A works in wrog direction. So, instead comparing A to a number, lets compare it to a signal B (a signal from constant combinator), and if A<B (power level less than a constant) send 1B to switch and to comparator input. Then when switch is activated the tested formula is A<B+1. Energy level in accumulators have to increase the whole 1%. It works nicely:
tick analizer2.png (120.56 KiB) Viewed 2576 times
one percent switcher and waveform.png (178.29 KiB) Viewed 2576 times
Timescale on the plot is "5s".
one percent switch blueprint
Just remember: Accumulator have to be powered only by main grid. B+1 have to be at most 100, so B<=99. Big field of accumulators in main grid is needed.

To further increase period I added an arithmetic combinator and multiplied deciders output by, for example, 5. B constant have to be decreased.
fully regulated switch
fully regulated switch and waveform.png (189.99 KiB) Viewed 2576 times
Now timescale is 1 minute.

Yes, I know (now:)) about hoarding steam and punting a fuel cell only when needed, and with huge bonuses for multiple reactors starting nuclear power slow (as a constant addition to conventional sources) make no sense:)

Aeternus
Filter Inserter
Posts: 832
Joined: Wed Mar 29, 2017 2:10 am
Contact:

### Re: Nuclear over coal priority; slow switch with hysteresis.

Isn't it simpler to just do a level-based latch on accumulator levels - switch closes at 20%, switch opens at 90%, and add more accumulators on the main grid if you find the switch keeps flicking all the time? Basically you're dealing with the same problem as people who want to be fully accumulator/solar powered, and use the chemical burner plants only for backup. You want those switched off unless your non-chemical power source can't handle the load.

Simple level-based latch consisting of one Decider and one Aritmathic combinator:
Input (A from the Accumulator) -> Decider (Condition: A>90). Output: Red=1.
Decider Output -> Aritmathic (Red * 70 = A) -> Decider Input
Switch condition: Red = 0, connect to Decider output.
For garnishing, connect a lamp to the decider output with condition Anything > 0, use colors - it'll become a red lightsource if the switch is open, for easy viewing.

AndrewIRL
Fast Inserter
Posts: 212
Joined: Fri Mar 24, 2017 2:17 pm
Contact:

### Re: Nuclear over coal priority; slow switch with hysteresis.

Thanks for taking the time to post and share your findings with us.
bartekltg wrote:Big field of accumulators in main grid is needed.
I politely suggest that this might not be cost effective vs steam storage. Incredibly not cost effective. Steam storage is OP.

Math

1 GJ of accumulators (dimension=2x2) = 200 accumulators.

Total cost for 1 GJ = 1800 iron, 1000 copper, 7000 water, 3000 crude (assuming advanced oil processing and crack everything), 800 land area

1 storage tank = 2500 units of fluid.
1 turbine = 60/s producing 5.8MW
That means a tank/turbine stores 5.8*2500/60 = 241 MJ.

4 storage tanks (dimension=3x3) = 180 iron, 36 land area, 962MJ

Ignoring all the rest of the stuff that's one tenth the iron and one twentieth the land area for about the same power. Now the 200 accumulators can manage a peak draw of 60MW whereas say 4 turbines peak at only 23.2MW but a fully upgraded laser turret can draw 2.4 - 6.2MW peak when firing (depending on firespeed upgrades) so peak production is important. Roughly 20 accumulators or 1 turbine can sustain a single fully upgraded laser tower. However many lasers you want to fire at once dictates your peak needs and that power has to come online quickly, as close as possible to the start of the attack.

Note: Only for over 500C steam for use in turbines, different math applies to cooler steam.
Disclaimer: I don't have 0.15 and haven't tested any of this, all numbers from online reference.

bartekltg
Inserter
Posts: 45
Joined: Fri Feb 06, 2015 12:40 pm
Contact:

### Re: Nuclear over coal priority; slow switch with hysteresis.

Aeternus wrote:Isn't it simpler to just do a level-based latch on accumulator levels - switch closes at 20%, switch opens at 90%,
I'm not sure I understand... isn't this is exactly that. The bigger switch closes at 95% and open at 99%. One can go much lower but I wanted to accumulators work as buffer for lasers too. I don't need to use accumulators to live through night. This also mean I do not need as many power storage as for solar panels. 10 "big accumulators" (one substation + 48 accumulators) is enough to sing/provide 144MW (and while in the example base uses 100MW give buffer for only 24 seconds).
Aeternus wrote: Input (A from the Accumulator) -> Decider (Condition: A>90). Output: Red=1.
Decider Output -> Aritmathic (Red * 70 = A) -> Decider Input
Switch condition: Red = 0, connect to Decider output.
This is very similar construction. Clever and a bit better than the one posted by me, because use only decider and arithmetic c., but not constant c.

Oh... do you mean this very long construction of deciders and lamps? It is only for fun. And to "debug" check how naive version works. It is not a part of switch;-)

The simpler, "1%" version uses tho only combinators too (decider and constant). But investigating how to transform my construction to yours ( negate condition on decider, negate condition on power switch, this essentially change +1 feedback loop to -1, so it can be carried to the other side of decider equation) we can build switch that use only a decider combinator:

Accumulator to decider input (red)
Decider output to decider input (red)
Decider output to switch (green!)
Decider condition: if A >= 100 then output 1A
Switch condition: A =/= 1

Works exactly like the simpler one from the first post, and it is simpler. Thanks!
1 percent switch with one combinator bleeprint
AndrewIRL wrote:I politely suggest that this might not be cost effective vs steam storage. Incredibly not cost effective. Steam storage is OP.

1 GJ of accumulators (dimension=2x2) = 200 accumulators.
Yes, I agree. Steam hoarding is OP. And I think it... takes away part of fun with nuclear power. I'm not sure but is seems it was intended to works in setup like my, constant base + fluctuation from other sources, not steam slow PWM:) I may be wrong. Nevertheless, nerf now!

As you showed, it's not cost effective (it just happened I have a chest with a line full of accumulators... I think I may play factorio wrong, I produce many things and just use more trains ) and as I mentioned in the first post, doing that really do not make any sense. It is better to built more reactors and hold steam. With 100MW base 4 reactors use less uranium to power whole base than one reactor working around the clock for 40% base consumption;-)

You are right, even (forgetting this is not an effective way) the reactor at full speed + coal setup can be done with steam. Give small steam container to heat exchangers and turn on/off pump providing water to coal part. But electric is fun

Dry Hairy Tree
Filter Inserter
Posts: 314
Joined: Wed Jun 08, 2016 10:51 pm
Contact:

### Re: Nuclear over coal priority; slow switch with hysteresis.

I have recently (2 days ago) built a device to buffer my nuclear power. It is my first device so may need improvement.

Nuclear power plant - 1 accumulator - 400 steam engines on standby (pumps wired).

From the accumulator wire to an SR latch I saw on you tube and looks like some of the above. Conditions for when you want steam turned off and on. And a programmable speaker.

What happens is if the power drops on the accumulator the pumps kick on and a global alarm sounds to let me know I need more power. Meantime the 400 steam engines roar into life and quench the alarm for me letting me know the buffer is working. I now have a bit of time to expand nuclear, but should stop expanding other stuff...

I can get you an image but it's just a decider-arithmetic SR latch with accumulator before and speaker after.

### Who is online

Users browsing this forum: No registered users