Is there a way to see accumulator charge over time?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Bomaz
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sun Jul 24, 2016 10:02 am
Contact:

Is there a way to see accumulator charge over time?

Post by Bomaz »

I would like to ensure that I don't risk running out of charge in my accumulators. The easiest way to do that would be to have a graph that shows the accumulator charge over time (possibly as a % of the max charge) is there any mod (or even part of the base game) that adds that?

zebediah49
Fast Inserter
Fast Inserter
Posts: 119
Joined: Fri Jun 17, 2016 8:17 pm
Contact:

Re: Is there a way to see accumulator charge over time?

Post by zebediah49 »

I don't know of a direct way of doing this, but it should be possible to do indirectly. Specifically, power can be plotted this way. This means you just need to convert accumulator charge into a power output.

Here's my proposal: build a sawtooth generator for the range 1-100 -- pick a signal, and then
  • a constant combinator feeds a '1' into
  • an arithmetic combinator that is configured as an integrator (one output feeds back into its input; math operation does nothing but return input to output -- +0 or *1)
  • a decider combinator feeds in '-100' if the output is greater than 100
This will produce a signal that ramps from 1 to 100, and then repeats (5 times per 3 seconds).

Now, you can make a very simple power network that consists of a power switch and some kind of flat load (like a radar).

The idea here is that if your accumulator is half-full, it will output a signal of 50 -- so half the time the sawtooth will be above that (and the switch will be on, powering the second network), and half the time it will be off. The result is that when you look at the average power use on that subnet, it should be approximately equal to the accumulator charge.

I haven't tested this, although I think I will now, because I've wanted this feature :)


------ Correction: Just tried to test it, and the idea mostly works, although you have to do the isolation and combinators a bit more cleverly. I'll post back with that once I get a chance, but I have to go for now.

EDIT: I have a working version: http://imgur.com/a/VCkEX

Image

The top half consists of the accumulator and combinator logic. The constant combinator feeds the integration step (I used 4 for decent results) into the arithmetic combinator, which is configured as an integrator (by looping to itself, and doing a null operation). The decider combinator is set to test if the value is greater than 100. If so, it outputs '1'. that goes to the second arithmetic combinator which multiplies by -50 (due to the two ticks it takes to propagate, it will output the -50 for two ticks for a total of 100), and sends that back into the integrator. This produces a sawtooth signal. The power switch compares the output of the sawtooth to the value in the accumulator. The bottom half is a minimalistic, independent power grid. The decider combinator just provides a dummy-load so that it doesn't flash at me; the arithmetic combinator is the test load.

Image

It's not perfect, and there are some aliasing artifacts, but power use pretty well represents accumulator charge.

You need to pick a good value for the integration speed. When I had it set to '1',the 5/3 second period meant that it didn't average out very well. When I had it set to '4', it was working pretty well, although there were still artifacts. It's probably good to about 5% worth of jitter in the 10-minute plot.

Harkonnen604
Filter Inserter
Filter Inserter
Posts: 285
Joined: Thu Jun 09, 2016 5:56 am
Contact:

Re: Is there a way to see accumulator charge over time?

Post by Harkonnen604 »

1. Simple way - if it's about solar, just check for accumulator charge level when night starts inside electric network info (click on the pole). If you are near accumulators, just see they are not charging :) many sparks there. well, that's obvious.

2. Hard way - add combinator network that has 1 minute (or 5 minutes) delay timer that is reset each time accumulators reach 100%. If that timer reaches 5 minutes, it means there was not 100% charge level for 5 minutes - you can then turn big fat cluster of red lamps pulsing under another circuit timer.

Bomaz
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sun Jul 24, 2016 10:02 am
Contact:

Re: Is there a way to see accumulator charge over time?

Post by Bomaz »

zebediah49 wrote: EDIT
That is really cool. However I do not think that I understand how it works.

Any chance you would be willing to post a blueprint string so I can tinker with it in my world in order to understand it? (easier it I can look at the settings etc)

zebediah49
Fast Inserter
Fast Inserter
Posts: 119
Joined: Fri Jun 17, 2016 8:17 pm
Contact:

Re: Is there a way to see accumulator charge over time?

Post by zebediah49 »

I had to go install that mod, but I think this will do it

Code: Select all

H4sIAAAAAAAA/7WW3W6jMBCFXyXyZRcqIMBeVF6pfYytVsgxQzOSsZExbSPEu69N/iAiCXS3l5F9huPPxzPJ1UoozsQqoy1Igwahpm0rWQmUMM6bshHMKE28
StV2VUnaflJ//Zh4O+qnj0nncSUlcLdkla8kJH9oqyG3VfqCuwxzmnZd56nGVI3JanyTTNDW7Cr7jXfUpmGCePtP7hf938QJDjbqkgnhg7Af0cj9Sgm4sJM6
M8lZkQPHHLTPVblBOeE/dIL1wb3RSmQb2LJ3VJq2B3FmV3I8HKtAXc9z/kz6mrVh0tAwCOyPsmLaeaDkF1kC4aUvVe2sk0aarNCqzFBaNS2YqKGbhz72OGre
oHE/Iof1lURTG5PhxrDrBjfANJptCcbSv4o0uoH0rP8fVANPVWCJui+TH4uQPve5+gI27xqo8dLPG3zjMd+hbP1P6IPvJP8yJO8nI/YP38R+PTeyN5CmI4qV
+rDtoP5Aw7djeOG+k8XT+I7lT+yWoLNNzKvBSRdkfNgsZuK6kcdxlo73eP0Rx32UpkgUKAxoNxvmn8V2LXtFKHP47J0sf3hj//cHQd+EokWvJ9kHwKYnR703
R9P5L2m6Kz0sml/OQLBgegW95eie46lBNrB7MZimJ43RDSw5StgbO+83wEof5BvKy6tyO+PhEaKTaqNQwFQ043NlVRT1Vmnwq6asJramw9Lx/dKJOyXyHtJF
xNFAecz38C9Rd4q2d0sxGcGj1nW3Jw2m0XKVPYHM/wJltOvYkQkAAA==
As for theory -- basically I used a sawtooth ADC design like this outlines to produce a PWM output. Ignore the last part; it's really just that first figure that matters here. This is then re-converted to the analog signal via a lowpass filter (the chart's averaging). This article from TI is pretty good about that.

Basically I just stole "elementary" electronics techniques for use in Factorio :)

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Is there a way to see accumulator charge over time?

Post by siggboy »

zebediah49 wrote:Here's my proposal: build a sawtooth generator for the range 1-100 -- pick a signal, and then
  • a constant combinator feeds a '1' into
  • an arithmetic combinator that is configured as an integrator (one output feeds back into its input; math operation does nothing but return input to output -- +0 or *1)
  • a decider combinator feeds in '-100' if the output is greater than 100
This can be done easier (and then you don't have to worry about tick delay):

Decider combinator that does: "C < 100 => Output C (input count)"; loop the output back to the input
Constant combinator with "C = 1" (or the step increase that you want, e.g. put "C = 4" if you want to increase the counter in steps of 4); connect it to any of the inputs of the decider.

This is a clock that loops through 100 and then resets (what you correctly call a Sawtooth generator).

If you want to slow down the clock you can simply divide the output by any number.

BTW I like the rest of your setup with the dummy load to get an ingame graph, great idea.
Bomaz wrote:I would like to ensure that I don't risk running out of charge in my accumulators. The easiest way to do that would be to have a graph that shows the accumulator charge over time (possibly as a % of the max charge) is there any mod (or even part of the base game) that adds that?
Maybe it would already help you to have a running average of the accumulator charge level, with a very long averaging period. It's like one of those graphs you see on stock trading websites, where they have a 200 day average graph overlaid to the spiky daily trading graph, that shows you the long term trends.

You can make something like it with only 4 combinators. The output will show you the long-term average of the accumulator level. If that number is low, it means you've been dropping low recently, if it's high it means everything is good.

Of course it won't protect you from blackouts or anything, but it's a good measure for the general "health" level of the accumulators. You need a mod to display the readout, if you use Smart Display you can even have the readout show up on the map (as a label like a train station), so you can look at it from anywhere (or you put the signal on a wire and put a readout into your factory).

Here's the contraption:
Capture.PNG
Capture.PNG (152.17 KiB) Viewed 5862 times
The top two combinators are just for initializing so you won't have to wait for the readout to ramp up to 100 when you connect it.

The middle two combinators do the counting and averaging. It's difficult to explain, but basically the accumulator keeps outputting its charge level every tick to the counter (decider in the middle), and the combinator below the decider subtracts a small fraction of the counter each tick (1/3000 of the counter value in this setup, you can't see this). That basically means that over 3000 ticks it will have subtracted the counter value from the counter. This will mean that the counter value slowly creeps to the average value that was input each tick.

The combinator to the right divides the counter value by 3000 and outputs it -- that's the average accumulator level each tick, averaged over a long period.

If you need shorter periods you can decrease the "3000" to a lower level (you also need to adapt the constant in the reset circuit, it needs to be that number divided by 2).

The constant combinator simply resets the counter to the current accu level when you want to start measuring. Turn it on and off again.

Blueprint has no accu but a combinator instead. Blueprint string fails if there's an accu in it, probably a bug. Smart Display is not included either, to keep it compatible with Vanilla.
blueprint
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Is there a way to see accumulator charge over time?

Post by siggboy »

Alright boys, I've taken Zebediah's idea with the power plant and taken it to the next level of crazy:

:ugeek: :ugeek: :ugeek:
Capture.PNG
Capture.PNG (304.02 KiB) Viewed 5859 times
This is an endless production/consumption loop with oil barrels. The pump in the middle controls how fast the assemblers can produce (if it's turned off, they'll stall after a short while).

The rest of the idea is taken from Zebediah: use the sawtooth signal to turn on the pump more frequently when the accu level is high, and less frequently when it's low.

So you can see on your production statistics for Oil Barrels how high the accu level was over time.

(If you actually want to do this in a game, you need the Rail Tanker mod, so you won't have to use barrels to actually transport oil. Alternatively install a barrel mod that allows you to barrel any fluid, and then put lubricant or sulfuric acid into the loop instead of oil.)

The contraption can be made more precise by speeding up the assemblers, but I haven't tried that. I'm also not sure if I put enough barrels into the loop, you need to have enough to be able to saturate the assembly machines at 100% (you need more if you speed them up).

Enjoy :mrgreen:
blueprint
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Is there a way to see accumulator charge over time?

Post by siggboy »

I'm having fun with this right now. I put 4x Speed 3 into both assemblers, then they need 93 oil/second to run at 100%, so I put 3 parallel pumps in between:
Capture.PNG
Capture.PNG (174.65 KiB) Viewed 5851 times
That's 90 oil/second max, not enough for 100% but close. The long handed inserters might be a tad too slow however, we need to move almost 3.75 barrels per second, I think they can only manage 3.45/second.

In any case, the maximum theoretical throughput is 217 barrels/minute, this contraption manages 208/minute, but whatever, it's good enough :).

So with A (accu) = 100 I get 208/minute (on a retry I got 193/minute, put more barrels in then it was back to 208)
A = 75 => 163/minute
A = 50 => 108/minute
A = 25 => 55/minute
A = 5 => 11/minute

All pretty close to the theoretical values. I think you need 10 barrels in the loop, but if you put too many in it can lock up.

This is how it looks on the 10-minute graph. The ramp-up is pretty fast.
Capture2.PNG
Capture2.PNG (57.68 KiB) Viewed 5851 times
I actually think this is a viable way to draw a graph of something in the game -- if you don't need the oil barrels for transport.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Is there a way to see accumulator charge over time?

Post by XKnight »

zebediah49 wrote: It's not perfect, and there are some aliasing artifacts, but power use pretty well represents accumulator charge.
Indeed, I've found this bug during investigation this problem.
It seems like some entities have bigger energy consumption in the first tick, so you should take this into account.

Your sawtooth generator should have higher threshold for the first tick.
For example, I've tried to multiply accumulator's output by 3, and then check if integrator's value is bigger than 320 (why 320? look for explanation in the mentioned bug), then subtract 320 from the integrator, and use upper limit = 300 for the next tick. If this check fails on the next tick, then we should turn back to upper limit 320. This is possible to do in a single tick, so you don't need to introduce "x50".
Video

Post Reply

Return to “Gameplay Help”