watertap-org / watertap

The WaterTAP development repository
https://watertap.readthedocs.io/en/latest
Other
59 stars 57 forks source link

Unit errors for costing flows with 0 values #574

Open arao53 opened 2 years ago

arao53 commented 2 years ago

Issue: Pyomo expressions drop units when encountering a zero value in flows (e.g. electricity, chemicals, etc.). This may result in inconsistent units when evaluating system cost metrics like levelized costs. Preliminary fix: This may be avoided at the flowsheet level or in parameters sweeps by using small value (1e-XX) to approximate zero. uniterror_pyomo

bknueven commented 2 years ago

I've run into a similar issue in the past with an empty sum, e.g.: https://github.com/watertap-org/watertap/blob/f2cc0d18ba0290f58222daefb178722437e308a0/watertap/examples/flowsheets/lsrro/lsrro.py#L394-L402

Note that multiplying 0 times the units explicitly seems to work. Might be something in our yaml reader?

adam-a-a commented 2 years ago

@andrewlee94 Wanted you to be aware of this

andrewlee94 commented 2 years ago

This is a known issue with Pyomo's units infrastructure: https://github.com/Pyomo/pyomo/issues/1627.

It might help to add a comment there asking for it to be fixed to try to get it pushed up in priority.