pjamesjoyce / lcopt

Create foreground LCA models via an intuitive user interface and analyse them using Brightway2
BSD 3-Clause "New" or "Revised" License
22 stars 6 forks source link

unclear mass flow results, maybe bug #50

Open cardosan opened 6 years ago

cardosan commented 6 years ago

Hi James (or Peter?) I was puzzled by the results of the mass flow diagram of the lcopt example. While the black tea shows nothing. This is what I get with the Tea cup as functional unit for the milky tea mass_flow_milky tea Which is not was was expecting

Tried to set allow_no_mass in both recurse_mass here mass_flow_black tea 2 mass_flow_milky tea 2 Closer to what I was expecting but still weird (see electricity)

the only way I get something closer to what I would expect is adding also litres in the allowed units here and here

mass_flow_black tea 1 mass_flow_milky tea 1

Have the feeling something need to be fixed but do not have time to further investigate now due to a crying daughter :)

pjamesjoyce commented 6 years ago

Hi @cardosan

The main problem is that the example model predates the mass flow diagram so:

1) the intermediate flows of water/tea etc are in units of litres 2) the masses don't quite balance - there should be a flow of 'waste leaves' to match the input of tea leaves

The code to draw the mass flow diagram is designed to ignore items with non-mass units - usually energy processes. The problem is litre is also a non-mass unit, and because the densities of all of the different things you can measure in litres vary wildly, you can't really include litres as a mass unit. Because the example was written before I had the idea for the mass flow diagram, the fact that the example model uses litres (which previously made no difference) now means the diagram doesn't work.

In terms of your fixes:

The allow_no_mass flag is there so that you can still get a mass flow diagram if you've got a non-mass functional unit with mass-like inputs. e.g. if your functional unit is 1m2 of paving, which consists of an input of 25kg of paving blocks for one scenario, and say 30kg with a more dense block in another scenario, you can still draw a mass flow diagram.

The idea is that it can be set for the first level in the tree, but defaults back to false for the rest of the recursion through the tree. As you found out, if you set it to True for the recursions you get non-mass items (e.g. electricity) in the mass flow diagram.

By adding litres to the allowed units you've kind of fluked upon the correct solution for this particular model, but only because one litre of water is equal to 1kg... The weird bit with the tea leaves is because the masses don't quite balance.

The solution is that I write a new version of the example model, where the intermediates are in kg, and the masses balance properly - I'll add it to the to do list!