Page 1 of 1

Power Conductor Limit

Posted: Sat Sep 05, 2015 5:13 pm
by sword2410
I'm not sure if someone already suggested, but it would be possible to implement a limited transfer of power to the power cables? For example, small electric pole can transfer up to 500 kW, after that limit starts to receive damage.

I think if implemented this could enhance the gaming experience.

Thank you. :)

Re: Power Conductor Limit

Posted: Sat Sep 05, 2015 5:18 pm
by reddutton
this could be usefull as real power line if overpowered will melt and will force every one to rethink where they place thier power generation at keeping it near the central base and not in farms as i have seen on most pictures of power gens althought weould be nice to have the option to turn it off as i dont belive every one would like that so may be best to do it a a mod and not part of the base game

Re: Power Conductor Limit

Posted: Sat Sep 05, 2015 7:22 pm
by ssilk
This is discussed to the following point:
- yes, something like a cable resistance would be useful and a very good game-element Also wanted by the devs.
- But sadly this is an extremly expensive calculation. Eats too much cpu-power.

See also https://forums.factorio.com/forum/vie ... 80&t=15546

Re: Power Conductor Limit

Posted: Sun Sep 06, 2015 2:42 am
by sword2410
ssilk wrote:This is discussed to the following point:
- yes, something like a cable resistance would be useful and a very good game-element Also wanted by the devs.
- But sadly this is an extremly expensive calculation. Eats too much cpu-power.

See also https://forums.factorio.com/forum/vie ... 80&t=15546
My suggestion is simple, just give a limit to the poles and also the calculation of damage when it exceeds that limit.

How complex can be to make route calculations of energy and the amount flowing through the poles? :)

Re: Power Conductor Limit

Posted: Sun Sep 06, 2015 5:36 am
by Fatmice
Because in the current model, nothing "flows" through anything. The power poles are simply there to test for whether an entity is part or not part of an electrical network. If it is and needs or produces energy, then it is added to a table that will be processed appropriately. There is very little computation needed once an entity has been registered to the table and no need to do the test again unless the entity has been marked for un-registration, for whatever reason. This enables the building of massive factories and arrays of power producers and consumers. There is no topology calculations involved with the current method, nor should there be any, imo. This game is about logistics, not energy distribution.

What you suggests, would require path tracing every tick, sixty times a second, as well as tree pruning to make sure the "electrical network" is following the rules. This is an exponential time problem. Computational time gets very large, very quickly for even modest sized networks, and by modest, I mean a typical factory of about 40-50 sectors in diameter with a tangle web of power poles that I see on every Youtubers; this typically amounts to about a few thousand power poles.

Re: Power Conductor Limit

Posted: Sun Sep 06, 2015 1:27 pm
by bobucles
What you suggests, would require path tracing every tick, sixty times a second,
Technically, the network would only have to be recalculated when the layout changes. Granted this can happen very frequently when logistic bots start hammering down blueprints.

Factorio shouldn't be trying to calculate a grid of 1 ohm resistors. That way lies madness. The best place to have any ability to throttle energy transfer is with the new switching apparatus.

Re: Power Conductor Limit

Posted: Sun Sep 06, 2015 2:53 pm
by sword2410
Fatmice wrote:Because in the current model, nothing "flows" through anything. The power poles are simply there to test for whether an entity is part or not part of an electrical network. If it is and needs or produces energy, then it is added to a table that will be processed appropriately. There is very little computation needed once an entity has been registered to the table and no need to do the test again unless the entity has been marked for un-registration, for whatever reason. This enables the building of massive factories and arrays of power producers and consumers. There is no topology calculations involved with the current method, nor should there be any, imo. This game is about logistics, not energy distribution.

What you suggests, would require path tracing every tick, sixty times a second, as well as tree pruning to make sure the "electrical network" is following the rules. This is an exponential time problem. Computational time gets very large, very quickly for even modest sized networks, and by modest, I mean a typical factory of about 40-50 sectors in diameter with a tangle web of power poles that I see on every Youtubers; this typically amounts to about a few thousand power poles.
I will try to elaborate a bit more the proposal, the game uses an algorithm that records the electrical network to calculate whether a device has power or not, right?

The same algorithm should have a map of the whole grid and different types of poles, as indicated bobucles, the network should be calculated only when components are changed.

And if the poles will include a limit parameter (that does not mean resistance) only indicate whether the pole gets hurt or not based on the consumption of connected devices, then just say ... once every 1 second and averaging energy supply (which is already done in the statistics of the network) calculate the damage taken by the pole. :)

Re: Power Conductor Limit

Posted: Sun Sep 06, 2015 5:30 pm
by ssilk
bobucles wrote:
What you suggests, would require path tracing every tick, sixty times a second,
Technically, the network would only have to be recalculated when the layout changes.
The load of the network changes in every tick and not only, when the layout changes.

I recommend reading the mentioned threads.
For example: I suggested an algorithm, that calculates the network more or less regularly and generates some kind of "blind resistance". The afford for that is still gigantic.

Re: Power Conductor Limit

Posted: Sun Sep 06, 2015 8:26 pm
by lancar
How about something simpler, like a a small power loss due to resistance that grows more severe the more "low-end" power poles you have in the network?
To avoid it, you'd have to section off the weaker power lines with Power Transformers.

It should demand significantly less CPU power to calculate (Have the small power poles "consume" power if they're not connected to the main network via a Transformer)

Re: Power Conductor Limit

Posted: Mon Sep 07, 2015 1:07 am
by Fatmice
There is no such thing as low-end power pole in vanilla Factorio. The area that a power pole services is not an indication of their hierarchy. Furthermore, to determine that a power pole is a terminus, you need path tracing, sounds familiar?

If you have certain power poles consume power because they are not under the influence of some gate, you would have to again check for such gate every tick. To do so would again require path tracing. And what of the transformers themselves? Do they act as simple gate or load sensitive gate? The electric network would need to be rewritten to carry additional information to even allow transformers to exist with any meaningful properties. So your "simpler" alternative turns out to add more problems than it solves.

By the way, the transformer mod in existence is not a transformer but a diode.

Re: Power Conductor Limit

Posted: Mon Sep 07, 2015 5:18 am
by lancar
Fatmice wrote:There is no such thing as low-end power pole in vanilla Factorio. The area that a power pole services is not an indication of their hierarchy. Furthermore, to determine that a power pole is a terminus, you need path tracing, sounds familiar?

If you have certain power poles consume power because they are not under the influence of some gate, you would have to again check for such gate every tick. To do so would again require path tracing. And what of the transformers themselves? Do they act as simple gate or load sensitive gate? The electric network would need to be rewritten to carry additional information to even allow transformers to exist with any meaningful properties. So your "simpler" alternative turns out to add more problems than it solves.

By the way, the transformer mod in existence is not a transformer but a diode.
In a way it doesn't actually "solve" anything as this feature is not part of the game (yet), and thus not a problem.

All it does is provide LESS problems than previously suggested methods. If a small power pole would only path a certain maximum amount of power then you'd need path tracing for every single such pole in the game. With my suggested transformer stations it would reduce that need to just them, making the CPU load significantly less. Besides, you can already do this cut-off in the game using Accumulators to separate electrical grids.
When you think about it like that, you actually don't have to re-write the electrical grid code that much all all. Who said the Transformer had to act like a pole? If it acts more like a Combinator with both input and output nodes, an entirely separate grid can fairly easily be created that has the non-pole-consumption modifier. No path tracing required at all.

/EDIT:
Although... that would require there to be some sort of advantage to having "high" power compared to "low" power grids, otherwise you'd just attach the transformer right after power production and stop caring.

Re: Power Conductor Limit

Posted: Mon Sep 07, 2015 8:05 am
by Fatmice
So your fixes result in a idea with limited use. Do you see a problem? :roll:

(A) Ideas -> Improvements -> Complications
(B) (A) -> fixes -> less complications -> limited use -> useless idea. :(

Don't mind me, but I don't ever see these ideas making it into the game. They don't extend anything or create any new game play element other than making it bothersome to create large factories. With them, the factories would need to be small modules such that the number of power poles servicing them would not eat all of the energy meant for production. This means distributed power generation instead of centralized generation.

Now distributed power generation is something interesting and can be implemented without path tracing. Simply create a hierarchy of power poles. Say there are four ranks of power poles, class 1, 2, 3, 4, and that each class has a limit to how many connections they can make and to whom they can connect. Without going into specific network topology, it is intuitively seen that such network has a size limit and therefore "power conductor limit", i.e. only so much power can flow through certain pole class because they service only so many poles. The power limit is of course not predetermined but finite due to a finite number of different consumers.

Re: Power Conductor Limit

Posted: Mon Sep 07, 2015 6:14 pm
by lancar
Fatmice wrote:So your fixes result in a idea with limited use. Do you see a problem? :roll:

(A) Ideas -> Improvements -> Complications
(B) (A) -> fixes -> less complications -> limited use -> useless idea. :(
Even if I hadn't seen the problem with it myself, this bit was both pointless and insulting.

Re: Power Conductor Limit

Posted: Mon Sep 07, 2015 11:30 pm
by Fatmice
Well I'm sorry you see it that way, but that is the reality of many of the suggestion threads here, useless, half-baked thoughts from the minds of those suffering what I call puppy syndrome, a condition where the person is easily excitable and quickly bored.

If you are going to give suggestions, then you should also be willing to hear that your suggestion is useless or has little value. It goes with the territory. Sometimes a little bluntness is needed to wake the senses for a person whose head is stuck in dream land. This is not a pointless or insulting exercise, I don't enjoy doing such thing, but a wake up call to tell you that ideas and suggestions need to be grounded in experience, what is practical, within the frame work of this game, and computation in general, as well as fun.

Ideas and suggestions is really not a playground for theoretical exercises where everything, including the impractical, is entertained. Though, it is clear many see it that way.

Re: Power Conductor Limit

Posted: Tue Sep 08, 2015 11:12 am
by ssilk
Offtopic, I need to go in here as moderator.

Fatmice, this is a suggestion forum. People are talking here about their ideas about Factorio.

Well, other people have other ideas and some people are maybe more right than others. This makes the things interesting, new ideas come out. This is wanted and needed.

I repeat: Different opinions is something, this forum lives from. But there is a clear line that should not be crossed: when you say there is no more to discuss (remember: it's a discussion forum), when you devaluate other ideas (you cannot know, if a stupid idea doesn't inspire someone else to a good one), or when you think you need to destroy other people dreams.

You can see that line clearly: It is between the extremes "Brave boy, you made us a happy new idea, nice you made it! We put it to the 100 others..." and "This idea is complete bullshit...". This line can be called "courtesy" or "respect".

I hope you don't cross it again.

Re: Power Conductor Limit

Posted: Tue Sep 08, 2015 11:47 am
by Fatmice
Off topic

I'm happy to take the hit. It is something that must be said after reading all of these ideas, not just this thread, though it is a prime speciment. I'm not one for political "correctness" so I call it what I see. As you can see from my post history, I almost never post in this section of the forum, for the obvious reason. I prefer to mind my own business over my own sub forum.

Back-on topic

This idea is salvageable only if path tracing is not involved. A hierarchy of poles is one way of simulating power conduction limit without path tracing. The condition to place a type of pole is only needed to be evaluated when placing poles or when such pole is broken or its connections changed. This again fits within the paradigm of nothing "flows" through the electric network. A partial implementation of this hierarchy already exists within vanilla Factorio as how large power poles prefers to connect to each other more than to other poles, but mainly this is realized by distance modulation and not type based. If this idea is implemented, there would be more brake up of the factories, which introduces more interesting game play.

Re: Power Conductor Limit

Posted: Tue Sep 08, 2015 1:47 pm
by safan
okay, no path tracing.

hmm lets think

Each small, medium and big pole gets exactly one network number. A High Voltage pole and power producers can be connected to multiple networks.

Each network works as a separate network and thus there should be a way to the producer of the power. (so about the same the game does now with only one network)

If you click on the HV pole or power producer you can see wich networks it connects too, and how much power these use.
If you click on the smb power pole, you see the producers and consumers, and also a max power for that separate network. Something like 10 MW

Playability features:

1. the factory has to be separated in blocks of 10 MW, connection between these blocks and power source has to be done with the HV poles.
Small factories have no problems, large factories also not as long as you provide a backbone with the HV poles. There is just no unlimited transfer with small poles all the way trough the factory

2. With combinators and switches you can put entire subnetworks on and off based on storage levels, or during the night, or based on accu levels.

3. You could make the lasers a separate network and shut everything else down during attacks. Just remember to include the coal mines and inserters for the steam engines

I think its do-able:

Start of game is the same. Only when you start on your third row of 10 steam engines it gets interesting: You now have to separate your network in 2 subareas.
You do this by placing a HV line from the steam engines towards the area you can easyly split off. You connect to the HW pole, and disconnect everything between the two subareas. Everything has now a line to a HV line that connects to the power source. And everything thats connected before the HV line uses less then 10 MW and suffers no energy problems.

Issue is mainly making it clear to the player that the problem is not the power source, but that the network is overloaded.

Re: Power Conductor Limit

Posted: Sun Feb 11, 2018 7:45 am
by Mekronid
I stumbled across this idea on a google search. Really cool. Of course, the computational limits imposed by electricity flow simulation are harsh. So here's how you deal with that:

Discount resistance (say, it's a self-balancing grid) so it's possible to treat electricity like an ideal fluid. Now we can calculate electricity consumption using only the coordinates of the electrical grid.

Calculate the maximum load difference of all electricity generation and consumption on each "side" of the pole.

Now this is the clever part. Store the spatial data on each pole servicing this particular load differential; select only the poles farthest from the center of the service region (ignoring the pole itself) and store those points in a list. Then attach that list to each of the aforementioned poles servicing this area. For multiple consecutive poles on the same axis we store only the endpoints to achieve a rudimentary compression.

Ex: We have several hundred assemblers. One assembler in the center and one on every side, radiating out to form a circle. Then a power plant at the bottom. The "service regions" that would form should look like a large circle, then a circle with the top chopped off, then a circle with a crescent chopped off, then a circle with a larger crescent chopped off, and so on. This is because no matter how the grid is laid out, the least electricity is used far away from the power plant while the most electricity is used nearest to the power plant. Our electricity doesn't "flow" in a hard-to-calculate wave pattern when there's no friction. So we can ignore all of the inner poles and structures when placing a pole or structure around the outside. In this case only the outer service area needs to be updated. Plus you can skip generation of a new service region for poles which don't service any structures. So there could theoretically be zero additional calculations done on transmission lines. The only time a large update is needed is when a new transmission line is laid outside of the service area of existing transmission lines.

For the sake of computational cost reduction it would be reasonable to "skip" every other pole when generating a new service area, since it's impossible for an electrical overload to occur anywhere but the largest service area. The purpose of service areas is just to roughly abstract the power usage pattern in a given area. This makes it easier to determine what areas need to be calculated for the simulation later on and can keep processing time low in case of a major grid merger.

Which is because:
  • Placing a new electricity consuming structure does not require recalculating coordinates or path tracing at all. You can directly backtrack the path by successively picking the next largest service region containing the current service region and then modifying the electrical load on each. This reduces our processing time from a monte carlo simulation all the way down to O(n), which is pretty awesome.
  • Placing a new pole no longer requires calculating the path and most of the coordinates do not change. Since we simply average the load between all poles servicing a service region, we only need to update the overall average differential on the current service region and also update service region maps which contain the service region we're currently operating on so the region maps will continue to line up. This uses the same backtracking algorithm described above.
Now we can finally get to the actual simulation part. Maintain calculations for the actual electrical draw and generation only on service regions determined to have the capability of exceeding their specified maximum. Calculating the rest would be pointless since we know they cannot reach the maximum load. All poles in a service region (but not in the smaller sub-regions) which have the possibility to overload will get a temperature bar on their mouseover window. The temperature rises by, say, 1°C for each tenth of a percentage point over 95% of the pole's rated capacity. Ex: A one frame electrical spike to 99.9% and an environmental temperature of 33°C (yes, I know the game doesn't have any environmental temperatures) would put all these poles at 82°C, decreasing by 1°C per frame until it reaches the current electrical load.

Each pole should have "fail temperature." For wood poles it could be 120°C and for big electric poles it could be 200°C. All poles at 75% or greater than the pole's maximum temperature would smoke to visually alert the player something is wrong (this is the purpose of having a temperature and not just an abstract "fail percent," it makes more sense) and perhaps put a warning notice on the map like when a structure is damaged. A pole reaching its maximum temperature would naturally collapse or explode. This would typically be at some value over 100% because engineers like to over-engineer their products. The pole could potentially take damage from temperatures exceeding 90% of their maximum, but lower temperatures are unlikely to cause permanent damage. The cool thing about this is, if a wooden pole burned up and dumped its load onto the others, you could get a cascading failure just like a real grid. Basically, don't build your grid like FirstEnergy! :roll:

Anyway, I know this is a lot of thought put into something that is not really an important part of Factorio, and I know this thread is old as dirt, but I wanted to share how it is possible to simplify this exceedingly complex problem by breaking it into parts and sidestepping the most complicating factor in the simulation. If this doesn't help the factorio devs then perhaps the theory behind it will help someone else plan out their software.

Re: Power Conductor Limit

Posted: Sun Feb 11, 2018 2:48 pm
by Tekky
Meanwhile, there is another thread on this topic, which contains a developer response:

viewtopic.php?f=6&t=51585 Electric System Rework