Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LeastSquaresLCA throwing NonsquareTechnoSphere #71

Open
Ong-Yi-Kai opened this issue Jun 12, 2023 · 0 comments
Open

LeastSquaresLCA throwing NonsquareTechnoSphere #71

Ong-Yi-Kai opened this issue Jun 12, 2023 · 0 comments

Comments

@Ong-Yi-Kai
Copy link

I am trying to create a LCA for PVC. I created a new database and inserted pseudo activities and exchanges into it.

# create and register our database
pvc_db = Database("pvc")
pvc_db.register()

# add activities and flows into our database
# note: all exchanges need to be added to the database as well

# cracking
pvc_db.write({
    # cracking
    ('pvc','cracking'):{
        'name':'cracking',
        'exchanges':[
            {'input':('pvc','natural gas'),'amount':-1,'unit':'cubic meters','type':'biosphere'},
            {'input':('pvc','ethylene'),'amount':1,'unit':'cubic meters','type':'technosphere'},
            {'input':('pvc','hydro carbons'),'amount':1,'unit':'kilograms','type':'biosphere'
            }]
    },
    # electrolysis cell
    ('pvc','electolysis cell'):{
        'name':'electrolysis',
        'exchanges':[
            {'input':('pvc','NaCl'),'amount':-1,'unit':'kilograms','type':'technosphere'},
            {'input':('pvc','electricity'),'amount':-1,'unit':'kilo-watts hour','type':'technosphere'},
            {'input':('pvc','hydrogen gas'),'amount':1,'unit':'cubic meter','type':'biosphere'},
            {'input':('pvc','caustic soda'),'amount':1,'unit':'kilograms','type':'biosphere'},
            {'input':('pvc','chlorine gas'), 'amount':1,'unit':'cubic meter','type':'technosphere'}
        ]
    },
    # VCM plant
    ('pvc', 'vcm plant'):{
        'name':'vcm plant',
        'exchanges':[
            {'input':('pvc','ethylene'),'amount':-2,'unit':'cubic meters','type':'technosphere'},
            {'input':('pvc','chlorine gas'),'amount':-3,'unit':'cubic meters','type':'technosphere'},
            {'input':('pvc','VCM gas'),'amount':1,'unit':'cubic meters','type':'technosphere'}
        ]
    },
    # PVC plant
    ('pvc', 'pvc plant'):{
        'name':'pvc plant',
        'exchanges':[
            {'input':('pvc','VCM gas'),'amount':-2,'unit':'cubic meters','type':'technosphere'},
            {'input':('pvc','pvc powder'),'amount':1,'unit':'kilograms','type':'technosphere'}
        ]
    },
    # Blender
    ('pvc', 'blender'):{
        'name':'blender',
        'exchanges':[
            {'input':('pvc','pvc powder'),'amount':-1,'unit':'kilograms','type':'technosphere'},
            {'input':('pvc','pvc solid'),'amount':1,'unit':'kilograms','type':'technosphere'}
        ]
    },

    # All exchanges/flows in and out of the system
    ('pvc','natural gas') : {'name':'natural gas', 'type':'biosphere'},
    ('pvc','ethylene') : {'name':'ethylene gas', 'type':'technosphere'},
    ('pvc','hydro carbons') : {'name':'hydrogen carbons', 'type':'biosphere'},
    ('pvc', 'NaCl') : {'name':'sodium chloride','type':'technosphere'},
    ('pvc','electricity'):{'name':'electricity','type':'technosphere'},
    ('pvc','hydrogen gas'):{'name':'hydrogen gas','type':'biosphere'},
    ('pvc','caustic soda'):{'name':'caustic soda','type':'biosphere'},
    ('pvc','chlorine gas'):{'name':'chlorine gas','type':'biosphere'},
    ('pvc','VCM gas'):{'name':'vinyl chloride gas','type':'technosphere'},
    ('pvc','pvc powder'):{'name':'pvc powder','type':'technosphere'},
    ('pvc','pvc solid'):{'name':'pvc solid','type':'technosphere'}
})

I then defined the functional unit and created a LeastSquareLCA object

final_product = pvc_db.get("pvc solid")
functional_unit = {final_product:1}
# create a LCA object
lca = LeastSquaresLCA(functional_unit)

# conduct inventory analysis
lca.lci(final_product)


# conduct impact assesment
lca.lcia()

but I am thrown a NonSquareTechnosphere error
NonsquareTechnosphere: Technosphere matrix is not square: 5 activities (columns) and 12 products (rows). Use LeastSquaresLCA to solve this system, or fix the input data

I am using
python: v3.10
brightway2

Would appreciate it if someone could let me know how to resolve this or to go around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant