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
For technical information about the Python API capabilities, refer to the documentation: [Py] Class reference
For useful script examples to get started, refer to the documentation: [Py] Usage
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.
Adding a new script
To add a new script, click on the 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: [Py] Class reference
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 button in the Script list.
Click on the Run Script button 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
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