Menu

exporting online physical properties from DWSIM to excel

2020-03-11
2020-03-11
  • Faraz Qasim

    Faraz Qasim - 2020-03-11

    i have a project where i need to use physical properties from DWSIM in excel or csv. i need to run dynamic simulation on DWSIM and to export required physcial properties from DWSIM to excel or csv online and updating this data at a specific update rate. any help for python script for this kind of data flow will be highly appreciated! Thank you

     
  • Daniel Medeiros

    Daniel Medeiros - 2020-03-11

    You can use the Timer class from the .NET Framework to execute a function at a specified interval:

    from System import String
    
    # https://docs.microsoft.com/en-US/dotnet/api/system.timers.timer?view=netframework-4.8
    
    from System.Timers import Timer
    
    timer = Timer()
    
    timer.Interval = 2000
    
    count = 0
    
    def ElapsedHandler(s, e):
    
        global count, timer
    
        count += 1
    
        print(String.Format("The Elapsed event was raised at {0:HH:mm:ss.fff}", e.SignalTime))
    
        if count > 4: timer.Stop()
    
    timer.Elapsed += ElapsedHandler
    
    timer.Enabled = True
    
    timer.Start()
    

    For Excel usage, see the Dynamic Simulation tutorial on the website.