Electric Network data
Electric Network data
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.

Re: Electric Network data
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:
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:
It would be awesome if we had access to better electrical network statistics data.
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
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:
- Entity activity, electricity, and production
- Power Readout mod support
- api call to get power drawed from electric network
- Get electric network information using API
- Total electrical network consumption
- API and electricity ?
- Electric Network data
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