Professional Documents
Culture Documents
30 SP2
PowerScript
1.1 Introduction
PowerScript
Application Sheet
1 PowerScript
1.1 Introduction
PowerScript is a tool that enables users to customize certain system behavior without modifying Spectrum
Power™ 7 directly. That is, users may write scripts calling standard APIs that impact certain AGC and SCADA
functionality without any source code modification. These scripts can be scheduled or called on-demand.
1.2 Highlights
The PowerScript framework has:
• A PowerScript Python API that provides extensions to the standard Python language which are made
available to interact with a Spectrum Power 7 system.
• The ability to connect Python objects to Analogs, Digitals and AGC TAs.
• Logging capability
The script deployment for server-side execution requires a configuration file for each deployed script. Config-
uration files follow the Windows INI file format. In this format, each section is preceded by a keyword
wrapped inside a pair of square brackets “[ ]” followed by a list of key/value pairs.
All scripts have their own log files that are in /home/logs/powerscript/ folder. The naming convention is
scriptname.log, for example, if a script is called script1.py, its log file is called script1.log.
A configuration file example:
#This is the configuration file from the example.py script.
# It will be executed every 5 seconds
# SCRIPT_TIMEOUT means that if the script elapsed time is greater than 10 sec-
onds, the execution will be terminated.
# RUN_IN_BACKUP_SITE means whether the PSP will schedule the script on a
BACKUP SP7 Multisite configuration
# RUN_IN_STANDBY_COM means whether the PSP will schedule the script on a SP7
Distributed configuration
[example1.py]
# crontab sec[0-59] min[0-59] hrs[0-23] days[1-31] mon[1-12] dweek[0-6]
SCHEDULE= 0/5 * * * * *
SCRIPT_TIMEOUT = 10