Menu

Python script in dynamic simulation

2020-08-14
2020-09-04
  • Meir Tseitlin

    Meir Tseitlin - 2020-08-14

    Hi,

    I am trying to modify properties of an element via Python script within Script Manager (version 6.1), so each step within the dynamic simulation the script will execute.

    The script works perfectly well when clicking on Run (or Run Async).

    But it's not working when I am attaching it to an event (let's say PID calculation start) and run an integrator for a dynamic simulation.

    What is the correct way to do it?
    Thanks

     
  • Daniel Medeiros

    Daniel Medeiros - 2020-08-15

    The PID Controller is solved separatedly, and I forgot to implement the linked script functionality for it. Sorry about that. It will be working on the next update.

     
  • Satoru Kishimoto

    Hi,

    During a dynamic calculation, I want to get the elapsed time and integration step in Python Script to use for the calculation.

    What kind of Python script can do this?

     
  • Daniel Medeiros

    Daniel Medeiros - 2020-08-17

    Try

    schedule = Flowsheet.DynamicsManager.ScheduleList[Flowsheet.DynamicsManager.CurrentSchedule]
    integrator = Flowsheet.DynamicsManager.IntegratorList[schedule.CurrentIntegrator]
    

    You can then access the properties of the current integrator: http://dwsim.inforside.com.br/api_help60/html/Properties_T_DWSIM_DynamicsManager_Integrator.htm

     

    Last edit: Daniel Medeiros 2020-08-17
  • Satoru Kishimoto

    Problem solved.
    Thank you.

     
    👍
    2
  • Meir Tseitlin

    Meir Tseitlin - 2020-09-04

    @danwbr, so is it possible to attach Python script to calulation events (Object Calculation Finished) for a specific Object when Executing an integrator? (so every step there will be a calculation).

    Thanks

     
    • Daniel Medeiros

      Daniel Medeiros - 2020-09-04

      Yes 👍🏻

       
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.