예제 #1
0
    def test_flows_water_03(self):

        print('CENGEL P10.57')

        # h3 = h11 ? says solutions
        # h4 = h9

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.massFR = 75
        flow_a.items = [
            mixcCond := MixingChamber(), state_i := StatePure(), condenser :=
            Condenser(), state_01 := StatePure(P=20, x=0), pump := Pump(),
            state_02 := StatePure(P=5000), cfwhA :=
            HeatExchanger(infer_common_exitT=True), state_03 := StatePure(),
            cfwhB := HeatExchanger(infer_common_exitT=True), state_04 :=
            StatePure(), boiler := Boiler(), state_05 := StatePure(P=5000,
                                                                   T=700),
            turbine := Turbine()
        ]

        flow_b = Flow(water)
        flow_b.massFF = 0.1446
        flow_b.items = [
            turbine, state_06 := StatePure(P=1400), cfwhB, state_09 :=
            StatePure(x=0), trap := Trap(), state_10 := StatePure(), mixcI :=
            MixingChamber()
        ]

        flow_c = Flow(water)
        flow_c.items = [turbine, state_07 := StatePure(P=245), mixcI]

        flow_e = Flow(water)
        flow_e.items = [
            mixcI, state_i2 := StatePure(), cfwhA, state_11 := StatePure(x=0),
            trapA := Trap(), state_12 := StatePure(), mixcCond
        ]

        flow_d = Flow(water)
        flow_d.items = [turbine, state_08 := StatePure(P=20), mixcCond]

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c, flow_d, flow_e]
        cycle.solve()

        # Todo - first 0-1-2 equations are solvable together

        self.CompareResults(state_01, {'h': 251, 'mu': 0.00102}, 3)
        self.CompareResults(state_02, {'h': 256.1}, 3)
        self.CompareResults(state_03, {'h': 533}, 3)
        self.CompareResults(state_11, {'h': state_03.h}, 3)
        self.CompareResults(state_04, {'h': 830}, 3)

        self.assertTrue(isWithin(flow_c.massFF, 3, '%', 0.09810))
        self.assertTrue(isWithin(cycle.netPower, 3, '%', 93000))
        self.assertTrue(isWithin(cycle.netPower / cycle.Q_in, 3, '%', 0.404))

        pass
예제 #2
0
    def test_flows_water_14(self):

        # CENGEL P10-47

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.massFR = 16
        flow_a.items = [
            ofwh2 := MixingChamber(), state_05 := StatePure(x=0), pump3 :=
            Pump(), state_06 := StatePure(), boiler := Boiler(), state_07 :=
            StatePure(P=8000, T=550), turbine := Turbine()
        ]

        flow_b = Flow(water)
        flow_b.items = [turbine, state_08 := StatePure(P=600), ofwh2]

        flow_c = Flow(water)
        flow_c.items = [
            turbine, state_09 := StatePure(P=200), ofwh1 := MixingChamber()
        ]

        flow_d = Flow(water)
        flow_d.items = [
            turbine, state_10 := StatePure(P=10), condenser := Condenser(),
            state_01 := StatePure(x=0), pump1 := Pump(), state_02 :=
            StatePure(), ofwh1
        ]

        flow_e = Flow(water)
        flow_e.items = [
            ofwh1, state_03 := StatePure(x=0), pump2 := Pump(), state_04 :=
            StatePure(), ofwh2
        ]

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c, flow_d, flow_e]
        cycle.solve()

        for e in cycle._equations:
            e.update()
        cycle.solve()

        for e in cycle._equations:
            e.update()
        cycle.solve()

        self.CompareResults(state_02, {'h': 192}, 2)
        self.CompareResults(state_04, {'h': 505.13}, 2)
        self.CompareResults(state_06, {'h': 678.52}, 2)
        self.CompareResults(flow_b, {'massFF': 0.07171}, 2)
        self.CompareResults(flow_c, {'massFF': 0.1201}, 2)

        self.assertTrue(isWithin(cycle.netPower, 1, '%', 19800))
        self.assertTrue(isWithin(cycle.efficiency, 1, '%', 0.435))

        pass
예제 #3
0
    def test_flows_water_12(self):
        # CENGEL P10-45

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            ofwh := MixingChamber(), state_3 := StatePure(x=0), pump2 :=
            Pump(), state_4 := StatePure(), boiler := Boiler(), state_5 :=
            StatePure(P=6000, T=450), turbine := Turbine()
        ]

        flow_b = Flow(water)
        flow_b.items = [turbine, state_6 := StatePure(P=400), ofwh]

        flow_c = Flow(water)
        flow_c.items = [
            turbine, state_7 := StatePure(P=20), condenser := Condenser(),
            state_1 := StatePure(x=0), pump1 := Pump(), state_2 := StatePure(),
            ofwh
        ]

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c]
        cycle.solve()
        cycle.solve()

        for e in cycle._equations:
            e.update()

        cycle.solve()

        self.assertTrue(isWithin(cycle.net_sPower, 1, '%', 1017))
        self.assertTrue(isWithin(cycle.efficiency, 1, '%', 0.378))

        pass
예제 #4
0
    def test_flows_water_06(self):
        # CENGEL P10-48
        # diagram in book is not helpful - see solutions

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            mixc := MixingChamber(), state_t := StatePure(), condenser :=
            Condenser(), state_1 := StatePure(x=0), pump := Pump(), state_2 :=
            StatePure(), cfwh := HeatExchanger(), state_3 :=
            StatePure(T=water.define(StatePure(P=1000, x=0)).T), boiler :=
            Boiler(), state_4 := StatePure(P=3000,
                                           T=350), turbine := Turbine()
        ]

        flow_b = Flow(water)
        flow_b.items = [
            turbine, state_5 := StatePure(P=1000), cfwh, state_7 :=
            StatePure(x=0), trap := Trap(), state_8 := StatePure(P=20), mixc
        ]

        flow_c = Flow(water)
        flow_c.items = [turbine, state_6 := StatePure(), mixc]

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c]
        cycle.solve()

        for e in cycle._equations:
            e.update()
        cycle.solve()
        for e in cycle._equations:
            e.update()
        cycle.solve()

        for f in cycle.flows:  # TODO - Has to solve the flows manually again
            f.solve()

        for e in cycle._equations:
            e.update()
        cycle.solve()

        self.CompareResults(state_2, {'h': 254.45}, 2)
        self.CompareResults(state_4, {'h': 3116.1, 's': 6.7450}, 2)
        self.CompareResults(state_5, {'h': 2851.9}, 2)
        self.CompareResults(state_6, {'h': 2221.7, 'x': 0.8357}, 2)
        self.CompareResults(state_7, {'h': 762.51, 'T': 179.9}, 2)
        self.CompareResults(flow_b, {'massFF': 0.2437}, 2)

        self.assertTrue(isWithin(cycle.sHeat, 2, '%', 2353))
        self.assertTrue(isWithin(cycle.net_sPower, 2, '%', 737.8))
        self.assertTrue(isWithin(cycle.efficiency, 1, '%', 0.3136))

        pass
예제 #5
0
    def test_flows_water_05(self):
        # CENGEL P10-53

        flow_a = Flow(workingFluid=water)
        flow_a.massFF = 1
        flow_a.items = [
            ofwh := MixingChamber(), state_03 := StatePure(x=0), pump2 :=
            Pump(), state_04 := StatePure(), cfwh := HeatExchanger(), state_05
            := StatePure(T=water.define(StatePure(x=0, P=1200)).T), boiler :=
            Boiler(), state_08 := StatePure(P=10000,
                                            T=600), turbine := Turbine()
        ]

        flow_b = Flow(water)
        flow_b.items = [
            turbine, state_09 := StatePure(P=1200), cfwh, state_06 :=
            StatePure(x=0), trap := Trap(), state_07 := StatePure(), ofwh
        ]

        flow_c = Flow(water)
        flow_c.items = [turbine, state_10 := StatePure(P=600), ofwh]

        flow_d = Flow(water)
        flow_d.items = [
            turbine, state_11 := StatePure(P=10), condenser := Condenser(),
            state_01 := StatePure(x=0), pump1 := Pump(), state_02 :=
            StatePure(), ofwh
        ]

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c, flow_d]
        cycle.netPower = 400000

        cycle.solve()

        for e in cycle._equations:
            e.update()
        cycle.solve()
        for e in cycle._equations:
            e.update()
        cycle.solve()

        self.assertTrue(isWithin(cycle.netPower / cycle.Q_in, 1, '%', 0.452))
        self.assertTrue(isWithin(cycle._get_mainFlow().massFR, 1, '%', 313))
        self.assertTrue(isWithin(flow_b.massFF, 4, '%', 0.05404))
        self.assertTrue(isWithin(flow_c.massFF, 4, '%', 0.1694))

        pass
예제 #6
0
    def test_flows_water_07(self):
        # CENGEL P10-55

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            ofwh := MixingChamber(), state_03 := StatePure(x=0), pump2 :=
            Pump(), state_04 := StatePure(), rhboiler := ReheatBoiler(),
            state_05 := StatePure(P=10000, T=550), turba := Turbine(), state_06
            := StatePure(P=800)
        ]

        flow_b = Flow(water)
        flow_b.items = [
            state_06, rhboiler, state_07 := StatePure(T=500), turbineb :=
            Turbine(), state_08 := StatePure(P=10), condenser := Condenser(),
            state_01 := StatePure(x=0), pump1 := Pump(), state_02 :=
            StatePure(), ofwh
        ]

        flow_c = Flow(water)
        flow_c.items = [state_06, ofwh]

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c]
        cycle.netPower = 80000

        cycle.solve()

        for e in cycle._equations:
            e.update()
        cycle.solve()

        self.CompareResults(state_02, {'h': 192.61}, 2)
        self.CompareResults(state_03, {'h': 720.87, 'mu': 0.001115}, 2)
        self.CompareResults(state_04, {'h': 731.12}, 2)
        self.CompareResults(state_05, {'h': 3502, 's': 6.7585}, 2)
        self.CompareResults(state_06, {'h': 2812.1}, 2)
        self.CompareResults(state_07, {'h': 3481.3, 's': 7.8692}, 2)
        self.CompareResults(state_08, {'h': 2494.7, 'x': 0.9627}, 2)

        self.CompareResults(flow_c, {'massFF': 0.2017}, 2)

        self.assertTrue(isWithin(flow_a.massFR, 2, '%', 54.5))
        self.assertTrue(isWithin(cycle.netPower / cycle.Q_in, 2, '%', 0.444))

        pass
예제 #7
0
    def test_flows_water_13(self):
        # CENGEL P10-46

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            mixc := MixingChamber(), state_4 := StatePure(), boiler :=
            Boiler(), state_5 := StatePure(P=6000,
                                           T=450), turbine := Turbine()
        ]

        flow_b = Flow(water)
        flow_b.items = [
            turbine, state_6 := StatePure(P=400), cfwh := HeatExchanger(),
            state_3 := StatePure(x=0), pump2 := Pump(), state_9 := StatePure(),
            mixc
        ]

        flow_c = Flow(water)
        flow_c.items = [
            turbine, state_7 := StatePure(), condenser := Condenser(), state_1
            := StatePure(x=0, P=20), pump1 := Pump(), state_2 := StatePure(),
            cfwh, state_8 := StatePure(), mixc
        ]

        # assuming h8 = h9 = h4 - 8 & 9 have same pressure. determine 8's h by vdp (determine out of nowhere)

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c]
        cycle.solve()

        wtot = 0
        for f in cycle.flows:
            wtot += f.massFF * f.get_net_sWorkExtracted()

        qtot = 0
        for f in cycle.flows:
            qtot += f.massFF * f.get_sHeatSupplied()

        self.assertTrue(isWithin(wtot, 1, '%', 1016.8))
        self.assertTrue(isWithin(wtot / qtot, 1, '%', 0.378))

        pass
예제 #8
0
    def test_flows_water_17(self):
        # CENGEL Ex10-6

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            mixc := MixingChamber(), state_08 := StatePure(), rhboiler :=
            ReheatBoiler(), state_09 := StatePure(P=15000, T=600), hpt :=
            Turbine(), state_10 := StatePure(P=4000)
        ]

        flow_b = Flow(water)
        flow_b.items = [
            state_10,  # diverging flows at pipe - no device
            rhboiler,
            state_11 := StatePure(T=600),
            lpt := Turbine()
        ]

        flow_c = Flow(water)
        flow_c.items = [
            state_10, cfwh := HeatExchanger(infer_common_exitT=True), state_06
            := StatePure(x=0), pump3 := Pump(), state_07 := StatePure(), mixc
        ]

        flow_d = Flow(water)
        flow_d.items = [
            lpt, state_12 := StatePure(P=500), ofwh := MixingChamber()
        ]

        flow_e = Flow(water)
        flow_e.items = [
            lpt, state_13 := StatePure(P=10), condenser := Condenser(),
            state_01 := StatePure(x=0), pump1 := Pump(), state_02 :=
            StatePure(), ofwh
        ]

        flow_f = Flow(water)
        flow_f.items = [
            ofwh,
            state_03 := StatePure(x=0),
            pump2 := Pump(),
            state_04 := StatePure(),  # h4 wrong in book?
            cfwh,
            state_05 := StatePure(),
            mixc
        ]

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c, flow_d, flow_e, flow_f]
        cycle.solve()

        for e in cycle._equations:
            e.update()
        cycle.solve()

        for e in cycle._equations:
            e.update()
        cycle.solve()

        self.CompareResults(flow_c, {'massFF': 0.1766}, 3)
        self.CompareResults(flow_d, {'massFF': 0.1306}, 3)

        self.assertTrue(isWithin(cycle.efficiency, 1, '%', 0.492))
        self.assertTrue(isWithin(cycle.sHeat, 1, '%', 2921.4))

        pass
예제 #9
0
    def test_flows_water_04(self):

        # MECH 2201 - A9 Q3

        water = Fluid(mpDF=water_mpDF)

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            mixCh := MixingChamber(), state_12 := StatePure(), boiler :=
            Boiler(), state_01 := StatePure(P=12000, T=520), turbine :=
            Turbine(eta_isentropic=1)
        ]

        flow_b = Flow(water)
        flow_b.items = [
            turbine, state_02 := StatePure(P=1000), cfwh := HeatExchanger(),
            state_10 := StatePure(x=0), pump1 := Pump(), state_11 :=
            StatePure(P=12000), mixCh
        ]

        flow_c = Flow(water)
        flow_c.items = [
            turbine, state_03 := StatePure(P=150), ofwh := OpenFWHeater()
        ]

        flow_d = Flow(water)
        flow_d.items = [
            turbine, state_04 := StatePure(P=6), condenser := Condenser(),
            state_05 := StatePure(x=0), pump2 := Pump(), state_06 :=
            StatePure(P=150), ofwh
        ]

        flow_e = Flow(water)
        flow_e.items = [
            ofwh, state_07 := StatePure(P=150, x=0), pump3 := Pump(), state_08
            := StatePure(P=12000), cfwh, state_09 := StatePure(T=170), mixCh
        ]

        cycle = Cycle()
        cycle.flows = [flow_a, flow_b, flow_c, flow_d, flow_e]
        cycle.netPower = 320000
        cycle.solve()

        for e in cycle._equations:
            e.update()

        cycle.solve()

        for e in cycle._equations:
            e.update()

        cycle.solve()

        self.CompareResults(state_01, {'h': 3401.8, 's': 6.5555}, 3)
        self.CompareResults(state_02, {'h': 2764.2, 'x': 0.9931}, 3)
        self.CompareResults(state_03, {'h': 2436.9, 's': state_01.s}, 3)
        self.CompareResults(state_04, {'h': 2018.3, 'x': 0.7727}, 3)
        self.CompareResults(state_05, {'h': 151.53}, 3)
        self.CompareResults(state_06, {'h': 151.67}, 3)
        self.CompareResults(state_07, {'h': 467.11}, 3)
        self.CompareResults(state_08, {'h': 479.59}, 3)
        self.CompareResults(state_09, {'h': 725.86}, 3)
        self.CompareResults(state_10, {'h': 762.81}, 3)
        self.CompareResults(state_11, {'h': 775.21}, 3)

        self.CompareResults(flow_b, {'massFF': 0.1096}, 3)

        self.CompareResults(state_12, {'h': 731.27}, 3)

        self.CompareResults(flow_c, {'massFF': 0.1229}, 3)

        self.assertTrue(
            isWithin(
                state_01.h - state_02.h + (1 - flow_b.massFF) *
                (state_02.h - state_03.h) +
                (1 - flow_b.massFF - flow_c.massFF) *
                (state_03.h - state_04.h), 3, '%', 1250.3))

        efficiency = cycle.netPower / cycle.Q_in
        self.assertTrue(isWithin(efficiency, 3, '%', 0.463))
        self.assertTrue(isWithin(3600 * flow_a.massFR, 3, '%', 9.31 * 10**5))