IcyDiamond wrote: ↑Sat Nov 23, 2019 23:36
Pretty much the only thing holding this mod in Alpha status is the broken energy distribution code located in
elepower_papi/network.lua.
Basically what the problem is that the energy is not being distributed evenly and that adding storage devices onto existing networks breaks the entire thing.
Storage devices are designed to accept energy from one network and create their own network of consumers from the attached machines. A machine should be able to accept energy from multiple networks.
In even distribution it is important to keep in mind that each machine can have a different maximum power input at any time (ele_inrush) and to consider all the possible attached storage and provider nodes.
I really need help with this code because I really can't wrap my head around it. I am willing to pay to make this happen if necessary.
IcyDiamond wrote:
TODO:
Currently, there's a problem where storage nodes are allowed to create their own graph.
When placing the storage onto a cable, it will add itself to the graph of that cable.
But, when placing a cable onto the storage, that cable is added to the storage's own graph
and thus cannot be connected to the previous graph.
I've read the notes IcyDiamond left i the code and the above and I cant replicate this behaviour has anyone come across this bug.
I can see part of the bug in that battery storage will fill up in a linear fashion not a small amount across all batteries. rather until ones full then the next. What I cant replicate is adding additional storage breaks the network I tried replicating from the code "TODO" above but again my storage just connected and eventually filled I tried giving them both there own power in then connecting them but again no luck....I'll try with some downline machines and see if I can break the network.
Anyone else using Icy's elepower and ever seen a broken network or can give me a pointer how to break it? This seemed to be the biggest concern Icy had to get this out of alpha.
Ona side note any intrest in conduit wall pass through node? basically conduit full node size so you can pass power from outside through a wall neatly to the inside. Unless I missed it I cant see a node to do this short of using a powercell?
EDIT-1
Power sharing in general appears to be only linear, if I connect 2 furnaces to a single solar panel. One furnace will fill with energy (8) while the other has to wait until the 1st is filled (on a branched conduit). This maybe related to the battery issue or not however ill see if i can fix this first so both furnaces recieve 4 units. ill need a few smarts there to allow for odd numbers so if there was 3 furnaces 2 will get 3 units and 1 will get 2 energy units
EDIT-2
So I've been looking more closely at the code at it all looks very provider_node (pnodeid) centric. Using a single solar panel to test was probably a little bit of a harsh test as it only provides 8 usable energy units. Were as each furnace can suck up 32 energy units each tick (sec) until charged (basically all machines have a backup battery :)).
I haven't delved fully into the distribution ABM or tested this but ABM runs and hits our solar_provider which can give 8 power it then runs through its users (machines/storage) nodes. Interestingly this does have a sharing check in the code and if I'm understanding correctly if the first power_users power demand exceeds supply then we break straight out of the sharing loop. This gels with what im seeing ie furnace 1 is getting all 8 power as it has a 32 demand and furnace 2 doesn't get a lookin. However that is a very specific loop break that has been put in there so it's clearly intentional design. My best guess is that it can be used as an indicator that when power supply is insufficient for devices they will go unpowered. Saying that as all our machines run with battery backup a trickle charge to everyone across the network might be better way to go or it could be there for another issue....
With the battery issue above from Icy I think this might be the problem a battery is both a provider and user of energy. Depending how its connected:
Placed then Conduit connected to existing - becomes essentially a standalone provider (own graph not sure why the term graph was picked?) - can never charge or supply power.
Placed onto end of conduit - now part of existing network as it's a user, however can provide power outwards as a provider if charged
Not that I can replicate the behaviour I've detailed above since my batteries seem to always charge...but assuming my understanding is getting there we probably need a new group for batteries so proxy_provider. so if placed alone then connected to network they are just a plain old user. However when power (abm) distribution kicks in they can act as a provider with there own sub-net of machines.
The other possibly easier solution is to have an "In" port for batteries and the rest as "out" ports...using In port then battery = user, using out port battery = provider. Slightly more annoying to connect battery bank up but solves the issue. problem is I can see in the code that side or node power directionality has been frameworked but not finished...
First step to fixing this is, is to replicate the bug which I am yet to be able to do......I might see if I can reach Icy via email maybe he fixed it before shelving the code....
ramblings as much for msyelf but I am very happy to take suggestions or ideas :)
EDIT-3
The below proves what I thought basically whomever is "1" during the network sharing check gets the max they can take and 2 gets the bit left over in this case 80
dem2 = running power demand total
user_gets = machine/battery power given
items 3-4 in my example arent drawing any power....not that they can
Code: Select all
2021-06-11 15:34:41: [Server]: elepower_solar:solar_generator supply: 208
2021-06-11 15:34:41: [Server]: dem2: 128 user_gets: 128 -- bat1
2021-06-11 15:34:41: [Server]: dem2: 208 user_gets: 80 -- bat2
2021-06-11 15:34:41: [Server]: dem2: 208 user_gets: 0 -- furnace1
2021-06-11 15:34:41: [Server]: dem2: 208 user_gets: 0 -- furnace2
other slight oddity my 15 sized solar array is producing 208 power, which isnt divisable by 15...or a multiple of 8..however some panels are fully charged so Im thinking there must be a piece of code that allows for some of the stored to be pushed as well...kind of cool if it does.
Given that -same test with coal fired....need a big bank of those to staturate a battery....
Code: Select all
2021-06-11 16:02:37: [Server]: elepower_machines:generator_active sup: 16
2021-06-11 16:02:37: [Server]: dem2: 16 user_gets: 16
2021-06-11 16:02:37: [Server]: dem2: 16 user_gets: 0
2021-06-11 16:02:37: [Server]: dem2: 16 user_gets: 0
2021-06-11 16:02:37: [Server]: dem2: 16 user_gets: 0
EDIT-4
I didnt change anything code wise but now I cant replicate those outputs above ie adding a second battery always seems to result in supply output being 0....even though the battery is still charging okay....so visually looks okay but now when I look at output very funky.....the conduit seems to have for want of a better word become scrambled....um yeh I cant actually make it work now even setting up a new network. So two issues:
1. Power isn't split between machines, its a 1st in gets the power and the rest who need it tough luck.
2. 2+ Batteries ona single conduit network do something very funky...I think something to do with the conduit crossed with being both a user and supplier. Single battery per "network" is okay but add two and behind the scenes a mess is occuring even though it looks okay user side.
I'll look at 1 first think thats a fairly easy just temp store values then do power division a bit later. Issue 2 um yes I need to dig on that....um in/outs socket is looking good....
EDIT-5
Well issue 1 as a test looks good, code needs a little cleanup and better integration, Im avoiding batteries - this was 1 solar panel and 3 furnaces - ran from 1 through to 8 furnaces and worked as expected the code balances out remander numbers by spreading them across the first few nodes and the last one - If power supplied <1 then the network "crashes" and supplies no power to any nodes a very crude overload type event:
Code: Select all
2021-06-11 20:46:20: [Server]: elepower_solar:solar_generator - supply power: 8
2021-06-11 20:46:20: [Server]: node_user (19,9,15) Power Supplied:3
2021-06-11 20:46:20: [Server]: node_user (18,9,15) Power Supplied:2
2021-06-11 20:46:20: [Server]: node_user (20,9,17) Power Supplied:3
2021-06-11 20:46:20: [Server]: end_run
Unfortunatly before I did any code changes I played around with adding and removing furnaces to a powered conduit and theres definitly some glitches there even for simple furnaces I could make the network forget or miss furnaces which should have been included adding works everytime, but removing is were issues seem to come in....that might be the next task look at that removal code - until thats rock solid fixing batteries would be more difficult.