QSD-Group / QSDsan

Quantitative Sustainable Design (QSD) of sanitation and resource recovery systems.
https://qsdsan.com
Other
30 stars 12 forks source link

Enhancemenet to LCA functions #95

Closed yalinli2 closed 1 year ago

yalinli2 commented 1 year ago

@QSD-Group/qsdsan Just want to let you know some of the changes I've made/am making regarding to LCA, mainly two things:

  1. Make it easier to work with stream impacts. I add add_indicators, get_impact, and get_impacts so that you can just add characterization factors for new indicators and see the stream impacts using the stream (previously you need to separately create StreamImpactItem/LCA objs to do this)
  2. There's now a _init_lca function that handles LCA-related attribute initialization to avoid repetitive creation of Construction and Transportation objs, I've updated the units accordingly, you can refer to units like PitLatrine for examples

Feel free to let me know if this breaks your systems, thanks!

yalinli2 commented 1 year ago

@haclohman an FYI that I found a bug in Reclaimer as I was doing this, specifically https://github.com/QSD-Group/QSDsan/blob/65fcd627e419f0b42433eba2a99d596024531086/qsdsan/sanunits/_reclaimer.py#L438

        # Battery replaces Solar
        self.construction = Construction(item='Solar', quantity=solar_quant, quantity_unit='m2')
        self.construction = Construction(item='Battery', quantity=battery_quant, quantity_unit='kg')

should be

        # Both Battery and Solar are included
        self.construction = (
Construction(item='Solar', quantity=solar_quant, quantity_unit='m2'),
Construction(item='Battery', quantity=battery_quant, quantity_unit='kg'),
)

After fixing this, there are some minor changes for sysC's LCA, but not to the point that I'll be worried about the manuscripts, you can see the diff scale here: https://github.com/QSD-Group/EXPOsan/commit/add7cdff844dc14d920fd419a9c10c9642d54817