def test_config(self): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.properties = PhysicalParameterTestBlock() m.fs.unit = Turbine(default={"property_package": m.fs.properties}) iscale.calculate_scaling_factors(m) assert isinstance(m.fs.unit, PressureChangerData) # Check unit config arguments assert len(m.fs.unit.config) == 12 assert m.fs.unit.config.material_balance_type == \ MaterialBalanceType.useDefault assert m.fs.unit.config.energy_balance_type == \ EnergyBalanceType.useDefault assert m.fs.unit.config.momentum_balance_type == \ MomentumBalanceType.pressureTotal assert not m.fs.unit.config.has_phase_equilibrium assert not m.fs.unit.config.compressor assert m.fs.unit.config.thermodynamic_assumption == \ ThermodynamicAssumption.isentropic assert m.fs.unit.config.property_package is m.fs.properties assert_units_consistent(m.fs.unit)
def test_turbine_performance_way1(self): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.properties = iapws95.Iapws95ParameterBlock() def perf_callback(b): unit_hd = units.J / units.kg unit_vflw = units.m**3 / units.s @b.Constraint(m.fs.config.time) def pc_isen_eff_eqn(b, t): prnt = b.parent_block() vflw = prnt.control_volume.properties_in[t].flow_vol return prnt.efficiency_isentropic[ t] == 0.9 / 3.975 * vflw / unit_vflw @b.Constraint(m.fs.config.time) def pc_isen_head_eqn(b, t): prnt = b.parent_block() vflw = prnt.control_volume.properties_in[t].flow_vol return b.head_isentropic[t]/1000 == \ -75530.8/3.975/1000*vflw/unit_vflw*unit_hd m.fs.unit = Turbine( default={ "property_package": m.fs.properties, "support_isentropic_performance_curves": True, "isentropic_performance_curves": { "build_callback": perf_callback } }) # set inputs m.fs.unit.inlet.flow_mol[0].fix(1000) # mol/s Tin = 500 # K Pin = 1000000 # Pa Pout = 700000 # Pa hin = iapws95.htpx(Tin * units.K, Pin * units.Pa) m.fs.unit.inlet.enth_mol[0].fix(hin) m.fs.unit.inlet.pressure[0].fix(Pin) m.fs.unit.initialize() assert degrees_of_freedom(m) == 0 assert_units_consistent(m.fs.unit) solver.solve(m, tee=True) assert value(m.fs.unit.efficiency_isentropic[0]) \ == pytest.approx(0.9, rel=1e-3) assert value(m.fs.unit.deltaP[0]) == pytest.approx(-3e5, rel=1e-3)