Esempio n. 1
0
    def test_flows_water_09(self):
        # CENGEL P10-35

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.massFR = 12
        flow_a.items = [
            state_1 := StatePure(x=0), pump := Pump(), state_2 :=
            StatePure(P=15000), rhboiler :=
            ReheatBoiler(infer_fixed_exitT=True), state_3 := StatePure(T=500),
            hpt := Turbine(), state_4 := StatePure(), rhboiler, state_5 :=
            StatePure(), lpt := Turbine(), state_6 := StatePure(P=10, x=0.9),
            condenser := Condenser(), state_1
        ]

        cycle = Cycle()
        cycle.flows = [flow_a]
        cycle.solve()

        self.CompareResults(state_2, {'h': 206.95}, 2)
        self.CompareResults(state_5, {
            'P': 2160,
            'h': 3466.61
        }, 2)  # not sure why answers say 2150 - did manually, ~2161
        self.CompareResults(state_4, {'h': 2817.2}, 2)

        self.assertTrue(isWithin(cycle.Q_in, 2, '%', 45039))
        self.assertTrue(isWithin(cycle.netPower / cycle.Q_in, 2, '%', 0.426))

        pass
Esempio n. 2
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
Esempio n. 3
0
    def test_flows_water_11(self):
        # CENGEL P10-38

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            state_1 := StatePure(x=0, P=10), pump := Pump(eta_isentropic=1),
            state_2 := StatePure(), rhboiler :=
            ReheatBoiler(infer_fixed_exitT=True), state_3 := StatePure(P=10000,
                                                                       T=500),
            hpt := Turbine(eta_isentropic=1), state_4 := StatePure(), rhboiler,
            state_5 := StatePure(P=1000,
                                 T=500), lpt := Turbine(eta_isentropic=1),
            state_6 := StatePure(), condenser := Condenser(), state_1
        ]

        cycle = Cycle()
        cycle.flows = [flow_a]
        cycle.netPower = 80000
        cycle.solve()

        self.CompareResults(state_6, {'x': 0.949}, 2)

        self.assertTrue(
            isWithin(
                flow_a.get_net_sWorkExtracted() / flow_a.get_sHeatSupplied(),
                2, '%', 0.413))
        self.assertTrue(isWithin(flow_a.massFR, 2, '%', 50))

        pass
Esempio n. 4
0
    def test_flows_water_15(self):

        # CENGEL P10-22

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.massFR = 20
        flow_a.items = [
            state_01 := StatePure(P=6000), boiler := Boiler(), state_02 :=
            StatePure(T=450), turbine := Turbine(eta_isentropic=0.94), state_03
            := StatePure(), condenser := Condenser(), state_04 :=
            StatePure(P=50, T=water.define(StatePure(P=50, x=0)).T - 6.3), pump
            := Pump(), state_01
        ]

        cycle = Cycle()
        cycle.flows = [flow_a]
        cycle.solve()

        self.CompareResults(state_04, {'h': 314.03, 'mu': 0.001026}, 2)
        self.CompareResults(state_01, {'h': 320.13}, 2)
        self.CompareResults(state_03, {'h': 2394.4}, 2)

        self.assertTrue(isWithin(cycle.Q_in, 1, '%', 59660))
        self.assertTrue(isWithin(cycle.netPower, 1, '%', 18050))
        self.assertTrue(isWithin(cycle.efficiency, 1, '%', 0.303))

        pass
Esempio n. 5
0
    def test_flows_water_17(self):
        # CENGEL P10-31

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.massFR = 1.74
        flow_a.items = [
            state_02 := StatePure(), rhboiler :=
            ReheatBoiler(infer_fixed_exitT=True), state_03 :=
            StatePure(T=400, P=6000), hpturbine := Turbine(), state_04 :=
            StatePure(P=2000), rhboiler, state_05 := StatePure(), lpturbine :=
            Turbine(), state_06 := StatePure(P=20), condenser := Condenser(),
            state_01 := StatePure(x=0), pump := Pump(), state_02
        ]

        cycle = Cycle()
        cycle.flows = [flow_a]
        cycle.solve()

        self.CompareResults(state_02, {'h': 257.5}, 2)
        self.CompareResults(state_06, {'h': 2349.7}, 2)

        self.assertTrue(isWithin(cycle.sHeat, 1, '%', 3268))
        self.assertTrue(isWithin(cycle.net_sPower, 1, '%', 1170))
        self.assertTrue(isWithin(cycle.efficiency, 1, '%', 0.358))

        pass
Esempio n. 6
0
    def test_flows_water_10(self):
        # CENGEL P10-37

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            state_1 := StatePure(x=0, P=10), pump := Pump(eta_isentropic=0.95),
            state_2 := StatePure(), rhboiler :=
            ReheatBoiler(infer_fixed_exitT=True), state_3 := StatePure(P=10000,
                                                                       T=500),
            hpt := Turbine(eta_isentropic=0.8), state_4 := StatePure(),
            rhboiler, state_5 := StatePure(P=1000, T=500), lpt :=
            Turbine(eta_isentropic=0.8), state_6 := StatePure(), condenser :=
            Condenser(), state_1
        ]

        cycle = Cycle()
        cycle.flows = [flow_a]
        cycle.netPower = 80000
        cycle.solve()

        self.CompareResults(state_2, {'h': 202.43}, 2)
        self.CompareResults(state_4, {'h': 2902}, 2)
        self.CompareResults(state_6, {'h': 2664.8, 'T': 88.1}, 2)

        self.assertTrue(
            isWithin(flow_a.get_net_sWorkExtracted(), 2, '%', 1276.8))
        self.assertTrue(isWithin(flow_a.get_sHeatSupplied(), 2, '%', 3749.8))
        self.assertTrue(isWithin(flow_a.massFR, 2, '%', 62.7))

        pass
Esempio n. 7
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
Esempio n. 8
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
Esempio n. 9
0
    def test_flows_refr_01(self):
        # CENGEL P11-13

        flow_a = Flow(R134a)
        flow_a.massFF = 1
        flow_a.items = [
            state_1 := StatePure(x=1), compressor := Compressor(), state_2 :=
            StatePure(P=800), condenser := Condenser(), state_3 :=
            StatePure(x=0), expValve := Trap(), state_4 := StatePure(T=-12),
            evaporator := Boiler(), state_1
        ]

        cycle = Cycle()
        cycle.flows = [flow_a]
        cycle.solve()

        pass
Esempio n. 10
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
Esempio n. 11
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
Esempio n. 12
0
    def test_flows_water_08(self):
        # CENGEL P10-34

        flow_a = Flow(water)
        flow_a.massFF = 1
        flow_a.items = [
            state_1 := StatePure(x=0), pump := Pump(), state_2 :=
            StatePure(P=5000), rhboiler :=
            ReheatBoiler(infer_fixed_exitT=False), state_3 := StatePure(), hpt
            := Turbine(), state_4 := StatePure(P=1200, x=0.96), rhboiler,
            state_5 := StatePure(), lpt := Turbine(), state_6 :=
            StatePure(P=20, x=0.96), condenser := Condenser(), state_1
        ]

        cycle = Cycle()
        cycle.flows = [flow_a]
        cycle.solve()

        self.CompareResults(state_2, {'h': 256.49}, 2)
        self.CompareResults(state_3, {'h': 3006.9, 'T': 327.2}, 2)
        self.CompareResults(state_5, {'h': 3436, 'T': 481.1}, 2)

        self.assertTrue(isWithin(flow_a.get_sHeatSupplied(), 2, '%', 3482))
        self.assertTrue(
            isWithin(
                flow_a.get_net_sWorkExtracted() / flow_a.get_sHeatSupplied(),
                2, '%', 0.35))

        pass
Esempio n. 13
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
Esempio n. 14
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
Esempio n. 15
0
    def test_flows_water_02(self):

        # MECH 2201 - A9 Q2

        flow_a = Flow(water)
        flow_a.massFR = 42
        flow_a.massFF = 1
        flow_a.items = [
            ofwh := OpenFWHeater(), state_03 := StatePure(x=0),
            Pump(), state_04 := StatePure(P=15000), heatExchanger :=
            HeatExchanger(), state_05 :=
            StatePure(T=water.define(StatePure(P=600, x=0)).T), rhboiler :=
            ReheatBoiler(infer_fixed_exitT=False), state_08 :=
            StatePure(P=15000,
                      T=600), hpt := Turbine(), state_09 := StatePure(P=1000),
            rhboiler, state_10 := StatePure(P=1000, T=500), lpt := Turbine()
        ]

        flow_b = Flow(water)
        flow_b.items = [
            lpt, state_11 := StatePure(P=600), heatExchanger, state_06 :=
            StatePure(x=0),
            Trap(), state_07 := StatePure(P=200), ofwh
        ]

        flow_c = Flow(water)
        flow_c.items = [lpt, state_12 := StatePure(P=200), ofwh]

        flow_d = Flow(water)
        flow_d.items = [
            lpt, state_13 := StatePure(), condenser := Condenser(), state_01 :=
            StatePure(P=5, x=0),
            Pump(), state_02 := StatePure(P=200), ofwh
        ]

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

        # difference in state_05.h causes difference in flow_b.massFF
        # state_05.h looked up from table in here - in solution, vdP is used

        # for flow in cycle.flows:
        #     flow._calculate_h_forIncompressibles = True

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

        self.CompareResults(state_01, {'h': 137.75, 'mu': 0.001005}, 3)
        self.CompareResults(state_02, {'h': 137.95}, 3)
        self.CompareResults(state_03, {'h': 504.71, 'mu': 0.001061}, 3)
        self.CompareResults(state_04, {'h': 520.41}, 3)
        self.CompareResults(state_06, {'h': 670.38, 'mu': 0.001101}, 3)
        self.CompareResults(
            state_05, {'h': 686.23}, 3
        )  # solution uses h calculated with mu*dP - we use table interpolation - ours should be more accurate?
        self.CompareResults(state_08, {'h': 3583.1, 's': 6.6796}, 3)
        self.CompareResults(state_09, {'h': 2820.8}, 3)
        self.CompareResults(state_10, {'h': 3479.1, 's': 7.7642}, 3)
        self.CompareResults(state_11, {'h': 3310.2}, 3)
        self.CompareResults(state_12, {'h': 3000.9}, 3)
        self.CompareResults(state_13, {'x': 0.9205, 'h': 2368.1}, 3)

        # self.assertTrue(isWithin(flow_b.massFF, 3, '%', 0.06287))  # our state_05.h causes difference in this.
        self.assertTrue(isWithin(flow_c.massFF, 3, '%', 0.1165))
        self.assertTrue(isWithin(cycle.netPower, 3, '%', 72447))
        self.assertTrue(isWithin(cycle.netPower / cycle.Q_in, 3, '%', 0.485))

        pass
Esempio n. 16
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
Esempio n. 17
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))
Esempio n. 18
0
    def test_flows_water_01(self):
        # From MECH2201 - A9 Q1
        # Net power = 80 MW
        # x after Turbine, mass flow rate, thermal efficiency?

        flow = Flow(workingFluid=water)
        flow.items = [
            state_3 := StatePure(P=10000, T=500),  # State 0
            turba := Turbine(eta_isentropic=0.8),
            state_4 := StatePure(P=1000),  # State 1
            rhboiler := ReheatBoiler(),
            state_5 := StatePure(T=500),  # State 2
            turbb := Turbine(eta_isentropic=0.8),
            state_6 := StatePure(),  # State 3
            cond := Condenser(),
            state_1 := StatePure(P=10, x=0),  # State 4
            pump := Pump(eta_isentropic=0.95),
            state_2 := StatePure(),  # State 5
            rhboiler,
            state_3
        ]
        flow.massFF = 1

        # Solution process:
        # State 0 - fully definable
        # State 1 - work out with isentropic efficiency
        # State 2 - infer pressure from State 1, fully definable
        # State 3 - infer pressure from 4, work out with isentropic efficiency
        # State 4 - fully definable

        # flow.solve()
        cycle = Cycle()
        cycle.flows = [flow]
        cycle.netPower = 80000
        cycle.solve()

        self.CompareResults(state_3, {'h': 3375.1, 's': 6.5995}, 3)
        self.CompareResults(state_4, {'h': 2902}, 3)
        self.CompareResults(state_5, {'h': 3479.1, 's': 7.7642}, 3)
        self.CompareResults(state_6, {'T': 88.1, 'h': 2664.8}, 3)
        self.CompareResults(state_1, {
            'h': 191.81,
            'mu': 0.001010,
            's': 0.6493
        }, 3)
        self.CompareResults(state_2, {'h': 202.43}, 3)

        eta_thermal = cycle.netPower / cycle.Q_in
        x_afterTurbine = flow.states[3].x

        print('Expected: ', 63.66)
        print('Received: ', flow.massFR)
        self.assertTrue(isWithin(flow.massFR, 3, '%', 63.66))

        print('Expected: ', 0.34)
        print('Received: ', eta_thermal)
        self.assertTrue(isWithin(eta_thermal, 5, '%', 0.34))

        print('Expected: ', 2)
        print('Received: ', x_afterTurbine)
        self.assertTrue(isWithin(x_afterTurbine, 3, '%', 2))

        pass