0% found this document useful (0 votes)
14 views

Python Incy Me

Uploaded by

Noutouy DUANGTA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Python Incy Me

Uploaded by

Noutouy DUANGTA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CYME

Pub. No.: IL927126EN


Power Engineering Software Effective: March 2018

Tutorial
Using Python® in CYME
– CYME 8.0

A self-contained study file (.sxst) to use with this tutorial is provided. The explanations below are based on the use of it.

1. Introduction to Python® in CYME


When using the CYME software, it is possible to script automated tasks with the Python language. The module can be
used in different ways:
• Embedded in CYME
• As an external Python Executable
The first method only is presented in this tutorial. The second one is for advanced users.
The following parts will be shown in the tutorial:
• Python Toolbar
• Python Console
• Python Toolbox
The Python tools can be accessed through the menu option: File > Tools > Python Console or Python Toolbox.
The toolbar can be added by right clicking on the toolbar area and selecting Python in the toolbar list displayed. The
following bar should appear.
The following options are available in the toolbar, from left to right:
• Toolbox Script selection box
• Run script button
• Open Python Toolbox button
• Open Python Console button
• Open Python Editor button
Open the python.sxst self-contained study available with this tutorial.

2. Python Console
The Python console can be
opened either from the
toolbar of from the menu
option: File >Tools->Python
Console. The following
window should open:
Pub. No.: IL917126EN
Effective: March 2018

From this window simple Python commands can be used, ranging from simple mathematical calculations to the cympy
commands provided with CYME. Type in the following, then press Enter:
1. 2*8
2. cympy.study.QueryInfoNode(‘Distance’, ‘B4’, 3)
The following should appear:

The second command shown is to query the keyword Distance on the node B4 with a precision of 3 decimals.
Note: It is also possible to explore the CymPy Library with the auto complete feature of the tool. By typing “cympy”
followed by a dot, the possible sub-modules, functions or variables will be shown. See the CYME Reference Manual for
more details.
3. Python Toolbox
The Python Toolbox can be used to save and run
scripts. The toolbox is accessed either from the toolbar
or from the menu: File > Tools > Python Toolbox.
The following dialog box should open. It contains a few
sample scripts.
The toolbar available in the dialog box contains the
following options; from left to right:
1. Toolbox options
2. Add Python script to toolbox
3. Modify script properties
4. Remove script from toolbox
5. Run selected script
6. Edit selected script
7. Import/Export Script
8. Search options
Select the Summary Report LF/SC Script and Run it. A
custom report should appear at the end of the
execution. It is also possible to view the script by
selecting the Edit Script option.
Note: If the sample scripts are not showing click on
the Toolbox options button and deselect the Show
only user-defined scripts option.

© Eaton, CYME International 2

You might also like