コード例 #1
0
    def evaluate(self, state):
        P, h = state[0] * 0.1, state[1] / 18.015
        if P < Pmin:
            P = Pmin
        hmin = _Region1(273.15, P)["h"]
        if h < hmin:
            h = hmin

        region = _Bound_Ph(P, h)
        if (region == 1):
            sw = 1
        elif (region == 4):
            hw = _Region4(P, 0)["h"]
            hs = _Region4(P, 1)["h"]
            rhow = 1 / _Region4(P, 0)["v"]
            rhos = 1 / _Region4(P, 1)["v"]
            sw = rhos * (hs - h) / (h * (rhow - rhos) -
                                    (hw * rhow - hs * rhos))
        elif (region == 2):
            sw = 0
        else:
            raise NotImplementedError("Incoming out of bound")
        return sw
コード例 #2
0
 def evaluate(self, state):
     P = state[0] * 0.1
     region = _Bound_TP(self.T, P)
     if (region == 1):
         h = _Region1(self.T, P)["h"] * 18.015
     elif (region == 4):
         Steam_sat = iapws_steam_saturation_evaluator()
         rho_steam = iapws_steam_density_evaluator()
         rho_water = iapws_water_density_evaluator()
         x = Steam_sat.evaluate(state) * rho_steam.evaluate(state) / (
             Steam_sat.evaluate(state) * rho_steam.evaluate(state) +
             Steam_sat.evaluate(water) * rho_water.evaluate(state))
         h = _Region4(P, x)["h"] * 18.015
     elif (region == 2):
         h = _Region2(self.T, P)["h"] * 18.015
     else:
         raise NotImplementedError("Incoming out of bound")
     return h
コード例 #3
0
 def evaluate(self, state):
     P, h = state[0] * 0.1, state[1] / 18.015
     if P < Pmin:
         P = Pmin
     hmin = _Region1(273.15, P)["h"]
     if h < hmin:
         h = hmin
     region = _Bound_Ph(P, h)
     if (region == 1):
         water_enth = h
     elif (region == 4):
         T = _TSat_P(P)
         if T <= 623.15:
             water_enth = _Region4(P, 0)["h"]
         else:
             raise NotImplementedError("Incoming out of bound")
     elif (region == 2):
         water_enth = 0
     else:
         print(region)
         raise NotImplementedError("Incoming out of bound")
     return water_enth * 18.015
コード例 #4
0
    def evaluate(self, state):
        P, h = state[0] * 0.1, state[1] / 18.015
        if P < Pmin:
            P = Pmin
        hmin = _Region1(273.15, P)["h"]
        if h < hmin:
            h = hmin

        region = _Bound_Ph(P, h)
        if (region == 1):
            steam_density = 0
        elif (region == 4):
            T = _TSat_P(P)
            if T <= 623.15:
                steam_density = 1 / _Region4(P, 1)['v']
            else:
                raise NotImplementedError("Incoming out of bound")
        elif (region == 2):
            To = _Backward2_T_Ph(P, h)
            T = newton(lambda T: _Region2(T, P)["h"] - h, To)
            steam_density = 1 / _Region2(T, P)["v"]
        else:
            raise NotImplementedError("Incoming out of bound")
        return steam_density / 18.015
コード例 #5
0
    def evaluate(self, state):
        P, h = state[0] * 0.1, state[1] / 18.015
        if P < Pmin:
            P = Pmin
        hmin = _Region1(273.15, P)["h"]
        if h < hmin:
            h = hmin

        region = _Bound_Ph(P, h)
        if (region == 1):
            temperature = temperature_region1_evaluator()
            T = temperature.evaluate(state)
            water_density = 1 / _Region1(T, P)['v']
        elif (region == 4):
            T = _TSat_P(P)
            if (T <= 623.15):
                water_density = 1 / _Region4(P, 0)['v']
            else:
                raise NotImplementedError("Incoming out of bound")
        elif (region == 2):
            water_density = 0
        else:
            raise NotImplementedError("Incoming out of bound")
        return water_density / 18.015