Factorio Runtime DocsVersion 2.1.7

LuaElectricNetwork - Runtime Docs

ClassLuaElectricNetworknew

A LuaElectricNetwork represents a group of LuaElectricSubNetworks that are directly or indirectly connected to each other through implicit connections (closed power switches, surface connections) and during next electric network update will transfer electricity from producers and consumers.

Electric networks can be merged together when a power switch is closed and can be split into multiple networks when power switch opens. Similarly turning on or off a global network may merge or split electric networks in a way that follows the expected electricity flows - two sub networks that are not directly or indirectly connected will be put into separate electric networks.

The electric network is what performs electric flow between entities. It does not track connected entities as that's the responsibility of the electric sub network.

Members

get_accumulators_energy{name?=…, quality?=…} EnergyAndCapacityPair

Gets total energy stored inside of accumulators that are part of any electric sub network covered by this electric network.

Gets total energy stored inside of accumulators that are part of any electric sub network covered by this electric network.

set_accumulators_energy{name?=…, quality?=…, energy=…, equalize?=…}

Changes energy stored inside of accumulators that are part of any electric sub network covered by this electric network.

Changes energy stored inside of accumulators that are part of any electric sub network covered by this electric network.

sub_networks :: R array[LuaElectricSubNetwork]
statistics :: R LuaFlowStatistics

Statistics for this electric network. [...]

Statistics for this electric network. [...]

flow_last_tick :: R table

Energy amounts of satisfaction percents related to latest electric network update.

Energy amounts of satisfaction percents related to latest electric network update.

valid :: R boolean

Is this object valid? [...]

Is this object valid? [...]

object_name :: R string

The class name of this object. [...]

The class name of this object. [...]

Methods

get_accumulators_energy{name?=…, quality?=…} → EnergyAndCapacityPair

Gets total energy stored inside of accumulators that are part of any electric sub network covered by this electric network.

Parameters

Table with the following fields:
name :: EntityID?

When given, only accumulators of this prototype will be considered.

When given, only accumulators of this prototype will be considered.

quality :: QualityID?

When given, only accumulators of this quality will be considered.

When given, only accumulators of this quality will be considered.


set_accumulators_energy{name?=…, quality?=…, energy=…, equalize?=…}

Changes energy stored inside of accumulators that are part of any electric sub network covered by this electric network.

Parameters

Table with the following fields:
name :: EntityID?

When given, only accumulators of this prototype will be considered.

When given, only accumulators of this prototype will be considered.

quality :: QualityID?

When given, only accumulators of this quality will be considered.

When given, only accumulators of this quality will be considered.

energy :: double

New total energy to be set onto matching accumulators.

New total energy to be set onto matching accumulators.

equalize :: boolean?

Whether all accumulators should have the same charge ratio, regardless of whether that means discharging some of them. Defaults to false.

Whether all accumulators should have the same charge ratio, regardless of whether that means discharging some of them. Defaults to false.

Attributes

sub_networks :: Read array[LuaElectricSubNetwork]


statistics :: Read LuaFlowStatistics

Statistics for this electric network.

If the electric network becomes invalid, the flow statistics obtained from it will also become invalid.


flow_last_tick :: Read table

Energy amounts of satisfaction percents related to latest electric network update.

Table fields

accumulator_energy :: double

Total energy of accumulators in the electric network before energy transfer.

Total energy of accumulators in the electric network before energy transfer.

accumulator_capacity :: double

Total capacity of accumulators in the electric network during electric network update.

Total capacity of accumulators in the electric network during electric network update.

primary_output :: double

Amount of energy offered by energy producers with "primary-output" usage priority.

Amount of energy offered by energy producers with "primary-output" usage priority.

secondary_output :: double

Amount of energy offered by energy producers with "secondary-output" usage priority.

Amount of energy offered by energy producers with "secondary-output" usage priority.

tertiary_output :: double

Amount of energy offered by energy sources with "tertiary" usage priority or accumulators.

Amount of energy offered by energy sources with "tertiary" usage priority or accumulators.

solar_output :: double

Amount of energy offered by energy producers with "solar" usage priority.

Amount of energy offered by energy producers with "solar" usage priority.

primary_demand :: double

Amount of energy requested by energy consumers with "primary-input" usage priority.

Amount of energy requested by energy consumers with "primary-input" usage priority.

secondary_demand :: double

Amount of energy requested by energy consumers with "secondary-input" usage priority.

Amount of energy requested by energy consumers with "secondary-input" usage priority.

tertiary_demand :: double

Amount of energy requested by energy consumers with "tertiary" usage priority or accumulators.

Amount of energy requested by energy consumers with "tertiary" usage priority or accumulators.

total_transfer :: double

Total amount of energy moved from producers to consumers.

Total amount of energy moved from producers to consumers.

maximum_production :: double

Sum of available production (solar_output, primary_output, secondary_output) increased by amount of energy actually provided from tertiary sources/accumulators.

Sum of available production (solar_output, primary_output, secondary_output) increased by amount of energy actually provided from tertiary sources/accumulators.

production_satisfaction :: double

Fraction of maximum_production that was actually used up.

Fraction of maximum_production that was actually used up.

maximum_consumption :: double

Sum of required consumption (primary_input, secondary_input) increased by amount of extra energy actually consumed by tertiary sources/accumulators.

Sum of required consumption (primary_input, secondary_input) increased by amount of extra energy actually consumed by tertiary sources/accumulators.

consumption_satisfaction :: double

Fraction of consumption_satisfaction that was actually provided.

Fraction of consumption_satisfaction that was actually provided.

lamp_satisfaction :: double
primary_output_usage :: double

Fraction of primary_output energy that was taken away during update.

Fraction of primary_output energy that was taken away during update.

secondary_output_usage :: double

Fraction of secondary_output energy that was taken away during update.

Fraction of secondary_output energy that was taken away during update.

tertiary_output_usage :: double

Fraction of tertiary_output energy that was taken away during update.

Fraction of tertiary_output energy that was taken away during update.

solar_output_usage :: double

Fraction of solar_output energy that was taken away during update.

Fraction of solar_output energy that was taken away during update.

primary_demand_usage :: double

Fraction of primary_demand energy that was provided during update.

Fraction of primary_demand energy that was provided during update.

secondary_demand_usage :: double

Fraction of secondary_demand energy that was provided during update.

Fraction of secondary_demand energy that was provided during update.

tertiary_demand_usage :: double

Fraction of tertiary_demand energy that was provided during update.

Fraction of tertiary_demand energy that was provided during update.


valid :: Read boolean

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.


object_name :: Read string

The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Fulltext search

Classes

Concepts

Events

Defines

Fulltext search for