Closed lbianchi-lbl closed 1 year ago
@adam-a-a some tests from EIDO are failing. We should take a look into which ones
The NotImplementedError
is because one of the WaterTAP property packages have not implemented the fix_initialization_states
method, which replicated the steps used in the old initialization routines to make the state block square for initialization.
The unit consistency error is likely due to a term with value of 0
which has not been assigned units in the costing package. Previously these terms were implicitly dropped from the expression but the new Pyomo expression writers are keeping these resulting in unit consistency errors (note that whilst this didn't show up until now, it does imply there was an underlying unit consistency error that was just being ignored).
The configuration error is probably similar and is likely due to improved error checking in IDAES. That error should only show up if you have a case where there is a property package with only one phase being used in a unit model with has_phase_equilibrium=True
. IDAES is now raising an Exception when it encounters inconsistencies like this; the fix is either to update the configuration arguments being used for the test case to be consistent, or to look at why a single phase property package is being used in a model that presumes two phases are present (and maybe adding additional error checking in the unit model on WaterTAPs end to catch this if the IDAES message is not sufficient).
Thanks @andrewlee94, that looks very helpful. Do you think the unit consistency error could be in any way related to #574, or is that a separate issue?
@lbianchi-lbl Yes, although that is the reflection of this. I think the changes made in Pyomo 6.6 would fix that issue (that was part of the reason for the new expression writer), but here we are seeing the reverse.
To be more specific, the issue here is due to the 0*utilization_factor
term in the costing expression (at least in the one example I grabbed to illustrate). The 0
term here really should have units of $/year
as it is a yearly cost (even though it has a value of 0). In the past, Pyomo implicitly dropped these terms as it recognized that anything multiplied by a hard 0 is 0 and therefore does not impact the model. However, this meant that it missed the fact that the units were technically inconsistent (even if it didn't matter). The new expression writer however does not drop these terms, hence we now get the unit consistency error that was being masked before.
I've tried to separate failures caused by IDAES 2.0 -> 2.1 and Pyomo 6.5 -> 6.6 by setting the requirements to idaes-pse==2.0, pyomo>=6.6.1
(the other combination, i.e. idaes-pse==2.1, pyomo==6.5.*
is not possible since IDAES 2.1 requires Pyomo 6.6).
The results are:
amo_1690
failing to solveResult discrepancy in examples/flowsheets/case_studies/activated_sludge/tests/test_asm2d_flowsheet.py::TestASM2DFlowsheet::test_results
assert 72813.23796132828 == 101325 ± 1.0e+01
comparison failed
Obtained: 72813.23796132828
Expected: 101325 ± 1.0e+01
Also, most of the unit consistency checks probably come from the same small set of models or tools (or maybe even only one model/too). I.e. you will only need to fix a limited number of pieces of code to fix all the failures.
As of today, several tests are still failing with IDAES 2.1.0rc0/Pyomo 6.6.1:
Screenshot (click to expand)
![image](https://github.com/watertap-org/watertap/assets/48035537/034c8cb9-d4d6-4029-9702-241ffcc0203c)Log (click to expand)
``` =========================== short test summary info ============================ FAILED watertap/core/tests/test_zero_order_properties.py::test_CV_integration - idaes.core.util.exceptions.ConfigurationError: Property package has only one phase; control volume cannot include phase equilibrium terms. Some property packages support phase equilibrium implicitly in which case additional terms are not necessary. FAILED watertap/examples/flowsheets/case_studies/activated_sludge/tests/test_asm2d_flowsheet.py::TestASM2DFlowsheet::test_results - assert 72813.23796132828 == 101325 ± 1.0e+01 comparison failed Obtained: 72813.23796132828 Expected: 101325 ± 1.0e+01 FAILED watertap/examples/flowsheets/case_studies/seawater_RO_desalination/tests/test_seawater_RO_desalination.py::test_seawater_RO_desalination_pressure_exchanger - pyomo.core.base.units_container.InconsistentUnitsError: Error in units found in expression: fs.ro_costing.maintenance_labor_chemical_operating_cost + fs.ro_costing.aggregate_fixed_operating_cost + fs.ro_costing.aggregate_variable_operating_cost + 0*fs.ro_costing.utilization_factor: USD_2018 / year not compatible with dimensionless. FAILED watertap/examples/flowsheets/case_studies/seawater_RO_desalination/tests/test_seawater_RO_desalination.py::test_seawater_RO_desalination_pump_as_turbine - pyomo.core.base.units_container.InconsistentUnitsError: Error in units found in expression: fs.ro_costing.maintenance_labor_chemical_operating_cost + fs.ro_costing.aggregate_fixed_operating_cost + fs.ro_costing.aggregate_variable_operating_cost + 0*fs.ro_costing.utilization_factor: USD_2018 / year not compatible with dimensionless. FAILED watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/amo_1575_hrcs/tests/test_multi_sweep.py::test_multi_sweep[1] - pyomo.core.base.units_container.InconsistentUnitsError: Error in units found in expression: fs.watertap_costing.maintenance_labor_chemical_operating_cost + fs.watertap_costing.aggregate_fixed_operating_cost + fs.watertap_costing.aggregate_variable_operating_cost + 0*fs.watertap_costing.utilization_factor: USD_2018 / year not compatible with dimensionless. FAILED watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/amo_1575_hrcs/tests/test_multi_sweep.py::test_multi_sweep[2] - pyomo.core.base.units_container.InconsistentUnitsError: Error in units found in expression: fs.watertap_costing.maintenance_labor_chemical_operating_cost + fs.watertap_costing.aggregate_fixed_operating_cost + fs.watertap_costing.aggregate_variable_operating_cost + 0*fs.watertap_costing.utilization_factor: USD_2018 / year not compatible with dimensionless. FAILED watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/amo_1690/tests/test_amo_1690.py::TestAMO1690Flowsheet::test_solve - ValueError: Cannot load a SolverResults object with bad status: error FAILED watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/amo_1690/tests/test_amo_1690_sweep.py::test_sweep[1] - ValueError: Cannot load a SolverResults object with bad status: error FAILED watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/amo_1690/tests/test_amo_1690_sweep.py::test_sweep[2] - ValueError: Cannot load a SolverResults object with bad status: error FAILED watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/amo_1690/tests/test_amo_1690_sweep.py::test_sweep[3] - ValueError: Cannot load a SolverResults object with bad status: error FAILED watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/swine_wwt/tests/test_swine_wwt.py::Test_Swine_WWT_Flowsheet::test_costing - pyomo.core.base.units_container.InconsistentUnitsError: Error in units found in expression: fs.watertap_costing.maintenance_labor_chemical_operating_cost + fs.watertap_costing.aggregate_fixed_operating_cost + fs.watertap_costing.aggregate_variable_operating_cost + 0*fs.watertap_costing.utilization_factor: USD_2018 / year not compatible with dimensionless. FAILED watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/swine_wwt/tests/test_swine_wwt.py::Test_Swine_WWT_Flowsheet::test_display - ValueError: No value for uninitialized NumericValue object fs.costing.aggregate_variable_operating_cost FAILED watertap/examples/flowsheets/lsrro/tests/test_lssro_multi_sweep.py::test_against_multisweep[1] - pyomo.core.base.units_container.InconsistentUnitsError: Error in units found in expression: (fs.costing.factor_capital_annualization*fs.PrimaryPumps[1].costing.capital_cost/(31557600.000000004*(s/a)*fs.product.properties[0.0].flow_vol_phase[Liq]*fs.costing.utilization_factor)) + 0*USD_2018 + (fs.costing.factor_capital_annualization*fs.EnergyRecoveryDevices[1].costing.capital_cost/(31557600.000000004*(s/a)*fs.product.properties[0.0].flow_vol_phase[Liq]*fs.costing.utilization_factor)): USD_2018 / meter ** 3 not compatible with USD_2018. FAILED watertap/examples/flowsheets/lsrro/tests/test_lssro_paper_analysis.py::test_against_paper_analysis[10_nodes_A_5LMHbar_optimize_Bmax_nomax_125gL_35.0pct.csv-4] - pyomo.core.base.units_container.InconsistentUnitsError: Error in units found in expression: (fs.costing.factor_capital_annualization*fs.PrimaryPumps[1].costing.capital_cost/(31557600.000000004*(s/a)*fs.product.properties[0.0].flow_vol_phase[Liq]*fs.costing.utilization_factor)) + 0*USD_2018 + (fs.costing.factor_capital_annualization*fs.EnergyRecoveryDevices[1].costing.capital_cost/(31557600.000000004*(s/a)*fs.product.properties[0.0].flow_vol_phase[Liq]*fs.costing.utilization_factor)): USD_2018 / meter ** 3 not compatible with USD_2018. FAILED watertap/property_models/tests/test_NDMA_prop_pack.py::TestNDMAroperty_idaes::test_default_initializer - NotImplementedError FAILED watertap/property_models/tests/test_NaCl_prop_pack.py::TestNaClProperty_idaes::test_default_initializer - NotImplementedError FAILED watertap/property_models/tests/test_cryst_prop_pack.py::TestNaClProperty_idaes::test_default_initializer - NotImplementedError FAILED watertap/property_models/tests/test_seawater_prop_pack.py::TestSeawaterProperty_idaes::test_default_initializer - NotImplementedError FAILED watertap/property_models/tests/test_water_prop_pack.py::TestSeawaterProperty_idaes::test_default_initializer - NotImplementedError FAILED watertap/ui/tests/test_flowsheet_interfaces.py::test_roundtrip_with_garbage_collection[watertap.examples.flowsheets.case_studies.wastewater_resource_recovery.amo_1690.amo_1690_ui-2 times] - RuntimeError: Building flowsheet: Cannot load a SolverResults object with bad status: error FAILED watertap/ui/tests/test_flowsheet_interfaces.py::test_roundtrip_with_garbage_collection[watertap.examples.flowsheets.case_studies.wastewater_resource_recovery.amo_1690.amo_1690_ui-3 times] - RuntimeError: Building flowsheet: Cannot load a SolverResults object with bad status: error ERROR watertap/ui/tests/test_flowsheet_interfaces.py::TestFlowsheetInterface::test_build[watertap.examples.flowsheets.case_studies.wastewater_resource_recovery.amo_1690.amo_1690_ui] - RuntimeError: Building flowsheet: Cannot load a SolverResults object with bad status: error ERROR watertap/ui/tests/test_flowsheet_interfaces.py::TestFlowsheetInterface::test_model_objects[watertap.examples.flowsheets.case_studies.wastewater_resource_recovery.amo_1690.amo_1690_ui] - RuntimeError: Building flowsheet: Cannot load a SolverResults object with bad status: error ERROR watertap/ui/tests/test_flowsheet_interfaces.py::TestFlowsheetInterface::test_solve[watertap.examples.flowsheets.case_studies.wastewater_resource_recovery.amo_1690.amo_1690_ui] - RuntimeError: Building flowsheet: Cannot load a SolverResults object with bad status: error = 21 failed, 3090 passed, 3 skipped, 12 xfailed, 5 xpassed, 38 warnings, 3 errors in 1019.07s (0:16:59) = ```This issue is to track progress made in resolving these.
NotImplementedError
forwatertap/property_models/tests/test_cryst_prop_pack.py::test_default_initializer()
watertap/examples/chemistry/tests/test_notebooks.py
)