Another approach to Cable Resistance (with fluid network)
Moderator: ickputzdirwech
Another approach to Cable Resistance (with fluid network)
The topic of cable resistance has been discussed before in
"Cable Resistance / Non-looseless Power Transmission"
viewtopic.php?f=80&t=15546&p=145539
and the show-stopper was the time-complexity of calculating a Flow network
https://en.wikipedia.org/wiki/Flow_network
.
I'd like to propose another approach which works like the water flow in pipes: You give every pole a small capacitance and every cable a resistance. Instead of calculating the equilibrium state with the complex algorithm, at each update cycle you only calculate the flow between each pair of connected poles. (Difference in voltage divided by the connecting resistance gives the current. Sum of currents times update time divided by capacitance gives the voltage in the next frame.) I assume this is how the pipe network works.
In order for these differential equations to converge using the incremental solution the RC-constants should be larger than the update time. With a constant consumption the whole network should converge against the real flow network solution. The solar cells and batteries couldn't be treated as one big thing anymore but they could be lumped together into local (neighboring) groups, which wouldn't be too bad.
This would enable great things like:
* having to plan your power distribution on large maps
* separating low-voltage and high-voltage networks for local and distant energy distribution
* having the transformer translate between the two networks
"Cable Resistance / Non-looseless Power Transmission"
viewtopic.php?f=80&t=15546&p=145539
and the show-stopper was the time-complexity of calculating a Flow network
https://en.wikipedia.org/wiki/Flow_network
.
I'd like to propose another approach which works like the water flow in pipes: You give every pole a small capacitance and every cable a resistance. Instead of calculating the equilibrium state with the complex algorithm, at each update cycle you only calculate the flow between each pair of connected poles. (Difference in voltage divided by the connecting resistance gives the current. Sum of currents times update time divided by capacitance gives the voltage in the next frame.) I assume this is how the pipe network works.
In order for these differential equations to converge using the incremental solution the RC-constants should be larger than the update time. With a constant consumption the whole network should converge against the real flow network solution. The solar cells and batteries couldn't be treated as one big thing anymore but they could be lumped together into local (neighboring) groups, which wouldn't be too bad.
This would enable great things like:
* having to plan your power distribution on large maps
* separating low-voltage and high-voltage networks for local and distant energy distribution
* having the transformer translate between the two networks
Re: Another approach to Cable Resistance
I think it would be fun.
Re: Another approach to Cable Resistance
This is how RedPower 2's blutricity worked.
The problem is that you need lots of capacitance - because e.g. all the power you want to draw from a pole in a tick has to be stored in that pole.
But then it takes a really long time for all the poles to charge up/discharge.
The problem is that you need lots of capacitance - because e.g. all the power you want to draw from a pole in a tick has to be stored in that pole.
But then it takes a really long time for all the poles to charge up/discharge.
Re: Another approach to Cable Resistance
Fluid dynamics, in my electrical system? I don't think that would fit very well here.
You can do nifty things with fake "hydraulic" power- I.E. a liquid that stores its power using temperature. It is not impossible to have a structure powered by such a material. In such a situation you would need a pipe network to process hydraulic power. But if every single thing depended on it, the complexity of your factory would skyrocket. It'd be way too difficult for a newbie at least.
You can do nifty things with fake "hydraulic" power- I.E. a liquid that stores its power using temperature. It is not impossible to have a structure powered by such a material. In such a situation you would need a pipe network to process hydraulic power. But if every single thing depended on it, the complexity of your factory would skyrocket. It'd be way too difficult for a newbie at least.
Re: Another approach to Cable Resistance
immibis, yours is a valid concern, I will have to look into that in more detail to explore how big of a problem that is in typical factorio maps.
One thing that could help is not storing all energy "in the pole" but to store some energy in the consumer or direclty creating a slow ramp-up and ramp-down of consumption. The problem is not the power draw as such, it is the fast changes in current and the reaction to fast changes voltage which can cause positive feedback and lead to oscillations.
In the end we don't have to simulate reality directly but we are free to do some adjustments to make it work.
One thing that could help is not storing all energy "in the pole" but to store some energy in the consumer or direclty creating a slow ramp-up and ramp-down of consumption. The problem is not the power draw as such, it is the fast changes in current and the reaction to fast changes voltage which can cause positive feedback and lead to oscillations.
In the end we don't have to simulate reality directly but we are free to do some adjustments to make it work.
Re: Another approach to Cable Resistance
Fluid networks with vanishingly small storage capacity act like a real electrical network. The problem is that the electrical network is too complex to simulate accurately, so I'm suggesting a trick to get the same effect. For the player both things should look the same.bobucles wrote:Fluid dynamics, in my electrical system? I don't think that would fit very well here.
That is a whole new idea. I don't know if hydraulic or pneumatic power has been suggested before. It would totally make sense... but then again offshore pumps need no fuelbobucles wrote: You can do nifty things with fake "hydraulic" power- I.E. a liquid that stores its power using temperature. It is not impossible to have a structure powered by such a material. In such a situation you would need a pipe network to process hydraulic power. But if every single thing depended on it, the complexity of your factory would skyrocket. It'd be way too difficult for a newbie at least.
Re: Another approach to Cable Resistance (with fluid network)
I have fixed the topic a bit.
Added to viewtopic.php?f=80&t=15546
Indeed an interesting idea... the problem is: The current fluid simulation is not very accurate. For example if there is low supply the fluid likes to turn left.
Hm.
Let's say there is a fluid simulation like so: Each chunk is connected with four neighbor-chunks other over a piece of pipe.
For every chunk the consumption and production and the in- and outgoing power is counted. Not every tick, more once in 10 secs. The question is here: Does the chunk in sum suck or fill liquid into the pipe?
We calculate also the incoming and outgoing streams from/to the 4 other chunks.
Then we let the fluid simulation run. The measured flow is then the resistance (R = U * I, where I is here the flow and U is constant for simplicity). That effects how much energy will be lost, when flowing from chunk to chunk, until nothing is left anymore.
As already mentioned: That needs to be calculated only every 1-10 seconds or so. (This is realistic! In reality this is the same, there the cable buffers some electrical overload, before there is the danger, that the cable smelts, so the regulation must not be really fast)
Added to viewtopic.php?f=80&t=15546
Indeed an interesting idea... the problem is: The current fluid simulation is not very accurate. For example if there is low supply the fluid likes to turn left.
Hm.
Let's say there is a fluid simulation like so: Each chunk is connected with four neighbor-chunks other over a piece of pipe.
For every chunk the consumption and production and the in- and outgoing power is counted. Not every tick, more once in 10 secs. The question is here: Does the chunk in sum suck or fill liquid into the pipe?
We calculate also the incoming and outgoing streams from/to the 4 other chunks.
Then we let the fluid simulation run. The measured flow is then the resistance (R = U * I, where I is here the flow and U is constant for simplicity). That effects how much energy will be lost, when flowing from chunk to chunk, until nothing is left anymore.
As already mentioned: That needs to be calculated only every 1-10 seconds or so. (This is realistic! In reality this is the same, there the cable buffers some electrical overload, before there is the danger, that the cable smelts, so the regulation must not be really fast)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Electric energy loss due per distance
Joined with this thread, cause basically the same idea -- ßilk
basically the idea is to copy pipes system, pressure decreases per tile, to electric network. would be more realistic and have sense. Like pump take 1 tile straight so you need 2 tiles to turn electric network needed an item without electric range or then you would have minimum energy or none at some kind of limit range. More poles more energy to their range? Range of loss variations depending of energy production but with max distance? Diferent kind of pole for more distance like now but more cable capacity? sry low english level.
hope to see some good response other than no thanks or already said. In the FSI section isnt mention.
basically the idea is to copy pipes system, pressure decreases per tile, to electric network. would be more realistic and have sense. Like pump take 1 tile straight so you need 2 tiles to turn electric network needed an item without electric range or then you would have minimum energy or none at some kind of limit range. More poles more energy to their range? Range of loss variations depending of energy production but with max distance? Diferent kind of pole for more distance like now but more cable capacity? sry low english level.
hope to see some good response other than no thanks or already said. In the FSI section isnt mention.
Re: Electric energy loss due per distance
This sure makes sense and would add realism, but it is rather hard to pull off in my opinion.
Good idea tho!
Good idea tho!
-
- Long Handed Inserter
- Posts: 87
- Joined: Wed Apr 27, 2016 6:30 pm
- Contact:
Re: Electric energy loss due per distance
On the surface, this wouldn't be that mechanically difficult - just decrease the power supplied by a given power pole by a percentage based on how many "jumps" the power pole is away from the nearest power provider. So, the huge steel power towers make for less power loss over distance because their jumps are longer. The difficulty comes in when determining available power in a grid with multiple sources - like a steam powerplant on one end, and a solar farm on another. Each pole would have to individually sum up the power gained from each source, which, in a large factory with potentially hundreds of solar panels, accumulators, and steam engines, plus thousands upon thousands of power poles, would create a fairly noticeable performance sink unless seriously optimized somehow.
Re: Electric energy loss due per distance
Koub - Please consider English is not my native language.
Re: Another approach to Cable Resistance (with fluid network)
I joined the above thread into this one.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Another approach to Cable Resistance (with fluid network)
I was actually looking at converting the fluid system to work more like the electric network for performance reasons.
Making the electric network operate like the fluid system does now is just not going to happen. The performance implications in doing that would be ridiculous and as the electric network got bigger the performance would drop off quickly.
Making the electric network operate like the fluid system does now is just not going to happen. The performance implications in doing that would be ridiculous and as the electric network got bigger the performance would drop off quickly.
If you want to get ahold of me I'm almost always on Discord.
Idea for adding complexity in power management
I found a post discussing how it would be nice if it was possible to add more complexity to the power distribution of the game. There were a lot of arguments on how it could be done but none of them were plausible because of computational overhead.
What I am doing in this post is coming with a new suggestion on how power loss during transmission can be handled. Without having too much of an idea on how easy this will be to implement it should not add an insane amount of extra computation to the game.
The basic idea is to keep it simple. Add a multipier to every power pole. Everything connected (which is not a power pole) to that power pole has its power consumption multiplied by the poles multiplier.
The multiplier is thought to be set based on how far the pole is from the nearest connected zero loss power source. A zero loss power source could be things like steam engines, the big steel power lines (transmission lines?) solar cells or accumulators.
By implementing it in a simple way like this you don't add a lot of overhead when it comes to extra processing, and the power draw should only need to be calculated once and otherwise your power network is just at it is in the game right now.
Implementing this will make it beneficial to not just spagetti string your power network together because if you do the part of your factory far away from your power generation will begin to consume inordinate amounts of electricity.
How does this sound for how adding complexity to the game without breaking it?
What I am doing in this post is coming with a new suggestion on how power loss during transmission can be handled. Without having too much of an idea on how easy this will be to implement it should not add an insane amount of extra computation to the game.
The basic idea is to keep it simple. Add a multipier to every power pole. Everything connected (which is not a power pole) to that power pole has its power consumption multiplied by the poles multiplier.
The multiplier is thought to be set based on how far the pole is from the nearest connected zero loss power source. A zero loss power source could be things like steam engines, the big steel power lines (transmission lines?) solar cells or accumulators.
By implementing it in a simple way like this you don't add a lot of overhead when it comes to extra processing, and the power draw should only need to be calculated once and otherwise your power network is just at it is in the game right now.
Implementing this will make it beneficial to not just spagetti string your power network together because if you do the part of your factory far away from your power generation will begin to consume inordinate amounts of electricity.
How does this sound for how adding complexity to the game without breaking it?
Re: Another approach to Cable Resistance (with fluid network)
[Koub] No need to start a new topic, the idea in all these topics is no stop lossless/immediate electric network. Topics merged.
Koub - Please consider English is not my native language.
Re: Another approach to Cable Resistance (with fluid network)
Thanks for the service.
Re: Another approach to Cable Resistance (with fluid network)
A somewhat abstracted way of implementing cable resistance is to give each power pole a constant power drain.
Letting this power drain be proportional to the pole's coverage area, players would also be encouraged to use poles appropriate for the task at hand.
It'd be a very direct way of emulating power loss, and should be computationally cheap - although the distance element would be completely ignored.
Letting this power drain be proportional to the pole's coverage area, players would also be encouraged to use poles appropriate for the task at hand.
It'd be a very direct way of emulating power loss, and should be computationally cheap - although the distance element would be completely ignored.
Re: Another approach to Cable Resistance (with fluid network)
There's always that one piece of any of the "solutions" that make the solution infeasibleBlurb wrote:... although the distance element would be completely ignored.
If you want to get ahold of me I'm almost always on Discord.
-
- Long Handed Inserter
- Posts: 87
- Joined: Wed Apr 27, 2016 6:30 pm
- Contact:
Re: Another approach to Cable Resistance (with fluid network)
I don't know if it's been suggested or thought of already - I can't read through all the different posts on the matter right now - but have you ever considered treating the system as a pathfinding solution, rather than a flow one? Because, really, electricity is not a flow. If you have a power consumer on the end of a very long line that only gets a fraction of the maximum power, then if you plug it in you'll get a reduction of available power across the entire network - the far-away consumer will have a cap on how much it can draw from the grid, but it will draw any available amount it needs up to that cap, even if there are other consumers closer to the powerplants.
With that in mind, something like a good pathfinding algorithm could suit your needs far better than a flow simulation. It might not be perfectly realistic, but then hardly anything in Factorio actually is. You'll end up with a dynamic calculation of paths by nodes, from each source to each destination, with assigned weights for calculating the cheapest path. Nodes are the power poles, the length of each cable can be easily gotten at, and the weight for getting from one node to the next is the cable length, maaaaaybe modified by the type of power pole. Each node will end up with a table of path cost values for each of the power providers in the grid, and the total power available at the pole will be the sum of those modified values. Still probably not a very performance-cheap solution, but since recalculations will only be required when the grid layout changes (i.e. not all that often), it could probably be a better solution than some.
With that in mind, something like a good pathfinding algorithm could suit your needs far better than a flow simulation. It might not be perfectly realistic, but then hardly anything in Factorio actually is. You'll end up with a dynamic calculation of paths by nodes, from each source to each destination, with assigned weights for calculating the cheapest path. Nodes are the power poles, the length of each cable can be easily gotten at, and the weight for getting from one node to the next is the cable length, maaaaaybe modified by the type of power pole. Each node will end up with a table of path cost values for each of the power providers in the grid, and the total power available at the pole will be the sum of those modified values. Still probably not a very performance-cheap solution, but since recalculations will only be required when the grid layout changes (i.e. not all that often), it could probably be a better solution than some.