Knowledge Base

Welcome to OPAL-RT’s Knowledge Base

OPAL-RT offers a repository of support information for optimal use of its technology.

Please note that OPAL-RT knowledge base is not fully optimized for mobile platforms.

For optimal experience, use a desktop computer.

Reference Number: AA-00666 // Views: 3351 // Created: 2010-10-21 05:00:00 // Last Updated: 2022-09-21 23:03:28
General Article
Automatic test sequence on a small electrical network using Python script

Automatic test sequence on a small electrical network using Python script

Here is an example model of an automatic test sequence using a Python script.

The model is a very small network with a variable inductor (based on SimPowerSystem example). It records variable inductor voltage and current into a mat file.The Python script will perform following steps : 

  • Connect to the model
  • Compile the model
  • Assign to development node with XHP mode
  • Load the model
  • change Inductor value 3 times
  • Reset the model
  • Open Matlab and open obtained mat file
  • Plot Figures.
  • Save the log in a text file

To run this example follow this procedure :

  1. Open a new project and add the model to it (make sure that init script is located in the same folder as the model)
  2. Make a right-click on your folder, New -> Other ->Folder and create a "Scripts" folder
  3. Click on the "Filter ressource" button of the Project Explorer view to make it appear
  4. right click on your script folder, choose New -> Other -> File and link to your script

Then select your script and run it from the Python icon in the Window toolbar.

example_VariableInductor.mdl49.2 KbDownload File
init.m11 bDownload File KbDownload File