LuaEntity.electric_supply_poles() for entities powered by electricity
Posted: Thu Mar 14, 2019 1:11 am
Hi,
I'm working on a mod that depends on the association between electric-poles and the entities that they are powering. Without a programmatic way to leverage the association between entities and the electric-poles that supply them, I would have to calculate the taxicab distance between the entity and every electric-pole on the LuaSurface to develop the assocation, which seems unnecessarily expensive since the engine appears to already make that association (when an entity is selected, the electric-pole(s) supplying the entity are highlighted with a blue box).
Separately, I would absolutely love a uniform way to query an entity's real-time electric power consumption (in watts or kW). It seems to take a lot of excess steps depending on the type of entity (entity.prototype.energy_usage is the nameplate consumption, and querying power consumption of devices with energy storage is done entirely differently)
Thanks!
P.S. Yes my goal is to implement DC approximation powerflow solution so that the amount of power flowing on any copper wire (or more accurately between any two electric-poles) can be calculated.
I'm working on a mod that depends on the association between electric-poles and the entities that they are powering. Without a programmatic way to leverage the association between entities and the electric-poles that supply them, I would have to calculate the taxicab distance between the entity and every electric-pole on the LuaSurface to develop the assocation, which seems unnecessarily expensive since the engine appears to already make that association (when an entity is selected, the electric-pole(s) supplying the entity are highlighted with a blue box).
Separately, I would absolutely love a uniform way to query an entity's real-time electric power consumption (in watts or kW). It seems to take a lot of excess steps depending on the type of entity (entity.prototype.energy_usage is the nameplate consumption, and querying power consumption of devices with energy storage is done entirely differently)
Thanks!
P.S. Yes my goal is to implement DC approximation powerflow solution so that the amount of power flowing on any copper wire (or more accurately between any two electric-poles) can be calculated.