Page 1 of 1

Finding separate electric networks

Posted: Mon Oct 22, 2018 5:59 pm
by AngledLuffa
Is there a way to find separate electric networks on a map? Base game or a mod would both be fine. I ask because during a recent survey of my biggest base, I found that there were a few hundred solar panels not connected to the rest of the network. It's possible there are other clusters of panels or accumulators that aren't attached yet.

Thanks!

Re: Finding separate electric networks

Posted: Mon Oct 22, 2018 7:12 pm
by eradicator
On the "maxi"-map you can enable showing connected power poles via the buttons on the right. Using the debug overlay (F4/F5/F6/F7) you can also enable "show-network-connected-entities" which will display the network number on every pole. If two poles have different numbers they're not on the same network. Though if two networks are connected via power switch they'll have different numbers.

I'm not aware of any mod that automatically shows this. Detecting it should be possible, but i'm not sure how a mod should communicate its findings to the user. Maybe map tags at the center of each network? That might work.

Edit: After some rummaging through the api i see no method to determine if two power poles are on the same network :/. Using .neighbour and a cache of all poles would work, i guess...

Re: Finding separate electric networks

Posted: Mon Oct 22, 2018 7:34 pm
by AngledLuffa
The debug overlay sounds like a good place to start, thanks!

Now I find myself wondering if such a mod could also find accumulators, panels, or other entities which are not connected to any network at all. I know about the blinking electric symbol when first installed, but I've been installing power by laying down bot blueprints and then forgetting about them, so if cliffs or water disrupted the blueprint there may be more unattached items.

Re: Finding separate electric networks

Posted: Mon Oct 22, 2018 7:52 pm
by eradicator
AngledLuffa wrote:
Mon Oct 22, 2018 7:34 pm
The debug overlay sounds like a good place to start, thanks!
See also the edit above. If networks are seperated by switches they won't have the same number. Just something to keep in mind.

Also finding unpowered entities is much easier:

Code: Select all

/c
for _,this in pairs(game.player.surface.find_entities_filtered{force=game.player.force}) do
  if (not this.is_connected_to_electric_network()) and this.electric_buffer_size then
    game.player.force.add_chart_tag(this.surface,{icon={type='virtual',name='signal-red'},position=this.position,orientation=0.2})
    end
  end
This will add a red square map icon on every unconnected entity. Be careful to not save the game after using this, or you will have to manually remove all the icons, which could be quite exhausting. Also if your map is very large the command might take a few seconds to run.

Re: Finding separate electric networks

Posted: Mon Oct 22, 2018 8:25 pm
by darkfrei
eradicator wrote:
Mon Oct 22, 2018 7:52 pm
This will add a red square map icon on every unconnected entity. Be careful to not save the game after using this, or you will have to manually remove all the icons, which could be quite exhausting. Also if your map is very large the command might take a few seconds to run.
can we find all chart tags with icon {type='virtual',name='signal-red'}?

Re: Finding separate electric networks

Posted: Mon Oct 22, 2018 8:30 pm
by eradicator
darkfrei wrote:
Mon Oct 22, 2018 8:25 pm
eradicator wrote:
Mon Oct 22, 2018 7:52 pm
This will add a red square map icon on every unconnected entity. Be careful to not save the game after using this, or you will have to manually remove all the icons, which could be quite exhausting. Also if your map is very large the command might take a few seconds to run.
can we find all chart tags with icon {type='virtual',name='signal-red'}?
Theoretically? Sure. You can write that if you want.

Re: Finding separate electric networks

Posted: Tue Oct 23, 2018 1:13 am
by AngledLuffa
Thanks, the suggestion on how to find disconnected items was perfect. Fixed a few more solar panels whose block was placed slightly over water and didn't have a power pole.