Circuit Power Measurement Pole deprecated

by mk-fg

[DEPRECATED] Adds Small 'Smart Meter' Electric Pole that transmits electrical network power production info to any constant combinator within its range.

Content
5 years ago
0.17
7
Circuit network

g Comparing to max capacity

5 years ago

I am curious if I am comparing consumption to capacity the right way. This is what I did:

1) Max production possible (K for KW):
- Store the # of my SteamEngines in a constant combinator. Multiplied them by 900 in an arithmetic combinator to get the max produced by my SteamEngines in KW. If I add more, I adjust the number in the constant combinator.
- Do the equivalent for other power sources to get the max produced by each of those types in KW.
- Green wire together the outputs and multiply by 1 to get the Total KW that can be produced.

2) Current production as Percentage (P) of Max capacity (K):
- Output each signal from the Pole's combinator to its own arithmetic combinator to multiply by 100.
- Use arithmetic combinators to divide each (multiplied above) signal by its corresponding K (or W/T if looking at the total). The result is the percentage as a number from 0-100.

3) Display and alert.
- I setup 5 lights for each Percentage that light up if > 0, 20, 40, 60, 80. 0, 20 and 40 are green, 60 is yellow, 80 is red.
- I setup a speaker to make a global alert when W's usage Percentage is over 80.

Does that sound right? Or is there a simpler way to do this?


Suggestion: If Factorio API's permits it (big if), it would be good to get Max Capacity signals to go along with the Production signals that your mod provides. It would make it much less tedious to figure out how much of the capacity we've consumed and when to "upgrade" the power.

5 years ago

If Factorio API's permits it (big if), it would be good to get Max Capacity signals

Don't think it does... well, not easily, anyway.
And don't think it itself tells accurate numbers either, due to many factors that go into the thing.

See next-door thread about same thing for more details:
https://mods.factorio.com/mod/Circuit_Power_Measurement_Pole/discussion/5ce422f8c83fea000bb7d97e

5 years ago

I see. Sounds like I reinvented the wheel, but did it just right :)

5 years ago
(updated 5 years ago)

Does that sound right?

Sounds right in general.

Store the # of my SteamEngines in a constant combinator.

Didn't look for one, but maybe there's a mod that straight-up counts buildings in some (comparatively large) radius?

Output each signal from the Pole's combinator to its own arithmetic combinator to multiply by 100.

I think you can use * input (all signals), multiply that by 100, and * output to replace these N combinators with one.

Use arithmetic combinators to divide each (multiplied above) signal by its corresponding K (or W/T if looking at the total). The result is the percentage as a number from 0-100.

Guess that'd still need N combos, unless you use something like LuaCombinator2 (probably my favorite mod), which allows you to just skip the puzzles and write whatever logic you want in lua (one of the simpliest programming langs).
https://mods.factorio.com/mod/LuaCombinator2

I setup 5 lights for each Percentage that light up if > 0, 20, 40, 60, 80. 0, 20 and 40 are green, 60 is yellow, 80 is red.

I'd use one of the Nixie Tube mods. Note that in my experience Santa's is actually more UPS-hungry one.

I setup a speaker to make a global alert when W's usage Percentage is over 80.

Hm, yeah, though note that it'll keep blaring that alert, unless you add a latch made of combinators between that >80 decider and speaker.
(lookup "factorio SR Latch" or check out circuit cookbook on factorio wiki, or can just use LuaCombinator2 above)

5 years ago

I did latch it... it rings once only :)

5 years ago

Output each signal from the Pole's combinator to its own arithmetic combinator to multiply by 100.

Oh, btw, there's one potential problem with that - I think if you have multi-gigawatt factory, result might overflow 2^31 limit for signal values.
It'd have to be a really large power numbers, but I know people do crazy things in factorio, which is why values are in kW and not W in this mod too :)

New response