How can I compare simulation results in a graphical way?

Category:
Dynamic Simulation
Answer

This script provides a convenient way to graphically compare simulation results within a single study case. It is particularly useful for parameter studies, event tuning, and model debugging, where a visual comparison of multiple simulation runs is required.

Basic workflow

  1. Run a simulation manually for the study case.
  2. Modify a parameter or event (e.g., controller setting, model parameter, switching event).
  3. Execute the script and run the simulation again via the script.

The script automatically duplicates all existing curves in the plots and links them to the results of the previous simulation. This overlays the old and new results, so the impact of the applied changes can be evaluated visually.

Plot cleanup options

  • iCleanup = 1
    Restores the plots to their original state by removing duplicated curves.
  • iCleanup = 2
    Enables a persistent cleanup mode. This is useful when multiple study cases are processed consecutively and a consistent cleanup behavior is required across all of them.

Result history and model configuration tracking

  • The script can store the configuration of ElmDsl models on the description page of the corresponding ElmRes object in the study case.
    • To use this, an ElmComp or ElmDsl must be linked as an external object.
    • This is particularly helpful for parameter tuning and sensitivity analyses, as it documents the model configuration used for each run.
  • If iHistory is enabled, the ElmRes objects from previous simulations are stored in a "history" folder, ensuring traceability of past results.

Advanced options

  • iAutoVar = 1
    Adds all internal variables, states, and signals of all ElmDsl models to the ElmRes.
    • Intended for DSL debugging and detailed analysis.
    • May generate a large number of result variables; use with care to avoid excessive result sizes and reduced performance.

Batch processing of multiple study cases

  • Store shortcuts to study cases in SetOfCases and set iRunForSelected = 1 to execute the comparison for all selected study cases in one run.
  • If iCleanup = 1 is set, the cleanup will be performed for all selected cases within the same run.

Summary

In short, the script enhances the simulation workflow by enabling:

  • Direct visual comparison of multiple simulation runs within the same study case
  • Controlled plot cleanup for reproducible and tidy plot management
  • Result history tracking and model configuration documentation
  • Batch execution across multiple study cases via SetOfCases

This makes it a practical tool for systematic studies, tuning tasks, and debugging activities in DIgSILENT PowerFactory.

Back