I see you used the second example.
To know what source the power is coming from you could add another parameter to the power function to be the generatorID.
So when calling the power function from the source nodes it would be
Power(node.uid, 0, node.generatorID)
Or however you want to identify the generator.
Then in the function you can set the Id of the nodes from param(2),
And when you call the function again, also pass param(2).
If that makes sense. You’d probably want to reset the id for all the nodes in the same place that powered is set to false.
I’m alway from my pc till probably Monday, and I don’t really use c3, although looking at projects from my phone is cool.
So in general you just need to know if something is connected to power and what that power source is? Does the number of linkages from the power source matter?
You say each component uses power. Is it distributed evenly over everything that’s connected? Or does each component use the power it needs and pass the leftover power down the wire?