Menu

Cannot get Mass or Mol flow of the differnt phase from the output stream

Charan
2018-06-19
2018-06-20
  • Charan

    Charan - 2018-06-19

    When I try to get the phase specifc flows from a output stream I'm always getting it as zero. This problem only occurs with the mass and mole flows. I could get the composition of the phases correctly and also get the total overall mass or mole flow correctly. I have checked and made sure that the output stream contains both vapor and liquid stream.
    Is there anything differnt that we have to do for mass or mole flow of phases.
    I have attached the code that I used below. This code was written inside a Custom Unit Operation.

    Specs : The inlet stream contains equal composition of water and carbon monoxide at 345 K and 1 atm with a massflow of 1kg/s.

    Thank You.

    from DWSIM.Thermodynamics import *
    
    feed1 = ims1
    P_1 = feed1.GetProp("pressure", "Overall", None, "", "")
    massflow_1 = feed1.GetProp("totalFlow" ,"Overall", None, "", "mass")
    molfrac_1 = feed1.GetProp("fraction", "Overall", None, "", "mole")
    molflow_1 = feed1.GetProp("totalFlow" ,"Overall", None, "", "mole")
    enthalpy_1 = feed1.GetProp("enthalpy" ,"Overall", None, "Mixture", "mass")
    T_1 = feed1.GetProp("temperature","Overall",None,"","")
    
    molflow_12 = feed1.GetProp("totalFlow" ,"Vapor", None, "", "mole")
    Flowsheet.WriteMessage(str(molflow_12))
    
    out = oms1
    out.Clear()
    out.SetProp("pressure", "Overall", None, "", "", P_1)
    out.SetProp("fraction", "Overall", None, "", "mole", molfrac_1)
    out.SetProp("totalFlow", "Overall", None, "", "mass", massflow_1)
    out.SetProp("enthalpy", "Overall", None, "", "mass",enthalpy_1)
    out.PropertyPackage.DW_CalcEquilibrium(PropertyPackages.FlashSpec.P, PropertyPackages.FlashSpec.H)
    
    molflow_11 = out.GetProp("totalFlow" ,"Liquid", None, "", "mole")
    Flowsheet.WriteMessage(str(molflow_11))
    
    molflow_13 = out.GetProp("totalFlow" ,"Vapor", None, "", "mole")
    Flowsheet.WriteMessage(str(molflow_13))
    
     
  • Daniel Medeiros

    Daniel Medeiros - 2018-06-19

    You are only calculating the phase distribution with DW_CalcEquilibrium. You need to calculate both equilibrium and phase properties, which include phase flow rates.

    I recommend using

    import clr
    clr.AddReference("DWSIM.Interfaces")
    
    from DWSIM.Thermodynamics import *
    from DWSIM.Interfaces import *
    
    (...)
    
    # set flash spec of the stream to P/H
    oms1.SpecType = Enums.StreamSpec.Pressure_and_Enthalpy
    # calculate phase equilibrium and phase properties
    out.Calculate(True, True)
    

    instead of

    out.PropertyPackage.DW_CalcEquilibrium(PropertyPackages.FlashSpec.P, PropertyPackages.FlashSpec.H)
    

    For more information about the StreamSpec property, see http://dwsim.inforside.com.br/api_help5/html/T_DWSIM_Interfaces_Enums_StreamSpec.htm

    The first boolean argument of the Calculate function is to tell it to calculate the equilibrium, while the second one refers to the phase properties. So, True/True for both equilibrium and properties.

     

    Last edit: Daniel Medeiros 2018-06-19
  • Charan

    Charan - 2018-06-20

    Thank you.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.