def test_nf_costing(self, model): model.fs.unit1 = NanofiltrationZO(default={ "property_package": model.fs.params, "database": model.db}) model.fs.unit1.inlet.flow_mass_comp[0, "H2O"].fix(10000) model.fs.unit1.inlet.flow_mass_comp[0, "sulfur"].fix(1) model.fs.unit1.inlet.flow_mass_comp[0, "toc"].fix(2) model.fs.unit1.inlet.flow_mass_comp[0, "tss"].fix(3) model.fs.unit1.load_parameters_from_database() assert degrees_of_freedom(model.fs.unit1) == 0 model.fs.unit1.costing = UnitModelCostingBlock(default={ "flowsheet_costing_block": model.fs.costing}) assert isinstance(model.fs.costing.nanofiltration, Block) assert isinstance(model.fs.costing.nanofiltration.capital_a_parameter, Var) assert isinstance(model.fs.costing.nanofiltration.capital_b_parameter, Var) assert isinstance(model.fs.costing.nanofiltration.reference_state, Var) assert isinstance(model.fs.unit1.costing.capital_cost, Var) assert isinstance(model.fs.unit1.costing.capital_cost_constraint, Constraint) assert_units_consistent(model.fs) assert degrees_of_freedom(model.fs.unit1) == 0 assert model.fs.unit1.electricity[0] in \ model.fs.costing._registered_flows["electricity"]
def test_costing_non_default_subtype(): m = ConcreteModel() m.db = Database() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.params = WaterParameterBlock(default={"solute_list": ["tds", "dye"]}) m.fs.costing = ZeroOrderCosting() m.fs.unit = NanofiltrationZO( default={ "property_package": m.fs.params, "database": m.db, "process_subtype": "rHGO_dye_rejection", } ) m.fs.unit.inlet.flow_mass_comp[0, "H2O"].fix(10000) m.fs.unit.inlet.flow_mass_comp[0, "tds"].fix(1) m.fs.unit.inlet.flow_mass_comp[0, "dye"].fix(2) m.fs.unit.load_parameters_from_database(use_default_removal=True) assert degrees_of_freedom(m.fs.unit) == 0 m.fs.unit.costing = UnitModelCostingBlock( default={"flowsheet_costing_block": m.fs.costing} ) assert isinstance(m.fs.unit.costing.capital_cost, Var) assert isinstance(m.fs.unit.costing.capital_cost_constraint, Constraint) assert isinstance(m.fs.costing.nanofiltration, Block) assert isinstance(m.fs.unit.costing.variable_operating_cost, Var) assert isinstance(m.fs.unit.costing.variable_operating_cost_constraint, Constraint) assert_units_consistent(m.fs) assert degrees_of_freedom(m.fs.unit) == 0 initialization_tester(m) results = solver.solve(m) # Check for optimal solution assert check_optimal_termination(results) assert pytest.approx(39162.813807, rel=1e-5) == value(m.fs.unit.area) assert pytest.approx(0.58744, rel=1e-5) == value(m.fs.unit.costing.capital_cost) assert pytest.approx(0.088116, rel=1e-5) == value( m.fs.unit.costing.variable_operating_cost )
def model(self): m = ConcreteModel() m.db = Database() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.params = WaterParameterBlock( default={"solute_list": ["sulfur", "toc", "tss"]} ) m.fs.unit = NanofiltrationZO( default={"property_package": m.fs.params, "database": m.db} ) m.fs.unit.inlet.flow_mass_comp[0, "H2O"].fix(10000) m.fs.unit.inlet.flow_mass_comp[0, "sulfur"].fix(1) m.fs.unit.inlet.flow_mass_comp[0, "toc"].fix(2) m.fs.unit.inlet.flow_mass_comp[0, "tss"].fix(3) return m
def model(self): m = ConcreteModel() m.db = Database() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.params = WaterParameterBlock(default={"solute_list": ["tds", "dye"]}) m.fs.unit = NanofiltrationZO( default={ "property_package": m.fs.params, "database": m.db, "process_subtype": "rHGO_dye_rejection", } ) m.fs.unit.inlet.flow_mass_comp[0, "H2O"].fix(0.9475) m.fs.unit.inlet.flow_mass_comp[0, "tds"].fix(0.05) m.fs.unit.inlet.flow_mass_comp[0, "dye"].fix(0.0025) return m
def test_costing(): m = ConcreteModel() m.db = Database() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.params = WaterParameterBlock( default={"solute_list": ["sulfur", "toc", "tss"]}) m.fs.costing = ZeroOrderCosting() m.fs.unit1 = NanofiltrationZO(default={ "property_package": m.fs.params, "database": m.db }) m.fs.unit1.inlet.flow_mass_comp[0, "H2O"].fix(10000) m.fs.unit1.inlet.flow_mass_comp[0, "sulfur"].fix(1) m.fs.unit1.inlet.flow_mass_comp[0, "toc"].fix(2) m.fs.unit1.inlet.flow_mass_comp[0, "tss"].fix(3) m.fs.unit1.load_parameters_from_database(use_default_removal=True) assert degrees_of_freedom(m.fs.unit1) == 0 m.fs.unit1.costing = UnitModelCostingBlock( default={"flowsheet_costing_block": m.fs.costing}) assert isinstance(m.fs.costing.nanofiltration, Block) assert isinstance(m.fs.costing.nanofiltration.capital_a_parameter, Var) assert isinstance(m.fs.costing.nanofiltration.capital_b_parameter, Var) assert isinstance(m.fs.costing.nanofiltration.reference_state, Var) assert isinstance(m.fs.unit1.costing.capital_cost, Var) assert isinstance(m.fs.unit1.costing.capital_cost_constraint, Constraint) assert_units_consistent(m.fs) assert degrees_of_freedom(m.fs.unit1) == 0 assert m.fs.unit1.electricity[0] in \ m.fs.costing._registered_flows["electricity"]