Documentation Home Page OPAL-RT Dashboard Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

8. Scripting

Page Content

References

This page explains the Scripting Feature

Scripting Feature Overview

Scripts serve as powerful tools within Dashboards, providing users with the capability to leverage Python scripts directly within the platform. Dashboards offer a Python API and a dedicated environment for executing Python scripts seamlessly.

The Scripts Panel is accessible in the Navigation pane, and is composed of the Script list, the Script Editor, and the Logs.

image-20240311-203554.png

Adding a new script

To add a new script, click on the plus.png button of the Script list.

The generated template script will show you how to access the current project, which is the entry point of the API. For more information about the Python API capabilities, refer to the documentation:

Editing a script

You may edit a script in Dashboards directly, or in an external environment.

Autosave: When editing your scripts from Dashboards, your changes will be saved automatically.

Running a script

To run a script, you may either:

  • Click on the image-20240409-153636.png button in the Script list.

  • Click on the Run Script button image-20240409-153606.png in the Script editor.

Logs: The logs displayed in the Logs pane are contextualized for the selected Script in the Script list. Only the most recent Log of each Script is saved.

Demonstration

ScriptAdd.gif

Triggering a script from a Button widget

In a panel, the Button widget can be used to trigger a script. Once in operate mode, the script will run on button press whether the simulation is running or not.

While many scripts may be ran at once, only one instance of the same script can run at the same time.

Limitations

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter