示例#1
0
    def state(self, nodes):
        if self.ef == 1.0:
            nodes[self.outNode].s = nodes[self.inNode].s
            nodes[self.outNode].ps()
        else:
            isoh = seuif97.ps2h(nodes[self.outNode].p, nodes[self.inNode].s)
            nodes[self.outNode].h = nodes[self.inNode].h - \
                self.ef * (nodes[self.inNode].h - isoh)
            nodes[self.outNode].ph()

        if self.extNode != None:
            if self.ef == 1.0:
                nodes[self.extNode].s = nodes[self.inNode].s
                nodes[self.extNode].ps()
            else:
                isoh = seuif97.ps2h(
                    nodes[self.extNode].p, nodes[self.inNode].s)
                nodes[self.extNode].h = nodes[self.inNode].h - \
                    self.ef * (nodes[self.inNode].h - isoh)
                nodes[self.extNode].ph()

                isoh = seuif97.ps2h(
                    nodes[self.outNode].p, nodes[self.extNode].s)
                nodes[self.outNode].h = nodes[self.extNode].h - \
                    self.ef * (nodes[self.extNode].h - isoh)
                nodes[self.outNode].ph()
示例#2
0
    def state(self, nodes):
        if self.ef == 1.0:
            nodes[self.outNode].s = nodes[self.inNode].s
            nodes[self.outNode].ps()
        else:
            isoh = seuif97.ps2h(nodes[self.outNode].p, nodes[self.inNode].s)
            nodes[self.outNode].h = nodes[self.inNode].h - \
                self.ef * (nodes[self.inNode].h - isoh)
            nodes[self.outNode].ph()

        if self.extNode != None:
            if self.ef == 1.0:
                nodes[self.extNode].s = nodes[self.inNode].s
                nodes[self.extNode].ps()
            else:
                isoh = seuif97.ps2h(
                    nodes[self.extNode].p, nodes[self.inNode].s)
                nodes[self.extNode].h = nodes[self.inNode].h - \
                    self.ef * (nodes[self.inNode].h - isoh)
                nodes[self.extNode].ph()

                isoh = seuif97.ps2h(
                    nodes[self.outNode].p, nodes[self.extNode].s)
                nodes[self.outNode].h = nodes[self.extNode].h - \
                    self.ef * (nodes[self.extNode].h - isoh)
                nodes[self.outNode].ph()
示例#3
0
def CalTurbineEx0(TurbineEx0, Nodes, Task):
    """
     "TURBINE-EX0": {'minID': None, 'moutID': None, 'eta': None, 
                    'wdot': None,
                    "energy": "Wout", 
                    "fun": CalTurbineEx0}

    """
    iND = Nodes[TurbineEx0['minID']]
    oND = Nodes[TurbineEx0['moutID']]
    if (Task == "State"):
        # 1 oND
        if TurbineEx0['eta'] == 1.0:
            oND['s'] = iND['s']
            oND['t'] = ps2t(oND['p'], oND['s'])
            oND['h'] = ps2h(oND['p'], oND['s'])
            oND['x'] = ps2x(oND['p'], oND['s'])
        else:
            sout_s = iND['s']
            hout_s = ps2h(oND['p'], sout_s)
            oND['h'] = iND['h'] - TurbineEx0['eta'] * (iND['h'] - hout_s)
            oND['t'] = ph2t(oND['p'], oND['h'])
            oND['s'] = ph2s(oND['p'], oND['h'])
            oND['x'] = ph2x(oND['p'], oND['h'])

    if (Task == "Balance"):
        # 2 Mass and Energy Balance
        if iND['fdot'] != None:
            oND['fdot'] = iND['fdot']
        if oND['fdot'] != None:
            iND['fdot'] = oND['fdot']

        TurbineEx0['wdot'] = iND['fdot'] * (iND['h'] - oND['h'])
def linepoint3(sstep,p,t,h,s,sis=None):
    if sis==None:
        s0 = s - sstep
    else:
        s0=sis-sstep  
    s2 = s + sstep
    point_h = np.zeros(shape=3)
    point_h[0] = if97.ps2h(p, s0)
    point_h[1] = h
    point_h[2] = if97.ps2h(p, s2)
    point_s = np.zeros(shape=3)
    point_s[0] = s0
    point_s[1] = s
    point_s[2] = s2
    return point_s,point_h
示例#5
0
def CylinderEff(cylinder):
    """simple function  for cylinde using 'dict' """

    cylinder['inlet']['h'] = pt2h(cylinder['inlet']['p'],
                                  cylinder['inlet']['t'])
    cylinder['inlet']['s'] = pt2s(cylinder['inlet']['p'],
                                  cylinder['inlet']['t'])

    cylinder['outlet']['h'] = pt2h(cylinder['outlet']['p'],
                                   cylinder['outlet']['t'])
    cylinder['outlet']['s'] = pt2s(cylinder['outlet']['p'],
                                   cylinder['outlet']['t'])

    # h2s is the specific enthalpy at state 2 for the isentropic turbine
    h2s = ps2h(cylinder['outlet']['p'], cylinder['inlet']['s'])

    cylinder['h2s'] = h2s

    hds = cylinder['inlet']['h'] - h2s  # isentropic specific enthalpy drop
    hd = cylinder['inlet']['h'] - cylinder['outlet'][
        'h']  # specific enthalpy drop

    cylinder['ef'] = 100 * hd / hds

    return cylinder
示例#6
0
def CalPump(Pump, Nodes, Task):
    """
    "PUMP": {'minID': None, 'moutID': None, 'eta': None, 
             'wdot': None,
             "energy": "Win",
             "fun": CalPump}
    """
    iND = Nodes[Pump['minID']]
    oND = Nodes[Pump['moutID']]
    if Task == "State":
        # 1 oND
        sout_s = iND['s']
        hout_s = ps2h(oND['p'], sout_s)
        oND['h'] = iND['h'] + (hout_s - iND['h']) / Pump['eta']
        oND['t'] = ph2t(oND['p'], oND['h'])
        oND['s'] = ph2s(oND['p'], oND['h'])
        oND['x'] = ph2x(oND['p'], oND['h'])

    if Task == "Balance":
        # 2 Mass and Energy Balance
        if iND['fdot'] != None:
            oND['fdot'] = iND['fdot']
        if oND['fdot'] != None:
            iND['fdot'] = oND['fdot']

        Pump['wdot'] = oND['fdot'] * oND['h'] - iND['fdot'] * iND['h']
示例#7
0
 def state(self):
     """
     calc oNode of the pump 
     """
     sout_s = self.iNode.s
     hout_s = ps2h(self.oNode.p, sout_s)
     self.oNode.h = self.iNode.h + (hout_s - self.iNode.h)/self.ef
     self.oNode.ph()
示例#8
0
def CalTurbineEx1(TurbineEx1, Nodes, Task):
    """
      "TURBINE-EX1":{'minID': None, 'moutID': None, 'mexID': None ,'eta': None,
                   'wdot': None,
                   "energy": "Wout",
                   "fun": CalTurbineEx1},

    """
    iND = Nodes[TurbineEx1['minID']]
    oND = Nodes[TurbineEx1['moutID']]
    eND = Nodes[TurbineEx1['mexID']]
    if Task == "State":
        # 1 oND
        if TurbineEx1['eta'] == 1.0:
            eND['s'] = iND['s']
            eND['t'] = ps2t(eND['p'], eND['s'])
            eND['h'] = ps2h(eND['p'], eND['s'])
            eND['x'] = ps2x(eND['p'], eND['s'])

            oND['s'] = iND['s']
            oND['t'] = ps2t(oND['p'], oND['s'])
            oND['h'] = ps2h(oND['p'], oND['s'])
            oND['x'] = ps2x(oND['p'], oND['s'])

        else:
            isoh = ps2h(eND['p'], iND['s'])
            eND['h'] = iND['h'] - TurbineEx1['eta'] * (iND['h'] - isoh)
            eND['t'] = ph2t(eND['p'], eND['h'])
            eND['s'] = ph2s(eND['p'], eND['h'])
            eND['x'] = ph2x(eND['p'], eND['h'])

            isoh = ps2h(oND['p'], eND['s'])
            oND['h'] = eND['h'] - TurbineEx1['eta'] * (eND['h'] - isoh)
            oND['t'] = ph2t(oND['p'], oND['h'])
            oND['s'] = ph2s(oND['p'], oND['h'])
            oND['x'] = ph2x(oND['p'], oND['h'])

    if Task == "Balance":
        # 2 Mass and Energy Balance
        oND['fdot'] = iND['fdot'] - eND['fdot']
        TurbineEx1['wdot'] = eND['fdot'] * (iND['h'] - eND['h'])
        TurbineEx1['wdot'] += oND['fdot'] * (iND['h'] - oND['h'])
示例#9
0
    def state(self, nodes):
        #nodes[self.exitNode].s = nodes[self.inletNode].s
        #nodes[self.exitNode].h = nodes[self.inletNode].h + nodes[self.inletNode].v * \
        #    (nodes[self.exitNode].p - nodes[self.inletNode].p) * 1000
        # nodes[self.exitNode].hs()

        sout_s = nodes[self.inletNode].s
        hout_s = seuif97.ps2h(nodes[self.exitNode].p, sout_s)
        nodes[self.exitNode].h = nodes[self.inletNode].h + (
            hout_s - nodes[self.inletNode].h)
        nodes[self.exitNode].ph()
示例#10
0
 def state(self, nodes):
     """
     calc outNode of the pump 
     """
     #nodes[self.outNode].h = (
     #    nodes[self.inNode].h +
     #    (nodes[self.inNode].v * (nodes[self.outNode].p -
     #                             nodes[self.inNode].p) * 1000.0) / self.ef
     #)
     sout_s = nodes[self.inNode].s
     hout_s = seuif97.ps2h(nodes[self.outNode].p, sout_s)
     nodes[self.outNode].h = nodes[
         self.inNode].h + (hout_s - nodes[self.inNode].h) / self.ef
     nodes[self.outNode].ph()
def CylinderEff(cylinder):
    """simple function  for cylinde using 'dict' """

    cylinder['inlet']['h'] = pt2h(cylinder['inlet']['p'], cylinder['inlet']['t'])
    cylinder['inlet']['s'] = pt2s(cylinder['inlet']['p'], cylinder['inlet']['t'])

    cylinder['outlet']['h'] = pt2h(cylinder['outlet']['p'], cylinder['outlet']['t'])
    cylinder['outlet']['s'] = pt2s(cylinder['outlet']['p'], cylinder['outlet']['t'])

    # h2s is the specific enthalpy at state 2 for the isentropic turbine
    h2s = ps2h(cylinder['outlet']['p'], cylinder['inlet']['s'])
    
    cylinder['h2s'] = h2s
     
    hds = cylinder['inlet']['h'] - h2s  # isentropic specific enthalpy drop
    hd = cylinder['inlet']['h'] - cylinder['outlet']['h']  # specific enthalpy drop

    cylinder['ef'] = 100 * hd / hds

    return cylinder
示例#12
0
 def ps(self):
     self.t = if97.ps2t(self.p, self.s)
     self.h = if97.ps2h(self.p, self.s)
     self.v = if97.ps2v(self.p, self.s)
     self.x = if97.ps2x(self.p, self.s)
示例#13
0
文件: node.py 项目: MuskZ/PyRankine
 def ps(self):
     self.t = if97.ps2t(self.p, self.s)
     self.h = if97.ps2h(self.p, self.s)
     self.v = if97.ps2v(self.p, self.s)
     self.x = if97.ps2x(self.p, self.s)