quintel / refinery

Calculates node demands and edge shares for sparse energy graphs.
2 stars 0 forks source link

Calculating node demands via slots #31

Closed antw closed 11 years ago

antw commented 11 years ago

In another issue we discussed how we could calculate the demand of a node from an outgoing edge.

In order to do this we assume that we already know:

node_demand = edge_demand / edge_share / conversion

I think this is OK, but @ChaelKruip seems skeptical. So I'd like to explain this from my understanding, and hopefully any misconceptions I have can be cleared up.

Here's the starting situation, with the slot conversion shown in red:

o

Refinery can therefore reason:

  1. The edge parent share is 1.0 and the demand is 120. Therefore the output slot demand is 120 / 1.0 = 120.
  2. Parent outputs 60% of its energy though the grey slot, therefore the parent node demand is 120 / 0.6 = 200.

o

It doesn't matter what the output conversion is between parent and sibling; it could be 0.4 – so that the slots sum to unity – or it could be anything else. Without knowing that conversion, we can't calculate the demand of the parentsibling edge, or of the sibling node.

However, @ChaelKruip says:

Assigning demand [...] is thus only correct if the other conversion(s) are zero... hence, if the assumption is valid that (output) conversions add up to 1.0.

... and I'm struggling to understand. The example in that issue describes a space heater node with an output conversion of 1.067, and an edge with an energy flow of 240.63. That node has a demand of 225.52, or to put it another way: 240.63 / 1.0 / 1.067 = 225.52.

Even if the "loss" conversion on that node was non-zero, I don't see how that would change the demand of the node. If it did then the "useable_heat" output conversion would then be wrong.

Can you explain? It sounds like you're saying that the demand of the node can only be determined from the edges if we know all of their demands, and all the output conversions?

ChaelKruip commented 11 years ago

... and I'm struggling to understand

It me that struggled to understand... I think you are completely right @antw! I had a short-circuit in my head but it is gone now thanks to your clear example here, sorry & thanks.

wouterterlouw commented 11 years ago

I am not sure what is exactly the "deeper" node demand calculation, but the issue described here still occur. Is this not related or did you expect that this would be fixed also?

antw commented 11 years ago

but the issue described here still occur.

It looks fine for me:

industry 1-finished-calculable

You will need to bundle install in the Atlas directory after updating, since a newer version of Refinery needs to be installed to make this work.

antw commented 11 years ago

but the issue described here still occur.

I realised why... I forgot to push the Atlas commit which brings in the newer Refinery. That's the second time I've done that today. :neutral_face:

In Atlas: git up, bundle install, and it'll work. Sorry.

wouterterlouw commented 11 years ago

:+1: It works fine!