Electric Network data

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 582
Joined: Tue May 19, 2015 1:56 am
Contact:

Electric Network data

Post by Reika »

From what I can tell, there is no way to access this; you can get the LuaFlowStatistics, but that only seems to have data about total energy transfer since...forever(?), not anything useful like current generation by category or satisfaction fraction.
Image

manuell
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue Jan 25, 2022 10:38 pm
Contact:

Re: Electric Network data

Post by manuell »

Motivation:
I would like to make a mod that provides circuit signals for the status of the electrical network.
Basically I would like to have access to the electric network info panels data:
  • satisfaction, both values
  • production, both values
  • accumulator charge, both values
In conjunction with the mod Power Overload this enables management of charge and discharge of accumulators.


what is currently possible:
Read LuaFlowStatistics and sum up the input and output of the electrical network. This gives no hint if the network has reserves.

I searched in the forum and found also these requests: Summary

Code: Select all

local stats = electricPole.network.stats;
stats.satisfactionCurrent
stats.satisfactionNeeded
stats.productionCurrent
stats.productionPossible
stats.accumulatorChargeCurrent
stats.accumulatorChargePossible

-- a request I found in the other discussions
local assembler = ...
assembler.powerState -- the energy bar when you hover over an assembler, inserter ..
-- could be also
assembler.energyCurrent
assembler.energyNeeded -- to skip the conversion to percent

-- another request was it to get access to all electric networks eg.
for networkId, stats in pairs(player.force.electricNetworks) do
-- the same network stats as above

-- event for split / join electric network (especially when rewiring)
script.on_event(defines.events.wire_joined, function(event)
event.fromEntity
event.toEntity
event.wireType
end)

script.on_event(defines.events.wire_cut, function(event)
event.fromEntity
event.toEntity
event.wireType
end)

-- for power pole entities, access to the connected circuit networks
pole.greenCircuit
pole.redCircuit
It would be awesome if we had access to better electrical network statistics data.

Post Reply

Return to “Modding interface requests”