Example #1
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']
Example #2
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'])
Example #3
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'])
Example #4
0
 def ph(self):
     self.t = if97.ph2t(self.p, self.h)
     self.s = if97.ph2s(self.p, self.h)
     self.v = if97.ph2v(self.p, self.h)
     self.x = if97.ph2x(self.p, self.h)
Example #5
0
 def ph(self):
     self.t = if97.ph2t(self.p, self.h)
     self.s = if97.ph2s(self.p, self.h)
     self.v = if97.ph2v(self.p, self.h)
     self.x = if97.ph2x(self.p, self.h)