Menu

Accessing Chemsep Column through python scripting

2023-04-06
2023-04-19
  • Pravin Dalve

    Pravin Dalve - 2023-04-06

    Can we access Chemsep Column variables through python scripting? I was exploring in DWSIM namespaces for Chemsep column class like Distillation Column class in DWSIM but could not find any.

     
  • Daniel Medeiros

    Daniel Medeiros - 2023-04-06

    First you need to expose the properties that you want through the column editor:

    Then, access the variable values in python with

    cscol = Flowsheet.GetObject('T-1 (DEMETHANIZER)')
    
    rtemp = cscol.GetPropertyValue('Reboiler temperature ')
    
    print(rtemp)
    
     
  • Pravin Dalve

    Pravin Dalve - 2023-04-13

    This method is working for reading the variables but when I am trying to use SetPropertyValue (for example: rd.SetPropertyValue("Number of stages" , 20)) it throws "TypeError: Specified cast not valid". I have tried various datatypes including system Int32, Int64 but it still shows the same error.

     

    Last edit: Pravin Dalve 2023-04-13
  • Pravin Dalve

    Pravin Dalve - 2023-04-19

    Hi Daniel,

    I accidently gave "Number of stages" and "Feed stages" as Double and it worked. Shouldn't those variables be Integers?

    Also how can we access reaction variables like "Start stage" and "End stage"? These are not present in the dropdown menu of variables section in above window. Please explain both Get and Set methods.

     
    • Daniel Medeiros

      Daniel Medeiros - 2023-04-19

      Hi Pravin,

      Handling of variables is done by the unit operation itself. If the parameter is defined as CAPE_REAL, then it will only accept double-precision values.

      If the variables that you want are not exposed by ChemSep then I can't do much, sorry. You would have to contact the developers and ask for them to be included in a future update.

      Regards
      Daniel

       
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.