by SegFault22 » Wed Nov 02, 2016 18:38
I thought I said that my network would only update when the nodes connected to it are changed, for example being broken or exploded. Instead of using a switching node as the center, any node which can be a producer is the center, so it would have some of the benefits of the Technic system. It would be a lot different though, because you would be able to connect two or more producers to the same cable feeding some machines, instead of having some kind of conflict or error when you try to connect two controllers on the same cable.
Nodes which can accept or produce power would be "sided", so for example a generator doesn't output from the input side (fire heat generator's front face, or a solar panel's top face), and any power storing nodes (including transformers) would act as a "network controller" for whatever is on the output(s) as well as being a receiver/consumer on its input side(s). Machines such as a powered furnace do not need to output power, so they are entirely consumers.
It is just so much more straightforward when you don't have a single central node controlling the whole network; you can just put down a generator, a cable, and a powered furnace all connected, and the generator would feed power to the furnace since it is kinda like a controller. If you want to use a switch to turn off parts of the network, a switch node would be implemented that acts like a cable when it is on, but when you turn it off it isn't a valid cable any more and it triggers a network update so that the producers can be aware that power can not flow through that node any more because it is not part of a valid connection.
It is also possible to just not use a voltage system, if for example your mod isn't based on electricity. That would get rid of the need for transformers, but you would probably still need to specify a voltage number for all of the mod's devices and conduits, since it will be a central part of the power system library/API/whatever. If you want to use a voltage system and transformers, that would also be possible, but as with previously mentioned "conduit switches", the only way to turn them off would be to transform them into a node which represents the off state and doesn't act as part of the network (for transformers, they would have no input, but the output would still exist so you could drain any remaining power in the buffer) which can easily be done with some skillful mesecons integration. If your transformers should only run when the storage on the output side is less than half full, for example, you could set the storage node to output a signal when it is half full, and the transformer to turn to the off-state when it receives a signal - if they are properly connected by a mesecons wire, then it will only ever conduct when the power storage is less than half full. However there is an obvious downside, that it would cause the network to "stutter" switching the transformer on and off when power is flowing through the storage node, but this can easily be fixed by setting another storage node (connected in parallel with the other one) to output a signal when it is less than a quarter full or some arbitrary lower limit, feed the signal from both storage nodes to a toggle latch, and one of the toggle latch output sides to the transformer wire. This will turn the transformer on only when both storage nodes go below whatever capacity you specified, and turn it off only when both storage nodes go above half capacity, so long as the toggle latch is synchronized properly of course.
I would also refrain from writing any code to update the network when power flow is changing, for example when a storage node goes from full to less than full or a machine begins consuming power from its buffer. Really the network only has to update when its structure has changed. This means you don't have to worry about transformers updating the network too often, since they would be simple power storage nodes outputting whatever higher or lower voltage instead of their input voltage. They would not update the network when they are running, only when they are switched on or off, and it would be best to leave them active, since they will never output power or consume power unless there is a consumer connected to the output which has a buffer that is less than full.
It should be understood that many people can't understand concepts that are this complex, mostly due to the limitations of written language that is based on spoken language. So it may be best to wait until I release the library/API/whatever and a simple mod demonstrating its usage, and then try to understand how it works and what are the benefits of optimization and using producer/storage nodes as the network controller instead of some extra block which serves no function to the player except being a vulnerable central controller.