Menu

GetProp Liquid 1 phase pH for Electrolyte NaCl Example

HowardD
2017-11-09
2017-11-09
  • HowardD

    HowardD - 2017-11-09

    Hi,

    New to DWSIM.

    The salt dissolution is working and the Flowsheet MSTR-000 stream for the calculated mixture pH is displayed in the table properites. I would like to try and control pH.

    In my Iron python script I can read most of the properites for all of the phases. However I cannot find out how to get the pH value for the Liquid 1 stream as shown in the Flowsheet properties table:

    MSTR-000 is the Flowsheet Stream assigned to MSTR_000
    
    MSTR_000_pH  = MSTR_000.GetProp("pH","Liquid1","Water","Mixture",None)
    

    exception trace gives:

    85  11/9/2017 10:05:34 AM   Message CapeOpen.CapeComputationException: Error in the application. ---> CapeOpen.CapeThrmPropertyNotAvailableException: Error in the application.
    

    --- End of inner exception stack trace ---

    at DWSIM.Thermodynamics.Streams.MaterialStream.ThrowCAPEException(Exception& ex, String name, String description, String interf, String moreinfo, String operation, String scope, Int32 code) in C:\Users\Daniel\Source\Repos\dwsim5\DWSIM.Thermodynamics\Material Stream\MaterialStream.vb:line 5669

    at DWSIM.Thermodynamics.Streams.MaterialStream.GetProp(String property, String phase, Object compIds, String calcType, String basis) in C:\Users\Daniel\Source\Repos\dwsim5\DWSIM.Thermodynamics\Material Stream\MaterialStream.vb:line 3115

    at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)

    at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

    at Microsoft.Scripting.Interpreter.LightLambda.Run8[T0,T1,T2,T3,T4,T5,T6,T7,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4

    Thanks,

    Howard

     
  • Daniel Medeiros

    Daniel Medeiros - 2017-11-09

    pH is not exposed through the CAPE-OPEN 'GetProp' method. You can get its value directly from:

    lp = MSTR_000.GetPhase('Liquid1')
    ph = lp.Properties.pH
    
     
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.