DplReference en
DplReference en
Contents
1 General Description 1
2 Global Functions 2
2.1 File System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.2 Date/Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.3 Dialogue Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.4 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.5 Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
2.6 MS Office . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
2.6.1 MS Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
2.6.2 MS Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
2.7 Multibyte Encoded String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
2.8 Output Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
2.9 String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
2
CONTENTS CONTENTS
3
CONTENTS CONTENTS
4
CONTENTS CONTENTS
5
CONTENTS CONTENTS
6
CONTENTS CONTENTS
7
CONTENTS CONTENTS
Index 858
8
CHAPTER 1. GENERAL DESCRIPTION
1 General Description
The DIgSILENT Programming Language (DPL) provides a large set of build-in functions. For
overview and understanding they can be grouped into the following categories
1. global functions,
2. general methods,
3. specialised methods,
4. set routines.
The “global functions” are a kind of static functions that can be called everywhere in the script.
The term ‘methods’ is used for functions that can be called on an object. Generally it is
distinguished between methods that are available for objects of different classes and those
available for distinct classes only. The first group is called “general methods”, the second
“specialised methods” with reference to its class.
The last group of “set routines” is formed by functions that are available for working with DPL
own data type ‘set’.
This document comes as a reference manual. The following chapters describe the syntax and
meaning of all available functions.
Please refer to the PowerFactory User Manual for general information about the DPL scripting
language and its usage.
1
CHAPTER 2. GLOBAL FUNCTIONS
2 Global Functions
Overview
ActivateProject
ClearCommands
ClearRecycleBin
CommitTransaction
ConvertGeometryStringToMDL
CreateFaultCase
CreateProject
DecodeColour
Delete
DeleteUntouchedObjects
EncodeColour
ExecuteCmd
exit*
GetActiveCalculationStr*
GetActiveNetworkVariations*
GetActiveProject*
GetActiveScenario*
GetActiveScenarioScheduler*
GetActiveStages*
GetActiveStudyCase*
GetAllUsers*
GetBorderCubicles*
GetBrowserSelection
GetCalcRelevantObjects*
GetClassDescription*
GetCurrentDiagram
GetCurrentSelection
GetCurrentUser*
GetCurrentZoomScaleLevel
GetDataFolder*
GetDescription*
GetDiagramSelection
GetFlowOrientation*
GetFromStudyCase*
GetGlobalLibrary*
GetGraphicsBoard*
GetLanguage*
GetLastCmd
GetLocalLibrary*
GetMem*
GetPageLen*
GetPFVersion*
2
CHAPTER 2. GLOBAL FUNCTIONS
GetProjectFolder*
GetRecordingStage*
GetResData
GetResDesc
GetResObj
GetResUnit
GetResVar
GetSettings*
GetSummaryGrid*
GetTouchedObjects
GetTouchingExpansionStages
GetTouchingStageObjects
GetTouchingVariations
GetUserManager*
GetUserSettings*
HttpGet
ImportDz
ImportSnapshot
IsLdfValid*
IsNAN*
IsRmsValid*
IsScenarioAttribute*
IsShcValid*
IsSimValid*
LicenceHasModule
LoadProfile
LoadResData
MarkInGraphics
OutputFlexibleData*
PostCommand
PrepForUntouchedDelete
Rebuild*
ReleaseResData
ReloadProfile
ResetCalculation
ResFirstValidObject
ResFirstValidObjectVar
ResFirstValidVar
ResGetMax
ResGetMin
ResIndex
ResNextValidObject
ResNextValidObjectVar
ResNextValidVar
ResNval
ResNvars
ResSortToVar
SaveAsScenario
SearchObjectByForeignKey*
SelectToolbox
SetShowAllUsers
Sleep*
SplitLine
StatFileGetXrange
StatFileResetXrange
StatFileSetXrange
3
CHAPTER 2. GLOBAL FUNCTIONS
ActivateProject
Activates a project with its name.
int ActivateProject(string name)
A RGUMENTS
name Name (”Project”), full qualified name (”Project.IntPrj”) or full qualified path (”\User\Project.IntPrj”)
of a project.
R ETURNS
0 on success and 1 if project can not be found or activated.
ClearCommands
Clears the command pipe of the input window. It does not interrupt currently running command.
void ClearCommands()
ClearRecycleBin
Clears the recylce bin of currently logged in user.
void ClearRecycleBin()
CommitTransaction
Writes pending changes to database.
While a script is running none of the changes are written to the database unless the script
terminates. PowerFactory can be forced to write all pending changes to the database using
this function.
void CommitTransaction()
D EPRECATED N AMES
CommitTx
ConvertGeometryStringToMDL
Conversion of string geometry used in PowerFactory versions ¡ 23.
string ConvertGeometryStringToMDL(string orgString,
object intGrfOrLayer)
A RGUMENTS
orgString String to be converted.
intGrfOrLayer
IntGrf or IntGrflayer which contains the text.
4
CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
The converted MDL-string.
CreateFaultCase
Create fault cases from the given elements.
int CreateFaultCase(set elms,
int mode,
[int createEvt = 0],
[object folder = NULL]
)
A RGUMENTS
elms Selected elements to create fault cases.
mode How the fault cases are created:
R ETURNS
0 On success.
1 On error.
CreateProject
Creates a new Project inside the parent object. The default project stored in the Configura-
tion/Default folder will be copied and if it contains any Study Cases the first will be used instead
of creating a new one. If desired, a new grid can also be created. Returns the newly created
project.
object CreateProject(string projectName,
string gridName,
[object parent = NULL])
5
CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
projectName
Name of the new project. Leave empty to open up the IntPrj dialog and let the
user enter a name.
gridName
Name of the grid that‘s created for the new project. Use an empty string to open
up the ElmNet dialog and let the user enter a name.
Leave out this argument completely to not create a grid.
parent The parent for the new project. Can be omitted to use the currently logged on user
as default.
DecodeColour
Decodes a colour value stored in PowerFactory’s internal colour representation, and splits it into
its RGBA components.
void DecodeColour(int encodedColour,
int& red,
int& green,
int& blue,
int& alpha)
A RGUMENTS
encodedColour
Colour value given in PowerFactory’s internal colour representation, as read from
any colour attribute.
red (out) Red colour channel. Range [0,255].
green (out)
Green colour channel. Range [0,255].
blue (out) Blue colour channel. Range [0,255].
alpha (out)
Colour transparency. Range [0,255], with 0 being fully transparent and 255 being
fully opaque.
E XAMPLE
The following example reads the background colour of operation scenario parameters:
object userSettings;
int encodedColour;
int red, green, blue, alpha;
userSettings = GetUserSettings();
encodedColour = userSettings:iColOPVar;
DecodeColour(encodedColour, red, green, blue, alpha);
printf('RGBA = (%i, %i, %i, %i)', red, green, blue, alpha);
6
CHAPTER 2. GLOBAL FUNCTIONS
Delete
Deletes an object or a set of objects from the database. The objects are not destroyed but are
moved to the recycle bin.
void Delete(object object)
void Delete(set objects)
A RGUMENTS
object Object to delete.
objects Set of objects to delete.
S EE ALSO
E XAMPLE
The following example removes all “Dummy” fuses from the network. The 'DummyType'
variable is a local variable in the DPL script. A set of objects to delete is created first and
then that set is deleted. This has the advantage that one single entry in the recycle bin is
created which contains all deleted fuses. Manually restoring ('undelete') the deleted fuses, in
case of a mistake, can then be done using a single restore command.
object obj;
set fuses, toDelete;
fuses = GetCalcRelevantObjects();
obj = fuses.FirstFilt('*.RelFuse');
while (obj) {
if (obj:typ_id=DummyType) {
toDelete.Add(obj);
}
obj = fuses.NextFilt();
}
Delete(toDelete);
DeleteUntouchedObjects
Delete all objects stored in the grid (or stored in set) which are not modified. Requires call of
PrepForUntouchedDelete() first, see PrepForUntouchedDelete(). Hint: function should only be
used when a variation is active. For details please contact support.
int DeleteUntouchedObjects(object grid)
int DeleteUntouchedObjects(set grids)
E XAMPLE
PrepForUntouchedDelete(grid);
DeleteUntouchedObjects(grid);
7
CHAPTER 2. GLOBAL FUNCTIONS
EncodeColour
Encodes an RGBA colour value into PowerFactory’s internal colour representation. The re-
turned value is meant to be assigned to a colour attribute.
int EncodeColour(int red,
int green,
int blue,
[int alpha = 255])
A RGUMENTS
red Red colour channel. Must be in the range [0,255].
green Green colour channel. Must be in the range [0,255].
blue Blue colour channel. Must be in the range [0,255].
alpha(optional)
Colour transparency. Must be in the range [0,255], with 0 being fully transparent
and 255 being fully opaque.
R ETURNS
The encoded colour value. This value can be assigned to any colour attribute.
E XAMPLE
The following example changes the background colour of operation scenario parameters to
magenta:
object userSettings;
int encodedColour;
userSettings = GetUserSettings();
encodedColour = EncodeColour(255, 0, 255);
userSettings:iColOPVar = encodedColour;
ExecuteCmd
Executes given command string as it would be executed if typed directly into the Input Window.
Current script will continue after the command has been executed.
This function is mainly intended for testing purpose and should be used by experienced users
only.
void ExecuteCmd(string command)
A RGUMENTS
command
The command string
D EPRECATED N AMES
Exe
E XAMPLE
The following script executed a load flow calculation with default options
ExecuteCmd('ldf');
8
CHAPTER 2. GLOBAL FUNCTIONS
exit*
Terminates a DPL script immediately. If called within a subscript, only the subscript itself will be
terminated and code is returned by 'subscript.Execute() ' in the main script.
void exit([int code])
A RGUMENTS
code The integer returned by ’subscript.Execute()’ in the main script, when exit() is
called within a subscript. The default value is 1.
S EE ALSO
ComDpl.Execute()
E XAMPLE
int number;
int sum;
GetActiveCalculationStr*
Gets “calculation string” of currently valid calculation.
string GetActiveCalculationStr()
R ETURNS
None basic
Load Flow ldf
AC Load Flow Sensitivities acsens
AC Contingency Analysis accont
DC Load Flow dcldf
DC Load Flow Sensitivities dcsens
DC Contingency Analysis dccont
VDE/IEC Short-Circuit shc
Complete Short-Circuit shcfull
ANSI Short-Circuit shcansi
IEC 61363 shc61363
RMS-Simulation rms
Modal Analysis modal
EMT-Simulation emt
Harmonics/Power Quality harm
9
CHAPTER 2. GLOBAL FUNCTIONS
GetActiveNetworkVariations*
Returns all active variations for the 'Network Data' folder.
set GetActiveNetworkVariations()
R ETURNS
Returns currently active IntScheme objects. Set is empty in case of no scheme being
currently active.
E XAMPLE
The following example returns the currently active variations:
object variation;
set variations;
variations = GetActiveNetworkVariations();
for(variation = variations.First();variation;variation = variations.Next()) {
variation.ShowFullName();
}
GetActiveProject*
This function returns the currently active project.
object GetActiveProject()
D EPRECATED N AMES
ActiveProject
E XAMPLE
The following example prints the currently active project to output window:
object project;
project = GetActiveProject();
printf('Currently active project: %o', project);
10
CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
Returns currently active IntPrj object or NULL in case of no project being currently active.
GetActiveScenario*
Returns the currently active scenario. NULL is returned if there is no active scenario.
object GetActiveScenario()
E XAMPLE
The following example prints the currently active scenario to output window:
object scenario;
scenario = GetActiveScenario();
printf('Active scenario: %o', scenario);
R ETURNS
Returns currently active IntScenario object or NULL in case of no scenario being currently
active.
GetActiveScenarioScheduler*
Returns currently active scenario scheduler.
object GetActiveScenarioScheduler()
R ETURNS
Returns currently active IntScensched object or NULL in case of no scheduler being currently
active.
GetActiveStages*
Returns all active stages currently active for a given folder, e.g. 'Network Data' folder.
set GetActiveStages([object variedFolder = NULL])
A RGUMENTS
variedFolder (optional)
Folder for which all active stages will be returned; by default, the project folder
'Network Data' is taken.
R ETURNS
Returns currently active IntSstage objects. Set is empty in case of no stages being currently
active.
E XAMPLE
The following example returns the currently active recording stages:
object stage;
set stages;
stages = GetActiveStages();
for(stage = stages.First(); stage; stage = stages.Next()) {
11
CHAPTER 2. GLOBAL FUNCTIONS
stage.ShowFullName();
}
GetActiveStudyCase*
Returns the active Study Case. NULL is returned if there is no active study case.
object GetActiveStudyCase()
R ETURNS
The active study case (IntCase object) or NULL.
D EPRECATED N AMES
ActiveCase
E XAMPLE
The following example writes the active study case to the output window:
object case;
case = GetActiveStudyCase();
printf('Active study case: %o', case);
R ETURNS
Returns currently active IntCase object or NULL in case of no study case being currently
active.
GetAllUsers*
Returns all known users, regardless of any Data Manager filters.
set GetAllUsers([int forceReload = 0])
A RGUMENTS
forceReload
0 Default, returns the cached state if function was called before.
1 Forces the cache to be cleared, may impact performance.
R ETURNS
Returns a container with all known users.
GetBorderCubicles*
This function returns the border cubicles of the parent station of passed element topologically
reachable from that element.
A cubicle (StaCubic) is considered to be a border cubicle if it resides inside the station
12
CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
element Element from which the search for border cubicles starts
R ETURNS
A set, containing border cubicles StaCubic. If the element does not reside in any substation
or no border cubicles exist, the set is empty.
GetBrowserSelection
Returns all objects marked in the “on top” Data Manager (Browser, right side). In comparison to
GetCurrentSelection() this is independently of how the script is executed.
set GetBrowserSelection()
R ETURNS
Objects marked in the “on top” Data Manager (Browser, right side).
S EE ALSO
GetCurrentSelection(), GetDiagramSelection()
GetCalcRelevantObjects*
Returns all currently calculation relevant objects, i.e. the objects which are used by the calcula-
tions.
The set of objects depends on active study case, active grid(s) and variation(s).
In contrast to object.IsCalcRelevant() it does not return objects of the active study case e.g.
simulation events (Evt*).
set GetCalcRelevantObjects([string nameFilter = "*.*",]
[int includeOutOfService = 1,]
[int topoElementsOnly = 0,]
[int bAcSchemes = 0])
A RGUMENTS
nameFilter (optional)
(Class) name filter. Wildcards are supported. Multiple filters to be separated by
comma ’,’. Must not contain a backslash ’\’.
If omitted, all objects are returned (corresponds to ’*.*’).
Examples for valid filter strings:
• ’ElmTerm’
• ’A*.ElmTerm’
• ’*.ElmLod,*.ElmSym’
includeOutOfService (optional)
Flag whether to include out of service objects. Default is 1 (=included).
topoElementsOnly (optional)
Flag to filter for topology relevant objects only. Default is 0 (=all objects).
13
CHAPTER 2. GLOBAL FUNCTIONS
bAcSchemes (optional)
Flag to include hidden objects in active schemes. Default is 0 (=not included).
R ETURNS
The currently calculation relevant objects, according to the given arguments. The order of
the set is undefined.
D EPRECATED N AMES
AllRelevant
S EE ALSO
object.IsCalcRelevant()
E XAMPLE
The following example prints the names of all calculation relevant loads
set loads;
object load;
loads = GetCalcRelevantObjects('*.ElmLod');
for(load = loads.First(); load; load = loads.Next()) {
load.ShowFullName();
}
GetClassDescription*
Returns a description for a PowerFactory class.
string GetClassDescription(string name)
A RGUMENTS
name Name of a PowerFactory class
R ETURNS
Returns the description of a valid PowerFactory class, otherwise an empty string.
GetCurrentDiagram
This function offers access to the current diagram object (IntGrfnet).
object GetCurrentDiagram()
GetCurrentSelection
Returns all objects marked in the “on top” Data Manager (Browser, right side) or diagram when
the script is executed via the right-click menu entry ’Execute Script’. When the script is executed
e.g via the edit dialog or via a toolbar button then it always returns an empty selection.
set GetCurrentSelection()
R ETURNS
Objects marked in the “on top” Data Manager (Browser, right side) or diagram.
14
CHAPTER 2. GLOBAL FUNCTIONS
S EE ALSO
GetBrowserSelection(), GetDiagramSelection()
GetCurrentUser*
Returns the PowerFactory user of current session.
object GetCurrentUser()
E XAMPLE
The following example prints the user of current session to output window:
object user;
user = GetCurrentUser();
printf('Current user: %o', user);
R ETURNS
Returns an IntUser object, never NULL.
GetCurrentZoomScaleLevel
Returns the zoom or scale level of the currently active diagram. If the active diagram is geo-
graphic, then the scale level is returned, otherwise the zoom level is returned.
int GetCurrentZoomScale()
R ETURNS
Zoom or scale level of the active diagram as integer.
• For geographic diagrams the scale level is returned. E.g. returns 50000 if 1:50000 is in
the zoom/ratio combo box
• For all other diagrams the zoom level is returned. E.g. returns 150 if 150
E XAMPLE
int level;
object diagram;
diagram = GetCurrentDiagram();
if (.not. diagram) {
Error('No diagram active!');
exit();
}
level = GetCurrentZoomScaleLevel();
if (diagram:iGPS) {
printf('Scale level of %o: 1:%d', diagram, level);
}
else {
printf('Zoom level of %o: %d%s', diagram, level, '%');
}
15
CHAPTER 2. GLOBAL FUNCTIONS
GetDataFolder*
This function returns the folder in which the network data for the given class are stored.
object GetDataFolder(string classname,
[int iCreate = 0])
A RGUMENTS
classname
Classname of the elements:
ElmBmu
ElmArea
ElmZone
ElmRoute
ElmOwner
ElmOperator
ElmFeeder
ElmCircuit
ElmBoundary
IntScales
iCreate(optional)
0 The folder is searched and returned if found. If the folder does not
exist, NULL is returned (default).
1 The folder is created if it does not exist. The found or created folder is
returned.
R ETURNS
The network data folder, which is found or created.
E XAMPLE
The following example returns the network data folder for 'ElmBoundary' elements:
object folder;
folder = GetDataFolder ('ElmBoundary');
folder.ShowFullName();
S EE ALSO
object.IsNetworkDataFolder()
GetDescription*
Returns the display text or unit of measurement for an attribute.
string GetDescription(string class,
string attribute,
[int type = 0])
16
CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
class Name of the class.
attribute Name of the attribute.
type (optional)
Description type.
0 Default, long form.
1 Short form.
2 Unit.
R ETURNS
Descriptive text or unit, can be empty (e.g. in case where given attribute does not exist).
E XAMPLE
string long, short, unit;
printf('ElmLod:plini means "%s (%s)" and is given in unit %s.', long, short, unit);
S EE ALSO
GetDiagramSelection
Returns all objects marked in the “on top” diagram. In comparison to GetCurrentSelection() this
is independently of how the script is executed.
set GetDiagramSelection()
R ETURNS
Objects marked in the “on top” diagram.
S EE ALSO
GetCurrentSelection(), GetBrowserSelection()
GetFlowOrientation*
This function returns the flow orientation setting of the active project.
int GetFlowOrientation()
R ETURNS
-1 No project is active
0 Flow orientation of active project is “MIXED MODE”
1 Flow orientation of active project is “LOAD ORIENTED”
2 Flow orientation of active project is “GENERATOR ORIENTED”
17
CHAPTER 2. GLOBAL FUNCTIONS
GetFromStudyCase*
Returns the first found object of class “className” from the currently active study case. The
object is created when no object of the given name and/or class was found.
For commands the returned instance corresponds to the one that is used if opened via the main
menue load-flow, short-circuit, transient simulation, etc.,
object GetFromStudyCase(string className)
A RGUMENTS
className
Class name of the object (“Class”), optionally preceded by an object name without
wildcards and a dot (“Name.Class”).
R ETURNS
The found or created object.
D EPRECATED N AMES
GetCaseObject, GetCaseCommand
E XAMPLE
The following example uses the default SetTime object to change the calculation time, and
then executes the load flow command with the name 'Unbalanced'.
object time, ldf;
time = GetFromStudyCase('SetTime');
time:hourofyear = 1234;
ldf = GetFromStudyCase('Unbalanced.ComLdf');
ldf.Execute();
GetGlobalLibrary*
Returns the global library for object-types of class “ClassName”. ClassName may be omitted,
in which case the complete global library folder is returned.
object GetGlobalLib([string ClassName = ""])
A RGUMENTS
ClassName (optional)
The classname of the objects for which the library folder is sought
R ETURNS
The libary folder
S EE ALSO
GetLocalLibrary()
D EPRECATED N AMES
GetGlobalLib
E XAMPLE
The following example shows the contents of the global library for line types.
18
CHAPTER 2. GLOBAL FUNCTIONS
GetGraphicsBoard*
Returns the currently active Graphics Board.
object GetGraphicsBoard()
R ETURNS
The graphics board object
D EPRECATED N AMES
GetGraphBoard
E XAMPLE
The following example looks for an opened Graphics Board and sets its default results to the
results object named 'Results'.
object graphBoard;
! Look for opened graphics board.
graphBoard=GetGraphicsBoard();
if (graphBoard) {
! Set default results object
graphBoard.SetResults(Results);
}
GetLanguage*
Returns a string for the current program language setting.
string GetLanguage()
R ETURNS
en English
de German
es Spanish
fr French
ru Russian
cn Simplified Chinese
tr Turkish
19
CHAPTER 2. GLOBAL FUNCTIONS
GetLastCmd
Returns the last executed command of the given class. If no class is given, the last executed
command is returned.
object GetLastCmd([string class])
A RGUMENTS
class (optional)
command class
R ETURNS
The last executed command.
GetLocalLibrary*
Returns the local library for object-types of class “ClassName”. ClassName may be omitted, in
which case the complete local library folder is returned.
object GetLocalLibrary([string ClassName = ""])
A RGUMENTS
ClassName (optional)
The classname of the objects for which the library folder is sought
R ETURNS
The libary folder
S EE ALSO
GetGlobalLibrary()
D EPRECATED N AMES
GetLocalLib
E XAMPLE
The following example shows the contents of the local library for line types.
object lib, obj;
set contents;
lib = GetLocalLib('TypLne');
contents = lib.GetContents();
obj = contents.First();
while (obj) {
obj.ShowFullName();
obj = contents.Next();
}
GetMem*
Allows to trace memory consumption (current working set size).
int GetMem([int calculateDelta=0],
[int inMegaByte=0]
)
20
CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
calculateDelta (optional)
Measure absolute memory consumption if 0, measure the delta since the last time
it was called if 1 (default: 0).
inMegaByte (optional)
Returns consumption in byte if 0, in megabyte if 1 (default: 0).
R ETURNS
The current working set size or the delta since the last call.
GetPageLen*
Returns the number of lines per page according to the currently selected printer and paper size.
int GetPageLen([int orientation])
A RGUMENTS
orientation (optional)
0 (default) Landscape
1 Portrait
R ETURNS
The maximum number of lines that can be printed on a single sheet of paper in given
orientation.
GetPFVersion*
Returns the internal version number of currently running PowerFactory application.
string GetPFVersion()
R ETURNS
Version string of format ##.#.#.#, e.g. 20.0.3.1
E XAMPLE
string strVersion;
strVersion=GetPFVersion();
printf('%s', strVersion);
GetProjectFolder*
Returns the project folder of a given type of active project. For each type (except ‘Generic’)
there exist not more than one folder per type.
object GetProjectFolder(string type, [int create = 0])
21
CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
type Type of the corresponding project folder. See IntPrjfolder.GetProjectFolderType()
for a list of possible values.
create Optional, default=0. Determines whether folder shall be created if it does not exist
(1=create, 0=don’t create).
R ETURNS
An IntPrjFolder object. If no project is currently active or project folder of this type does not
exist and ’create’ is not given as 0, NULL is returned.
E XAMPLE
The following example returns the study case project folder:
object folder;
folder = GetProjectFolder('study');
folder.ShowFullName();
GetRecordingStage*
Returns the currently active recording scheme stage.
object GetRecordingStage()
R ETURNS
An IntSstage object; NULL if there is no recording stage.
E XAMPLE
The following example returns the currently active recording stage:
object stage;
stage = GetRecordingStage();
stage.ShowFullName();
GetResData
This function is deprecated. Please use ElmRes.GetValue() or IntComtrade.GetValue() in-
stead.
int GetResData(double& d,
object resultObject,
int iX,
[int col])
GetResDesc
This function is deprecated. Please use ElmRes.GetDescription() or
IntComtrade.GetDescription() instead.
string GetResDesc(object resultObject,
int col,
[int ishort])
22
CHAPTER 2. GLOBAL FUNCTIONS
GetResObj
This function is deprecated. Please use ElmRes.GetObject() instead.
object GetResObj(object res,
int col)
GetResUnit
This function is deprecated. Please use ElmRes.GetUnit() or IntComtrade.GetUnit() instead.
string GetResUnit(object resultObject,
int col)
GetResVar
This function is deprecated. Please use ElmRes.GetVariable() or IntComtrade.GetVariable()
instead.
string GetResVar(object resultObject,
int col)
GetSettings*
Offers read-only access to some selected PowerFactory settings.
string GetSettings(string key)
A RGUMENTS
key
Key Return type Description
username string Name of logged-in user
installationdir string Fully qualified path of installation directory of PowerFac-
tory
workingdir string Fully qualified path of working directory of PowerFactory
tempdir string Fully qualified path of temporary directory used by PowerFac-
tory
sessionid integer ID of current session
db driver string Name of used database driver
logfile string Path of current log file
R ETURNS
Value of settings as string
E XAMPLE
The following example demonstrated how to access those settings:
string s;
int i;
s = GetSettings('username');
printf('Username: %s', s);
23
CHAPTER 2. GLOBAL FUNCTIONS
s = GetSettings('installationdir');
printf('InstallationDir: %s', s);
s = GetSettings('workingdir');
printf('WorkingDir: %s', s);
s = GetSettings('tempdir');
printf('TempDir: %s', s);
s = GetSettings('db_driver');
printf('DBDriver: %s', s);
i = GetSettings('sessionid');
printf('SessionID: %d', i);
s = GetSettings('logfile');
printf('Used log file: %s', s);
GetSummaryGrid*
Returns the summary grid in the currently active Study Case. The summary grid is the combi-
nation of all active grids in the study case.
object GetSummaryGrid()
R ETURNS
A ElmNet object, or a 'NULL ' object when no grids are active
D EPRECATED N AMES
SummaryGrid
E XAMPLE
The following example performs a load-flow and returns the total grid active power losses.
object sumGrid;
sumGrid = GetSummaryGrid();
if (sumGrid) {
Ldf.Execute();
printf('Active Power Losses=%f', sumGrid:c:LossP);
}
GetTouchedObjects
Gets all root objects added, modified or deleted in the given variations and expansion stages.
set GetTouchedObjects(object varOrStage)
set GetTouchedObjects(set varsAndStages)
A RGUMENTS
varOrStage
Variation or expansion stage.
24
CHAPTER 2. GLOBAL FUNCTIONS
varsAndStages
Variations and expansion stages.
R ETURNS
Matching root objects.
GetTouchingExpansionStages
Gets all expansion stages in which at least one of the given objects is added, modified or
deleted.
set GetTouchingExpansionStages(object rootObject)
set GetTouchingExpansionStages(set rootObjects)
A RGUMENTS
rootObject
Root object.
rootObjects
Root objects.
R ETURNS
Matching expansion stages.
GetTouchingStageObjects
Gets all stage objects adding, modifying or deleting one of the given objects.
set GetTouchingStageObjects(object rootObject)
set GetTouchingStageObjects(set rootObjects)
A RGUMENTS
rootObject
Root object.
rootObjects
Root objects.
R ETURNS
Matching expansion stages.
GetTouchingVariations
Gets all variations in which at least one of the given objects is added, modified or deleted.
set GetTouchingVariations(object rootObject)
set GetTouchingVariations(set rootObjects)
A RGUMENTS
rootObject
Root objects.
rootObjects
Root objects.
25
CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
Matching variations.
GetUserManager*
Offers access to the user manager object (IntUserman) stored in the configuration folder.
object GetUserManager()
R ETURNS
The user manager object
GetUserSettings*
Convient routine to get the settings object (SetUser) of a user.
object GetUserSettings([object user = NULL])
A RGUMENTS
user (optional)
If current user that executes the function is Administrator, passing a user object
(IntUser) will return the corresponding setting object for that user.
Note: For normal users, the argument is ignored and always the setting object of
current user is returned.
R ETURNS
Returns the settings object (SetUser) for a user.
HttpGet
This function performs a HTTP/HTTPS request and returns the response. Access to the passed
URL must be allowed by the global security settings (IntExtaccess).
int HttpGet(string url,
string& | object& content,
[string& | object& headers,]
[string& error])
A RGUMENTS
url URL to fetch. Only HTTP and HTTPS protocols are supported. Empty or mal-
formed URLs are not allowed. Examples: https://www.digsilent.de
content (out)
Returned content (body) of the http response. The passed argument must be a
string or an instance of class IntDplVec.
26
CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
Standard http code, e.g. 200=OK, 404=Not found etc.
Single exception is a value 1 that is returned in case of a general error
E XAMPLE
int i, ret, size;
string errors, s;
content.Clear(); !content and headers are intended to be IntDplvec
headers.Clear(); !objects stored inside the script
size = headers.Size();
for(i=0; i<size; i+=1) {
s = headers.Get(i);
printf('%s', s);
}
printf('Content:');
size = content.Size();
for(i=0; i<size; i+=1) {
s = content.Get(i);
printf('%s', s);
}
S EE ALSO
IntUrl.View()
ImportDz
Imports a DZ file. Overwrites data if it already exists.
int ImportDz(object target,
string dzFilePath,
set& importedObjects)
A RGUMENTS
target Target object for imported data.
dzFilePath
Path to the DZ file that should be imported.
importedObjects (out)
Collection of top-level objects imported.
R ETURNS
0 Success
-1 Wrong file extension
nonzero Import failed
27
CHAPTER 2. GLOBAL FUNCTIONS
ImportSnapshot
Imports a Snapshot DZS file.
int ImportSnapshot(string dzsFilePath,
set& importedObjects)
A RGUMENTS
dzsFilePath
Path to the DZ file that should be imported.
importedObjects (out)
Collection of top-level objects imported.
R ETURNS
0 Success
-1 Wrong file extension
nonzero Import failed
IsLdfValid*
Checks to see if the last load-flow results are still valid and available.
int IsLdfValid()
R ETURNS
0 if no load-flow results are available
D EPRECATED N AMES
validLDF
E XAMPLE
The following example checks if a load-flow is available, and performs one when not.
int valid;
valid = IsLdfValid();
if (.not.valid) {
Ldf.Execute();
}
IsNAN*
Checks whether a double value is NAN (not a number).
int IsNAN(double value)
A RGUMENTS
value Double value to check.
R ETURNS
Returns 1, if value is NAN, 0 otherwise.
28
CHAPTER 2. GLOBAL FUNCTIONS
IsRmsValid*
Checks to see if the last RMS simulation results are still valid and available.
int IsRmsValid()
R ETURNS
0 if no RMS simulation results are available
D EPRECATED N AMES
validRMS
E XAMPLE
The following example checks if a RMS simulation is available, and performs one when not.
int valid;
valid = IsRmsValid();
if (.not.valid) {
Rms.Execute();
}
IsScenarioAttribute*
Checks if a given attribute of a given class is recorded in scenario. It does not check whether a
concrete instance is recorded at all. The check is just performed against the scenario configu-
ration and is independent of a concrete scenario.
int IsScenarioAttribute(string classname, string attributename)
A RGUMENTS
classname
Name of a PowerFactory class
attributename
Name of an attribute of given class
E XAMPLE
int t;
t = IsScenarioAttribute('ElmTerm', 'loc_name');
if (t=1) {
printf('Attribute loc_name of class ElmTerm can be recorded by a scenario');
}
else {
printf('Attribute loc_name of class ElmTerm cannot be recorded by a scenario');
}
t = IsScenarioAttribute('ElmTerm', 'iEarth');
if (t=1) {
printf('Attribute iEarth of class ElmTerm can be recorded by a scenario');
}
else {
printf('Attribute iEarth of class ElmTerm cannot be recorded by a scenario');
}
29
CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
1 If attribute is scenario relevant according to current scenario configuration
0 If attribute is not scenario relevant
IsShcValid*
Checks to see if the last short-circuit results are still valid and available.
int IsShcValid()
R ETURNS
0 if no short-circuit results are available
D EPRECATED N AMES
validSHC
E XAMPLE
The following example checks if a short-circuit result is available, and performs one when
not.
int valid;
valid = IsShcValid();
if (.not.valid) {
Shc.Execute();
}
IsSimValid*
Checks to see if the last simulation results are still valid and available.
int IsSimValid()
R ETURNS
0 if no simulation results are available
D EPRECATED N AMES
validSIM
E XAMPLE
The following example checks if a simulation result is available.
int valid;
valid = validSIM();
if (.not.valid) {
printf('No simulation result available');
}
30
CHAPTER 2. GLOBAL FUNCTIONS
LicenceHasModule
Checks whether the current licence contains a module.
The following licence module abbreviations can be used:
• ai - Artificial Intelligence
• anaredefas - ANAREDE/ANAFAS Export
• arcflash - Arc-Flash Analysis
31
CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
module Abbreviated name of the licence module, e.g. ”prot”. See list above.
R ETURNS
1 Module is contained in the current licence. Corresponding functionality can be
used.
0 Module is not contained in the current licence.
LoadProfile
Activates a profile for current user. This corresponds to the select profile action via main menu
“TOOLS-Profiles”.
int LoadProfile(string profileName)
A RGUMENTS
profileName
Name of profile to be loaded.
R ETURNS
0 On error, e.g. profile with given name not found.
1 On success.
E XAMPLE
The following example demonstrates how to active the ’Base Package’ profile
int ret;
32
CHAPTER 2. GLOBAL FUNCTIONS
S EE ALSO
ReloadProfile()
LoadResData
This function is deprecated. Please use ElmRes.Load() or IntComtrade.Load() instead.
void LoadResData(object resultObject)
MarkInGraphics
This function is not supported in GUI-less mode.
Marks all objects in the diagram in which the elements are found by hatch crossing them.
void MarkInGraphics(set objects,
[int searchOpenedDiagramsOnly = 0])
A RGUMENTS
objects Objects to be marked.
searchOpenedDiagramsOnly (optional)
Search can be restricted to currently shown diagrams on the desktop, instead of
all diagrams.
0 Searching all diagrams, not only the ones which are currently shown
on the desktop. If there is more than one occurrence the user will be
prompted which diagrams shall be opened (default).
1 Only search in currently opened diagrams and open the first diagram
in which the elements were found.
E XAMPLE
The following example will mark a set of lines in the currently visible diagram or if not found
in one of the other diagrams which are currently opened .
set lines;
lines = GetCalcRelevantObjects('*.ElmLne');
MarkInGraphics(lines, 1);
OutputFlexibleData*
Outputs the Flexible Data of the given objects to the output window.
Has identical functionality to that implemented in the Object Filter dialogue, whereby the user
can right-click on a single row or multiple rows in a Flexible Data page and select Output
. . . Flexible Data. The OutputFlexibleData() function assumes that the user has already defined
a Flexible Data page for the objects in the set. Upon execution of this function, all Flexible
Data defined for the objects in the set is output to the PowerFactory output window in a tabular
format.
void OutputFlexibleData(set objects,
[string flexibleDataPage = ''])
33
CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
objects Objects to output the Flexible Data for.
flexibleDataPage (optional)
Name of the Flexible Data page to be outputed. If multiple Flexible Data pages
are defined and no or an empty string is given then a dialog to select a Flexible
Data page is shown.
E XAMPLE
The following example collects all lines and terminals which are relevant to the calculation
and output their defined Flexible Data to the output window:
set elements;
elements = GetCalcRelevantObjects('*.ElmLne,*.ElmTerm');
OutputFlexibleData(elements);
PostCommand
Adds a command as string to the command pipe of the “input window”. The posted command
string will be executed after the currently running script has finished.
void PostCommand(string commandString)
void PostCommand(object command)
A RGUMENTS
commandString
A command as string e.g ’exit’ for ComExit.
command
A command. Internally the command is converted to a command string including
all its properties.
E XAMPLE
The following command causes PowerFactory to end after the DPL script has finished.
PostCommand('exit');
PrepForUntouchedDelete
Mark (as not modified) all objects stored in the grid (or stored in set). Required for function
DeleteUntouchedObjects().
void PrepForUntouchedDelete(object grid)
void PrepForUntouchedDelete(set grids)
Rebuild*
Rebuilds the currently visible single line diagram or plot.
void Rebuild([int iMode = 1])
34
CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
iMode (optional)
0 Draws graphic objects only
1 (default) Reads graphic objects (IntGrf) from database and draws
2 For single line diagrams: Reads graphic objects (IntGrf) from database,
re-calculates intersections and draws.
For plot pages: Adjust view to page format and re-create plots.
E XAMPLE
Rebuild(1); !typical usage to perform a single line diagram update
ReleaseResData
This function is deprecated. Please use ElmRes.Release() or IntComtrade.Release() instead.
void ReleaseResData(object resultObject)
ReloadProfile
Reloads currently selected user profile. (See main menue “TOOLS-Profiles”)
void ReloadProfile()
S EE ALSO
LoadProfile()
ResetCalculation
Resets all calculations and deletes all calculation results.
Results that have been written to result objects (for display in graphs) will not be destroyed. All
results that are visible in the single line diagrams, however, will be destroyed.
void ResetCalculation()
S EE ALSO
IsAutomaticCalculationResetEnabled(), SetAutomaticCalculationResetEnabled()
ResFirstValidObject
This function is deprecated. Please use ElmRes.GetFirstValidObject() instead.
int ResFirstValidObject(object resultFile,
int row,
[string classNames,]
[string variableName,]
[double limit,]
[int limitOperator,]
[double limit2,]
[int limitOperator2])
35
CHAPTER 2. GLOBAL FUNCTIONS
ResFirstValidObjectVar
This function is deprecated. Please use ElmRes.GetFirstValidObjectVariable() instead.
int ResFirstValidObjectVar(object resultFile,
[string variableNames])
ResFirstValidVar
This function is deprecated. Please use ElmRes.GetFirstValidVariable() instead.
int ResFirstValidVar(object resultFile,
int row,
[string variableNames])
ResGetMax
This function is deprecated. Please use ElmRes.FindMaxInColumn() or
IntComtrade.FindMaxInColumn() instead.
int ResGetMax(object resultFile,
int col,
[double& value])
ResGetMin
This function is deprecated. Please use ElmRes.FindMinInColumn() or
IntComtrade.FindMinInColumn() instead.
int ResGetMin(object resultFile,
int col,
[double& value])
ResIndex
This function is deprecated. Please use ElmRes.FindColumn() or IntComtrade.FindColumn()
instead.
int ResIndex(object resultFile,
object obj,
[string varName])
int ResIndex(object resultFile,
object obj,
[int colIndex])
int ResIndex(object resultFile,
[string varName,]
[int colIndex])
36
CHAPTER 2. GLOBAL FUNCTIONS
ResNextValidObject
This function is deprecated. Please use ElmRes.GetNextValidObject() instead.
int ResNextValidObject(object resultFile,
[string classNames,]
[string variableName,]
[double limit,]
[int limitOperator,]
[double limit2,]
[int limitOperator2])
int ResNextValidObject(object resultFile,
set objects)
ResNextValidObjectVar
This function is deprecated. Please use ElmRes.GetNextValidObjectVariable() instead.
int ResNextValidObjectVar(object resultFile,
[string variableNames])
ResNextValidVar
This function is deprecated. Please use ElmRes.GetNextValidVariable() instead.
int ResNextValidVar(object resultFile,
[string variableNames])
ResNval
This function is deprecated. Please use ElmRes.GetNumberOfRows() or
IntComtrade.GetNumberOfRows() instead.
int ResNval(object resultObject,
[int col])
ResNvars
This function is deprecated. Please use ElmRes.GetNumberOfColumns() or
IntComtrade.GetNumberOfColumns() instead.
int ResNvars(object resultObject)
ResSortToVar
This function is deprecated. Please use ElmRes.SortAccordingToColumn() or
IntComtrade.SortAccordingToColumn() instead.
int ResSortToVar(object resultObject,
int col)
37
CHAPTER 2. GLOBAL FUNCTIONS
SaveAsScenario
Saves the operational data or relevant network elements as a new scenario.
object SaveAsScenario(string pName,
int iSetActive)
A RGUMENTS
pName Name of the new scenario.
iSetActive
1 Activate the new scenario afterwards.
0 Do not activate the new scenario.
R ETURNS
Returns newly created IntScenario object. NULL is returned in case of creation of a new
scenario was not allowed (e.g. no active project).
D EPRECATED N AMES
SaveScenarioAs
E XAMPLE
The following example demonstrates how to save a scenario:
object scenario;
scenario = SaveAsScenario('NewScenario', 0); ! do not activate the new scenario
printf('The following scenario was created: %o', scenario);
SearchObjectByForeignKey*
Searches for an object by foreign key within an active project.
object SearchObjectByForeignKey(string foreignKey)
A RGUMENTS
foreignKey
Foreign key
R ETURNS
Object if found, otherwise NULL.
E XAMPLE
The following example shows how to search for an object by foreign key:
object obj;
str foreignKey;
foreignKey = '...';
obj = SearchObjectByForeignKey(foreignKey);
printf('Object found: %o', obj);
38
CHAPTER 2. GLOBAL FUNCTIONS
SelectToolbox
Sets tool box to be displayed at a switchable tool box group.
int SelectToolbox(int toolbar,
string groupName,
string toolboxName)
A RGUMENTS
toolbar 1 Main tool bar
2 Drawing tool bar (SGL)
groupName
Name of tool box group.
toolboxName
Name of tool box to be selected.
R ETURNS
0 On error, e.g. no matching tool box found.
1 On success.
SetShowAllUsers
Enables or disables the filtering of all available users in data manager. All users are only
visualised in data manager when enabled.
int SetShowAllUsers(int enabled)
A RGUMENTS
enabled
0 Disabled, only Demo, Public Area Users and current user are shown
1 Enabled, all available users are listed
R ETURNS
Returns previous setting.
1 If enabled before.
0 If disabled before.
Sleep*
Suspends the execution of the script for given duration.
void Sleep(double duration)
A RGUMENTS
duration Duration in milliseconds
39
CHAPTER 2. GLOBAL FUNCTIONS
SplitLine
Splits the passed line or ElmBranch-object at a given position
object SplitLine(object Line,
[double percent = 50,]
[int createSwitchSide0 = 0,]
[int createSwitchSide1 = 0])
A RGUMENTS
double rPercent (optional)
Position in percent from the first connection side where line shall be split.
int iCreateSwitchSide0 (optional)
R ETURNS
Inserted terminal
0 = error
StatFileGetXrange
Gets the x-range for the statistic result file.
int StatFileGetXrange(double& min,
double& max)
A RGUMENTS
min (out) First point in time considered in statistics.
max (out) Last point in time considered in statistics.
R ETURNS
0 If time range of statistic result file was found.
1 On errors (There is no statistic result file).
StatFileResetXrange
Reset the user defined x-range of the statistic result file. The complete x-range will be consid-
ered in the statistic results after calling this function.
void StatFileResetXrange()
40
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
StatFileSetXrange
Sets the user defined x-range of the statistic result file. The statistic results consider only the
given time range.
void StatFileSetXrange(double min,
double max)
A RGUMENTS
min First point in time to be considered in statistics.
max Last point in time to be considered in statistics.
CheckFileExists*
CopyFile*
CreateDir*
fclose*
fflush*
fopen*
fprintf*
fscanf*
fscanfsep*
GetDirectories*
GetFileDate*
GetFiles*
GetInstallationDirectory*
GetTemporaryDirectory*
GetWorkspaceDirectory*
CheckFileExists*
Checks if a file exists.
int CheckFileExists(string filename)
A RGUMENTS
filename Name and path of a file.
The file name can contain characters such as ’*’ and ’?’. In case of wildcard
characters are used, the function searches for existence of any file that matches
the criteria.
Example e.g. ’c:\*.exe’ to search for any executable on drive C.
R ETURNS
Returns 1 if exists, 0 otherwise.
E XAMPLE
Checks for existence of Windows Help Viewer:
int exists;
string file;
41
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
file = 'C:\Windows\winhlp32.exe';
exists = CheckFileExists(file);
if (exists = 1) {
printf('File "%s" exists', file);
}
else {
printf('File "%s" does not exist', file);
}
R ETURNS
1 If file exists
0 If file does not exist
S EE ALSO
GetDirectories(), GetFiles()
CopyFile*
Creates a copy of a file.
int CopyFile(string sourceFile, string targetFile)
A RGUMENTS
sourceFile
Path and name of the file to copy
R ETURNS
1 if successfull, 0 if not.
E XAMPLE
The following example creates a copy of a file and prints the result code of CopyFile.
string sourceFile;
string targetFile;
int success;
sourceFile = 'E:\tmp\source.txt';
targetFile = 'E:\tmp\target.txt';
success = CopyFile(sourceFile, targetFile);
printf('CopyFile returned %d', success);
CreateDir*
Creates a complete directory path with all neccessary subdirectories.
void CreateDir(string path)
42
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
path The path that should be created
fclose*
Closes a file previously opened by fopen().
Please note, calling the fclose for a currently not opened or invalid file handle will result in a
scripting error.
void fclose(int handleNumber)
A RGUMENTS
handleNumber
File handle number of an open file (see fopen()).
S EE ALSO
fopen()
fflush*
Writes all content of the associated buffer to the file.
void fflush(int handleNumber)
A RGUMENTS
handleNumber
File handle number of an open file (see fopen()).
fopen*
Opens a file for output or input. The function fclose() is to be called for closing the file and
releasing the handle.
int fopen(string filename,
string mode,
int handleNumber,
[int continueScriptOnError])
A RGUMENTS
filename Path of file to open. Path must exist. File could be created depending on the
’mode’
mode Access mode for opening the file (r,w,a,r+,w+,a+,rb,wb,ab,r+b,w+b,a+b).
Same as used for C++ fopen().
handleNumber
≥ 0, file handle number to be used for accessing the file.
continueScriptOnError (optional)
0 Default. In case of an error the script will be stopped and an error
messagebox will appear.
1 Function will return a proper execution code informing about the suc-
cess of the open action.
43
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
0 On success.
1 On error.
S EE ALSO
E XAMPLE
The following example demonstrates a basic writing and writing process:
int i, ret;
string line;
44
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
fprintf*
Prints a formatted string to a file and automatically inserts a line-break.
The DPL script stops with an appropriate error when the passed arguments don’t match the
format string. The line-break insertion can be disabled with SetLineFeed().
string fprintf(int handleNumber,
string format,
[int|double|string|object argument0,]
[...])
A RGUMENTS
handleNumber
File handle number of an open file (see fopen()).
format C++-like printf() format string. See the Format String Syntax for more information.
argument... (optional)
Arguments matching the format string.
R ETURNS
The printed string.
S EE ALSO
E XAMPLE
double x;
int i;
string s;
fopen('e:\tmp\test.txt','w',0);
x = 123456789.987654321;
i = 2468;
s = 'hello dpl';
fprintf(0,'string:%s int=%d double=%f', s,i,x);
fclose(0);
fscanf*
Parses a line of values which are separated by comma or tabulator from the file according
the given format. Each parsed value is stored into the passed arguments. Empty tokens are
skipped.
int fscanf(int handleNumber,
string format,
[int|double|string argument0,]
[...])
A RGUMENTS
handleNumber
File handle number of an open file (see fopen()).
format C++-like printf() format string. See the Format String Syntax for more information.
Only int, double and string types are supported.
argument... (optional)
Arguments matching the format string.
45
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
≥0 Number of values successfully converted and assigned.
−1 On error.
S EE ALSO
fscanfsep(), fprintf()
E XAMPLE
The file 'test.txt'
249.87 Hz
250.11 Hz
while (result>=0) {
result = fscanf(0, '%f %s', freq, unit);
printf('%f %s (result = %d)', freq, unit, result);
}
fclose(0);
! Output:
! 249,870000 Hz (result = 2)
! 250,110000 Hz (result = 2)
! 250,110000 Hz (result = -1)
fscanfsep*
Parses a line of values which are separated by a separation character from the file according
the given format. Each parsed value is stored into the passed arguments. Empty tokens are
skipped.
int fscanfsep(int handleNumber,
string format,
[int|double|string argument0,]
[...],
string separator,
[int stopAfterLine = 0]
)
A RGUMENTS
handleNumber
File handle number of an open file (see fopen()).
format C++-like printf() format string. See the Format String Syntax for more information.
Only int, double and string types are supported.
argument... (optional)
Arguments matching the format string.
46
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
≥0 Number of values successfully parsed and stored.
−1 On error.
S EE ALSO
fscanf(), fprintf()
E XAMPLE
The file 'test.txt'
249.87;Hz;
250.11;Hz;
fopen('e:\tmp\test.txt','r', 0);
GetDirectories*
Searches a given directory with optional filter criteria for subdirectories and stores the result in
an IntDplvec. The directory must either end with a backslash or a filter, e.g. ’example*’.
void GetDirectories(string directory,
object resultVec)
A RGUMENTS
directory Path with optional filter of the search directory
resultVec IntDplvec with the found directory names
E XAMPLE
Searches a directory for all subdirectories beginning with ’example’ and prints them to the
Output Window. The script requires ’vec’ to be an IntDplvec stored below the script.
47
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
int vecSize;
int i;
string fileName;
vec.Clear();
GetDirectories('E:\\tmp\\example*', vec);
vecSize = vec.Size();
GetFileDate*
Returns the last modification date of given file.
string GetFileDate(string file)
A RGUMENTS
file File name, either absolute or relative
R ETURNS
Last modification date of given file for local timezone in format ”YYYY-MM-DD HH:MM:SS”,
e.g. ”2009-09-08 15:29:40”. An empty string is returned in case that the file does not exist or
access is denied.
S EE ALSO
CheckFileExists()
GetFiles*
Searches a given directory with optional filter criteria for files and stores the result in an IntD-
plvec. The directory must either end with a backslash or a file filter, e.g. ’*.TXT’.
void GetFiles(string directory,
object resultVec)
A RGUMENTS
directory Path with optional filter of the search directory
resultVec IntDplvec with the found file names
E XAMPLE
Searches a directory for all files ending with ’dgs’ and prints them to the Output Window. The
script requires ’vec’ to be an IntDplvec stored below the script.
int vecSize;
int i;
string fileName;
vec.Clear();
GetFiles('E:\\tmp\\*.dgs', vec);
48
2.1. FILE SYSTEM CHAPTER 2. GLOBAL FUNCTIONS
vecSize = vec.Size();
GetInstallationDirectory*
Returns the installation directory of PowerFactory .
string GetInstallationDirectory()
R ETURNS
Full path to installation directory of current PowerFactory .
D EPRECATED N AMES
GetInstallDir
S EE ALSO
GetTemporaryDirectory(), GetWorkspaceDirectory()
GetTemporaryDirectory*
Returns the temporary directory of used by PowerFactory .
string GetTemporaryDirectory()
R ETURNS
Full path to a directory where temporary data can be stored. This directory is also used by
PowerFactory to store temporary data.
D EPRECATED N AMES
GetTempDir
S EE ALSO
GetWorkspaceDirectory(), GetInstallationDirectory()
GetWorkspaceDirectory*
Returns the workspace directory of PowerFactory .
string GetWorkspaceDirectory()
R ETURNS
Full path to the directory where currently used workspace is stored.
D EPRECATED N AMES
GetWorkingDir
49
2.2. DATE/TIME CHAPTER 2. GLOBAL FUNCTIONS
S EE ALSO
GetTemporaryDirectory(), GetInstallationDirectory()
2.2 Date/Time
Overview
FormatDateLT*
FormatDateUTC*
GetStudyTimeObject*
GetSystemTime*
GetSystemTimeUTC*
GetTime*
ParseDateLT*
ParseDateUTC*
strftime*
FormatDateLT*
Creates a formatted date string. The time must be given in seconds elapsed since 01.01.1970
00:00 in UTC and is converted to a display string in local time.
string FormatDateLT(string format,
int timeInSecondsUTC)
A RGUMENTS
format
%d Day of month as integer (01..31).
%H Hour in 24-hour format (00..23).
%m Month as integer (01..12).
%M Minute as integer (00..59).
%S Second as integer (00..59).
%Y Year with century, as integer.
timeInSecondsUTC
Time in seconds since 01.01.1970 00:00 in UTC.
R ETURNS
Formatted date string in local time.
E XAMPLE
The following example gets the formatted date string in local time:
string str;
int t;
t = 1180703210;
str = FormatDateLT('%Y-%m-%d %H:%M:%S', t);
!Output: 1180703210 seconds in utc -> local time string 2007-06-01 15:06:50
50
2.2. DATE/TIME CHAPTER 2. GLOBAL FUNCTIONS
FormatDateUTC*
Creates a formatted date string. The time must be given in seconds elapsed since 01.01.1970
00:00 and is considered to be in UTC time. No time zone corrections are done.
string FormatDateUTC(string format,
int timeInSecondsUTC)
A RGUMENTS
format
%a Abbreviated weekday name.
%A Full weekday name.
%b Abbreviated month name.
%B Full month name.
%c Date and time representation appropriate for locale.
%d Day of month as integer (01..31).
%H Hour in 24-hour format (00..23).
%I Hour in 12-hour format (01..12).
%j Day of year as integer (001..366).
%m Month as integer (01..12).
%M Minute as integer (00..59).
%p Current locale’s A.M./P.M. indicator for 12-hour clock.
%S Second as integer (00..59).
%U Week of year as integer, Sunday as first day of week (00..53).
%w Weekday as integer (0..6; Sunday is 0).
%W Week of year as integer, Monday as first day of week (00..53).
%x Date representation for current locale.
%X Time representation for current locale.
%y Year without century, as integer (00..99).
%Y Year with century, as integer.
%tz Time-zone as offset (+/- hh:mm), always +00:00.
%% Percent sign.
timeInSecondsUTC
Time in seconds since 01.01.1970 00:00 in UTC time.
R ETURNS
Formatted date string.
E XAMPLE
The following example gets the formatted date string:
string date;
int seconds;
!Output: 2006-07-25T15:13:46+00:00
seconds = GetSystemTimeUTC();
51
2.2. DATE/TIME CHAPTER 2. GLOBAL FUNCTIONS
GetStudyTimeObject*
Returns the date and time object (SetTime) from the study case. This is the object being used
by the characteristics, scenarios, ...
object GetStudyTimeObject()
R ETURNS
SetTime or NULL.
E XAMPLE
The following example uses the default SetTime object to change the calculation time, and
then executes the load flow command with the name 'Unbalanced'.
object time, ldf;
time = GetStudyTimeObject();
time:hourofyear = 1234;
ldf = GetFromStudyCase('Unbalanced.ComLdf');
ldf.Execute();
GetSystemTime*
Returns the current system time in seconds since 00:00 01.01.1970GMT. This time is always in
local time. For getting the time in UTC, a function GetSystemTimeUTC() is available.
int GetSystemTime()
R ETURNS
Current system time in seconds since 00:00 01.01.1970GMT
E XAMPLE
The following example gets the current system time in seconds:
int seconds;
seconds = GetSystemTime();
printf('Now in local time %d', seconds);
52
2.2. DATE/TIME CHAPTER 2. GLOBAL FUNCTIONS
GetSystemTimeUTC*
Returns the current system time in seconds since 00:00 01.01.1970GMT. This time is always in
UTC. For getting the local time, a function GetSystemTime() is available.
int GetSystemTimeUTC()
R ETURNS
Current system time in seconds since 00:00 01.01.1970GMT for UTC zone.
E XAMPLE
The following example gets the current system time in UTC seconds:
int seconds;
seconds = GetSystemTimeUTC();
printf('Now in UTC seconds %d', seconds);
GetTime*
Returns current processor time.
double GetTime(int precision)
A RGUMENTS
precision Precision after decimal point
R ETURNS
Current processor time in seconds
ParseDateLT*
Parses a given date string that represents a date in local time and returns the corresponding
UTC time in seconds elapsed since 01.01.1970 00:00 UTC.
int ParseDateLT(string format,
string date)
A RGUMENTS
format
%d Day of month as integer (01..31).
%H Hour in 24-hour format (00..23).
%m Month as integer (01..12).
%M Minute as integer (00..59).
%S Second as integer (00..59).
%Y Year with century, as integer.
R ETURNS
Date in seconds since 00:00 01.01.1970 UTC.
53
2.2. DATE/TIME CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
The following example returns the date in seconds since 00:00 01.01.1970 UTC:
string date;
int t;
!Output: 1180703210
ParseDateUTC*
Parses a given date string and returns the date in seconds elapsed since 01.01.1970 00:00
UTC. If a time zone is given and specified in format string this information is used to convert the
seconds to UTC.
int ParseDateUTC(string format,
string date)
A RGUMENTS
format
%d Day of month as integer (01..31).
%H Hour in 24-hour format (00..23).
%m Month as integer (01..12).
%M Minute as integer (00..59).
%S Second as integer (00..59).
%Y Year with century, as integer.
date Formatted date string.
R ETURNS
Date in seconds since 00:00 01.01.1970 UTC that is represented by given date string.
E XAMPLE
The following example returns the date in seconds since 00:00 01.01.1970 UTC:
int t;
!Output: 0
!Output: 3600
!Output: 1153828740
54
2.2. DATE/TIME CHAPTER 2. GLOBAL FUNCTIONS
strftime*
Creates a formatted time string.
string strftime(string format, int time)
A RGUMENTS
Format The format string The following formatting codes are recognized in the format
string.
%a Abbreviated weekday name.
%A Full weekday name.
%b Abbreviated month name.
%B Full month name.
%c Date and time representation appropriate for locale.
%d Day of month as integer (01..31).
%H Hour in 24-hour format (00..23).
%I Hour in 12-hour format (01..12).
%j Day of year as integer (001..366).
%m Month as integer (01..12).
%M Minute as integer (00..59).
%p Current locale’s A.M./P.M. indicator for 12-hour clock.
%S Second as integer (00..59).
%U Week of year as integer, Sunday as first day of week (00..53).
%w Weekday as integer (0..6; Sunday is 0).
%W Week of year as integer, Monday as first day of week (00..53).
%x Date representation for current locale.
%X Time representation for current locale.
%y Year without century, as integer (00..99).
%Y Year with century, as integer.
%z, %Z Time-zone name or abbreviation; no characters if zone is unknown.
%% Percent sign.
R ETURNS
The formatted time string.
D EPRECATED N AMES
FormatDate
E XAMPLE
The following example shows the date.
str = strftime('Today is %A, day %d of %B in the year %Y.');
printf('%s', str);
55
2.3. DIALOGUE BOXES CHAPTER 2. GLOBAL FUNCTIONS
CloseTableReports
GetTableReports
input
MessageBox
ShowModalBrowser
ShowModalOpenFileDialog
ShowModalSaveFileDialog
ShowModalSelectBrowser
ShowModalSelectFolderDialog
ShowModelessBrowser
UpdateTableReports
CloseTableReports
This function is not supported in GUI-less mode.
GetTableReports
This function is not supported in GUI-less mode.
input
This function is not supported in GUI-less mode.
Provides the possibility to get user input during the execution of a DPL script. When executed,
an input box is displayed. The execution of the script pauses until the user presses the OK
button. On cancel, the running DPL script is aborted.
void input(string& inputStr,
string msg,
[int length = 18])
void input(double& inputDbl,
string msg,
[int length = 18])
A RGUMENTS
inputStr — inputDbl (out)
Output variable that will hold the user's input; depending on the type, the input is
returned as string or as double.
msg Message displayed in the input box.
56
2.3. DIALOGUE BOXES CHAPTER 2. GLOBAL FUNCTIONS
length (optional)
The input is limited to 'length' characters, 18 by default. -1 leads to an unlimited
input for string input.
R ETURNS
Please note, that the execution of the script is aborted if the user cancels the input request.
E XAMPLE
The following example displays first an input box to enter a number and then to enter a text:
double number;
string text;
MessageBox
This function is not supported in GUI-less mode.
MessageBox shows a message box while pausing the execution of a DPL script, and then
returns the pressed button.
int MessageBox(string title,
string message,
[int buttons = 1,]
[int defaultButton = 1]
[int icon = 1])
A RGUMENTS
title Title of the message box
message Message displayed in the message box
buttons (optional)
Flag for the buttons of the message box (default 1)
1 Ok button (default)
2 Cancel button
4 Yes button
8 ’Yes to all’ button
16 No button
defaultButton (optional)
Default button of the message box (default 1)
icon (optional)
Icon of the message box (default 0)
0 Information icon
1 Question icon
2 Warning icon
3 Error icon
57
2.3. DIALOGUE BOXES CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
Returns an integer for the pressed button.
E XAMPLE
int res;
58
2.3. DIALOGUE BOXES CHAPTER 2. GLOBAL FUNCTIONS
ShowModalBrowser
This function is not supported in GUI-less mode.
A RGUMENTS
objects Objects to be listed. The listing is in detailed mode, if only one kind of objects (e.g.
only ElmTerm) is contained.
detailMode (optional)
0 Show browser in normal mode (default).
1 Show browser in detail mode.
title (optional)
String for user defined window title. The default window title is shown when no or
an empty string is given.
page (optional)
Name of page to be shown in browser e.g. 'Flexible Data' (only in detailed mode).
The default page is shown when no or an empty string is given.
ShowModalOpenFileDialog
This function is not supported in GUI-less mode.
Opens a modal Open File dialogue which prompts the user to select an existing file.
string ShowModalOpenFileDialog([string title = '',]
[string filters = '',]
[string initialPath = ''])
A RGUMENTS
title (optional)
The title of the dialogue. If this argument is not provided or an empty string, a
suitable default title is used instead.
filters (optional)
Available file extension filters. A filter is specified by giving
• a non-empty filter description which may consist of multiple words, but no
parentheses (e.g. 'Image files') and
• a semicolon-separated list of extensions (each starting with the prefix '*.') in
parentheses (e.g '(*.jpg; *.jpeg; *.png; *.bmp)').
Please note that the filter selection field in the file dialogue will show the filter
description and the corresponding extensions. Multiple filter definitions are sepa-
rated by semicolons (e.g. 'Filter one (*.txt; *.out); Filter two (*.py; *.pyc); All Files
(*.*)'). If multiple filter definitions are provided, the first filter in the list is selected
when the dialogue is shown. If this argument is not provided or an empty string,
an All files filter is used which allows the selection of any file.
initialPath (optional)
The folder to be displayed when the dialogue is shown. If this argument is not
provided or an empty string, a suitable folder is used as initial location.
59
2.3. DIALOGUE BOXES CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
The path to the file selected by the user. If the user cancels the dialogue, an empty string is
returned instead.
E XAMPLE
string title, filters, initialPath, selectedFile;
int pathLength;
pathLength = strlen(selectedFile);
if (pathLength > 0) {
! a file path has been provided by the user
printf('User selected the file %s', selectedFile);
}
else {
! the user cancelled the file dialogue
printf('User cancelled the dialogue');
}
S EE ALSO
ShowModalSaveFileDialog(), ShowModalSelectFolderDialog()
ShowModalSaveFileDialog
This function is not supported in GUI-less mode.
Opens a modal Save File dialogue which prompts the user to specify a file. If the user chooses
an existing file, they are asked if they want to replace the existing file.
string ShowModalSaveFileDialog([string title = '',]
[string filters = '',]
[string initialPath = ''])
A RGUMENTS
title (optional)
The title of the dialogue. If this argument is not provided or an empty string, a
suitable default title is used instead.
filters (optional)
Available file extension filters. A filter is specified by giving
• a non-empty filter description which may consist of multiple words, but no
parentheses (e.g. 'Image files') and
• a semicolon-separated list of extensions (each starting with the prefix '*.') in
parentheses (e.g '(*.jpg; *.jpeg; *.png; *.bmp)').
Please note that the filter selection field in the file dialogue will show the filter
description and the corresponding extensions. Multiple filter definitions are sepa-
rated by semicolons (e.g. 'Filter one (*.txt; *.out); Filter two (*.py; *.pyc); All Files
(*.*)'). If multiple filter definitions are provided, the first filter in the list is selected
when the dialogue is shown. If this argument is not provided or an empty string,
60
2.3. DIALOGUE BOXES CHAPTER 2. GLOBAL FUNCTIONS
an All files filter is used which allows the selection of any file. Please note that
if the user enters a file name and does not provide an extension from the active
filter, the first extension of the active filter is appended automatically.
initialPath (optional)
The folder to be displayed when the dialogue is shown. If this argument is not
provided or an empty string, a suitable folder is used as initial location.
R ETURNS
The path to the file specified by the user. If the user cancels the dialogue, an empty string is
returned instead.
E XAMPLE
string title, filters, initialPath, selectedFile;
int pathLength;
pathLength = strlen(selectedFile);
if (pathLength > 0) {
! a file path has been provided by the user
printf('User selected the file %s', selectedFile);
}
else {
! the user cancelled the file dialogue
printf('User cancelled the dialogue');
}
S EE ALSO
ShowModalOpenFileDialog(), ShowModalSelectFolderDialog()
ShowModalSelectBrowser
This function is not supported in GUI-less mode.
Opens a modal browser window and lists all given objects. The user can make a selection from
the list.
set ShowModalSelectBrowser(set objects,
[string title,]
[string classFilter,]
[string page = ''])
A RGUMENTS
objects Objects to be listed. The listing is in detailed mode, if only one kind of objects (e.g.
only ElmTerm) is contained.
title (optional)
String for user defined window title. The default window title is shown when no or
an empty string is given.
61
2.3. DIALOGUE BOXES CHAPTER 2. GLOBAL FUNCTIONS
classFilter (optional)
Class name filter. If set, only objects matching that filter will be listed in the dialog
e.g. ’Elm*’, ’ElmTr?’ or ’ElmTr2,ElmTr3’.
page (optional)
Name of page to be shown in browser e.g. 'Flexible Data' (only in detailed mode).
The default page is shown when no or an empty string is given.
R ETURNS
Set of selected objects. The set is empty if “cancel” is pressed.
ShowModalSelectFolderDialog
This function is not supported in GUI-less mode.
Opens a modal Select Folder dialogue which prompts the user to select a folder.
string ShowModalSelectFolderDialog([string description = '',]
[string initialPath = ''])
A RGUMENTS
description (optional)
The text shown above the folder selection field of the dialogue. If this argument is
not provided or an empty string, a suitable default description is used instead.
initialPath (optional)
The folder to select when the dialogue is shown. If this argument is not provided
or an empty string, a suitable folder is used as initial selection.
R ETURNS
The path to the folder specified by the user. If the user cancels the dialogue, an empty string
is returned instead.
E XAMPLE
string description, initialPath, selectedFolder;
int pathLength;
if (pathLength > 0) {
! a folder has been selected by the user
printf('User selected the folder %s', selectedFolder);
}
else {
! the user cancelled the folder selection dialogue
printf('User cancelled the dialogue');
}
S EE ALSO
ShowModalOpenFileDialog(), ShowModalSaveFileDialog()
62
2.4. ENVIRONMENT CHAPTER 2. GLOBAL FUNCTIONS
ShowModelessBrowser
This function is not supported in GUI-less mode.
A RGUMENTS
objects Objects to be listed. The listing is in detailed mode, if only one kind of objects (e.g.
only ElmTerm) is contained.
detailMode (optional)
0 Show browser in normal mode (default).
1 Show browser in detail mode.
title (optional)
String for user defined window title. The default window title is shown when no or
an empty string is given.
page (optional)
Name of page to be shown in browser e.g. 'Flexible Data' (only in detailed mode).
The default page is shown when no or an empty string is given.
UpdateTableReports
This function is not supported in GUI-less mode.
2.4 Environment
Overview
EchoOff
EchoOn
EndTableReportGroup
GetDiffMode
IsAutomaticCalculationResetEnabled*
IsFinalEchoOnEnabled
NoFinalUpdate
SetAutomaticCalculationResetEnabled
SetConsistencyCheck
SetDiffMode
SetFinalEchoOnEnabled
SetGraphicUpdate
SetGuiUpdateEnabled
SetProgressBarUpdatesEnabled
SetUserBreakEnabled
StartNewTableReportGroup
63
2.4. ENVIRONMENT CHAPTER 2. GLOBAL FUNCTIONS
EchoOff
Freezes (de-activates) the user-interface. For each EchoOff(), an EchoOn() should be called.
An EchoOn() is automatically executed at the end of the execution of a ComDpl or ComPython.
This could be changed with SetFinalEchoOnEnabled().
void EchoOff()
S EE ALSO
E XAMPLE
The following example de-activates the user-interface to speed up the calculations, after
which the user-interface is re-activated again.
EchoOff();
... do some calculation ...
EchoOn();
EchoOn
Re-activates the user interface. For more informations see EchoOff().
void EchoOn()
S EE ALSO
EndTableReportGroup
Ends grouping of newly opened table reports to a special TDI group.
void EndTableReportGroup()
GetDiffMode
Returns the currently set result access mode. See SetDiffMode() for more information.
int GetDiffMode()
R ETURNS
0 Base case results access.
1 Compare case results access.
S EE ALSO
64
2.4. ENVIRONMENT CHAPTER 2. GLOBAL FUNCTIONS
IsAutomaticCalculationResetEnabled*
Returns whether the automatic calculation reset while setting attributes via the ”:” notation e.g.
”load:scale0 = 0.98” is enabled. object.SetVal() is not affected. See SetAutomaticCalculation-
ResetEnabled() for more informations.
int IsAutomaticCalculationResetEnabled()
S EE ALSO
SetAutomaticCalculationResetEnabled(), ResetCalculation()
IsFinalEchoOnEnabled
Returns whether the automatic EchoOn() at the end of each ComDpl or ComPython is enabled.
int IsFinalEchoOnEnabled()
R ETURNS
1 Final EchoOn() is enabled.
0 Final EchoOn() is disabled.
S EE ALSO
NoFinalUpdate
This function is deprecated. Use SetFinalEchoOnEnabled() instead.
void NoFinalUpdate()
SetAutomaticCalculationResetEnabled
Enables or disables the automatic calculation reset while setting attributes via the ”:” notation
e.g. ”load:scale0 = 0.98”. object.SetVal() is not affected.
In DPL/QDSL the automatic calculation reset is by default disabled. Thus only changing the
”outserv” attribute of an network element or the ”on off” attribute of a switch device resets auto-
matically the current calculation. When the calculation is reset the load-flow will be calculated
with a flat start. Thus a disabled automatic calculation reset can be helpful e.g. when calculating
a load-flow without a flat start after changing the scaling factor of a load. On the other side it
could lead to wrong results e.g. doing short-circuit calculations after changing the short-circuit-
location of a branch without calling ResetCalculation().
If the automatic calculation reset is enabled, changing an arbitrary object attribute could lead to
a calculation reset, e.g. changing the scaling factor of a load, but do not have to, e.g. renaming
an object.
void SetAutomaticCalculationResetEnabled(int enabled)
S EE ALSO
IsAutomaticCalculationResetEnabled(), ResetCalculation()
65
2.4. ENVIRONMENT CHAPTER 2. GLOBAL FUNCTIONS
SetConsistencyCheck
This function enables or disables the value consistency check executed whenever an attribute
is set. The consistency check is enabled by default.
Note: Disabling of consistency check might be required when dependent attributes are set
where the object is temporarily left in an invalid state until all attributes are set. In Python please
use Application.SetWriteCacheEnabled() for the same purpose.
int SetConsistencyCheck(int iEnable)
A RGUMENTS
iEnable
0 Disable attribute consistency check
1 Enable attribute consistency check
R ETURNS
1 If consistency check was enabled before.
0 If consistency check was disabled before.
SetDiffMode
This function allows switching between base and compare case result access mode when using
the comparing results functionality of PowerFactory (see User Manual Chapter: Comparisons
Between Calculations). Depending on this mode, the access to object parameters returns base
case values or is redirected to result case values. There is no need to adapt the parameter
access statements.
void SetDiffMode(int mode)
A RGUMENTS
mode
0 Base case results access.
1 Compare case results access.
S EE ALSO
E XAMPLE
The following example demonstrates how to access the comparing results functionality from
DPL.
object term, comldf, comdiff;
set terms;
double u1, u2;
66
2.4. ENVIRONMENT CHAPTER 2. GLOBAL FUNCTIONS
!report differences:
!for all relevant terminals
terms = GetCalcRelevantObjects('*.ElmTerm');
for (term = terms.First(); term; term = terms.Next()) {
SetDiffMode(0); !base case results
u1 = term:m:u;
SetDiffMode(1); !compare case results
u2 = term:m:u;
printf('%o: u1=%f p.u. u2=%f', term, u1, u2);
}
!stop comparing of results
comdiff.Stop();
SetFinalEchoOnEnabled
Enables or disables the automatic EchoOn() at the end of each ComDpl or ComPython.
void SetFinalEchoOnEnabled(int enabled)
A RGUMENTS
enabled
1 Enables the final EchoOn().
0 Disables the final EchoOn().
S EE ALSO
E XAMPLE
EchoOff();
SetFinalEchoOnEnabled(0);
... do some calculation which calls other scripts ...
SetFinalEchoOnEnabled(1);
SetGraphicUpdate
Enables or disables the updates of the single line graphics.
void SetGraphicUpdate(int enabled)
67
2.4. ENVIRONMENT CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
enabled
0 disabled (graphic will not be updated automatically)
1 enabled
E XAMPLE
The following example disables and enables the graphics update:
!disable graphic updates
SetGraphicUpdate(0);
!do some calculations
!...
!enable graphic updates again
SetGraphicUpdate(1);
SetGuiUpdateEnabled
Enables or disables updates of the graphical user interface (e.g. application window) while the
script is running.
This can be useful to get maximum execution performance. However, the user interface might
look frozen and becomes not responsive.
Please note that the progress bar, which is located in the status bar of the application window,
is not affected by this. Updates of the progress bar can be enabled or disabled separately by
invoking SetProgressBarUpdatesEnabled().
The updates will automatically be re-enabled after termination of the script. In case of sub-
scripts, the restore is done at termination of main script.
int SetGuiUpdateEnabled(int enabled)
A RGUMENTS
enabled
0 Disables GUI updates.
1 Enables GUI updates.
R ETURNS
Previous state before the function was called
D EPRECATED N AMES
SetRescheduleFlag
S EE ALSO
SetProgressBarUpdatesEnabled(), SetGraphicUpdate()
E XAMPLE
The following example disables and enables the GUI updates
68
2.4. ENVIRONMENT CHAPTER 2. GLOBAL FUNCTIONS
int oldState;
! disable gui updates
oldState = SetGuiUpdateEnabled(0);
!do some calculations
!...
!restore gui updates old state
SetGuiUpdateEnabled(oldState);
SetProgressBarUpdatesEnabled
Enables or disables updates of the progress bar (located in the status bar of the application
window) while the script is running. Other components of the status bar are not affected.
If a script executes a high number of small, fast commands that report progress (noticable by
the progress bar repeatedly and quickly filling up), disabling progress bar updates can provide
an immense performance boost.
The updates will automatically be re-enabled after termination of the script. In case of sub-
scripts, the restore is done at termination of main script.
int SetProgressBarUpdatesEnabled(int enabled)
A RGUMENTS
enabled
0 Disables progress bar updates.
1 Enables progress bar updates.
R ETURNS
Previous state before the function was called
S EE ALSO
SetGuiUpdateEnabled(), SetGraphicUpdate()
E XAMPLE
The following example disables and enables the GUI updates
int oldProgressBarUpdateState;
! disable progress bar updates
oldProgressBarUpdateState = SetProgressBarUpdatesEnabled(0);
! execute a high number of small, fast commands that report progress
!...
! restore progress bar updates
SetProgressBarUpdatesEnabled(oldProgressBarUpdateState);
69
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
SetUserBreakEnabled
Enables or disables the “Break” button of the main tool bar. After script execution it is disabled
automatically.
Disabling the “Break” button before executing a lot of Python code e.g a large loop can pro-
vide an immense performance boost. Disabling the “Break” button does not lead to a further
performance improvement when the GUI updates are already disabled (see SetGuiUpdateEn-
abled()).
void SetUserBreakEnabled(int enabled)
A RGUMENTS
enabled
0 Disables “Break” button.
1 Enable “Break” button.
D EPRECATED N AMES
EnableUserBreak, SetEnableUserBreak
StartNewTableReportGroup
Starts grouping of newly opened table reports to a special TDI group.
void StartNewTableReportGroup()
2.5 Mathematics
Overview
abs*
acos*
asin*
atan2*
atan*
BinaryAnd*
BinaryOr*
CalcWeibullPar*
ceil*
cos*
cosh*
exp*
floor*
frac*
GetRandomNumber*
GetRandomNumberEx*
InvertMatrix*
ln*
log*
max*
min*
modulo*
pi*
70
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
pow*
RndExp*
RndGetMethod*
RndGetSeed*
RndNormal*
RndSetup*
RndUnifInt*
RndUnifReal*
RndWeibull*
round*
SetRandomSeed*
sin*
sinh*
sqr*
sqrt*
tan*
tanh*
time*
trunc*
twopi*
abs*
Calculates the absolute value.
double abs(double x)
A RGUMENTS
x A value.
R ETURNS
The absolute value.
acos*
Calculates the arc cosine.
double acos(double x)
A RGUMENTS
x For x ∈ [−1, 1].
R ETURNS
Arc cosine of x, in radians.
asin*
Calculates the arc sine.
double asin(double x)
A RGUMENTS
x For x ∈ [−1, 1].
71
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
Arc sine of x, in radians.
atan2*
Calculates atan(y/x).
double atan(double y, double x)
A RGUMENTS
y For a value y.
x For a value x.
R ETURNS
Returns atan(y/x), in radians.
atan*
Calculates the arc tangent.
double atan(double x)
A RGUMENTS
x For a value x.
R ETURNS
Arc tangent of x, in radians.
BinaryAnd*
Performs a binary 'AND' operation on the two input arguments.
int BinaryAnd(int a, int b)
A RGUMENTS
a First value, either 0 or 1
b Second value, either 0 or 1
R ETURNS
0 If one of the arguments is 0
1 If all of the arguments are 1
E XAMPLE
int r;
r = BinaryAnd(0, 0);
printf('0 and 0 = %d', r);
r = BinaryAnd(1, 0);
printf('1 and 0 = %d', r);
r = BinaryAnd(0, 1);
printf('0 and 1 = %d', r);
r = BinaryAnd(1, 1);
printf('1 and 1 = %d', r);
72
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
BinaryOr*
Performs a binary 'OR' operation on the two input arguments.
int BinaryOr(int a, int b)
A RGUMENTS
a First value, either 0 or 1
b Second value, either 0 or 1
R ETURNS
0 If all of the arguments are 0
1 If one of the arguments is 1
E XAMPLE
int r;
r = BinaryOr(0, 0);
printf('0 or 0 = %d', r);
r = BinaryOr(1, 0);
printf('1 or 0 = %d', r);
r = BinaryOr(0, 1);
printf('0 or 1 = %d', r);
r = BinaryOr(1, 1);
printf('1 or 1 = %d', r);
CalcWeibullPar*
Performs a conversion between the weibull parameters listed below:
The output parameter is calculated from the two input parameters (e.g.: lambda = f(mean,
beta))
int CalcWeibullPar(double& parameter,
double in1,
double in2,
string keyout,
string keyin1,
string keyin2)
73
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
parameter (out)
Calculated weibull parameter
in1 The first input parameter
in2 The second input parameter
keyout Key specifying the variable of the output parameter
keyin1 Key specifying the variable of the first input parameter
keyin2 Key specifying the variable of the second input parameter
R ETURNS
0 Ok
1 Calculation failed
2 Invalid or unknown key(s)
E XAMPLE
double mean,lambda,variance,beta;
int failed;
mean = 22;
beta = 3;
! Calculate the scale factor from the mean value and the shape
failed = CalcWeibullPar(lambda,mean,beta,'l','m','b');
if (failed) {
printf('CalcWeibullPar failed');
}
else {
printf('lambda = f(mean, beta):\n%f = f(%f,%f)',lambda,mean,beta);
}
ceil*
Calculates the smallest larger integer.
double ceil(double x)
A RGUMENTS
x A value.
R ETURNS
The smallest larger integer.
cos*
Calculates the cosine.
double cos(double x)
A RGUMENTS
x A value in radians.
74
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
Cosine of x.
cosh*
Calculates the hyperbolic cosine.
double cosh(double x)
A RGUMENTS
x A value.
R ETURNS
Hyperbolic cosine of x.
exp*
Calculates ex , with the mathematical constant e (Euler’s number).
double exp([double x = 1])
A RGUMENTS
x (optional)
A value (default = 1).
R ETURNS
The value ex .
floor*
Calculates the largest smaller integer.
double floor(double x)
A RGUMENTS
x A value.
R ETURNS
The largest smaller integer.
frac*
Calculates the fractional part of x.
double frac(double x)
A RGUMENTS
x A value.
75
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
The integral part of x.
GetRandomNumber*
This function is marked as deprecated since PowerFactory 2017. Please use RndUnifReal()
instead.
Draws a uniformly distributed random number. Uses the ’global random number generator’. If
x1 and x2 are omitted, the distribution will be uniform in the interval [0, 1]. If only x1 is given, the
distribution is uniform in [0, x1] and with both x1 and x2, the distribution is uniform in [x1, x2].
double GetRandomNumber([double x1,]
[double x2])
A RGUMENTS
x1 (optional)
x2 not given: maximum; x1 and x2 given: minimum
x2 (optional)
maximum
R ETURNS
A uniformly distributed random number
D EPRECATED N AMES
Random
E XAMPLE
The following example sets a load to a random active power prior to calculating a load-flow.
double P;
Load:plini = GetRandomNumber(1.2, 2.3);
Ldf.Execute();
GetRandomNumberEx*
This function is marked as deprecated since PowerFactory 2017. Please use RndUnifReal(),
RndNormal() or RndWeibull() instead.
Draws a random number according to a specific probability distribution. Uses the ’global random
number generator’.
double GetRandomNumberEx(int distribution,
[double p1,]
[double p2])
A RGUMENTS
distribution
0 uniform distribution
1 normal distribution
2 weibull distribution
else returns 0.0
76
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
p1 (optional)
distribution = 0 (uniform), argument p2 is also given: min
distribution = 0 (uniform), argument p2 is not given: max (min is as-
sumed to be 0).
distribution = 1 (normal) : mean
distribution = 2 (weibull) : scale
p2 (optional)
distribution = 0 (uniform) : max
distribution = 1 (normal) : stddev
distribution = 2 (weibull) : weibull
R ETURNS
double Newly drawn random number from the specified distribution.
0.0 On failure e.g. non-supported mode.
D EPRECATED N AMES
fRand
E XAMPLE
The following example prints random numbers for the following distributions:
!uni0 : an uniform distribution in [0..1]
!uni1 : an uniform distribution in [0..50]
!uni2 : an uniform distribution in [-8, 21];
!norm : a normal distribution with mean=30 and standard deviation=5
!weib : a Weibull distribution with scale=5 and shape=30
int n;
double uni0,uni1,uni2,norm,weib;
SetRandomSeed(2);
for (n=0; n<10; n+=1) {
uni0 = GetRandomNumberEx(0);
uni1 = GetRandomNumberEx(0, 50);
uni2 = GetRandomNumberEx(0, -8, 21);
norm = GetRandomNumberEx(1, 30, 5);
weib = GetRandomNumberEx(2, 5, 30);
printf('%f %f %f %f %f', uni0, uni1, uni2, norm, weib);
}
InvertMatrix*
This routine calculates the inverse matrix by the Gauss-Jordan method. It uses scaled partial
pivoting preceeded by column equilibration of the input matrix. The routine can be called in two
different versions:
• Real Inversion: Only one matrix, realP art, is provided as an input to the function. Then,
realP art is inverted and the result, realP art−1 , is stored into the input matrix realP art on
success.
• Complex Inversion: Two matrices, realP art and imaginaryP art, are provided as inputs
to this function. Then, a complex matrix C is formed, with entries
77
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
The complex matrix C is inverted and, on success, the resulting real part of C −1 is written
to realP art whereas the resulting imaginary part of C −1 is written to imaginaryP art.
Please note that realP art and imaginaryP art must have the same dimensions.
A RGUMENTS
realPart If imaginaryPart is not set, realpart is the matrix to invert on input. In case of
success, it will be overwritten by the inverted input matrix. If imaginaryPart is set,
it holds the real part of the complex matrix to invert on input and is overwritten by
the real part of the inverted complex matrix on output.
imaginaryPart
If this is set, it should hold the imaginary part of the matrix to invert on input and
is overwritten by the imaginary part of the inverted matrix on output.
R ETURNS
1 Matrix inversion failed. The provided input matrix is singular.
0 Matrix inversion was successful. Resulting inverted matrix returned in input ma-
trix/matrices.
D EPRECATED N AMES
MatrixInvert
E XAMPLE
The following example shows the two possible applications of this method.
int errCode;
double val1,
val2,
val3,
val4;
errCode = InvertMatrix(A);
if (errCode) {
printf('Matrix A could not be inverted.');
}
else {
printf('The inverse of the input matrix is:');
val1 = A.Get(1, 1);
78
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
imaginaryPart.Resize(2, 2);
imaginaryPart.Set(1, 1, 0.5);
imaginaryPart.Set(1, 2, 0.0);
imaginaryPart.Set(2, 1, 0.0);
imaginaryPart.Set(2, 2, 0.5);
79
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
ln*
Calculates the natural logarithm of x (base e).
double ln(double x)
A RGUMENTS
x A value.
R ETURNS
The natural logarithm of x (base e).
log*
Calculates the logarithm of x with base 10.
double log(double x)
A RGUMENTS
x A value.
R ETURNS
The logarithm of x with base 10.
max*
Calculates the larger value.
double max(double x, double y)
A RGUMENTS
x A value.
y A value.
R ETURNS
The larger value.
min*
Calculates the smaller value.
double min(double x, double y)
A RGUMENTS
x A value.
y A value.
80
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
The smaller value.
modulo*
Calculates the remainder after a division.
double modulo(double x, double y)
A RGUMENTS
x A value.
y A value.
R ETURNS
The remainder after a division.
pi*
Return the mathematical constant π.
double pi()
R ETURNS
The mathematical constant π.
pow*
Calculates x raised to the power y.
double pow(double x, double y)
A RGUMENTS
x A value.
y A value.
R ETURNS
The value xy .
RndExp*
Returns a random number distributed according to exponential distribution with given rate. See
the example given in the DPL description of RndSetup().
double RndExp(double rate, [int rngNum])
A RGUMENTS
rate Rate of exponetial distribution.
rngNum (optional)
Number of the random number generator.
81
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
double Random number
RndGetMethod*
Returns the used method of a random number generator. See the example given in the DPL
description of RndSetup().
string RndGetMethod([int rngNum])
A RGUMENTS
rngNum (optional)
Number of the random number generator of which the method type is returned.
0 (default) ’Global random number generator’.
1, 2, ... Other random number generators accessible via this number.
R ETURNS
string Name of the used method
RndGetSeed*
Returns the used seed of a random number generator. See the example given in the DPL
description of RndSetup().
int RndGetSeed([int rngNum])
A RGUMENTS
rngNum (optional)
Number of the random number generator.
0 (default) ’Global random number generator’.
1, 2, ... Other random number generators accessible via this number.
R ETURNS
int Used seed
RndNormal*
Returns a random number distributed according to normal distribution with given mean and
standard deviation. See the example given in the DPL description of RndSetup().
double RndNormal(double mean, double stddev, [int rngNum])
82
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
mean Mean of normal distribution.
stddev Standard deviation of normal distribution.
rngNum (optional)
Number of the random number generator.
0 (default) ’Global random number generator’.
1, 2, ... Other random number generators accessible via this number.
R ETURNS
double Random number
RndSetup*
Initializes a random number generator. Allows to choose:
1. Mersenne Twister,
2. Linear Congruential,
3. Additive Lagged Fibonacci.
Internally a vector of random number generators is used. These can be accessed via the
number passed as last argument. Number 0 corresponds to the ’global random number gener-
ator’, updated also in ComInc and ComGenrelinc. Numbers 1,2, . . . will access different random
number generators, which can be setup individually.
void RndSetup(int seedAutomatic, [int seed], [int rngType], [int rngNum])
A RGUMENTS
seedAutomatic
Seed the random number generator automatically
0 Do not seed automatically.
1 Seed automatically.
seed (optional)
Seed for the random number generator. (default: 0) Note, that for the Additive
Lagged Fibonacci generator, only the seeds 0,...,9 are supported.
rngType (optional)
Type of random number generator
0 Mersenne Twister (recommended) (default).
1 Linear Congruential.
83
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
rngNum (optional)
Number of random number generator to be used
0 (default) ’Global random number generator’.
1, 2, ... Other random number generators accessible via this number.
E XAMPLE
int i;
int numOfDraws;
int usedSeed;
84
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
! Get the seed, used to initialise the random number generator rngNum.
usedSeed = RndGetSeed(rngNum);
printf('Used seed: %d', usedSeed);
RndUnifInt*
Returns a random number distributed according to uniform distribution on the set of numbers
{min, . . . , max}. See the example given in the DPL description of RndSetup().
int RndUnifInt(int min, int max, [int rngNum])
A RGUMENTS
min Smallest possible number
max Largest possible number
rngNum (optional)
Number of the random number generator.
0 (default) ’Global random number generator’.
1, 2, ... Other random number generators accessible via this number.
R ETURNS
int Random number
RndUnifReal*
Returns a random number distributed according to uniform distribution on the intervall [min,max].
See the example given in the DPL description of RndSetup().
double RndUnifReal(double min, double max, [int rngNum])
A RGUMENTS
min Lower endpoint of interval [min, max]
max Upper endpoint of interval [min, max]
rngNum (optional)
Number of the random number generator.
85
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
double Random number
RndWeibull*
Returns a random number distributed according to Weibull distribution with given shape and
scale parameters. See the example given in the DPL description of RndSetup().
double RndWeibull(double shape, double scale, [int rngNum])
A RGUMENTS
shape Shape parameter of Weibull distribution.
scale Scale parameter of Weibull distribution.
rngNum (optional)
Number of the random number generator.
0 (default) ’Global random number generator’.
1, 2, ... Other random number generators accessible via this number.
R ETURNS
double Random number
round*
Calculates the closest integer.
double round(double x)
A RGUMENTS
x A value.
R ETURNS
The closest integer.
SetRandomSeed*
This function is marked as deprecated since PowerFactory 2017. Please use RndSetup()
instead.
Initializes the ’global random number generator’ as Additive Lagged Fibonacci random number
generator. Sets the seed for the random number generator. One out of 10 predefined initializa-
tion seeds can be selected.
void SetRandomSeed(int seed)
A RGUMENTS
seed seed 0..9
86
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
D EPRECATED N AMES
SetRandSeed
sin*
Calculates the sine.
double sin(double x)
A RGUMENTS
x A value in radians.
R ETURNS
Sine of x.
sinh*
Calculates the hyperbolic sine.
double sinh(double x)
A RGUMENTS
x A value.
R ETURNS
Hyperbolic sine of x.
sqr*
Calculates the square.
double sqr(double x)
A RGUMENTS
x A value.
R ETURNS
The square x2 .
sqrt*
Calculates the square root.
double sqrt(double x)
A RGUMENTS
x A value.
87
2.5. MATHEMATICS CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
The square root.
tan*
Calculates the tangent.
double tan(double x)
A RGUMENTS
x A value in radians.
R ETURNS
Tangent of x.
tanh*
Calculates the hyperbolic tangent.
double tanh(double x)
A RGUMENTS
x A value.
R ETURNS
Hyperbolic tangent of x.
time*
Return the current simulation time.
double time()
R ETURNS
The current simulation time.
trunc*
Calculates the integral part of x.
double trunc(double x)
A RGUMENTS
x A value.
R ETURNS
The integral part of x.
88
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
twopi*
Return the mathematical constant 2π.
double twopi()
R ETURNS
The mathematical constant 2π.
2.6 MS Office
2.6.1 MS Access
Overview
mdbClose
mdbExecuteSqlQuery
mdbExecuteSqlStatement
mdbFetchResult
mdbGetResultColumnCount
mdbGetResultColumnName
mdbGetResultColumnType
mdbGetResultColumnValue
mdbOpen
mdbSetDebug
mdbClose
Closes currently opened MS Access file.
void mdbClose()
S EE ALSO
mdbOpen()
mdbExecuteSqlQuery
Executes a SQL query. The result of the query can be obtained by calling FetchResult().
Please note: Executing a new query will invalidate a previous one. It is not possible to have
multiple queries open in parallel.
int mdbExecuteSqlQuery(string statement)
A RGUMENTS
statement
Sql statement as text, e.g. SELECT FROM... .
R ETURNS
0 On success.
1 On error.
89
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
!// example to get contents of table 'Info'
ret = mdbExecuteSqlStatement('SELECT * from Info');
if (ret = 1) {
Error('Execution of SQL query failed');
}
mdbExecuteSqlStatement
Executes a SQL statement that does not return any values.
Executing a statement invalidates a previous query if there exists one. Special queries:
A RGUMENTS
statement
Sql statement as text, e.g. CREATE TABLE... .
R ETURNS
0 On success.
1 On error.
E XAMPLE
!// example to create a new table called 'Info'
ret = mdbExecuteSqlStatement(
'CREATE TABLE [Info] ([Name] VARCHAR(20), [Version] INTEGER)'
);
if (ret = 1) {
Error('Execution of SQL statement failed');
}
mdbFetchResult
Fetches next data set returned by previous SQL query.
To get all result sets, this function must be called until 0 is returned.
int mdbFetchResult()
R ETURNS
0 On success.
1 On error.
90
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
ret = mdbExecuteSqlStatement('SELECT * from Info');
if (ret = 1) {
Error('Execution of SQL query failed');
exit();
}
ret = mdbFetchResult();
while(ret = 0) {
...
ret = mdbFetchResult();
}
mdbGetResultColumnCount
Returns the number of data columns a result set has.
All sets of a query have identical number of column counts. Therefore, it is sufficient to get this
value only once while iterating over the results. Please note, this function requires that results
values have already been fetched via mdbFetchResult().
int mdbGetResultColumnCount()
R ETURNS
Number of columns in result set (always ≥ 0).
E XAMPLE
ret = mdbExecuteSqlStatement('SELECT * from Info');
...
!// get first data set
ret = mdbFetchResult();
...
ret = mdbGetResultColumnCount();
printf('Number of columns in result: %d', ret);
mdbGetResultColumnName
Returns the field name of a result column.
All sets of a query have identical number of column counts. Therefore, it is sufficient to get this
value only once while iterating over the results. Please note, this function requires that results
values have already been fetched via mdbFetchResult().
string mdbGetResultColumnName(int column)
A RGUMENTS
column Column index, 1 ≤ index ≤ mdbGetResultColumnCount().
R ETURNS
Name of the column. String is empty if index is out of valid range.
E XAMPLE
91
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
mdbGetResultColumnType
Returns the data type of the colum in result set. Please note, this function requires that results
values have already been fetched via mdbFetchResult().
int mdbGetResultColumnType(int column)
A RGUMENTS
column Column index, 1 ≤ index ≤ mdbGetResultColumnCount().
R ETURNS
Data type of values in given column:
0 string
1 integer
2 double
E XAMPLE
ret = mdbExecuteSqlStatement('SELECT * from Info');
...
ret = mdbFetchResult();
...
ret = mdbGetResultColumnType(1);
printf('Data type of column 1 is: %d', ret);
mdbGetResultColumnValue
Returns the value of a column in current data set.
int mdbGetResultColumnValue(int column
int& | double& | string& value)
A RGUMENTS
column Column index, 1 ≤ index ≤ mdbGetResultColumnCount().
value (out)
Output variable. The variable type must match the data type of the column. The
only exception is as string: It is allowed to retrieve all values as strings.
R ETURNS
0 On success.
1 On error.
92
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
ret = mdbExecuteSqlStatement('SELECT * from Info');
...
!//get first data set
ret = mdbFetchResult();
...
ret = mdbGetResultColumnValue(1, str);
printf('Value is %s', str);
mdbOpen
Opens an MS Access file.
int mdbOpen(string file,
[int createIfNotExists = 0,]
[int accessMode = 0])
A RGUMENTS
file Full file name of mdb.
createIfNotExists (optional)
0 Do not create a new file if it does not exist (default).
1 Create a new file if it does not exist.
accessMode (optional)
0 Read/write (default).
1 Read only.
R ETURNS
0 On success.
1 On error.
S EE ALSO
mdbClose()
E XAMPLE
mdbOpen('c:\database.mdb', 1);
E XAMPLE
This example demonstrates the creation of a new table and insertion of some values.
int error, i, ival;
string sql, s;
double dval;
93
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
This example demonstrates how to access information about available tables.
int error, colcount, i, t;
string sql, s;
94
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
This example demonstrates how to get information about the columns of a specific table.
int error, colcount, i, t;
string sql, s;
95
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
SetLineFeed(1);
E XAMPLE
This example demonstrates how to read data from an existing table.
int error, colcount, i, t;
string sql, s;
96
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
SetLineFeed(1);
mdbSetDebug
Enables output of additional information of errors during communication with MS Access.
The information is printed as plain text to the PowerFactory output window.
void mdbSetDebug(int debug)
A RGUMENTS
debug
0 Disable debug mode.
1 Enable debug mode.
E XAMPLE
mdbSetDebug(1); !// enable debug info for MS Access communication
97
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
2.6.2 MS Excel
Overview
xlActivateWorksheet
xlAddWorksheet
xlCloseWorkbook
xlDeleteWorksheet
xlGetActiveWorksheetIndex
xlGetDateSeparator
xlGetDecimalSeparator
xlGetThousandsSeparator
xlGetValue
xlGetWorksheetCount
xlGetWorksheetName
xlNewWorkbook
xlOpenWorkbook
xlResetTextStyle
xlRunMacro
xlSaveWorkbook
xlSaveWorkbookAs
xlSetBorder
xlSetColumnWidth
xlSetDebug
xlSetFillColor
xlSetFontName
xlSetFontSize
xlSetHorizontalAlignment
xlSetNumberFormat
xlSetPrintTitleRows
xlSetRowHeight
xlSetTextColor
xlSetTextStyle
xlSetValue
xlSetValues
xlSetVerticalAlignment
xlSetVisible
xlSetWorksheetName
xlSetWrapText
xlStart
xlTerminate
xlActivateWorksheet
Activates sheet with given index in active workbook.
int xlActivateWorksheet(int sheetIndex)
A RGUMENTS
sheetIndex
Index of the sheet that should become active. This index is 1-based, this means
1 ≤ sheetIndex ≤ xlGetWorksheetCount().
R ETURNS
0 On success.
1 On error.
98
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
S EE ALSO
xlGetWorksheetCount()
E XAMPLE
xlActivateSheet(1); !// activates first sheet
xlAddWorksheet
Adds a new worksheet to current workbook. The new worksheet will automatically be set to be
the active one.
int xlAddWorksheet([string name])
A RGUMENTS
name (optional)
Name for new worksheet.
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlAddWorksheet();
xlCloseWorkbook
Closes currently opened workbook. Any unsaved modifications will be lost.
int xlCloseWorkbook()
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlSaveWorkbookAs(), xlSaveWorkbook()
E XAMPLE
xlCloseWorkbook();
xlDeleteWorksheet
Deletes a worksheet from current workbook.
int xlDeleteWorksheet(int sheetIndex)
99
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
sheetIndex
Index of sheet to delete. 1 ≤ sheetIndex ≤ GetWorksheetCount().
R ETURNS
0 On success.
1 On error.
E XAMPLE
int count;
!// delete all worksheets (except last one = error)
count = xlGetWorksheetCount();
while(count > 0) {
error = xlDeleteWorksheet(count);
if (error = 0) {
printf('Successfully deleted sheet %d', count);
}
else {
printf('Sheet %d could not be deleted', count);
break;
}
count -= 1;
}
xlGetActiveWorksheetIndex
Returns the index of currently active sheet.
int xlGetActiveWorksheetIndex()
R ETURNS
Index of active worksheet, 1 ≤ sheetIndex ≤ xlGetWorksheetCount().
S EE ALSO
xlGetWorksheetCount()
xlGetDateSeparator
Returns currently used date separator.
string xlGetDateSeparator()
R ETURNS
Data separator, e.g. ”/”.
E XAMPLE
sep = xlGetDateSeparator();
100
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
xlGetDecimalSeparator
Returns currently used decimal separator.
string xlGetDecimalSeparator()
R ETURNS
Decimal separator, e.g. ”,”.
E XAMPLE
sep = xlGetDecimalSeparator();
xlGetThousandsSeparator
Returns currently used thousands separator.
string xlGetThousandsSeparator()
R ETURNS
Thousands separator, e.g. ”.”.
E XAMPLE
sep = xlGetThousandsSeparator();
xlGetValue
Returns the value of a cell.
int xlGetValue(int column,
int row,
int|double|string value)
A RGUMENTS
column Column index of cell (≥ 1).
row Row index of cell (≥ 1).
value (out)
Variable in which the output will be stored. It is always possible to get a cell value
as strings. For other data types, the type of the variable must match that of the
cell value.
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlSetValue()
101
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
string value;
xlGetValue(1, 1, value);
printf('The value of Cell A1 is %s', value);
xlGetWorksheetCount
Returns the number of worksheets in current workbook.
int xlGetWorksheetCount()
R ETURNS
Number of sheets (always ≥ 0).
E XAMPLE
count = xlGetWorksheetCount();
printf('Current Workbook contains %d sheets', count);
xlGetWorksheetName
Gets the name of a worksheet (in active workbook).
string xlGetWorksheetName(int sheetIndex)
A RGUMENTS
sheetIndex
Index of sheet for which the name shall be returned. This index is 1-based, this
means 1 ≤ sheetIndex ≤ xlGetWorksheetCount().
R ETURNS
Name of sheet or empty in case sheet does not exist.
S EE ALSO
xlGetWorksheetCount(), xlSetWorksheetName()
E XAMPLE
count = xlGetWorksheetCount();
printf('Number of sheets in current workbook: %d', count);
while(count > 0) {
name = xlGetWorksheetName(count);
printf('Worksheet[%d]: Name=%s', count, name);
count -= 1;
}
xlNewWorkbook
Creates a new Workbook.
int xlNewWorkbook()
102
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlNewWorkbook();
xlOpenWorkbook
Opens an existing workbook.
int xlOpenWorkbook(string file)
A RGUMENTS
name Name of existing MS Excel file to open.
R ETURNS
0 On success.
1 On error.
E XAMPLE
ret = xlOpenWorkbook('c:\test.xlsx'); !// opens c:\test.xlsx
xlResetTextStyle
Resets given text style for a cell or for a range of cells.
Note: If column2 and row2 are given, the text style is changed for the whole range from column1,
row1 to column2, row2.
int xlResetTextStyle(int column1,
int row1,
int style)
int xlResetTextStyle(int column1,
int row1,
int column2,
int row2,
int style)
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
row2 (optional)
2nd row index for specifying a range (≥ 1).
style Text style to be reset:
103
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
1 bold
2 italic
4 underline
8 strikethrough
16 superscript
32 subscript
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlSetTextStyle()
E XAMPLE
xlResetTextStyle(1,1,3,2,1); !// no bold for range A1:B2
xlResetTextStyle(5,2,6); !// no italic and no underline for cell D2
xlRunMacro
Executes a macro.
int xlRunMacro(string macro)
A RGUMENTS
macro Macro name; if a macro of that name does not exist, a value of 1 is returned.
createIfNotExists (optional)
0 Do not create a new file if it does not exist (default).
1 Create a new file if it does not exist.
accessMode (optional)
0 Read/write (default).
1 Read only.
R ETURNS
0 On success.
1 On error.
This is not the return value of the macro itself but just an indicator whether macro has been
found an executed.
E XAMPLE
xlRunMacro('MyMacro');
104
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
xlSaveWorkbook
Saves a modified workbook. The existing file will be overwritten with current version of the
workbook. Please note, for new workbooks the SaveAs() function has to be used.
int xlSaveWorkbook()
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlSaveWorkbookAs()
E XAMPLE
xlSaveWorkbook(); !// overwrites existing file with current version
!// of workbook
xlSaveWorkbookAs
Saves current workbook as a new file.
int xlSaveWorkbookAs(string file)
A RGUMENTS
file Full file name of new MS Excel file.
R ETURNS
0 On success.
1 On error.
E XAMPLE
ret = xlSaveWorkbookAs('c:\test_new.xlsx'); !// save current workbook as
!// c:\test_new.xlsx
xlSetBorder
Sets/resets the border of a cell or a range of cells.
To reset a border, use lineStyle=none. In this case, the given w̧eight and çolor is ignored.
int xlSetBorder(int column1,
int row1,
int borders,
int lineStyle,
int weight,
int colorR,
int colorG,
int colorB)
int xlSetBorder(int column1,
int row1,
int column2,
105
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
int row2,
int borders,
int lineStyle,
int weight,
int colorR,
int colorG,
int colorB)
A RGUMENTS
column1 Column index (≥ 1).
106
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetBorder(2,2,15,1,2,0,0,0); !// sets a border around B2,
!// bottom+right+top+left
xlSetBorder(2,2,15,0,0,0,0,0); !// resets border for B2
xlSetColumnWidth
Sets the width of a given column in active worksheet.
int xlSetColumnWidth(int column,
double width)
A RGUMENTS
column Column index (≥ 1).
width New width. If a value < 0 is passed, the optimal width will be automatically
detected (’autofit’).
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetColumnWidth(1, 20.25); !// set width of column 1 to 20.25
xlSetDebug
Enables output of additional information of errors during communication with MS Excel.
The information is printed as plain text to the PowerFactory output window.
Note: This method must not be called before xlStart if the alternative Excel implementation is
used.
void xlSetDebug(int debug)
A RGUMENTS
debug
0 Disable debug mode.
1 Enable debug mode.
E XAMPLE
xlSetDebug(1); !// enable debug info for MS Excel communication
107
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
xlSetFillColor
Sets the background color for a cell or a range of cells. The color must be given in RGB parts.
Note: If column2 and row2 are given, the text style is changed for the whole range from column1,
row1 to column2, row2.
int xlSetFillColor(int column1,
int row1,
int colorR,
int colorG,
int colorB)
int xlSetFillColor(int column1,
int row1,
int column2,
int row2,
int colorR,
int colorG,
int colorB)
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
row2 (optional)
2nd row index for specifying a range (≥ 1).
colorR Red part of RGB color, 0 ≤ colorR ≤ 255.
colorG Green part of RGB color, 0 ≤ colorR ≤ 255.
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetFillColor(1,1,3,2,255, 255, 150); !// range A1:B2 to yellow
xlSetFontName
Sets a new text font for a cell or a range of cells.
int xlSetFontName(int column1,
int row1,
string fontname)
int xlSetFontName(int column1,
int row1,
int column2,
int row2,
string fontname)
108
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
row2 (optional)
2nd row index for specifying a range (≥ 1).
fontname Windows font name, e.g. ”Arial”.
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetFontName(1,1,'Courier'); !// text will now be visualized
!// in font 'Courier'
xlSetFontSize
Sets a new size for text font of a cell or a range of cells.
int xlSetFontSize(int column1,
int row1,
double fontsize)
int xlSetFontSize(int column1,
int row1,
int column2,
int row2,
double fontsize)
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
row2 (optional)
2nd row index for specifying a range (≥ 1).
fontsize Size, e.g. 12.0.
R ETURNS
0 On success.
1 On error.
109
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
xlSetFontSize(1,1,9.75);
xlSetHorizontalAlignment
Sets the horizontal content alignmnet for a cell or a range of cells.
Note: If column2 and row2 are given, the alignment is changed for the whole range from
column1, row1 to column2, row2.
int xlSetHorizontalAlignment(int column1,
int row1,
int alignment)
int xlSetHorizontalAlignment(int column1,
int row1,
int column2,
int row2,
int alignment)
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
row2 (optional)
2nd row index for specifying a range (≥ 1).
alignment
New horizontal alignment. Possible values are:
0 left
1 center
2 right
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetHorizontalAlignment(1,1,2); !// set horizontal text alignment
!// for A1 to center
110
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
xlSetNumberFormat
Sets the number format for a cell or a range of cells. Please note that decimal, date separators
are localized and must be used according to current settings.
int xlSetNumberFormat(int column1,
int row1,
string format)
int xlSetNumberFormat(int column1,
int row1,
int column2,
int row2,
string format)
A RGUMENTS
column1 Column index (≥ 1).
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetValue(3.1415, 1, 1);
xlSetNumberFormat(1, 1, '0,0'); !// value will now be displayed as '3.1'
xlSetPrintTitleRows
Allows to set fixed header rows for printing. The corresponding setting in Excel is called ”rows
to repeat on top” and can be found in ’Page Setup’ on tab ’Sheet’.
Calling this function with row1=row2=-1 will reset the setting.
int xlSetPrintTitleRows(int row1,
int row2)
A RGUMENTS
row1 First row index, −1 or ≥ 1.
row2 Second row index, −1 or ≥ 1; row2 ≥ row1.
R ETURNS
0 On success.
1 On error.
111
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
xlSetPrintTitleRows(1,1); !// row1 will now be printed on
!// each page (on printout)
xlSetRowHeight
Sets the height of a given row in active worksheet.
int xlSetRowHeight(int row,
double height)
A RGUMENTS
row Row index (≥ 1).
height New height. If a value < 0 is passed, the optimal height will be automatically
detected (’autofit’).
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetRowHeight(1, 10); //set height of row 1 10
xlSetTextColor
Sets the text color for a cell or a range of cells. The color must be given in RGB parts.
Note: If column2 and row2 are given, the text style is changed for the whole range from column1,
row1 to column2, row2.
int xlSetTextColor(int column1,
int row1,
int colorR,
int colorG,
int colorB)
int xlSetTextColor(int column1,
int row1,
int column2,
int row2,
int colorR,
int colorG,
int colorB)
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
112
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
row2 (optional)
2nd row index for specifying a range (≥ 1).
colorR Red part of RGB color, 0 ≤ colorR ≤ 255.
colorG Green part of RGB color, 0 ≤ colorR ≤ 255.
colorB Blue part of RGB color, 0 ≤ colorR ≤ 255.
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetTextColor(1,1,3,2,255,0,0); !// range A1:B2 to red
xlSetTextStyle
Sets given text style for a cell or for a range of cells.
Note: If col2 and row2 are given, the text style is changed for the whole range from col1, row1
to col2, row2.
The formatting can be undone using function xlResetTextStyle().
int xlSetTextStyle(int column1,
int row1,
int style)
int xlSetTextStyle(int column1,
int row1,
int column2,
int row2,
int style)
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
row2 (optional)
2nd row index for specifying a range (≥ 1).
style Text style to be set:
1 bold
2 italic
4 underline
8 strikethrough
16 superscript
32 subscript
Note, multiple styles can be combined by summing up the corresponding style
values, e.g. bold and italic is 3 (=1+2)
113
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlResetTextStyle()
E XAMPLE
xlSetTextStyle(1,1,3,2,1); !// range A1:B2 to bold
xlSetTextStyle(5,2,6); !// cell D2 to italic+underline
xlSetValue
Sets a cell’s value.
int xlSetValue(int column,
int row,
int|double|string value)
A RGUMENTS
column Column index of cell (≥ 1).
row Row index of cell (≥ 1).
value New value to be set.
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlGetValue(), xlSetNumberFormat()
E XAMPLE
xlSetValue(1, 1, 'My text'); !// sets text for cell A1
xlSetValues
Sets values for a row of cells.
int xlSetValues(int column,
int row,
string values,
string sep)
A RGUMENTS
column Column index of cell (≥ 1).
row Row index of cell (≥ 1).
values New values separated by ’sep’.
sep Used separator.
114
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlSetValue()
E XAMPLE
xlSetValues(1, 1, 'Hello|World', '|'); !// sets text for cell
!// A1=Hello, A2=World
xlSetVerticalAlignment
Sets the vertical content alignmnet for a cell or a range of cells.
Note: If column2 and row2 are given, the alignment is changed for the whole range from
column1, row1 to column2, row2.
int xlSetVerticalAlignment(int column1,
int row1,
int alignment)
int xlSetVerticalAlignment(int column1,
int row1,
int column2,
int row2,
int alignment)
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
row2 (optional)
2nd row index for specifying a range (≥ 1).
alignment
New vertical alignment. Possible values are:
0 top
1 center
2 bottom
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetVerticalAlignment(1,1,2); !// set vertical text alignment
!// for A1 to center
115
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
xlSetVisible
Sets visibility of MS Excel application window. By default, the window is hidden.
int xlSetVisible(int visible)
A RGUMENTS
visible)
0 Makes MS Excel invisible.
1 Makes MS Excel visible.
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetVisible(1); !// makes application window visible
xlSetWorksheetName
Sets the name of a worksheet (in active workbook).
int xlSetWorksheetName(int sheetIndex,
string name)
A RGUMENTS
sheetIndex
Index of sheet for which the name shall be set. This index is 1-based, this means
1 ≤ sheetIndex ≤ xlGetWorksheetCount().
name New name to be set.
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlGetWorksheetCount(), xlGetWorksheetName()
E XAMPLE
count = xlGetWorksheetCount();
printf('Number of sheets in current workbook: %d', count);
while(count > 0) {
name = sprintf('My Sheet %d', count);
xlSetWorksheetName(count, name);
count -= 1;
}
116
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
xlSetWrapText
Enables or disables text wrapping for a cell or range of cells.
int xlSetWrapText(int column1,
int row1,
int enabled)
int xlSetWrapText(int column1,
int row1,
int column2,
int row2,
int enabled)
A RGUMENTS
column1 Column index (≥ 1).
row1 Row index (≥ 1).
column2 (optional)
2nd column index for specifying a range (≥ 1).
row2 (optional)
2nd row index for specifying a range (≥ 1).
enabled
0 Wrapping disabled.
1 Wrapping enabled.
R ETURNS
0 On success.
1 On error.
E XAMPLE
xlSetWrapText(1,1,1); !// enabled text wrapping for A1
xlSetValue(1,1,'Hello\nExcel'); !// set a text that contains
!// an explicit line break
xlStart
Creates a new MS Excel instance. This function must be called once at the beginning of any
communication with MS Excel.
The interface will per default use the COM interface Microsoft Excel provides. This requires
Excel to be installed on the machine. Passing 1 for the type parameter uses an alternative
implementation which does not require Excel to be installed. However, the alternative imple-
mentation cannot handle macro-enabled Excel files (.xlsm).
int xlStart([int interface = 0])
A RGUMENTS
interface (optional)
0= Use COM, 1= Use alternative implementation
R ETURNS
0 On success.
1 On error.
117
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
S EE ALSO
xlTerminate()
E XAMPLE
xlStart(); !// starts MS Excel
...
xlTerminate();
E XAMPLE
This example demonstrates how to export data of PowerFactory elements into an Excel
sheet.
string class, attributes;
string s, desc, type, sval, sep, numberFormat;
set objs;
object obj, oval;
double dval;
int error, pos, i, t, row, col, maxRow, maxCol;
!// get decimal separator and build number format used here
sep = xlGetDecimalSeparator();
numberFormat = sprintf('0%s000', sep);
118
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
s = strtok(attributes,',',pos,col);
while(pos > -1) {
obj.GetVarType(s, type);
t = strcmp(type, 'string');
if (t=0) {
obj.GetVal(sval, s);
xlSetValue(col, row, sval);
}
t = strcmp(type, 'object');
if (t=0) {
obj.GetVal(oval, s);
sval = oval:loc_name;
xlSetValue(col, row, sval);
}
t = strcmp(type, 'double');
if (t=0) {
obj.GetVal(dval, s);
xlSetValue(col, row, dval);
xlSetNumberFormat(col, row, numberFormat);
}
col+=1;
s = strtok(attributes,',',pos,col);
}
row += 1;
}
E XAMPLE
This example demonstrates how to open an Excel file and read values from active sheet.
int error, row, col, count, active, i, t, stop;
string str;
119
2.6. MS OFFICE CHAPTER 2. GLOBAL FUNCTIONS
xlTerminate
Closes currently active MS Excel instance. This function should be called at the end of a script
if all communication with MS Excel is finished.
int xlTerminate()
R ETURNS
0 On success.
1 On error.
S EE ALSO
xlStart()
E XAMPLE
xlStart();
...
xlTerminate(); !// closes MS Excel
120
2.7. MULTIBYTE ENCODED STRING CHAPTER 2. GLOBAL FUNCTIONS
mbschg*
mbscmp*
mbscpy*
mbslen*
mbsprintf*
mbsscanf*
mbsstr*
mbstok*
tombchar*
tombcharcodepoint*
tombslower*
tombsupper*
mbschg*
Searches a substring and replaces it. See strchg() for more details.
int mbschg(string& str,
string find,
string new)
S EE ALSO
strchg()
mbscmp*
Compares two strings case sensitive. See strcmp() for more details.
int mbscmp(string str1,
string str2,
[int maxCount])
S EE ALSO
strcmp()
mbscpy*
Returns a copy of a substring. See strcpy() for more details.
string mbscpy(string str,
int startIndex,
[int maxCount])
S EE ALSO
strcpy()
121
2.7. MULTIBYTE ENCODED STRING CHAPTER 2. GLOBAL FUNCTIONS
mbslen*
Returns the multibyte length of a string.
int mbslen(string str)
A RGUMENTS
str The string.
R ETURNS
Returns the number of multibyte characters of a string. For strings containing invalid multibyte
characters 0 is returned.
S EE ALSO
strlen()
mbsprintf*
Returns a formatted multibyte character string. See sprintf() for more details.
string mbsprintf(string format,
[int|double|string|object argument0,]
[...])
S EE ALSO
mbprintf(), mbsscanf()
mbsscanf*
Parses a multibyte character string of values. See sscanf() for more details.
int mbsscanf(string source,
string format,
[int|double|string argument0,]
[...])
S EE ALSO
sscanf(), mbsprintf()
mbsstr*
Searches for a substring in a string and returns its multibyte position. See strstr() for more
details.
int mbsstr(string str,
string substr)
S EE ALSO
strstr()
122
2.7. MULTIBYTE ENCODED STRING CHAPTER 2. GLOBAL FUNCTIONS
mbstok*
Splits a string into tokens. See strtok() for more details.
string mbstok(string source,
string delimiters,
int& index,
[int tokenNumber = 1],
[int skipEmptyToken = 1])
S EE ALSO
strtok()
tombchar*
Converts the given codepoint (number) to the corresponding multibyte character.
string tombchar(int codePoint)
A RGUMENTS
codePoint
Number between 0 and 65535 which represents a multibyte character in the
current Windows ANSI code page.
R ETURNS
A string of multibyte length 1 containing the multibyte character representation of the given
codepoint in the current Windows ANSI code page or an empty string if no multibyte character
representation exists.
S EE ALSO
tombcharcodepoint(), tochar()
tombcharcodepoint*
Converts a multibyte character to its code point.
int tombcharcodepoint(string str)
A RGUMENTS
str A string of multibyte length 1 containing the multibyte character.
R ETURNS
Number between 0 and 65535 which represents the given multibyte character in the current
Windows ANSI code page or 0 if an error occurred.
S EE ALSO
tombcharcodepoint(), tochar()
tombslower*
Creates a lowercased copy of a string. See tolower() for more details.
string tombslower(string str)
123
2.8. OUTPUT WINDOW CHAPTER 2. GLOBAL FUNCTIONS
S EE ALSO
tombsupper(), tolower()
tombsupper*
Creates a uppercased copy of a string. See toupper() for more details.
string tombsupper(string str)
S EE ALSO
tombslower(), toupper()
ClearOutputWindow*
Error*
FlushOutputWindow*
Info*
mbprintf*
printf*
SetLineFeed*
SetOutputWindowState
Warn*
Write*
ClearOutputWindow*
Clears the output window.
void ClearOutputWindow()
D EPRECATED N AMES
ClearOutput
Error*
Prints a formatted string as an error to the Output Window and automatically inserts a line-break.
The DPL script stops with an appropriate error when the passed arguments don’t match the
format string. The line-break can’t be disabled.
To stop a script after an error use exit().
string Error(string format,
[int|double|string|object argument0,]
[...])
A RGUMENTS
format C++-like printf() format string. See the Format String Syntax for more information.
argument... (optional)
Arguments matching the format string.
124
2.8. OUTPUT WINDOW CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
The printed string.
S EE ALSO
E XAMPLE
The following example writes an error to the output window.
Error('Index could not be calculated.');
FlushOutputWindow*
Calling this function ensures that all previously printed and potentially buffered messages are
visible in the output window.
void FlushOutputWindow()
E XAMPLE
The following example demonstrated the usage of FlushOutputWindow().
string message;
message += 'It is not guaranteed that this message is shown immediately';
message += ' in the output window as it could be buffered.';
Info(message);
! After this call all previously printed messages
! are guaranteed to be visible in the output window.
FlushOutputWindow();
Info*
Prints a formatted string as information to the Output Window and automatically inserts a line-
break.
The DPL script stops with an appropriate error when the passed arguments don’t match the
format string. The line-break can’t be disabled.
string Info(string format,
[int|double|string|object argument0,]
[...])
A RGUMENTS
format C++-like printf() format string. See the Format String Syntax for more information.
argument... (optional)
Arguments matching the format string.
R ETURNS
The printed string.
S EE ALSO
125
2.8. OUTPUT WINDOW CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
The following example writes an info message to the output window.
Info('Trying to calculate first index...');
mbprintf*
Prints a formatted multibyte string as plain text to the Output Window. See printf() for more
details.
To print a formatted multibyte string as information, warning or error use mbsprintf() together
with Info(), Warn() or Error().
string mbprintf(string format,
[int|double|string|object argument0,]
[...])
S EE ALSO
printf*
Prints a formatted string as plain text to the Output Window and automatically inserts a line-
break.
The DPL script stops with an appropriate error when the passed arguments don’t match the
format string. The line-break insertion can be disabled with SetLineFeed().
string printf(string format,
[int|double|string|object argument0,]
[...])
A RGUMENTS
format C++-like printf() format string. See the Format String Syntax for more information.
argument... (optional)
Arguments matching the format string.
R ETURNS
The printed string.
D EPRECATED N AMES
fWrite
S EE ALSO
E XAMPLE
object load;
126
2.8. OUTPUT WINDOW CHAPTER 2. GLOBAL FUNCTIONS
! A table
printf('\n\n0123456789 0123456789\n');
printf('%10F %10F', -3.143458903850, 1.71);
printf('%10F %10F', 1234567890, 1234567890123);
printf('%10F %10F', 1.0, 1234.0005);
SetLineFeed*
Sets or resets the automatic line feed for printf(), mbprintf() and fprintf(). By default, the auto-
matic line feed is enabled.
void SetLineFeed(int enabled)
A RGUMENTS
enabled ‘0’ disables automatic line feed, ‘1’ enables it.
E XAMPLE
The following example demonstrates the output of two printf statements with and without
automatic line feed.
SetLineFeed(1); !can be omitted, as automatic line feed is enabled by default
printf('Hello ');
printf('PowerFactory');
SetLineFeed(0);
printf('Hello ');
printf('PowerFactory');
printf('\n'); !explicit newline
S EE ALSO
SetOutputWindowState
Changes the display state of the output window.
void SetOutputWindowState(int newState)
A RGUMENTS
newState
0 Minimized output window.
1 Maximized output window.
-1 Restore previous state.
127
2.8. OUTPUT WINDOW CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
The following example shows how to change the display state:
!minimize output window
SetOutputWindowState(0);
printf('Window was minimized');
Sleep(1000);
Warn*
Prints a formatted string as warning to the Output Window and automatically inserts a line-
break.
The DPL script stops with an appropriate error when the passed arguments don’t match the
format string. The line-break can’t be disabled.
string Warn(string format,
[int|double|string|object argument0,]
[...])
A RGUMENTS
format C++-like printf() format string. See the Format String Syntax for more information.
argument... (optional)
Arguments matching the format string.
R ETURNS
The printed string.
S EE ALSO
E XAMPLE
The following example writes a warning message to the output window.
Warn('No loads attached: using approximation.');
128
2.8. OUTPUT WINDOW CHAPTER 2. GLOBAL FUNCTIONS
Write*
This function is described here for compatibility reasons. In most cases the printf() is easier to
use. It writes out a line of formatted text, using the DIgSILENT output language.
void Write(string format,
[object obj,]
[...])
void Write(string format,
[set objects,]
[...])
A RGUMENTS
format The format string
obj (optional)
A object which is used to get data from.
objects (optional)
Objects which are used to get data from.
This function is used to quickly output a line of formatted output, using the same formatting
language as is used for defining reports and result-boxes (see PowerFactory User Manual).
Because data or parameters of more than one object are often written out, the DIgSILENT
output language has the special macro “ACC(x)” to distinguish between these objects. Prior to
execution, all given objects and all objects in the given sets are listed together in a single list.
The “ACC(x)” macro returns the object with the index “x” in that list. The ACC (“acc”=“access”)
macro can be used more than once for the same object.
Interface variables of the DPL script can also be used in the format string by the “DEF” macro.
If the DPL script has “ResX” as an interface double, then “DEF:ResX” will access that variable.
S EE ALSO
printf()
E XAMPLE
In the following example, two name and loading of two lines written to the Output Window.
string format;
set objects;
129
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
2.9 String
Overview
sprintf*
sscanf*
sscanfsep*
strchg*
strcmp*
strcpy*
strlen*
strstr*
strtok*
tochar*
tocharcodepoint*
tolower*
toupper*
d or i For an integer.
e For a double. The printed format is [−]d.dddd e [sign]ddd where d is a single
decimal digit, dddd is one or more decimal digits, ddd is exactly three decimal
digits, and [sign] is + or −.
E Identical to type e except that the exponent is uppercase.
f For a double. The printed format is [−]dddd.dddd, where dddd is one or more
decimal digits. The number of digits before the decimal point depends on the
magnitude of the number, and the number of digits after the decimal point
depends on the requested precision.
F For a double. Prints a floating point value as a string of fixed width (width is
required). The place of the point is determined automatically so that always a
maximum precision is achieved.
g For a double. The printed type is e or f, whichever is more compact for the given
value and precision. The type e is used only when the exponent of the value is
less than −4 or greater than or equal to the precision argument. Trailing zeros
are truncated, and the decimal point appears only if one or more digits follow it.
G Identical to type g, except that the exponent E instead of e, is used (where
appropriate).
s For a string.
o For an object. Prints the class icon and loc name of a given object. The loc name
can be clicked to show the element dialog. The width of the icon and name can
be limited/extended to a fix number of characters (the icon needs 3 characters).
If the specified width is smaller than 3, the width is set to 3.
b For an object or a string. Prints the class icon of the given object or class name.
130
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
double d;
int i;
string s;
d = 123456789.987654321;
i = 2468;
s = 'hello dpl';
printf('%f|%15.3f|%E|%.2e|%+f|', d, d, d, d, d);
printf('%d|%6d|%-6d|', i, i, i);
printf('%s|%-20s|%20s|', s, s, s);
In addition to placeholders, the printed string may also contain “escape”-sequences for line
feeds, tabs, form feeds and colour. The following escape-sequences can be used:
a black i gray
b black j light gray
c red k bordeaux
d green l dark red
e blue m dark green
f brown n light green
g cyan o marine
h magenta p dark blue
E XAMPLE
printf('The \cfbrown \cafox jumped \nover\tthe\nlazy\tcat.');
printf('result written to c:\\documents\\pf\\res.txt');
printf('%% = %%%6.2f%% %%', 123.34);
131
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
sprintf*
Returns a formatted string.
The DPL script stops with an appropriate error when the passed arguments don’t match the
format string.
string sprintf(string format,
[int|double|string|object argument0,]
[...])
A RGUMENTS
format C++-like printf() format string. See the Format String Syntax for more information.
argument... (optional)
Arguments matching the format string.
R ETURNS
The formated string.
D EPRECATED N AMES
ToStr
S EE ALSO
E XAMPLE
The following example writes a report to a file not using fprintf(). It redirects the text from the
Output Window to a file. The filename is formatted from a path and the name of the current
study case.
string lines; ! the lines of a report
object studycase;
! Redirect is an ComOp object inside this script
! StopRedirect is an ComCl object inside this script
studycase = GetActiveStudyCase();
Redirect:f = sprintf('%s%s.out', 'c:\\MyDocuments\\results1215\\',
studycase:loc_name);
Redirect.Execute();
Form.WriteOut(lines); ! write the report
StopRedirect.Execute(); ! stop redirection
sscanf*
Parses a string of values which are separated by space or tabulator according the given format.
Each parsed value is stored into the passed arguments. sscanfsep() supports other separators.
int sscanf(string source,
string format,
[int|double|string argument0,]
[...])
A RGUMENTS
source A formatted source string.
132
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
format C++-like printf() format string. See the Format String Syntax for more information.
Only int, double and string types are supported.
argument... (optional)
Arguments matching the format string.
R ETURNS
≥0 Number of values successfully parsed and stored.
−1 On error.
S EE ALSO
E XAMPLE
The following example assignes the first two fields of string sStr to the string sRes and the
double rVal:
int result;
double freq;
string unit;
sscanfsep*
Parses a string of values which are separated by a separation character according the given
format. Each parsed value is stored into the passed arguments. Empty tokens are skipped by
default.
int sscanfsep(string input,
string format,
int|double|string argument0,
[... ,]
string separator,
[int skipEmptyToken = 1]
)
A RGUMENTS
input Input string containing separated values.
format C++-like printf() format string. See the Format String Syntax for more information.
Only int, double and string types are supported.
argument...
Arguments matching the format string.
separator Character that separates value in given input string.
R ETURNS
Number (≥ 0) of values successfully parsed and stored.
133
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
S EE ALSO
sscanf(), sprintf()
E XAMPLE
int result;
int i;
string s;
!Output:
!result: 2
!s: Hello DPL
!i: 123
strchg*
Searches in the string ’str’ for the substring ’find’ and replaces it with the string ’new’.
int strchg(string& str,
string find,
string new)
A RGUMENTS
str (in, out)
String to be scanned and modified.
find Substring to be found.
new String to be inserted instead of ’find’.
R ETURNS
The first index (geq0) in ’str’ where ’find’ was found; -1 if substring was not found.
S EE ALSO
mbschg()
E XAMPLE
int ret;
string str, find, new;
134
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
strcmp*
Compares two strings case sensitive. Therefore:
int result;
result = strcmp('a' ,'A' ); ! result = 1
result = strcmp('A' ,'a' ); ! result = -1
result = strcmp('a' ,'a' ); ! result = 0
A RGUMENTS
str1 The first string.
str2 The second string.
maxCount (optional)
Maximal number of characters to compare.
S EE ALSO
mbscmp()
R ETURNS
<0 str1 is lexicographically less than str2.
=0 Strings are equal.
>0 str1 is lexicographically greater than str2.
strcpy*
Returns a copy of a substring.
string strcpy(string str,
int startIndex,
[int maxCount])
A RGUMENTS
str The string.
startIndex
The start index (≥ 0).
maxCount (optional)
Maximal number of characters to copy (> 0).
R ETURNS
The copied substring.
S EE ALSO
mbscpy()
135
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
E XAMPLE
string str1, str2;
str1 = 'The brown fox';
str2 = strcpy(str1, 4, 5); ! str2 now equals 'brown'
strlen*
Returns the length of a string.
int strlen(string str)
A RGUMENTS
str The string.
R ETURNS
Returns the number of single-byte characters of a string.
S EE ALSO
mbslen()
strstr*
Searches for a substring in a string and returns its position.
int strstr(string str,
string substr)
A RGUMENTS
str The string.
substr The substring.
R ETURNS
The index of the first character of the substring searched for or -1 when it was not found.
S EE ALSO
mbsstr()
E XAMPLE
The following example searches for string 'brown' in string str1
string str1, str2;
int i;
str1 = 'The brown fox';
i = strstr(str1, 'brown');
! i now equals 4
136
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
strtok*
Splits the string ’source’ into tokens separated by the characters defined in ’delimiters’ and
returns one of these. Empty tokens are skipped by default.
string strtok(string source,
string delimiters,
int& index,
[int tokenNumber = 1],
[int skipEmptyToken = 1])
A RGUMENTS
source Source string to be split.
delimiters String of delimiter characters used for the split.
index (out)
Outputs the index of the returned token in the source string (≥ 0).
number (optional)
Number (≥ 1) of the token to be read (default = 1).
skipEmptyToken (optional) 0 Empty tokens are not skipped.
1 Empty tokens are skipped (default).
R ETURNS
Token between separator (tokenNumber-1) and (tokenNumber) as a string. If nothing is read,
the token is empty and index is set to -1.
S EE ALSO
mbstok()
E XAMPLE
The following example searches for different tokens in str
string res, str, del;
int pos;
str = 'Das, ist nur, ein Test mit Nr. (555); weiter nichts';
del = ',;()';
res = strtok(str,del,pos);
printf('Token: %s pos = %d',res,pos);
res = strtok(str,del,pos,2);
printf('Token: %s pos = %d',res,pos);
res = strtok(str,del,pos,4);
printf('Token: %s pos = %d',res,pos);
tochar*
Converts the given codepoint (number) to the corresponding character.
string tochar(int codePoint)
A RGUMENTS
codePoint
Number between 0 and 255 which represents a sigle-byte character in the current
Windows ANSI code page.
137
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
R ETURNS
A string of length 1 containing the character representation of the given codepoint in the cur-
rent Windows ANSI code page or an empty string if no single-byte character representation
exists.
S EE ALSO
tocharcodepoint(), tombchar()
tocharcodepoint*
Converts a character to its code point.
int tocharcodepoint(string str)
A RGUMENTS
str A string of length 1 containing the single-byte character.
R ETURNS
Number between 0 and 255 which represents the given character in the current Windows
ANSI code page or 0 if an error occurred.
S EE ALSO
tocharcodepoint(), tombchar()
tolower*
Creates a copy of a string, where all characters are converted to lowercase.
string tolower(string str)
R ETURNS
Copy of original string, but with all characters in lowercase.
S EE ALSO
toupper(), tombslower()
E XAMPLE
string src, scp;
src = 'This is just a test';
scp = tolower(src);
printf('%s', scp);
toupper*
Creates a copy of a string, where all characters are converted to uppercase.
string toupper(string str)
R ETURNS
Copy of original string, but with all characters in uppercase.
138
2.9. STRING CHAPTER 2. GLOBAL FUNCTIONS
S EE ALSO
tolower(), tombsupper()
E XAMPLE
string src, scp;
src = 'This is just a test';
scp = toupper(src);
printf('%s', scp);
139
CHAPTER 3. OBJECT METHODS
3 Object Methods
AddCopy
CopyData
CreateObject
Energize
GetChildren*
GetClassName*
GetCombinedProjectSource
GetConnectedElements*
GetConnectionCount*
GetContents*
GetControlledNode*
GetCubicle*
GetFullName*
GetImpedance*
GetInom*
GetNet
GetNode*
GetOperator*
GetOwner*
GetParent*
GetReferences*
GetRegion*
GetSize*
GetSupplyingSubstations*
GetSupplyingTransformers*
GetSupplyingTrfstations*
GetSystemGrounding*
GetUnom*
GetVal*
GetVarType*
GetZeroImpedance*
HasReferences*
HasResults*
IsCalcRelevant*
IsClass*
IsDeleted*
IsEarthed*
IsEnergized*
IsHidden*
140
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
IsInFeeder*
IsNetworkDataFolder*
IsNode*
IsObjectActive*
IsObjectModifiedByVariation*
Isolate
IsOutOfService*
IsReducible*
IsShortCircuited*
lnm*
MarkInGraphics
Move
PasteCopy
PurgeUnusedObjects
ReportUnusedObjects
SearchObject*
SetSize
SetVal
ShowEditDialog
ShowFullName*
ShowModalSelectTree
snm*
SwitchOff
SwitchOn
unm*
VarExists*
AddCopy
Adds a copy of a single object or a set of objects to this object (= target object).
When copying a single object it is possible to give the new name. The new name will be
concatenated by the given name parts. This is not possible for a project (IntPrj).
The target object must be able to receive a copy of the objects.
Copying a set of objects will respect all internal references between those objects. Copying a
set of lines and their types, for example, will result in a set of copied lines and line types, where
the copied lines will use the copied line types.
When source object(s) and target object are inside different projects the method object.PasteCopy()
has to be used instead, since it adapts all references automatically.
object object.AddCopy(object objectToCopy,
[int|string partOfName0,]
[...])
object object.AddCopy(set objectsToCopy)
A RGUMENTS
objectToCopy
Object to copy.
objectNameParts (optional)
Parts of the name of the new copy which will be concatenated to the object name.
objectsToCopy
Set of objects to copy.
R ETURNS
Returns the copy that has been created on success or NULL, when copying a single object.
141
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
S EE ALSO
E XAMPLE
The following example copies a given fuse to all calculation relevant cubicles:
set cubics;
object fuse, cubic, copy;
int n;
n = 0;
cubics = GetCalcRelevantObjects('StaCubic');
for (cubic = cubics.First(); cubic; cubic = cubics.Next()) {
n += 1;
copy = cubic.AddCopy(fuse, 'Fuse Nr', n);
printf('Created new fuse %o', copy);
}
CopyData
Copies all parameters except for loc name and containers from one object to another.
void object.CopyData(object source)
A RGUMENTS
source Object from which parameters are to be copied
R ETURNS
0 ok
1 error
E XAMPLE
object source,
target;
int ret;
ret = target.CopyData(source);
if (ret=1) { ! error
exit();
}
142
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
CreateObject
Creates a new object of given class and name in the target object. The object name will be
concatenated by the given object name parts. The target object must be able to store an object
of the given class in its content otherwise the currently running script will stop with an error.
object object.CreateObject(string className,
[int|string objectNamePart0,]
[...]
)
A RGUMENTS
className
The class name of the object to create.
objectNameParts (optional)
Parts of the name of the object to create (without classname) which will be con-
catenated to the object name.
R ETURNS
object Newly created object.
NULL When no object was created.
E XAMPLE
The following example creates a fuse in a set of cubicles. The new fuses will be named
“Fuse0”, “Fuse1”, etc.
object target;
set cubs;
int n;
cubs = SEL.GetAll('StaCubic');
target = cubs.First();
n = 0;
while (target) {
target.CreateObject('RelFuse', 'Fuse', n);
target = cubs.Next();
n+=1;
}
Energize
Performs an “energize” action on the network element. This corresponds to removing earthings
from current region (if any) followed by a “switch on” action on the element.
The action is identical to that in the context menue.
int object.Energize([set& changedSwitches,]
[int resetRA])
A RGUMENTS
changedSwitches (optional, out)
All switches whose switching state was changed by the action are filled into this
set.
resetRA (optional)
Determines whether an active running arrangement that would prevent switching
action should be deactivated or not.
143
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
Information about the success of the action:
S EE ALSO
GetChildren*
This function returns the objects that are stored within the object the function was called on. In
contrast to object.GetContents() this function gives access to objects that are currently hidden
due to scheme management.
set object.GetChildren(int hiddenMode,
[string filter,]
[int subfolders])
A RGUMENTS
hiddenMode
Determines how hidden objects are handled.
0 Hidden objects are ignored. Only nonhidden objects are returned.
1 Hidden objects and nonhidden objects are returned.
2 Only hidden objects are returned. Nonhidden objects are ignored.
filter (optional)
Name filter, possibly containing '*' and '?' characters.
subfolder (optional)
Determines if children of subfolders are returned.
0 Only direct children are returned, children of subfolders are ignored
(Default).
1 Also children of subfolders are returned.
R ETURNS
Objects that are stored in the called object.
S EE ALSO
object.GetContents()
E XAMPLE
The following example lists all contained terminals for each substation:
object obj, substat;
set objs, substats;
!lists all contained terminals for each substation
substats = GetCalcRelevantObjects('*.ElmSubstat');
144
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
GetClassName*
Returns the class name of the object.
string object.GetClassName()
R ETURNS
The class name of the object.
D EPRECATED N AMES
GetClass
GetCombinedProjectSource
For an object in a combined project return the intermediate folder where the object is contained,
indicating the original source project.
object object.GetCombinedProjectSource()
R ETURNS
The intermediate folder for that object or nothing when not applicable.
GetConnectedElements*
Returns the set of connected elements. Only electrically connected elements are returned when
the conditions of all switches are regarded. Possible connections will also be returned when rBrk
and/or rDis is zero, in the case of open breakers and/or disconnectors. The default values are
(0,0,0).
set object.GetConnectedElements([int rBrk],
[int rDis],
[int rOut])
A RGUMENTS
rBrk (optional)
if 1, regards position of breakers
rDis (optional)
if 1, regards position of disconnectors
rOut (optional)
if 1, regards in-service or out-of-service status
R ETURNS
The set of connected elements.
145
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
D EPRECATED N AMES
GetConnectedElms
GetConnectionCount*
Returns the number of electrical connections.
A RGUMENTS
includeNeutral (optional)
1, also separate neutral conductor connections are taken into account.
R ETURNS
The number of electrical connections.
E XAMPLE
int i, count;
object transformer,cubicle,bus;
set transformers;
GetContents*
Returns the objects that are stored in the object and whose name matches the argument name.
No object is returned if the object's container is empty, or if the object is not capable of storing
objects. The argument name may contain the complete name and classname, or parts of the
name with wildcard and class name.
set object.GetContents([string Name,]
[int recursive])
A RGUMENTS
Name (optional)
loc name.class name, name possibly contains wildcards: '*' and '?' characters
recursive (optional)
1 All contained objects will be added recursively.
0 (default) Only direct children of current object will be collected.
146
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
Objects that are stored in the object.
E XAMPLE
The following example collects all lines that are stored in network objects.
set grids, lines;
object line, grid;
grids = GetCalcRelevantObjects('*.ElmNet');
! get all grids
grid = grids.First();
while (grid) {
printf('Lines in Grid %o',grid);
! get all objects of class ElmLne
! in all grid and subfolders of grid
lines = grid.GetContents('*.ElmLne',1);
line = lines.First();
while (line) {
line.ShowFullName();
line = lines.Next();
}
grid = grids.Next();
}
GetControlledNode*
Returns the target terminal and the resulting target voltage for generators and other voltage
regulating units.
object object.GetControlledNode(int bus,
double& targetVoltage,
[int check])
A RGUMENTS
bus)
-1 currently controlled bus
0 HV bus
1 MV/ LV bus
2 LV bus
targetVoltage (out)
The target voltage of the voltage regulating unit in pu.
check (optional)
0 (default) Do not check if the control mode is set to voltage control.
1 Only return the controlled node if the control mode is set to voltage
control.
R ETURNS
Controlled node, NULL if no controlled terminal exists (or not voltage controlled if check=1)
147
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example writes the controlled nodes for all calculation relevant objects.
set objs;
object obj, node;
double vtarget;
objs = GetCalcRelevantObjects();
GetCubicle*
Returns the cubicle of an object at the connection with index n, or NULL if there is no cubicle
inside the object.
object object.GetCubicle(int side)
A RGUMENTS
side The connection number.
R ETURNS
The cubicle object or NULL.
GetFullName*
Returns the full name of the object as a string.
string object.GetFullName([int type])
A RGUMENTS
type(optional)
Is used to determine the format of the returned full name:
not given
No special formatting.
=0
The full name (complete database path including the name and class name)
of the object. It becomes a clickable link if printed to the output window.
> 0 (but less or equal to 190)
Formatted exactly to this length and also clickable if printed to the output
window.
R ETURNS
The fullname (complete database path including the name and class name) of the object.
148
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
E XAMPLE
str = obj.GetFullName();
printf('%s', str);
! Output:
! \Support.IntUser\Example Hierarchy 6.IntPrj\Network Model.IntPrjfolder
! \Network Data.IntPrjfolder\Small Network.ElmNet \400 kV Drakelow\SGT3A.ElmTr3
str = obj.GetFullName(0);
printf('%s', str);
! Output:
! 'Network Model\Network Data\Small Network\400 kV Drakelow\SGT3A.ElmTr3'
str = obj.GetFullName(30);
printf('%s', str);
! Output:
! '400 kV Drakelow\SGT3A.ElmTr3'
GetImpedance*
Returns the positive sequence impedance of an element referred to a given voltage.
int object.GetImpedance(double& real,
double& imag,
double refVoltage,
[int i3Trf])
A RGUMENTS
real (out) Real part of the impedance in Ohm.
imag (out)
Imaginary part of the impedance in Ohm.
refVoltage
Reference voltage for the impedance in kV.
i3Trf (optional)
When used with an ElmTr3
0 Return the HV-MV impedance.
1 Return the HV-LV impedance.
2 Return the MV-LV impedance.
R ETURNS
1 An error occurred.
0 Otherwise.
S EE ALSO
object.GetZeroImpedance()
GetInom*
Returns the nominal current of the object at given bus index.
double object.GetInom([int busIndex = 0],
[int inclChar = 0])
149
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
A RGUMENTS
busIndex (optional)
Bus index, default value is 0.
inclChar (optional)
option to consider thermal rating objects and values modified by characteristics
on the (de-)rating factor.
0 Not considering thermal rating objects or values modified by charac-
teristics on the (de-)rating factor (default).
1 Considering thermal rating objects and values modified by character-
istics on the (de-)rating factor.
2 Considering thermal rating objects but not values modified by charac-
teristics on the (de-)rating factor.
R ETURNS
The nominal current at bus index.
D EPRECATED N AMES
Inom
S EE ALSO
object.GetUnom()
E XAMPLE
The following example shows the nominal voltages and currents on both sides of all trans-
formers.
set lines;
object obj;
double cur1, cur2;
double volt1, volt2;
lines = GetCalcRelevantObjects('*.ElmTr2');
for(obj=lines.First(); obj; obj=lines.Next()) {
volt1 = obj.GetUnom(0);
volt2 = obj.GetUnom(1);
cur1 = obj.GetInom(0);
cur2 = obj.GetInom(1);
printf('%o: Inom1 = %f, Inom2 = %f', obj, volt1, volt2);
printf('%o: Unom1 = %f, Unom2 = %f', obj, cur1, cur2);
}
GetNet
Returns the grid in which the object is located.
object object.GetNet()
R ETURNS
object The grid (ElmNet) where the object is stored in.
NULL If the current object is not stored in any grid.
150
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
GetNode*
Returns the node connected to the object at specified bus index.
object object.GetNode(int busIndex,
[int considerSwitches = 0])
A RGUMENTS
busIndex Bus index.
considerSwitches (optional)
0 Ignore the status of the switches (default).
1 Consider the status of the switches.
R ETURNS
object Connected node object at specified bus index.
NULL If no node at bus index is found.
GetOperator*
Returns the element’s operator (ElmOperator ).
object object.GetOperator()
R ETURNS
Object of class ElmOperator determined according to following rules
• If operator is set in current object instance (attribute “pOperator”) this operator object is
retured.
• Else the operator inherited from its parent is used (recursively applied).
• NULL if none if its parents have an operator set.
GetOwner*
Returns the elements’s owner (ElmOwner ).
object object.GetOwner()
R ETURNS
Object of class ElmOwner determined according to following rules
• If owner is set in current object instance (attribute “pOwner”) this owner object is retured.
• Else the owner inherited from its parent is used (recursively applied).
• NULL if none if its parents have an operator set.
GetParent*
Returns the parent folder object (same as parameter ’fold id’).
object object.GetParent()
151
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
object The parent folder object.
NULL On the root database folder e.g. parent of a user.
S EE ALSO
object.GetContents()
E XAMPLE
The following example returns the folder in which a line is stored.
set objects;
object line, folder;
objects = GetCalcRelevantObjects();
line = objects.Firstmatch('ElmLne');
folder = line.GetParent();
if (folder) {
folder.ShowFullName();
}
GetReferences*
Returns a set containing all objects with references to the object the method was called on. By
default, references from IntSubset objects or hidden objects are ignored.
set object.GetReferences([string filter = '*',]
[int includeSubsets = 0,]
[int includeHiddenObjects = 0])
A RGUMENTS
filter (optional)
Object filter to get only objects whose name matches this filter string, e.g. '*.ElmLne'.
(default: ’*’)
includeSubsets (optional)
Forces references from IntSubset objects to be evaluated. These are normally not
included for performance reasons. (default: 0)
includeHiddenObjects (optional)
Include also hidden objects. By default they are not included. In contrast hidden
objects are always included in the ’Reference List’ output of the data browser.
(default: 0)
R ETURNS
Set of objects with references to the object the method was called on.
E XAMPLE
The following example returns all relevant objects of class 'TypBar':
set objs, refs;
object obj1, obj2;
152
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
refs = obj1.GetReferences();
for (obj2 = refs.First(); obj2; obj2 = refs.Next()) {
obj2.ShowFullName();
}
}
S EE ALSO
object.GetReferences()
GetRegion*
All network components are internally associated with an artificial region. A region consists of
topologically connected elements. This means, two elements elm1 and elm2 are topologically
connected ⇔ elm1.GetRegion() == elm2.GetRegion().
A region is simply identified by a number that can be access via this function.
int object.GetRegion()
E XAMPLE
The following example shows the region index for all calculation relevant network elements:
set elements;
object obj;
int region, t;
string clasz;
elements = GetCalcRelevantObjects();
for (obj = elements.First(); obj; obj = elements.Next()) {
clasz = obj.GetClass();
t = strcmp('Elm', clasz, 3);
if (t <> 0) {
continue; !only for network elements
}
region = obj.GetRegion();
if (region > -1) {
printf('Element %o belongs to region %d', obj, region);
}
else {
printf('Region for element %o is unknown', obj);
}
}
R ETURNS
Region index >0. A value of ‘-1’ means status is unknown for that element (normally for not
topology relevant elements).
153
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
GetSize*
Returns the size of the variable “VarName” when this variable is a vector or a matrix.
int object.GetSize(string VarName,
int& rows,
[int& cols])
A RGUMENTS
VarName The name of the variable.
rows (out)
The number of rows for a vector or matrix.
cols (optional, out)
The number of columns for a matrix.
R ETURNS
0 When “VarName” is a valid variable name.
1 Otherwise.
S EE ALSO
object.GetVal()
E XAMPLE
The following example prints the matrix resistances from a tower model with 2 circuits.
int err;
double x;
int r, rows, c, cols;
string str;
err = Tower.GetSize('R_c',rows, cols);
if (.not.err) {
r=0;
while (r<rows) {
str = '';
c = 0;
while (c<cols) {
err = Tower.GetVal(x, 'R_c', r,c);
if (.not.err) str = sprintf('%str %f', str, x); {
c+=1;
}
printf(str);
r+=1;
}
}
Example Output :
0.067073 0.016869 0.016594 0.016851 0.016576 0.016372 0.016869 0.066832
0.016701 0.016576 0.016445 0.016408 0.016594 0.016701 0.066738 0.016372
0.016408 0.016516 0.016851 0.016576 0.016372 0.067073 0.016869 0.016594
0.016576 0.016445 0.016408 0.016869 0.066832 0.016701 0.016372 0.016408
0.016516 0.016594 0.016701 0.066738
154
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
GetSupplyingSubstations*
Returns the closest supplying substation(s) for a network component.
“Closest” means that there is no other supplying element of same type in topological path
between network component and the supplying component(s) returned by this function.
set object.GetSupplyingSubstations()
R ETURNS
List of substations (objects of class ElmSubstat). Can be empty.
S EE ALSO
GetSupplyingTransformers*
Returns the closest supplying transformer(s) for a network component. “Closest” means that
there is no other supplying element of same type in topological path between network compo-
nent and the supplying component(s) returned by this function.
set object.GetSupplyingTransformers()
R ETURNS
List of transformers (objects of class ElmTr2 or ElmTr3). Can be empty.
S EE ALSO
GetSupplyingTrfstations*
Returns the closest supplying transformer station(s) for a network component.
“Closest” means that there is no other supplying element of same type in topological path
between network component and the supplying component(s) returned by this function.
set object.GetSupplyingTrfstations()
R ETURNS
List of transformer stations (objects of class ElmTrfstat). Can be empty.
S EE ALSO
GetSystemGrounding*
Returns the grounding type employed in the grounding area of the grid the object belongs to.
The grounding area is defined by network components separating the zero sequence system
(e.g. star-delta transformers).
int object.GetSystemGrounding()
155
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
-1 grounding type can not be determined
0 system is solidly grounded
1 system is compensated
2 system is isolated
D EPRECATED N AMES
GetSystemGround
GetUnom*
Returns the nominal voltage of the object.
double object.GetUnom([int busIndex = 0])
A RGUMENTS
busIndex (optional)
Bus index, default value is 0.
R ETURNS
The nominal voltage at bus index.
D EPRECATED N AMES
Unom
S EE ALSO
object.GetInom()
E XAMPLE
The following example collects all high voltage lines. The value VoltageLevel is an input
parameter. The script also needs a general selection defined.
set lines, highvoltages;
object obj;
double voltage;
highvoltages.Clear();
lines = SEL.AllLines();
obj = lines.First();
while (obj) {
voltage = obj.GetUnom();
if (voltage>VoltageLevel) {
highvoltages.Add(obj);
}
obj = lines.Next();
}
156
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
GetVal*
Returns the value of the given variable in the currently set unit (unit could differ from ob-
ject.SetVal()). The row or column can be given for vector or matrix variables.
int object.GetVal(int& | double& | string& | object& | set& value,
string variable,
[int row,]
[int col,]
[string key])
A RGUMENTS
value (out)
Outputs the value of the variable. The value is always in the currently set unit of
the variable (as seen in the edit dialog).
variable Name of the variable to get the value for.
row (optional)
Row number for a vector or matrix variable (≥ 0). For negative numbers 0 is used.
col (optional)
Column number for a matrix variable (≥ 0). For negative numbers 0 is used.
key (optional)
The key parameter is used to get the real, imaginary part, angle, magnitude of a
complex parameter (and complex vector, matrix), or for a double vector parameter
to get statistic values like min, max, average, sum, ...
’r’,’i’,’mag’,’phi’,’phirad’ real part, imaginary part, magnitude, angle in degree,
angle in radians
’min’,’max’,’sum’,’avg’,’std’,’varia’ minimum, maximum, sum, avarage, stan-
dard deviation, variance...
R ETURNS
0 Value successfully obtained.
1 On error e.g. variable does not exist or row/column number is out of range.
S EE ALSO
object.SetVal()
GetVarType*
Outputs the data type of an attribute of the object.
int object.GetVarType(string name,
string& type)
A RGUMENTS
name Name of the attribute to get the type for.
type (out) Outputs the data type of the attribute as string, if it exists.
R ETURNS
0 Variable exists.
1 On error.
157
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
E XAMPLE
set terminals;
object terminal;
string attribute, type;
attribute = 'loc_name';
terminal.GetVarType(attribute, type);
printf('Data type of attribute "%s" is "%s"', attribute, type);
attribute = 'uknom';
terminal.GetVarType(attribute, type);
printf('Data type of attribute "%s" is "%s"', attribute, type);
GetZeroImpedance*
Returns the zero sequence impedance of an element referred to a given voltage.
int object.GetZeroImpedance(double& real,
double& imag,
double refVoltage,
[int i3Trf])
A RGUMENTS
real (out) Real part of the impedance in Ohm.
imag (out)
Imaginary part of the impedance in Ohm.
refVoltage
Reference voltage for the impedance in kV.
i3Trf (optional)
When used with an ElmTr3
0 Return the HV-MV impedance.
1 Return the HV-LV impedance.
2 Return the MV-LV impedance.
R ETURNS
1 An error occurred.
0 Otherwise.
S EE ALSO
object.GetImpedance()
HasReferences*
Find out whether there are objects with references to the object the method was called on.
int object.HasReferences()
158
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
0 There are no such objects
1 There is one or more such objects
S EE ALSO
object.GetReferences()
HasResults*
Checks if the object has calculated result parameters.
int object.HasResults([int ibus])
A RGUMENTS
ibus (optional)
Bus index
-1(default) Checks if “c:” quantities exist
>= 0 Checks if 'm:xxxx:bus ' quantities exist for bus index=ibus
2 Hidden objects are returned
R ETURNS
0 no results available
1 results exist
E XAMPLE
The following example checks if lines have results.
set lines;
object line;
int iret;
lines = GetCalcRelevantObjects('*.ElmLne');
for(line = lines.First(); line; line = lines.Next()) {
iret = line.HasResults();
if (iret) {
printf('Line %o has results', line);
}
else {
printf('Line %o DOES NOT have results', line);
}
}
IsCalcRelevant*
Returns whether the object is relevant for calculation.
In contrast to GetCalcRelevantObjects() it also returns 1 for objects in the active study case e.g.
simulation events (Evt*).
int object.IsCalcRelevant()
159
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
0 When the object is not used for calculations.
1 When the object is currently used for calculations.
D EPRECATED N AMES
IsRelevant
S EE ALSO
GetCalcRelevantObjects()
E XAMPLE
The following example checks if a line is used in the calculation.
int isCalcRelevant;
isCalcRelevant = MyLine.IsCalcRelevant();
if (isCalcRelevant) {
MyLine.ShowFullName();
}
IsClass*
Returns whether the object is of a certain class.
int object.IsClass(string className)
A RGUMENTS
className
The name of the class.
R ETURNS
1 Object is of the given class.
0 Object is not of the given class.
S EE ALSO
object.GetClassName()
E XAMPLE
The following example write all overloaded lines and transformers to the output window,
where a different maximum loading is used for lines or transformers.
set objects;
object obj;
int result;
objects = GetCalcRelevantObjects();
obj = objects.First();
while (obj) {
result = obj.IsClass('ElmLne');
if (result) {
if (obj:c:loading > 0.85) {
obj.ShowFullName();
}
}
else {
result = obj.IsClass('ElmTr2');
160
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
if (result) {
if (obj:c:loading > 0.95) {
obj.ShowFullName();
}
}
}
obj = objects.Next();
}
IsDeleted*
Returns 1 if the object is deleted.
int object.IsDeleted()
R ETURNS
1 Object is already deleted.
0 Object is not deleted.
IsEarthed*
Checks if a network component is topologically connected to any earthed component. Earthing
components are terminals / busbars (ElmTerm) with attribute ‘iEarth’ = 1 and all closed ground-
ing switches (ElmGndswt). An energized component is never considered to be earthed.
int object.IsEarthed()
R ETURNS
1 Component is earthed (connected to an earthing component)
0 Component is not earthed
E XAMPLE
The following example shows the earthed elements:
set elements;
object obj;
int status, t;
string clasz;
elements = GetCalcRelevantObjects();
for (obj = elements.First(); obj; obj = elements.Next()) {
clasz = obj.GetClass();
t = strcmp('Elm', clasz, 3);
if (t <> 0) {
continue; !only for network elements
}
status = obj.IsEarthed();
if (status = 0) {
printf('Component %o is not earthed.', obj);
}
else if (status > 0) {
printf('Component %o is earthed.', obj);
}
}
161
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
IsEnergized*
Checks if a network component is energized. A component is considered to be energized, if it is
topologically connected to a generator. All other elements are considered to be deenergized.
int object.IsEnergized()
R ETURNS
1 Component is energized
0 Component is deenergized
-1 Component has no energizing status (status unknown)
E XAMPLE
The following example shows the energizing status of all elements:
set elements;
object obj;
int status, t;
string clasz;
elements = GetCalcRelevantObjects();
status = obj.IsEnergized();
if (status = 0) {
printf('Component %o is de-energized.', obj);
}
else if (status > 0) {
printf('Component %o is energized.', obj);
}
else if (status < 0) {
printf('Energizing status for %o is unknown.', obj);
}
}
IsHidden*
Checks whether an object is hidden with respect to currently activated variation. An object is
hidden if it is
int object.IsHidden()
R ETURNS
0 not hidden, currently ’active’
1 hidden, currently ’inactive’
162
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
IsInFeeder*
Checks if the object is part of the given feeder. A network element is considered being part of a
feeder if a topological path from the feeder definition to the element exists.
This function is based on load flow calculation results. Therefore, it can only be used after such
a calculation has been successfully executed and as long as the results are available.
int object.IsInFeeder(object Feeder,
[int OptNested=0])
A RGUMENTS
Feeder The Feeder definition object ElmFeeder
OptNested (optional
0 Nested feeders are not considered.
1 Nested feeders are considered.
R ETURNS
1 If “Feeder” is a feeder definition and the object is part of that feeder.
0 Otherwise
S EE ALSO
ElmFeeder.GetAll()
IsNetworkDataFolder*
Checks whether given object is a special folder within a project that stores specific data ele-
ments. Each project can not have more than one instance per folder type.
The following folder types are distinguished (PowerFactory class names):
int object.IsNetworkDataFolder()
163
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
0 false, object is not a network data folder
1 true, object is a network data folder
S EE ALSO
GetDataFolder()
IsNode*
Indicates wtheter an object is a node (terminal or busbar).
int object.IsNode()
R ETURNS
1 Object is a node.
0 Otherwise.
IsObjectActive*
Check if an object is active for specific time.
int object.IsObjectActive(int time)
A RGUMENTS
time Time in seconds since 01.01.1970 00:00:00.
R ETURNS
0 Object is not active (hidden or deleted).
1 Object is active.
IsObjectModifiedByVariation*
Check if an object is active for specific time.
int object.IsObjectModifiedByVariation(int considerADD, int considerDEL, int considerDELTA)
A RGUMENTS
considerADD
checks if an ADD-object exists
0 ignore ADD-objects
1 consider ADD-objects
considerDEL
check if a DELETE-Object exists or exist for the parent objects
0 ignore DELETE-objects
1 consider DELETE-objects
considerDELTA
check if a DELTA-Object exists
0 ignore DELTA-objects
1 consider DELTA-objects
164
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Object is not modified by an active variation
1 Object is modified by an active variation
Isolate
Performs an “isolate” action on the network element. This corresponds to performing a “switch
off” action followed by an additional earthing of switched off region.
The action is identical to that in the context menue.
int object.Isolate([set& changedSwitches,]
[int resetRA,]
[int isolateCBs])
A RGUMENTS
changedSwitches (optional, out)
All switches whose switching state was changed by the action are filled into this
set
resetRA (optional)
Determines whether an active running arrangement that would prevent switching
action should be deactivated or not.
1 All running arrangements that cause blocking of relevant switches are
applied and reset automatically before the switching is performed.
0 (default) Active running arrangements are not reset. Blocked switches
will cause the switching action to fail
isolateCBs (optional)
Determines if, in addition, circuit breakers should be isolated by opening its adja-
cent disconnectors (if not given, default will be taken from project settings)
0 No additional opening of disconnectors
1 Also open disconnectors adjacent to switched circuit breakers)
R ETURNS
Information about the success of the action:
S EE ALSO
IsOutOfService*
Indicates whether or not the object is currently out of service.
int object.IsOutOfService()
R ETURNS
0 When the object is in service.
1 When the object is out of service.
165
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example checks if a line is out of service.
int i;
i = MyLine.IsOutOfService();
if (i) {
MyLine.ShowFullName();
}
IsReducible*
Checks if object can be reduced during network reduction.
int object.IsReducible()
R ETURNS
0 object can never be reduced.
1 object can be reduced (e.g. switch, zero-length lines)
2 in principle the object can be reduced, but not now (e.g. switch that is set to be
detailed)
E XAMPLE
The following example checks if an object is reducible:
set objs;
object obj;
int res;
objs = GetCalcRelevantObjects();
for (obj = objs.First(); obj; obj = objs.Next()) {
res = obj.IsReducible();
if (res = 0) {
printf('Object %o is not reducible.', obj);
continue;
}
if (res = 1){
printf('Object %o is reducible.', obj);
continue;
}
if (res = 2) {
printf('Object %o is currently not reducible.', obj);
continue;
}
}
IsShortCircuited*
Returns whether an element is short-circuited or not.
int object.IsShortCircuited()
166
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
0 No short-circuit found.
1 Element is short-circuited.
lnm*
Returns the long description of the variable.
string object.lnm(string VarName
[int& error])
A RGUMENTS
VarName The variable name.
error (optional, out)
1 on error, otherwise 0.
R ETURNS
The long variable description.
S EE ALSO
object.snm(), object.unm()
E XAMPLE
The following example prints information about the length of a line.
set lines;
object line;
string s1,s2,s3;
lines = GetCalcRelevantObjects('*.ElmLne');
for(line = lines.First(); line; line = lines.Next()) {
s1 = line.lnm('dline');
s2 = line.snm('dline');
s3 = line.unm('dline');
printf('%s (%s) = %5.3f [%s]',s1, s2, line:dline, s3);
}
Example output:
Length of Line (Length) = 0.547 [km]
MarkInGraphics
This function is not supported in GUI-less mode.
Marks the object in the diagram in which the element is found by hatch crossing it. By default
all the currently opened diagrams are searched for the element to mark beginning with the
diagram shown. The first diagram in which the element is found will be opened and the element
is marked.
Alternatively the search can be extended to all existing diagrams by passing 1 as parameter. If
the element exists in more than one diagram the user can select from a list of diagrams which
diagram shall be opened.
void object.MarkInGraphics([int searchAllDiagramsAndSelect = 0])
167
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
A RGUMENTS
searchAllDiagramsAndSelect (optional)
Search can be extended to all diagrams, not only the ones which are currently
shown on the desktop.
0 Only search in currently opened diagrams and open the first diagram
in which the element was found. (default)
1 Searching all diagrams, not only the ones which are currently shown
on the desktop. If there is more than one occurrence the user will be
prompted which diagrams shall be opened.
R ETURNS
A diagram in which the element is drawn is opened and the element is marked.
E XAMPLE
The following example will a line in the currently visible diagram or if not found in one of the
other diagrams which are currently opened .
set lines;
object line;
lines = GetCalcRelevantObjects('*.ElmLne');
line = lines.First();
if (line) {
line.MarkInGraphics();
}
Move
Moves an object or a set of objects to this folder.
int object.Move(object objectToMove)
int object.Move(set objectsToMove)
A RGUMENTS
objectToMove
Object to move.
objectToMove
Set of objects to move.
R ETURNS
0 On success.
1 On error.
S EE ALSO
E XAMPLE
object targetobj,startobj;
set allObjs;
! move startobj to targetobj
targetobj.Move(startobj);
! move all objects inside allObjs to targetobj
targetobj.Move(allObjs);
168
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
PasteCopy
Pastes a copy of a single object or a set of objects to this object (= target object) using the
merge tool if source object(s) and target object are inside different projects (equivalent to a
manual copy&paste operation).
If the argument ‘resetMissingReferences’ is not given, a dialog on assignment conflicts will pop
up, which offers to reset all missing references, to show the merge tool or to cancel the action.
int object.PasteCopy(object objectToCopy,
[object& newObject],
[int resetMissingReferences])
int object.PasteCopy(set objectsToCopy)
A RGUMENTS
objectToCopy
Object to be copied.
objectsToCopy
Set of objects to copy.
newObject (optional, out)
The new object copy of objectToCopy is assigned on success.
resetMissingReferences (optional)
If set, determines how to handle missing references.
0 No action is taken, the operation is cancelled with an error.
1 Missing references are automatically reset.
R ETURNS
0 Object(s) successfully copied.
1 Error.
S EE ALSO
PurgeUnusedObjects
The function deletes the following child objects:
1. All 'hidden' objects without corresponding ”Add” object. These objects are only deleted, if
the condition is fulfilled for all child objects (hidden without corresponding 'Add' object).
2. All internal expansion stage objects with invalid target object (target object reference is
missing).
It’s crucial that there is no study case active when executing the function.
void object.PurgeUnusedObjects()
169
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
S EE ALSO
object.ReportUnusedObjects()
ReportUnusedObjects
Prints a report in the PowerFactory output window, which object will be deleted when function
object.PurgeUnusedObjects() is called. It’s crucial that there is no study case active when
executing the function.
void ReportUnusedObjects()
S EE ALSO
object.PurgeUnusedObjects()
SearchObject*
Searches for an object with a full name, such as
'rootfolder.class\subfolder.class\...\locname.class '.
object object.SearchObject(string name)
A RGUMENTS
name string to search
R ETURNS
Returns the searched object.
E XAMPLE
The following example searches for a terminal in the Network Model folder.
object obj, folder;
folder = GetProjectFolder('netmod');
if (folder) {
obj = folder.SearchObject('Network Data.IntPrjfolder\Nine_Bus.ElmNet\Bus1.ElmTerm');
if (obj) {
obj.ShowFullName();
}
}
S EE ALSO
object.GetFullName()
SetSize
Sets the size of the variable 'VarName' for an object if this variable is a vector or matrix.
int object.SetSize(string VarName,
int rows,
[int cols])
170
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
A RGUMENTS
VarName Object variable
rows Row of the variable’s matrix or vector
cols (optional)
Column of the variable’s matrix or vector
R ETURNS
0 'VarName' is a valid variable name
1 Variable not found or variable is not a matrix or vector
S EE ALSO
object.SetVal()
E XAMPLE
The following example will set the size of the row and column to 5:
object typSym;
int res1,res2;
typSym.GetSize('satv',oldsize);
printf('Old size of vector: %d',oldsize);
res1 = typSym.SetSize('satv',5);
res2 = typSym.SetSize('satse',5);
if (res1=1.or.res2=1) {
printf('Error - parameter setse or setv no vector or matrix');
exit();
}
typSym.GetSize('satv',size);
printf('New size of vector: %d',size);
SetVal
Sets the value of the given variable in the default unit (unit could differ from object.GetVal()).
The row or column can be given for vector or matrix variables.
int object.SetVal(int|double|string|object|set value,
string variable,
[int row],
[int col])
A RGUMENTS
value (out)
Value to set to. Have to be given in the default unit and could differ from the
currently set unit.
variable Name of the variable to set the value for.
row (optional)
Row number for a vector or matrix variable (≥ 0). For negative numbers 0 is used.
col (optional)
Column number for a matrix variable (≥ 0). For negative numbers 0 is used.
171
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Value successfully set.
1 On error e.g. variable does not exist or row/column number is out of range.
S EE ALSO
object.GetVal()
E XAMPLE
The following example sets the size of the row and column to 5:
object typSym;
int row, size;
double val;
typSym.GetSize('satv',size);
val = 0;
row = 0;
while (row<size) {
typSym.SetVal(val,'satv',row);
typSym.SetVal(0,'satse',row);
val += 0.1;
row += 1;
}
ShowEditDialog
This function is not supported in GUI-less mode.
Opens the edit dialogue of the object. Command objects (such as ComLdf ) will have their
“Execute” button disabled. The execution of the running script will be halted until the edit
dialogue is closed again.
Editing of command objects (ComDPL, ComPython) is not supported.
int object.ShowEditDialog()
R ETURNS
1 Edit dialogue was cancelled by the user.
0 Otherwise.
D EPRECATED N AMES
Edit
E XAMPLE
The following example opens a line dialogue, prior to calculating a load flow.
MyLine.ShowEditDialog();
Ldf.Execute();
172
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
ShowFullName*
Prints the full name (complete database path including the name and class name) of the object
as clickable link to the output window. This is useful to inspect or edit the printed object after the
script has finished.
void object.ShowFullName()
S EE ALSO
object.GetFullName()
E XAMPLE
The following example writes all overloaded lines from the selection to the output window.
set lines;
object line;
lines = SEL.AllLines();
line = lines.First();
while (line) {
if (line:c:loading > 100.0) {
line.ShowFullName();
}
line = lines.Next();
}
ShowModalSelectTree
This function is not supported in GUI-less mode.
Shows a modal window with the database object tree of the object on which the function is
called on.
object object.ShowModalSelectTree([string title,]
[string filter])
A RGUMENTS
title (optional)
Title of the dialog. If omitted, a default title will be used.
filter (optional)
Classname filter e.g. 'ElmLne' or 'Com*'. If set, a selection is only accepted if the
classname of the selected object matches that filter.
R ETURNS
object Selected object.
NULL No object selcted e.g. 'Cancel' clicked.
snm*
Returns the short variable name. By default, the short name equals the long variable name.
In some cases, the variable also has a short name which is used to save space in reports or
dialogues.
string object.snm(string VarName
[int& error])
173
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
A RGUMENTS
VarName The variable name
error (optional, out)
1 on error, otherwise 0.
R ETURNS
The short name.
S EE ALSO
object.lnm(), object.unm()
SwitchOff
Performs a “switch off” action on the network element. This action is identical to that in the
context menue.
int object.SwitchOff([set& changedSwitches,]
[int resetRA,]
[int simulateOnly])
A RGUMENTS
changedSwitches (optional, out)
All switches whose switching state was changed by the action are filled into this
set
resetRA (optional)
Determines whether an active running arrangement that would prevent switching
action should be deactivated or not.
1 All running arrangements that cause blocking of relevant switches are
applied and reset automatically before the switching is performed.
0 (default) Active running arrangements are not reset. Blocked switches
will cause the switching action to fail
simulateOnly (optional)
Can be used to get the switches that would be changed. No switching is performed
if set to ‘1’. (default is ’0’)
R ETURNS
Information about the success of the action:
S EE ALSO
SwitchOn
Performs a “switch on” action on the network element. This action is identical to that in the
context menue.
int object.SwitchOn([set& changedSwitches,]
[int resetRA,]
[int simulateOnly])
174
3.1. GENERAL METHODS CHAPTER 3. OBJECT METHODS
A RGUMENTS
changedSwitches (optional, out)
All switches whose switching state was changed by the action are filled into this
set
resetRA (optional)
Determines whether an active running arrangement that would prevent switching
action should be deactivated or not.
1 All running arrangements that cause blocking of relevant switches are
applied and reset automatically before the switching is performed.
0 (default) Active running arrangements are not reset. Blocked switches
will cause the switching action to fail
simulateOnly (optional)
Can be used to get the switches that would be changed. No switching is performed
if set to ‘1’. (default is ’0’)
R ETURNS
Iinformation about the success of the action:
S EE ALSO
unm*
Returns the unit of the variable.
string object.unm(string VarName,
[int& error])
A RGUMENTS
VarName The variable name
error (optional, out)
1 on error, otherwise 0.
R ETURNS
The unit name.
S EE ALSO
object.lnm(), object.snm()
VarExists*
Checks whether the variable exists and whether it is currently valid on this object.
int object.VarExists(string name)
A RGUMENTS
name Name of the variable.
175
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
1 Variable exists and is currently valid on this object.
0 Variable does not exist e.g. variable never exists or variable currently not exists
since the load flow is not calculated.
E XAMPLE
The following example calculates the total length of cables and lines.
int exists, unitFound;
double totalLength;
string unit;
object obj;
set objects;
objects = GetCalcRelevantObjects();
obj = objects.First();
while (obj) {
exists = obj.VarExists('dline');
if (exists) {
totalLength += obj:dline;
unitFound = strlen(unit);
if (unitFound = 0) {
unit = obj.unm('dline');
}
}
obj = objects.Next();
}
3.2.1 ElmArea
Overview
CalculateInterchangeTo*
CalculateVoltageLevel*
CalculateVoltInterVolt*
DefineBoundary
GetAll*
GetBranches*
GetBuses*
GetObjs*
176
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CalculateInterchangeTo*
Calculates interchange power to the given area (calculated quantities are: Pinter, Qinter, Pex-
port, Qexport, Pimort, Qimport). Prior the calculation the valid load flow calculation is required.
int ElmArea.CalculateInterchangeTo(object area)
A RGUMENTS
area Area to which the interchange is calculated
R ETURNS
<0 Calculation error (i.e. no valid load flow, empty area...)
0 No interchange power to the given area
1 Interchange power calculated
E XAMPLE
object AreaA, AreaB; ! externally defined (i.e. input)
AreaA = inputA;
AreaB = inputB;
object Ldf = GetFromStudyCase('ComLdf');
Ldf.Execute();
AreaA.CalculateInterchangeTo(AreaB);
printf('Interchange Pinter from %o to %o is %f MW', AreaA, AreaB, AreaA:c:Pinter);
CalculateVoltageLevel*
Internal funciton to calculate per voltage level the corresponding summary results. The values
are stored in current area (values from the previous load flow calculation are overwritten):
int ElmArea.CalculateVoltageLevel(double U)
A RGUMENTS
U for voltage level (in kV)
R ETURNS
<0 error
=0 voltage level not exists in the area
>0 ok
CalculateVoltInterVolt*
This function calculates the power flow from voltage level to voltage level. The values are stored
in current area in the following attributes (values from the previous load flow calculation are
overwritten):
177
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
Ufrom from voltage level (in kV)
Uto to voltage level (in kV)
R ETURNS
<0 error
=0 voltage levels not exists in the area, no interchange exists
>0 ok
DefineBoundary
Defines boundary with this area as interior part. Resulting cubicles of boundary are busbar-
oriented towards the area.
object ElmArea.DefineBoundary(int shift)
A RGUMENTS
shift Elements outside the area that are within a distance of shift many elements to
a boundary cubicle of the area are added to the interior part of the resulting
boundary
R ETURNS
The defined boundary is returned in case of success. Otherwise NULL, if an error appeared
in the definition of the boundary.
E XAMPLE
external object: "thisArea"
double shift;
object newBoundary;
shift = 2;
newBoundary = thisArea.DefineBoundary(shift);
if ({newBoundary <> NULL}) {
printf('Defined boundary %o by shifting %d elements!', newBoundary, shift);
}
GetAll*
Returns all objects which belong to this area.
set ElmArea.GetAll()
R ETURNS
The set of contained objects.
178
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
set all,areas;
object prj,area,obj;
! output elements in the area
prj = GetActiveProject();
if (prj) {
areas = prj.GetContents('*.ElmArea',1);
areas.SortToVar(0,'loc_name');
for (area=areas.First(); area; area=areas.Next()) {
printf('Elements in area %s',area:loc_name);
all = area.GetAll();
for (obj=all.First(); obj; obj=all.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
GetBranches*
Returns all branches which belong to this area.
set ElmArea.GetBranches()
R ETURNS
The set of branch objects.
E XAMPLE
set all,areas;
object prj,area,obj;
! output elements in the area
prj = GetActiveProject();
if (prj) {
areas = prj.GetContents('*.ElmArea',1);
areas.SortToVar(0,'loc_name');
for (area=areas.First(); area; area=areas.Next()) {
printf('Branches in area %s',area:loc_name);
all = area.GetBranches();
for (obj=all.First(); obj; obj=all.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
GetBuses*
Returns all buses which belong to this area.
set ElmArea.GetBuses()
R ETURNS
The set of objects.
179
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetObjs*
Returns all objects of the given class which belong to this area.
set ElmArea.GetObjs(string classname)
A RGUMENTS
classname
Name of the class (i.e. ”ElmTr2”).
R ETURNS
The set of objects.
E XAMPLE
set all,areas;
object prj,area,obj;
! output cubicles in the area
prj = GetActiveProject();
if (prj) {
areas = prj.GetContents('*.ElmArea',1);
areas.SortToVar(0,'loc_name');
for (area=areas.First(); area; area=areas.Next()) {
printf('Cubicles in area %s',area:loc_name);
all = area.GetObjs('StaCubic');
for (obj=all.First(); obj; obj=all.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
3.2.2 ElmAsm
Overview
CalcEfficiency
GetAvailableGenPower*
GetElecTorque*
GetGroundingImpedance*
GetMechTorque*
GetMotorStartingFlag*
GetStepupTransformer*
IsPQ*
180
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CalcEfficiency
Calculate efficiency for connected storage model at given active power value.
double ElmAsm.CalcEfficiency(double activePowerMW)
A RGUMENTS
activePowerMW
Active power value to calculate efficiency for.
R ETURNS
Returns the resulting efficiency in p.u.
E XAMPLE
set objs;
object obj;
int err;
double eff, Ptherm, Pelect;
Pelect = 30.0;
objs = GetCalcRelevantObjects('*.ElmAsm');
obj = objs.First();
if (obj) {
eff = obj.CalcEfficiency(Pelect);
Ptherm = Pelect/eff;
}
GetAvailableGenPower*
Returns the available power that can be dispatched from the generator, for the particular study
time.
For the case of conventional generators (no wind generation selected), the available power is
equal to the nominal power specified.
For wind generators, the available power will depend on the wind model specified:
181
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
double ElmAsm.GetAvailableGenPower()
R ETURNS
Available generation power
E XAMPLE
set generators;
object generator;
double totalpower, power;
generators = GetCalcRelevantObjects('*.ElmAsm');
GetElecTorque*
Calculates the electrical torque for a given speed and voltage.
double ElmAsm.GetElecTorque(double speed,
double uReal,
[double addZReal,]
[double addZImag]
)
A RGUMENTS
speed speed value in p.u.
uReal voltage value (real part) in p.u.
addZReal (optional)
additional impedance (real part) in p.u.
addZImag (optional)
additional impedance (imaginary part) in p.u.
R ETURNS
Returns the calculated electrical torque.
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmAsm.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
182
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
GetMechTorque*
Calculates the electrical torque for a given speed and voltage.
double ElmAsm.GetMechTorque(double speed,
double uReal
)
A RGUMENTS
speed speed value in p.u.
uReal voltage value (real part) in p.u.
R ETURNS
Returns the calculated mechanical torque.
GetMotorStartingFlag*
Returns the starting motor condition.
int ElmAsm.GetMotorStartingFlag()
R ETURNS
Returns the motor starting condition. Possible values are:
GetStepupTransformer*
Performs a topological search to find the step-up transformer of the asynchronous machine.
object ElmAsm.GetStepupTransformer(double hvVoltage,
int ignSwtStatus
)
183
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
hvVoltage
voltage level at which the search will stop
ignSwtStatus
consideration of switch status. Possible values are:
R ETURNS
Returns the first collected step-up transformer object. It is empty if not found (e.g. start
terminal already at hvVoltage).
IsPQ*
Informs whether or not it is a ”PQ” machine (constant Q control mode).
int ElmAsm.IsPQ()
R ETURNS
Returns 1 if it is a ”PQ” machine.
3.2.3 ElmAsmsc
Overview
GetAvailableGenPower*
GetGroundingImpedance*
GetStepupTransformer*
GetAvailableGenPower*
Returns the available power that can be dispatched from the generator, for the particular study
time.
For the case of conventional generators (no wind generation selected), the available power is
equal to the nominal power specified.
For wind generators, the available power will depend on the wind model specified:
184
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A power value for any time characteristic is calculated by obtaining the wind speed for the
current study time, and then calculating the power from the specified Power Curve. If the
units of the Power Curve are in MW, the returned value is directly the power value. In the
other hand, if the units are in PU, the returned value is multiplied by the nominal power of
the generator to return the power value.
R ETURNS
Available generation power
E XAMPLE
set generators;
object generator;
double totalpower, power;
generators = GetCalcRelevantObjects('*.ElmAsmsc');
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmAsmsc.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
185
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetStepupTransformer*
Performs a topological search to find the step-up transformer of the asynchronous machine.
object ElmAsmsc.GetStepupTransformer(double hvVoltage,
int ignSwtStatus
)
A RGUMENTS
hvVoltage
voltage level at which the search will stop
ignSwtStatus
consideration of switch status. Possible values are:
R ETURNS
Returns the first collected step-up transformer object. It is empty if not found (e.g. start
terminal already at hvVoltage).
3.2.4 ElmBbone
Overview
CheckBbPath*
GetBbOrder*
GetCompleteBbPath*
GetFOR
GetMeanCs*
GetMinCs*
GetTieOpenPoint*
GetTotLength*
HasGnrlMod*
CheckBbPath*
Check whether the backbone object is still valid. This means:
A RGUMENTS
outputMsg
1 Output resulting messages of check function.
0 Only check, no output of messages.
186
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Backbone is valid.
1 Backbone is invalid because of one or more of the above listed reasons.
E XAMPLE
The following example checks whether all calculated backbones are still valid.
object oBbone;
object folder;
set elementBbones;
int valid;
folder = GetDataFolder('IntBbone');
elementBbones = folder.GetContents('*.ElmBbone');
GetBbOrder*
Get order of backbone object, determined by backbone calculation according to the selected
criterion.
int ElmBbone.GetBbOrder()
R ETURNS
The order of the backbone object. The smaller the returned value, the better the backbone
according to chosen criterion. The order 1 is returned for the best backbone.
E XAMPLE
This example calculates backbones aretrieves all calculated backbones
int order;
object backboneCmd;
object backbone;
object folder;
set allBackbones;
backboneCmd = GetFromStudyCase('ComBbone');
if ( backboneCmd<>nullptr ) {
backboneCmd:e:iFeedSettng = 0; ! for all feeders
backboneCmd:e:iCalcMeth = 1; ! Criterion is cross section
backboneCmd.Execute();
folder = GetDataFolder('IntBbone');
allBackbones = folder.GetContents('*.ElmBbone');
187
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetCompleteBbPath*
Get the complete (ordered) path containing all terminals and connecting elements of the back-
bone.
void ElmBbone.GetCompleteBbPath(set& AllElmsOnBb,
int iReverse,
[int iStopAtTieOpen = 0])
A RGUMENTS
AllElmsOnBb (out)
Ordered path containing all terminals and connecting elements of the backbone.
iReverse
0 Return ordered path from start feeder to end feeder
1 Return ordered path from end feeder to start feeder
iStopAtTieOpen
0 return complete path
1 only return part of path in start feeder (iReverse=0) / in end feeder
(iReverse=1)
E XAMPLE
This example lists all calculated backbones together with all their elements
object oBbone;
object obj;
object folder;
set ElementsOnBbone;
set ElementBbones;
folder = GetDataFolder('IntBbone');
ElementBbones = folder.GetContents('*.ElementBbone');
GetFOR
Get aggregated forced outage rate (FOR) of all elements on the path of the backbone.
double ElmBbone.GetFOR()
R ETURNS
The aggregated forced outage rate (FOR) of all elements on the path of the backbone [in
1/a].
188
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
object oBbone;
object folder;
double dFOR;
set ElementBbones;
folder = GetDataFolder('IntBbone');
ElementBbones = folder.GetContents('*.ElmBbone');
GetMeanCs*
Get mean cross section value of all elements on the path of the backbone. Every cross section
value is weighted with the relative length corresponding to the total length of the backbone.
double ElmBbone.GetMeanCs()
R ETURNS
The mean cross section of the elements on the backbone path [in mm2].
E XAMPLE
object oBbone;
object folder;
double meanCs;
set ElementBbones;
folder = GetDataFolder('IntBbone');
ElementBbones = folder.GetContents('*.ElmBbone');
GetMinCs*
Get minimum cross section value of all elements on the path of the backbone. Optional: a set
with all elements on the backbone path featuring this cross section may be returned.
double ElmBbone.GetMinCs([set& ElmsMinCs])
A RGUMENTS
ElmsMinCs
Elements on the backbone path featuring minimum cross section value.
R ETURNS
The minimum cross section of all elements on the backbone path [in mm2].
189
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
object oBbone;
object obj;
object folder;
double minCs;
set ElmsMinCs;
set ElementBbones;
folder = GetDataFolder('IntBbone');
ElementBbones = folder.GetContents('*.ElmBbone');
GetTieOpenPoint*
Search and obtain the first open switching device (ElmCoup, StaSwitch) on the backbone path
(starting from the infeeding point of the starting feeder).
object ElmBbone.GetTieOpenPoint()
R ETURNS
The switching device (ElmCoup or StaSwitch) or NULL if backbone is invalid.
E XAMPLE
object oBbone;
object folder;
object oTie;
set ElementBbones;
folder = GetDataFolder('IntBbone');
ElementBbones = folder.GetContents('*.ElmBbone');
GetTotLength*
Get total lenth of all elements on the path of the backbone.
double ElmBbone.GetTotLength()
R ETURNS
The total length of the backbone path [in km].
190
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
object oBbone;
object folder;
double length;
set ElementBbones;
folder = GetDataFolder('IntBbone');
ElementBbones = folder.GetContents('*.ElmBbone');
HasGnrlMod*
Check whether backbone object ElmBbone has a valid CalBbone where corresponding results
are stored. This is only the case after a backbone calculation by scoring method (until the
calculation is reset).
int ElmBbone.HasGnrlMod()
R ETURNS
1 ElmBbone has a calculation model,
0 no calculation model available.
3.2.5 ElmBmu
Overview
Apply
Update
Apply
Applies the power dispatch. Depending on the selected 'Distribution Mode ' this is done by a
built-in algorithm based on 'Merit Order' or by a user-defined DPL script that is stored in the
contents of the virtual power plant object.
int ElmBmu.Apply()
R ETURNS
0 on success, no error occurred
1 error during dispatch by virtual power plant. Please note, a value of 1 is also
returned in case the power plant is current set out-of-service.
191
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
Update
Updates the list of machines in the tables: 'Dispatchable Machines' and 'Non-dispatchable
(fixed) Machines'.
void ElmBmu.Update()
3.2.6 ElmBoundary
Overview
AddCubicle
CalcShiftedReversedBoundary
Clear
GetInterior*
IsSplitting*
Resize
Update
AddCubicle
Adds a given cubicle with given orientation to an existing boundary. The cubicle is added only if
it is not already contained within the boundary.
int ElmBoundary.AddCubicle(object cubicle,
int orientation
)
R ETURNS
0 cubicle was successfully added
1 cubicle was not added because it is already contained (including given orienta-
tion)
CalcShiftedReversedBoundary
Defines boundary where exterior and interior part of this boundary are exchanged. Resulting
boundary cubicles are branch-oriented.
int ElmBoundary.CalcShiftedReversedBoundary(double shift,
object& boundary)
A RGUMENTS
shift Elements that are within a distance of shift many elements to a boundary cubicle
of this boundary are added to the exterior part of the resulting boundary.
boundary (out)
Defined boundary.
R ETURNS
0 Successful call, boundary defined.
1 Error during determination of boundary cubicles.
192
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
external object: "thisBoundary"
double shift;
int ret;
object newBoundary;
shift = 2;
ret = thisBoundary.CalcShiftedReversedBoundary(shift, newBoundary);
if (res = 0) {
printf('Defined boundary %o by shifting %d elements!', newBoundary, shift);
}
Clear
Removes all boundary cubicles from an existing boundary.
void ElmBoundary.Clear()
GetInterior*
Returns a set of all elements that are contained in the interior region of the boundary.
set ElmBoundary.GetInterior()
R ETURNS
Returns the set of interior elements.
E XAMPLE
external object 'newBoundary'
set interior;
object o;
interior = newBoundary.GetInterior();
o = interior.First();
while (o) {
printf('interior object: %o \n',o);
o = interior.Next();
}
IsSplitting*
Checks if the boundary splits the network into two regions. A boundary is called splitting, if and
only if, for each boundary cubicle, the adjacent terminal and the adjacent branch component
belong to different sides of the boundary.
int ElmBoundary.IsSplitting([set& notSplittingCubicles])
A RGUMENTS
notSplittingCubicles (optional, out)
All cubicles that prevent the boundary from being splitting are filled into this set.
R ETURNS
0 not splitting boundary
1 splitting boundary
193
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
set cubicles;
object cubicle;
int res;
res = boundary.IsSplitting(cubicles);
if (res) {
printf('Boundary is splitting');
}
else {
printf('Boundary is not splitting because of: ');
for (cubicle = cubicles.First(); cubicle; cubicle = cubicles.Next()) {
cubicle.ShowFullName();
}
}
Resize
Resizes the boundary cubicle vector or the cubicle orientation vector. It is strongly advised that
the size of both vectors must be the same.
void ElmBoundary.Resize(double size,
string name
)
A RGUMENTS
size size of the referenced vector (number of cubicles)
name reference to the vector (’iorient’ or ’cubicles’)
R ETURNS
If the resize is unsuccessful the error message shall be issued.
Update
Updates cached information (such as topological interiour). Required when boundary definition
was changed via DPL or Python.
void ElmBoundary.Update()
3.2.7 ElmBranch
Overview
Update
194
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
Update
Updates connection points and contained elements of the branch. If the branch element exter-
nally modified by the user, then the update shall refresh all connections in the correct manner.
Behaves same as the update button within the ElmBranch.
void ElmBranch.Update()
3.2.8 ElmCabsys
Overview
FitParams
GetLineCable*
Update
FitParams
Calculates distributed parameters for cable system elements. Whether this function calculates
constant parameters or frequency dependent parameters depends on the user setting of the
parameter 'i model' in the ElmCabsys dialog. The settings are as follows: i model=0: constant
parameters; i model=1: frequency dependent parameters.
int ElmCabsys.FitParams()
R ETURNS
0 on success
1 on error
E XAMPLE
object cabSys;
set cabSysElements;
int err;
cabSysElements = GetCalcRelevantObjects('*.ElmCabsys');
cabSys = cabSysElements.First();
err = cabSys.FitParams();
if (err) {
Error('Could not calculate line parameters for %s.', cabSys);
exit();
}
GetLineCable*
Gets cable type for the corresponding line, within the cable system.
object ElmCabsys.GetLineCable(int line)
A RGUMENTS
line Index of line.
R ETURNS
cable type On success.
NULL On error.
195
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
object oElmSys;
set lines;
object otyp;
int indx;
indx = 1;
oElmSys = GetCalcRelevantObjects('*.ElmCabsys');
cableElement = cableElements.First();
otyp = cableElement.GetLineCable(indx);
if (otyp = nullptr) {
Error('Could not find cable type for the index: %d', indx);
exit();
}
else {
printf('Line index %d corresponds to the cable type %o', indx, otyp);
}
Update
Updates cable system element depending on configuration of the associated cable system
type.
int ElmCabsys.Update()
R ETURNS
1 Cable system was updated.
0 Update was not required.
E XAMPLE
object cable;
set cableElements;
int ierr;
cableElements = GetCalcRelevantObjects('*.ElmCabsys');
cable = cableElements.First();
ierr = cable.Update();
3.2.9 ElmComp
Overview
SlotUpdate
196
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
SlotUpdate
Performs a slot update for the composite model, to try to reassign each model found in the
composite model contents to the corresponding slot.
void ElmComp.SlotUpdate()
D EPRECATED N AMES
Slotupd
3.2.10 ElmCoup
Overview
Close
GetRemoteBreakers*
IsBreaker*
IsClosed*
IsOpen*
Open
Close
Closes the switch by changing its status to ’close’. This action will fail if the status is currently
determined by an active running arrangement.
int ElmCoup.Close()
R ETURNS
0 On success
6= 0 On error
E XAMPLE
The following example gathers all open switches and closes them.
int open;
set switches;
object switch;
switches = GetCalcRelevantObjects('*.ElmCoup');
S EE ALSO
ElmCoup.Open()
197
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetRemoteBreakers*
Returns the remote circuit breakers or connected bus bars.
This information is determined by a topological search that starts at given breaker in all direc-
tions, generally stopping at
If the search reaches a busbar while only reducible components have been passed (see ob-
ject.IsReducible()) it stops and returns the connected busbar (no breaker found). In case of
non-redubicle components have been passed, the search continues until next circuit breaker is
found. Only breakers with given breaker state are returned.
set ElmCoup.GetRemoteBreakers(int desiredBreakerState,
set& foundBreakers,
[set& foundBusbars])
A RGUMENTS
desiredBreakerState
Only breakers with given status are collected.
-1 Return all remote circuit breakers
1 Return all closed remoted circuit breakers
0 Return all opened remoted circuit breakers
foundBreakers (out)
The list of the remote circuit breakers
foundBusbars (optional, out)
The list of the local bus bars
IsBreaker*
Checks if type of current switch is ’circuit-breaker’.
int ElmCoup.IsBreaker()
R ETURNS
1 Switch is a circuit-breaker.
0 Switch is not a circuit-breaker.
IsClosed*
Returns information about current switch state.
int ElmCoup.IsClosed()
R ETURNS
1 switch is closed
0 switch is open
198
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
S EE ALSO
ElmCoup.IsOpen()
IsOpen*
Returns information about current switch state.
int ElmCoup.IsOpen()
R ETURNS
1 switch is open
0 switch is closed
S EE ALSO
ElmCoup.IsClosed()
Open
Opens the switch by changing its status to ’open’. This action will fail if the status is currently
determined by an active running arrangement.
int ElmCoup.Open()
R ETURNS
0 On success
6= 0 On error
E XAMPLE
The following example gathers all closed switches and opens them.
int closed;
set switches;
object switch;
switches = GetCalcRelevantObjects('*.ElmCoup');
S EE ALSO
ElmCoup.Close()
199
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.11 ElmDsl
Overview
ExportToClipboard
ExportToFile
ExportToClipboard
Export the parameter list to clipboard.
void ElmDsl.ExportToClipboard([string colSeparator],
[int useLocalHeader]
)
A RGUMENTS
colSeparator (optional)
Separator between the columns (default: tab character).
useLocalHeader (optional)
Use the localised version of the header. Possible values are:
1 Yes (default).
0 No (use English language header).
ExportToFile
Export the parameter list to CSV file(s).
void ElmDsl.ExportToFile(string filePath,
[string colSeparator],
[int useLocalHeader]
)
A RGUMENTS
filePath Path of the CSV target file. In case of array and matrix parameters (names:
“array NAME” and “matrix NAME”), additional CSV files are created in the same
location with names obtained by appending “ array NAME” and “ matrix NAME”
to the target file name.
colSeparator (optional)
Separator between the columns (default: “;”).
useLocalHeader (optional)
Use the localised version of the header. Possible values are:
1 Yes (default).
0 No (use English language header).
200
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.12 ElmFeeder
Overview
CalcAggrVarsInRadFeed*
GetAll*
GetBranches*
GetBuses*
GetNodesBranches*
GetObjs*
CalcAggrVarsInRadFeed*
Computes all the aggregated variables in radial feeders.
int ElmFeeder.CalcAggrVarsInRadFeed([int lookForRoot,]
[int considerNested])
A RGUMENTS
lookForRoot (optional)
Calculates the variables from the deepest root. Possible values are:
0 Start from this feeder
1 (default) Find the deepest root.
considerNested (optional)
Calculates the variables also for any nested subfeeders. Possible values are:
0 Ignore any nested feeders
1 (default) Consider nested feeders.
R ETURNS
Returns whether or not the aggregated variables were calculated. Possible values are:
E XAMPLE
set feeders;
object folder,feeder;
int ierr;
! calculates the aggregated variables of all the feeders
folder = GetDataFolder('ElmFeeder');
if (folder) {
feeders = folder.GetContents('*.ElmFeeder',1);
for (feeder=feeders.First(); feeder; feeder=feeders.Next()) {
ierr = feeder.CalcAggrVarsInRadFeed();
printf('Calculation of aggr. variables in feeder %o: %d', feeder, ierr);
}
}
GetAll*
Returns a set with all objects belonging to this feeder.
set ElmFeeder.GetAll([int iNested])
201
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
iNested (optional)
Affects the collection of objects in case of nested feeders:
0 Only the objects of this feeder will be returned.
1 (default) All elements including those of nested feeders will be re-
turned.
R ETURNS
The set of network elements belonging to this feeder. Can be empty.
E XAMPLE
set all,feeders;
object folder,feeder,obj;
! output elements in the feeders
folder = GetDataFolder('ElmFeeder');
if (folder) {
feeders = folder.GetContents('*.ElmFeeder',1);
feeders.SortToVar(0,'loc_name');
for (feeder=feeders.First(); feeder; feeder=feeders.Next()) {
printf('Elements in feeder %s',feeder:loc_name);
all = feeder.GetAll(1);
for (obj=all.First(); obj; obj=all.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
S EE ALSO
object.IsInFeeder()
GetBranches*
Returns a set with all branch elements belonging to this feeder.
set ElmFeeder.GetBranches([int iNested])
A RGUMENTS
iNested (optional)
Affects the collection of objects in case of nested feeders:
R ETURNS
The set of bus and branch elements in feeder.
E XAMPLE
set aBranches,feeders;
object folder,feeder,obj;
! output elements in the feeders
folder = GetDataFolder('ElmFeeder');
202
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
if (folder) {
feeders = folder.GetContents('*.ElmFeeder',1);
feeders.SortToVar(0,'loc_name');
for (feeder=feeders.First(); feeder; feeder=feeders.Next()) {
printf('Branches in feeder %s',feeder:loc_name);
aBranches = feeder.GetBranches(1);
for (obj=aBranches.First(); obj; obj=aBranches.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
GetBuses*
Returns a set with all buses belonging to this feeder.
set ElmFeeder.GetBuses([int iNested])
A RGUMENTS
iNested (optional)
Affects the collection of objects in case of nested feeders:
0 Only the objects of this feeder will be returned.
1 (default) All elements including those of nested feeders will be re-
turned.
R ETURNS
The set of bus elements in feeder.
E XAMPLE
set nodes,feeders;
object folder,feeder,obj;
! output elements in the feeders
folder = GetDataFolder('ElmFeeder');
if (folder) {
feeders = folder.GetContents('*.ElmFeeder',1);
feeders.SortToVar(0,'loc_name');
for (feeder=feeders.First(); feeder; feeder=feeders.Next()) {
printf('Buses in feeder %s',feeder:loc_name);
nodes = feeder.GetBuses(1);
for (obj=nodes.First(); obj; obj=nodes.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
GetNodesBranches*
Returns a set with all buses and branches belonging to this feeder.
set ElmFeeder.GetNodesBranches([int iNested])
203
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
iNested (optional)
Affects the collection of objects in case of nested feeders:
0 Only the objects of this feeder will be returned.
1 (default) All elements including those of nested feeders will be re-
turned.
R ETURNS
The set of bus and branch elements in feeder.
E XAMPLE
set aAll,feeders;
object folder,feeder,obj;
! output elements in the feeders
folder = GetDataFolder('ElmFeeder');
if (folder) {
feeders = folder.GetContents('*.ElmFeeder',1);
feeders.SortToVar(0,'loc_name');
for (feeder=feeders.First(); feeder; feeder=feeders.Next()) {
printf('Branches and Nodes in feeder %s',feeder:loc_name);
aAll = feeder.GetNodesBranches(1);
for (obj=aAll.First(); obj; obj=aAll.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
GetObjs*
Returns a set with all objects of class 'ClassName' which belong to this feeder.
set ElmFeeder.GetObjs(string ClassName,
[int iNested])
A RGUMENTS
iNested (optional)
Affects the collection of objects in case of nested feeders:
0 Only the objects of this feeder will be returned.
1 (default) All elements including those of nested feeders will be re-
turned.
R ETURNS
The set of feeder objects.
E XAMPLE
set aAll,feeders;
object folder,feeder,obj;
! output elements in the feeders
folder = GetDataFolder('ElmFeeder');
if (folder) {
feeders = folder.GetContents('*.ElmFeeder',1);
feeders.SortToVar(0,'loc_name');
204
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.13 ElmFile
Overview
LoadFile
SaveFile
LoadFile
(Re)Loads the file into a buffer.
int ElmFile.LoadFile([int loadComplete = 1])
A RGUMENTS
loadComplete (optional)
0 Removes all points in the future simulation time and adds all points
from the file (including the current interpolated value).
1 Clears the buffer and reloads the complete file (default).
R ETURNS
0 On success.
6= 0 On error.
SaveFile
Saves the buffer and overwrites the file.
int ElmFile.SaveFile()
R ETURNS
0 On success.
6= 0 On error.
205
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.14 ElmFilter
Overview
GetGroundingImpedance*
GetGroundingImpedance*
Returns the impedance of the internal grounding. Single phase filters connected to neutral
are considered as grounding devices themselves; i.e. instead of the dedicated grounding
parameters, the filters parameters are used.
int ElmFilter.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
3.2.15 ElmGenstat
Overview
CalcEfficiency
Derate
Disconnect
GetAvailableGenPower*
GetGroundingImpedance*
GetStepupTransformer*
IsConnected*
Reconnect
ResetDerating
206
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CalcEfficiency
Calculate efficiency for connected storage model at given active power value.
double ElmGenstat.CalcEfficiency(double activePowerMW)
A RGUMENTS
activePowerMW
Active power value to calculate efficiency for.
R ETURNS
Returns the resulting efficiency in p.u.
E XAMPLE
set objs;
object obj;
int err;
double eff, Ptherm, Pelect;
Pelect = 30.0;
objs = GetCalcRelevantObjects('*.ElmGenstat');
obj = objs.First();
if (obj) {
eff = obj.CalcEfficiency(Pelect);
Ptherm = Pelect/eff;
}
Derate
Derates the value of the Max. Active Power Rating according to the specified value given in
MW.
The following formula is used: P max uc = P max uc − ”Deratingvalue”.
void ElmGenstat.Derate(double deratingP)
A RGUMENTS
deratingP Derating value
Disconnect
Disconnects a static generator by opening the first circuit breaker. The topological search
performed to find such a breaker, stops at any busbar.
int ElmGenstat.Disconnect()
R ETURNS
0 breaker already open or successfully opened
1 an error occurred (no breaker found, open action not possible (earthing / RA))
207
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
set objs;
object obj;
int err;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
GetAvailableGenPower*
Returns the available power that can be dispatched from the generator, for the particular study
time.
For the case of conventional generators (no wind generation selected), the available power is
equal to the nominal power specified.
For wind generators, the available power will depend on the wind model specified:
• Time Series Characteristics of Wind Speed: The available power is calculated with the
average of the power values (in MW) calculated for all the specified time characteristics.
A power value for any time characteristic is calculated by obtaining the wind speed for the
current study time, and then calculating the power from the specified Power Curve. If the
units of the Power Curve are in MW, the returned value is directly the power value. In the
other hand, if the units are in PU, the returned value is multiplied by the nominal power of
the generator to return the power value.
R ETURNS
Available generation power
E XAMPLE
set generators;
object generator;
double totalpower, power;
208
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
generators = GetCalcRelevantObjects('*.ElmGenstat');
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmGenstat.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
GetStepupTransformer*
Performs a topological search to find the step-up transformer of the static generator.
object ElmGenstat.GetStepupTransformer(double voltage,
int swStatus
)
A RGUMENTS
voltage voltage level at which the search will stop
R ETURNS
Returns the first collected step-up transformer object. It is empty if not found (e.g. start
terminal already at hvVoltage).
209
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
IsConnected*
Checks if generator is topologically connected to any busbar.
int ElmGenstat.IsConnected()
R ETURNS
0 false, not connected to a busbar
1 true, generator is connected to a busbar
E XAMPLE
set objs;
object obj;
int status;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
Reconnect
Connects a static generator by closing all switches (breakers and isolators) up to the first breaker
on the HV side of a transformer. The topological search to find all the switches, stops at any
busbar.
int ElmGenstat.Reconnect()
R ETURNS
0 the machine was successfully closed
1 a error occurred and the machine could not be connected to any busbar
E XAMPLE
set objs;
object obj;
int err;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
210
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
ResetDerating
Resets the derating value, setting the Max. Active Power Rating according to the rating factor.
The following formula is used: P max uc = pmaxratf ∗ P n ∗ ngnum.
void ElmGenstat.ResetDerating()
3.2.16 ElmGndswt
Overview
Close
GetGroundingImpedance*
IsClosed*
IsOpen*
Open
Close
Closes the switch by changing its status to ’close’. If closed, the connected node will be
considered as being earthed.
int ElmGndswt.Close()
R ETURNS
1, always
S EE ALSO
ElmGndswt.Open()
GetGroundingImpedance*
Returns the impedance of the internal grounding. ElmGndswt is only considered to have an
internal grounding if it is single phase and connected to neutral.
int ElmGndswt.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
211
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
IsClosed*
Returns information about current switch state.
int ElmGndswt.IsClosed()
R ETURNS
1 switch is closed
0 switch is open
S EE ALSO
ElmGndswt.IsOpen()
IsOpen*
Returns information about current switch state.
int ElmGndswt.IsOpen()
R ETURNS
1 switch is open
0 switch is closed
S EE ALSO
ElmGndswt.IsClosed()
Open
Opens the switch by changing its status to ’open’.
int ElmGndswt.Open()
R ETURNS
0, always
S EE ALSO
ElmGndswt.Close()
212
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.17 ElmLne
Overview
AreDistParamsPossible*
CreateFeederWithRoutes
FitParams
GetIthr*
GetType*
GetY0m*
GetY1m*
GetZ0m*
GetZ1m*
GetZmatDist*
HasRoutes*
HasRoutesOrSec*
IsCable*
IsNetCoupling*
MeasureLength*
SetDetailed
AreDistParamsPossible*
Check if the line fulfils conditions for the calculation of distributed parameters:
int ElmLne.AreDistParamsPossible()
R ETURNS
The returned value are:
213
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CreateFeederWithRoutes
Creates a new feeder in the line by splitting the line into 2 routes and inserting a terminal.
int ElmLne.CreateFeederWithRoutes(double dis,
double rem,
object O,)
int ElmLne.CreateFeederWithRoutes(double dis,
double rem,
object O,
int sw0,
int sw1)
A RGUMENTS
dis Inserting operation occurs after this distance
rem Remaining distance, percentage of distance ’dis’
O Branch object that is to be connected at the inserted terminal
sw0 If set to (1), switch is inserted on the first side
sw1 If set to (1), switch is inserted on the second side
R ETURNS
0 Success, feeders created
1 Error
FitParams
Calculates distributed parameters of the line element. Whether this function calculates constant
parameters or frequency dependent parameters depends on the user setting of the parameter
'i model' in the ElmLne dialogue. The settings are as follows: i model=0: constant parameters;
i model=1: frequency dependent parameters.
int ElmLne.FitParams([int isRMSModel = 0,]
[int modify = 1])
A RGUMENTS
isRMSModel
modify
R ETURNS
0 Success
1 Error
E XAMPLE
object line;
set lines;
int err;
lines = GetCalcRelevantObjects('*.ElmLne');
line = lines.First();
err = line.FitParams();
if (err) {
214
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetIthr*
Returns the rated short-time current of the line element.
double ElmLne.GetIthr()
R ETURNS
Returns rated short-time current value
E XAMPLE
External Object (ElmLne) pre-defined: MyLine
double Ir;
if (MyLine) {
Ir = MyLine.GetIthr();
}
Info('Rated short-time current is %f kA',Ir);
GetType*
Returns the line type object.
object ElmLne.GetType()
R ETURNS
The TypLne object if exists or NULL
E XAMPLE
The following example reports all 'untyped' lines
set list;
object line, type;
list = GetCalcRelevantObjects();
line = list.Firstmatch('ElmLne');
while (line) {
type = line.GetType();
if (type=nullptr) {
line.ShowFullName();
}
line = list.Nextmatch();
}
215
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetY0m*
The function returns the zero-sequence mutual coupling admittance (G0m, B0m) in Ohm of the
line and input argument line (object Lne2). When Lne2 = line, the function returns the zero-
sequence self admittance.
int ElmLne.GetY0m(object Lne2,
double& G0m,
double& B0m)
A RGUMENTS
Lne2 Line element
G0m (out)
Resulting G0m value
B0m (out)
Resulting B0m value
R ETURNS
0 Success, data obtained
1 Error, e.g. no coupling objects defined
E XAMPLE
External Object (ElmLne) pre-defined: MyLine
double fG0m, fB0m;
int iret;
if (MyLine) {
iret = MyLine.GetY0m(MyLine, fG0m, fB0m);
}
if (iret) {
Warn('No values for G0m and B0m obtained!');
}
else {
Info('The value for G0m is %f Ohm and for B0m is %f Ohm', fG0m, fB0m);
}
GetY1m*
The function returns the positive-sequence mutual coupling admittance (G1m, B1m) in Ohm
of the line and input argument line (object Lne2). When Lne2 = line, the function returns the
positive-sequence self admittance.
int ElmLne.GetY1m(object Lne2,
double& G1m,
double& B1m)
A RGUMENTS
Lne2 Line element
G1m (out)
Resulting G1m value
B1m (out)
Resulting B1m value
216
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Success, data obtained
1 Error, e.g. no coupling objects defined
E XAMPLE
External Object (ElmLne) pre-defined: MyLine
double fG1m, fB1m;
int iret;
if (MyLine) {
iret = MyLine.GetY1m(MyLine, fG1m, fB1m);
}
if (iret) {
Warn('No values for G1m and B1m obtained!');
}
else {
Info('The value for G1m is %f Ohm and for B1m is %f Ohm', fG1m, fB1m);
}
GetZ0m*
Gets the zero-sequence mutual coupling impedance (R0m, X0m) in Ohm of the line and input
argument line (object otherLine). When otherLine = line, the function returns the zero-sequence
self impedance.
int ElmLne.GetZ0m(object otherLine,
double& R0m,
double& X0m)
A RGUMENTS
otherLine Line element
R0m (out)
To be obtained R0m value
X0m (out)
To be obtained X0m value
R ETURNS
0 Success, data obtained
1 Error, e.g. no coupling objects defined
E XAMPLE
External Object (ElmLne) pre-defined: MyLine
double fR0m, fX0m;
int iret;
if (MyLine) {
iret = MyLine.GetZ0m(MyLine, fR0m, fX0m);
}
if (iret) {
Warn('No values for R0m and X0m obtained!');
}
else {
Info('The value for R0m is %f Ohm and for X0m is %f Ohm', fR0m, fX0m);
}
217
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetZ1m*
The function returns the positive-sequence mutual coupling impedance (R1m, X1m) in Ohm
of the line and input argument line (object Lne2). When Lne2 = line, the function returns the
positive-sequence self impedance.
int ElmLne.GetZ1m(object Lne2,
double& R1m,
double& X1m)
A RGUMENTS
Lne2 Line element
R1m (out)
Resulting R1m value
X1m (out)
Resulting X1m value
R ETURNS
0 Success, data obtained
1 Error, e.g. no coupling objects defined
E XAMPLE
External Object (ElmLne) pre-defined: MyLine
double fR1m, fX1m;
int iret;
if (MyLine) {
iret = MyLine.GetZ1m(MyLine, fR1m, fX1m);
}
if (iret) {
Warn('No values for R1m and X1m obtained!');
}
else {
Info('The value for R1m is %f Ohm and for X1m is %f Ohm', fR1m, fX1m);
}
GetZmatDist*
The function gets impedance matrix in phase domain (only amplitudes), for a line with distributed
parameters, short-circuit ended.
int ElmLne.GetZmatDist(double frequency,
int exact,
object matrix)
A RGUMENTS
frequency
Frequency for which the calculation is carried out
exact 0: Approximated solution, 1: Exact solution for ‘frequency’
218
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
The returned value reports if the impedance matrix acquired:
HasRoutes*
Checks if the line is subdivided into routes.
int ElmLne.HasRoutes()
R ETURNS
0 When the line is a single line
1 When the line is subdivided into routes
E XAMPLE
The following example reports all lines with routes.
set list;
object line;
int i;
list = GetCalcRelevantObjects();
line = list.Firstmatch('ElmLne');
while (line) {
i = line.HasRoutes();
if (i) line.ShowFullName(); {
line = list.Nextmatch();
}
}
HasRoutesOrSec*
Checks if the line is subdivided into routes or sections.
int ElmLne.HasRoutesOrSec()
R ETURNS
0 When the line is a single line
1 When the line is subdivided into routes
2 When the line is subdivided into sections
E XAMPLE
The following example reports all lines with sections.
set list;
object line;
int i;
list = GetCalcRelevantObjects();
line = list.Firstmatch('ElmLne');
while (line) {
i = line.HasRoutesOrSec();
if (i=2) line.ShowFullName(); {
219
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
line = list.Nextmatch();
}
}
IsCable*
Checks if this line is a cable.
int ElmLne.IsCable()
R ETURNS
2 when line contains cable and overhead line sections
1 Line is a cable
0 Line is not a cable
E XAMPLE
The following example reports the loading of all cables.
set list;
object cable;
int i;
list = GetCalcRelevantObjects();
cable = list.Firstmatch('ElmLne');
while (cable) {
i = cable.IsCable();
if (i) {
Write('# : #.## $N', @ACC(1):loc_name, @ACC(1):c:loading, O);
}
cable = list.Nextmatch();
}
IsNetCoupling*
Checks if the line connects two grids.
int ElmLne.IsNetCoupling()
R ETURNS
The returned value reports if the line is a coupler:
E XAMPLE
set list;
object line;
int i;
list = GetCalcRelevantObjects();
line = list.Firstmatch('ElmLne');
while (line) {
i = line.IsNetCoupling();
if (i) {
220
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
MeasureLength*
Measures the length of this line using the active diagram. For graphical measurement the active
diagram needs to have a scaling factor. Geographic diagrams by default have a scaling factor.
If iUseGraphic = 1, the line length is determined directly from the positions given in (latitude/lon-
gitude) considering the earth as a perfect sphere. In this case no graphic needs to be open.
double ElmLne.MeasureLength([int iUseGraphic])
A RGUMENTS
iUseGraphic (optional)
Use SGL diagram for calculation or not.
1 Use displayed diagram for calculation (default)
0 Calculate distance without diagram
R ETURNS
≥0 Returns the graphical length of this line in its current unit
<0 Error: E.g. when line is not represented in the active diagram and iUseGraphic=1
E XAMPLE
double length;
object line;
set lines;
lines = GetCalcRelevantObjects('*.ElmLne');
line = lines.First();
if (.not. line) {
Error('no line found');
exit();
}
length = line.MeasureLength();
printf('Measured length of %o: %f', line, length);
SetDetailed
The function can be used to prevent the automatically reduction of a line e.g. if the line is a line
dropper (length = 0). The function should be called when no calculation method is valid (before
first load flow). The internal flag is automatically reset after the first calculation is executed.
int ElmLne.SetDetailed()
E XAMPLE
Suggested code order:
221
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.18 ElmLnesec
Overview
IsCable*
IsCable*
Checks if this line section is a cable.
int ElmLnesec.IsCable()
R ETURNS
1 Line section is a cable
0 Line section is not a cable
-1 Error
E XAMPLE
The following example reports the loading of all cables.
set list;
object cable;
int i;
list = GetCalcRelevantObjects();
cable = list.Firstmatch('ElmLnesec');
while (cable) {
i = cable.IsCable();
if (i>0) {
Write('# : #.## $N', @ACC(1):loc_name, @ACC(1):c:loading, O);
}
cable = list.Nextmatch();
}
222
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.19 ElmMdl
Overview
ExportToClipboard
ExportToFile
ExportToClipboard
Export the parameter list to clipboard.
void ElmMdl.ExportToClipboard([string colSeparator],
[int useLocalHeader]
)
A RGUMENTS
colSeparator (optional)
Separator between the columns (default: tab character).
useLocalHeader (optional)
Use the localised version of the header. Possible values are:
1 Yes (default).
0 No (use English language header).
ExportToFile
Export the parameter list to CSV file(s).
void ElmMdl.ExportToFile(string filePath,
[string colSeparator],
[int useLocalHeader]
)
A RGUMENTS
filePath Path of the CSV target file. In case of array and matrix parameters (names:
“array NAME” and “matrix NAME”), additional CSV files are created in the same
location with names obtained by appending “ array NAME” and “ matrix NAME”
to the target file name.
colSeparator (optional)
Separator between the columns (default: “;”).
useLocalHeader (optional)
Use the localised version of the header. Possible values are:
1 Yes (default).
0 No (use English language header).
223
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.20 ElmNec
Overview
GetGroundingImpedance*
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmNec.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
3.2.21 ElmNet
Overview
Activate
CalculateInterchangeTo*
CalculateVoltageLevel*
CalculateVoltInterVolt*
Deactivate
DefineBoundary
Activate
Adds a grid to the active study case. Can only be applied if there are is no currently active
calculation (i.e. running contingency analysis).
int ElmNet.Activate()
R ETURNS
0 on success
1 on error
224
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CalculateInterchangeTo*
This function calculates the power flow from current grid to a connected grid. The values are
stored in current grid in the following attributes (values from the previous load flow calculation
are overwritten):
A RGUMENTS
net Connected grid
R ETURNS
<0 error
=0 grids are not connected, no interchange exists
>0 ok
E XAMPLE
external grid objects: "from", "to"
ElmNet pnetA, pnetB;
object Ldf;
pnetA = from;
pnetB = to;
Ldf = GetFromStudyCase('ComLdf');
Ldf.Execute(); ! Valid load flow calculation
int res;
res = pnetA.CalculateInterchangeTo(pnetB);
if (res > 0) {
printf('Pinter: %d', pnetA:c:Pinter);
printf('Qinter: %d', pnetA:c:Qinter);
printf('ExportP: %d', pnetA:c:ExportP);
printf('ExportQ: %d', pnetA:c:ExportQ);
printf('ImportP: %d', pnetA:c:ImportP);
printf('ImportQ: %d', pnetA:c:ImportQ);
}
CalculateVoltageLevel*
Internal funciton to calculate per voltage level the corresponding summary results. The values
are stored in current grid (values from the previous load flow calculation are overwritten):
int ElmNet.CalculateVoltageLevel(double U)
225
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
U for voltage level (in kV)
R ETURNS
<0 error
=0 voltage level not exists in the grid
>0 ok
CalculateVoltInterVolt*
This function calculates the power flow from voltage level to voltage level. The values are stored
in current grid in the following attributes (values from the previous load flow calculation are
overwritten):
A RGUMENTS
Ufrom from voltage level (in kV)
Uto to voltage level (in kV)
R ETURNS
<0 error
=0 voltage levels not exists in the grid, no interchange exists
>0 ok
Deactivate
Removes a grid from the active study case.Can only be applied if there are is no currently active
calculation.
int ElmNet.Deactivate()
R ETURNS
0 on success
1 on error
226
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
DefineBoundary
Defines boundary with this grid as interior part. Resulting cubicles of boundary are busbar-
oriented towards the grid.
object ElmNet.DefineBoundary(int shift)
A RGUMENTS
shift Elements outside the grid that are within a distance of shift many elements to
a boundary cubicle of the grid are added to the interior part of the resulting
boundary
R ETURNS
The defined boundary is returned in case of success. Otherwise NULL, if an error appeared
in the definition of the boundary.
E XAMPLE
external object: "thisGrid"
double shift;
object newBoundary;
shift = 2;
newBoundary = thisGrid.DefineBoundary(shift);
if ({newBoundary <> NULL}) {
printf('Defined boundary %o by shifting %d elements!', newBoundary, shift);
}
3.2.22 ElmPvsys
Overview
CalcEfficiency
Derate
Disconnect
GetAvailableGenPower*
GetGroundingImpedance*
IsConnected*
Reconnect
ResetDerating
CalcEfficiency
Calculate efficiency for connected storage model at given active power value.
double ElmPvsys.CalcEfficiency(double activePowerMW)
A RGUMENTS
activePowerMW
Active power value to calculate efficiency for.
R ETURNS
Returns the resulting efficiency in p.u.
E XAMPLE
227
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
set objs;
object obj;
int err;
double eff, Ptherm, Pelect;
Pelect = 30.0;
objs = GetCalcRelevantObjects('*.ElmPvsys');
obj = objs.First();
if (obj) {
eff = obj.CalcEfficiency(Pelect);
Ptherm = Pelect/eff;
}
Derate
Derates the value of the Max. Active Power Rating according to the specified value given in
MW.
The following formula is used: P max uc = P max uc − ”Deratingvalue”.
void ElmPvsys.Derate(double deratingP)
A RGUMENTS
deratingP Derating value
Disconnect
Disconnects a PV system by opening the first circuit breaker. The topological search performed
to find such a breaker, stops at any busbar.
int ElmPvsys.Disconnect()
R ETURNS
0 breaker already open or successfully opened
1 an error occurred (no breaker found, open action not possible (earthing / RA))
E XAMPLE
set objs;
object obj;
int err;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
228
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetAvailableGenPower*
Returns the available power that can be dispatched from the generator, for the particular study
time.
For the case of conventional generators (no wind generation selected), the available power is
equal to the nominal power specified.
For wind generators, the available power will depend on the wind model specified:
R ETURNS
Available generation power
E XAMPLE
set generators;
object generator;
double totalpower, power;
generators = GetCalcRelevantObjects('*.ElmPvsys');
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmPvsys.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
229
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
IsConnected*
Checks if a PV system is already connected to any busbar.
int ElmPvsys.IsConnected()
R ETURNS
0 false, not connected to a busbar
1 true, generator is connected to a busbar
E XAMPLE
set objs;
object obj;
int status;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
Reconnect
Connects a PV system by closing all switches (breakers and isolators) up to the first breaker
on the HV side of a transformer. The topological search to find all the switches, stops at any
busbar.
int ElmPvsys.Reconnect()
R ETURNS
0 the machine was successfully closed
1 a error occurred and the machine could not be connected to any busbar
230
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
set objs;
object obj;
int err;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
ResetDerating
Resets the derating value, setting the Max. Active Power Rating according to the rating factor.
The following formula is used: P max uc = pmaxratf ∗ P n ∗ ngnum.
void ElmPvsys.ResetDerating()
3.2.23 ElmRelay
Overview
CalculateMaxFaultCurrents
CheckRanges*
GetCalcRX*
GetMaxFdetectCalcI*
GetSlot*
GetUnom*
IsStarted*
SetImpedance
SetMaxI
SetMaxIearth
SetMinI
SetMinIearth
SetOutOfService
SetTime
SlotUpdate
CalculateMaxFaultCurrents
Calculates and stores the “Max. phase fault current” and the “Max. earth fault current”.
void ElmRelay.CalculateMaxFaultCurrents()
231
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CheckRanges*
Checks the settings of all elements in the relay for range violations.
int ElmRelay.CheckRanges()
R ETURNS
0 All settings are valid.
1 At least one setting was forced into range.
-1 An error occurred.
GetCalcRX*
Gets the calculated impedance from the polarising unit.
int ElmRelay.GetCalcRX(int inSec,
int unit,
double& real,
double& imag)
A RGUMENTS
inSec
0 Get the value in pri. Ohm.
1 Get the value in sec. Ohm.
unit
0 Get the value from Phase-Phase or Multifunctional polarizing.
1 Get the value from Phase-Earth or Multifunctional polarizing.
2 Get the value from Multifunctional polarizing
real (out) Real part of the impedance in Ohm.
imag (out)
Imaginary part of the impedance in Ohm.
R ETURNS
0 No error occurred, the output is valid.
1 An error occurred, the output is invalid.
GetMaxFdetectCalcI*
Get the current measured by the starting unit.
int ElmRelay.GetMaxFdetectCalcI(double& Iabs,
int earth,
int iunit
)
A RGUMENTS
Iabs (out) The measured current in A
earth
0 Get the phase current.
232
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
unit
0 Get the current in pri. A.
1 Get the current in sec. A.
R ETURNS
0 No error, output is valid.
1 An error occurred, the output is invalid.
GetSlot*
Returns the element in the slot with the given name.
object ElmRelay.GetSlot(string name,
[int iShowErr]
)
A RGUMENTS
name Exact name of the slot to search for (no wildcards).
iShowErr (optional)
0 Do not show error messages.
1 Show error messages if a slot is not found or empty.
R ETURNS
The object in the slot or NULL.
GetUnom*
Returns the nominal voltage of the local bus of the relay.
double ElmRelay.GetUnom()
R ETURNS
The nominal voltage of the local bus of the relay in kV.
IsStarted*
Checks if the starting unit detected a fault.
int ElmRelay.IsStarted()
R ETURNS
0 No fault was detected.
1 Fault was detected.
-1 An error occurred.
233
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
SetImpedance
Sets the the given impedance to the distance blocks matching the criteria.
int ElmRelay.SetImpedance(double real,
double imag,
int inSec,
int zone,
int unit
)
int ElmRelay.SetImpedance(double real,
double imag,
double lineAngle,
double Rarc,
int inSec,
int zone,
int unit
)
A RGUMENTS
real Real part of the impedance in Ohm.
imag Imaginary part of the impedance in Ohm.
inSec
0 The values are in pri. Ohm.
1 The values are in sec. Ohm.
zone Set the impedance for elments with this zone number.
unit
0 Set the impedance for Phase - Phase or Multifunctional elements.
1 Set the impedance for Phase - Earth or Multifunctional elements.
2 Set the impedance for Multifunctional elements.
A RGUMENTS
real Real part of the impedance in Ohm.
234
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 No error occurred.
1 An error occurred or no element was found.
SetMaxI
Sets the “Max. Phase Fault Current” of the relay to the currently measured value.
void ElmRelay.SetMaxI()
SetMaxIearth
Sets the “Max. Earth Fault Current” of the relay to the currently measured value.
void ElmRelay.SetMaxIearth()
SetMinI
Sets the “Min. Phase Fault Current” of the relay to the currently measured value.
void ElmRelay.SetMinI()
SetMinIearth
Sets the “Min. Earth Fault Current” of the relay to the currently measured value.
void ElmRelay.SetMinIearth()
SetOutOfService
Sets the “Out of Service” flag of elements contained in the relay.
int ElmRelay.SetOutOfService(int outServ,
int type,
int zone,
int unit
)
A RGUMENTS
outServ
0 Set elements in service.
1 Set Elements out of service.
type
1 Set the flag for overcurrent elements.
2 Set the flag for distance elements.
zone Set the flag for elments with this zone number (only when settings distance ele-
ments).
unit
235
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 No error occurred.
1 An error occurred or no element was found.
SetTime
Sets the tripping time for elements contained in the relay.
int ElmRelay.SetTime(int time,
int type,
int zone,
int unit
)
A RGUMENTS
time Time in s.
type
1 Set the time for overcurrent elements.
2 Set the time for distance elements.
zone Set the time for elments with this zone number (only when settings distance
elements).
unit
0 Set the time for Phase-Phase or Multifunctional elements.
1 Set the time for Phase-Earth or Multifunctional elements.
2 Set the time for Multifunctional elements.
R ETURNS
0 No error occurred.
1 An error occurred or no element was found.
SlotUpdate
Triggers a slot update of the relay.
void ElmRelay.SlotUpdate()
D EPRECATED N AMES
slotupd
236
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.24 ElmRes
Overview
AddVariable
Clear
ExecuteLoadingCommand
FindColumn*
FindMaxInColumn*
FindMaxOfVariableInRow*
FindMinInColumn*
FindMinOfVariableInRow*
FinishWriting
Flush
GetColumnValues*
GetDescription*
GetFirstValidObject*
GetFirstValidObjectVariable*
GetFirstValidVariable*
GetNextValidObject*
GetNextValidObjectVariable*
GetNextValidVariable*
GetNumberOfColumns*
GetNumberOfRows*
GetObj*
GetObject*
GetObjectValue*
GetRelCase*
GetSubElmRes*
GetUnit*
GetValue*
GetVariable*
InitialiseWriting
Load*
Release*
SetAsDefault
SetObj
SetSubElmResKey
SortAccordingToColumn*
Write
WriteDraw
AddVariable
Adds a variable to the list of monitored variables for the Result object.
int ElmRes.AddVariable(object element,
string varname
)
A RGUMENTS
element An object.
varname Variable name for object element.
R ETURNS
0 On success.
237
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
D EPRECATED N AMES
AddVars
E XAMPLE
The following script gets the result file named “DPL” from the active study case, defines the
variables for recording (variables from summary grid), calculates a load flow and records the
corresponding variables inside the result file.
object sumGrid,
ldfCmd, !
elmRes;
elmRes = GetFromStudyCase('DPL.ElmRes');
if (nullptr=elmRes) {
exit(1);
}
ldfCmd = GetFromStudyCase('ComLdf');
if (nullptr=ldfCmd) {
exit(1);
}
sumGrid = GetSummaryGrid();
if (nullptr=sumGrid){
exit(1);
}
elmRes.AddVariable(sumGrid,'c:GenP');
elmRes.AddVariable(sumGrid,'c:GenQ');
ldfCmd.Execute();
elmRes.InitialiseWriting();
elmRes.Write();
elmRes.Flush();
Clear
Clears all data (calculation results) written to the result file. The Variable definitions stored in
the contents of ElmRes are not modified.
int ElmRes.Clear()
R ETURNS
Always 0 and can be ignored.
E XAMPLE
The following example deletes the data of all ElmRes stored in the active study case.
object case,
elmRes;
set resObjs;
case = GetActiveStudyCase();
if (case) {
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
for (elmRes=resObjs.First(); elmRes; elmRes=resObjs.Next()) {
elmRes.Clear();
}
}
238
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
ExecuteLoadingCommand
Loads results into memory.
int ElmRes.ExecuteLoadingCommand()
R ETURNS
0 Success
1 Failure
FindColumn*
Returns the index of the first header column matching the given object and/or variable name.
int ElmRes.FindColumn(object obj,
[string varName]
)
int ElmRes.FindColumn(object obj,
[int startCol]
)
int ElmRes.FindColumn(string varName,
[int startCol]
)
A RGUMENTS
obj (optional)
Object of matching column.
varName (optional)
Variable name of matching column.
startCol (optional)
Index of first checked column; Search starts at first column if colIndex is not
given.
R ETURNS
≥0 column index
<0 no valid column found
The index can be used in the ElmRes method GetData to retrieve the value of the column.
E XAMPLE
object case,
elmRes,
terminal;
set resObjs,
relevantObjs;
int index;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('Quasi-Dynamic Simulation AC.ElmRes',0);
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
239
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
relevantObjs = GetCalcRelevantObjects('*.ElmTerm');
terminal = relevantObjs.First();
elmRes.Load();
elmRes.Release();
FindMaxInColumn*
Find the maximum value of the variable in the given column.
int ElmRes.FindMaxInColumn(int column,
[double& value])
A RGUMENTS
column The column index.
value (optional, out)
The maximum value found. The value is 0. in case that the maximum value was
not found.
R ETURNS
<0 The maximum value of column was not found.
≥0 The row with the maximum value of the column.
E XAMPLE
object case,
elmRes;
set resObjs;
int row,
column;
double value;
column = 1;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('All calculations.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (elmRes) {
elmRes.Load();
row = elmRes.FindMaxInColumn(column,value);
240
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
if (row<0) {
Info('The maximum of column %d was not found',column);
}
else {
Info('The maximum of column %d is %f (row: %d)',column, value,row);
}
row = elmRes.FindMinInColumn(column,value);
if (row<0) {
Info('The minimum of column %d was not found',column);
}
else {
Info('The minimum of column %d is %f (row: %d)',column, value,row);
}
elmRes.Release();
}
FindMaxOfVariableInRow*
Find the maximum value for the given row and variable.
int ElmRes.FindMaxOfVariableInRow(string variable,
int row,
[double& maxValue])
A RGUMENTS
variable The variable name
variable The row
maxValue (optional)
The corresponding maximum value.
R ETURNS
<0 There is no valid value of the corresponding variable in the row.
≥0 Column index of variable.
E XAMPLE
The following example reports the maximum and minimum of variable m:u in the first row.
object case,
elmRes,
terminal;
set resObjs;
int index;
double voltage;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('Quasi-Dynamic Simulation AC.ElmRes',0);
elmRes = resObjs.First();
if (elmRes) {
elmRes.Load();
index = elmRes.FindMaxOfVariableInRow('m:u',0, voltage);
printf('Maximum m:u at column %d: %f',index,voltage);
index = elmRes.FindMinOfVariableInRow('m:u',0, voltage);
241
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
FindMinInColumn*
Find the minimum value of the variable in the given column.
int ElmRes.FindMinInColumn(int column,
[double& value])
A RGUMENTS
column The column index.
value (optional, out)
The minimum value found. The value is 0. in case that the minimum value was
not found.
R ETURNS
<0 The minimum value of column was not found.
≥0 The row with the minimum value of the column.
E XAMPLE
See example of ElmRes.FindMaxInColumn.
FindMinOfVariableInRow*
Find the minimum value for the given row and variable.
int ElmRes.FindMinOfVariableInRow(string variable,
int row,
[double& minValue])
A RGUMENTS
variable The variable name.
variable The row.
minValue (optional, out)
The corresponding minimum value.
R ETURNS
<0 There is no valid value of the corresponding variable in the row.
≥0 Column index of variable.
E XAMPLE
See example of ElmRes.FindMinOfVariableInRow.
FinishWriting
Finishes the writing of values to a result file.
void ElmRes.FinishWriting()
242
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
D EPRECATED N AMES
Close
E XAMPLE
See example of ElmRes.InitialiseWriting.
S EE ALSO
Flush
This function is required in scripts which perform both file writing and reading operations. While
writing to a results object (ElmRes), a small portion of this data is buffered in memory. This
is required for performance reasons. Therefore, all data must be written to the disk before
attempting to read the file. 'Flush' copies all data buffered in memory to the disk. After calling
'Flush'all data is available to be read from the file.
int ElmRes.Flush()
E XAMPLE
The following example writes a result object and prints the data written to the file. The DPL
command contains to variables on the advanced options page:
double x x-value
double y y-value
These variables were selected in the variable definitions inside the result object which itself
is stored in the DPL command. The DPL script code is as follows:
int xFailed,yFailed,iX,iY,row;
double xValue,yValue;
! write results to ElmRes named Results (stored in Contents)
for (x=-16; x<16; x=x+0.1) {
y= x*x;
Results.Write();
}
243
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetColumnValues*
Get complete column values.
int ElmRes.GetColumnValues(object dataVector,
int column)
A RGUMENTS
dataVector
IntVec which will be filled with column values.
column The column index. -1 for default (e.g. time).
R ETURNS
=0 Column values were found.
=1 dataVector is NULL.
=2 dataVector is not of class IntVec.
=3 Column index is out of range.
GetDescription*
Get the description of a column.
string ElmRes.GetDescription([int column],
[int short]
)
A RGUMENTS
column (optional)
The column index. The description name of the default variable is returned if the
parameter is nor passed to the function.
short (optional)
0 long desc. (default)
1 short description
R ETURNS
Returns the description which is empty in case that the column index is not part of the data.
E XAMPLE
See example of ElmRes.GetVariable.
GetFirstValidObject*
Gets the index of the column for the first valid variable in the given line. Starts at the beginning
of the given line and sets the internal iterator of the result file to the found position.
int ElmRes.GetFirstValidObject(int row,
[string classNames,]
[string variableName,]
[double limit,]
[int limitOperator,]
[double limit2,]
[int limitOperator2]
244
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
)
int ElmRes.GetFirstValidObject(int row,
set objects
)
A RGUMENTS
row Result file row
classNames (optional)
Comma separated list of class names for valid objects. The next object of one
of the given classes is searched. If not set all objects are considered as valid
(default).
variableName (optional)
Name of the limiting variable. The searched object must have this variable. If not
set variables are not considered (default).
limit (optional)
Limiting value for the variable.
limitOperator (optional)
Operator for checking the limiting value:
0 all values are valid (default)
1 valid values must be < limit
2 valid values must be ≤ limit
3 valid values must be > limit
4 valid values must be ≥ limit
limit2 (optional)
Second limiting value for the variable.
limitOperator2 (optional)
Operator for checking the second limiting value:
<0 first OR second criterion must match,
>0 first AND second criterion must match,
0 all values are valid (default)
1/-1 valid values must be < limit2
2/-2 valid values must be ≤ limit2
3/-3 valid values must be > limit2
4/-4 valid values must be ≥ limit2
objects Valid objects
R ETURNS
≥0 column index
<0 no valid column found
245
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
! Find first line or generator whose loading is $>$= 80%
iCol = ResFirstValidObject(oRes, iRow, 'ElmLne,ElmSym', 'c:loading', 80, 4);
GetFirstValidObjectVariable*
Gets the index of the first valid variable of the current object in the current line. Starts at the
internal iterator of the given result file and sets it to the position found.
int ElmRes.GetFirstValidObjectVariable([string variableNames])
A RGUMENTS
variableNames (optional)
Comma separated list of valid variable names. The next column with one of
the given variables is searched. If empty all variables of the current object are
considered as valid (default).
R ETURNS
≥0 column index
<0 no valid column found
E XAMPLE
iCol = elmRes.GetFirstValidObjectVariable('c:loading,c:loading_st');
GetFirstValidVariable*
Gets the index of the column for the first valid variable in the given line. Starts at the beginning
of the given line and sets the internal iterator of the result file to the found position.
int ElmRes.GetFirstValidVariable(int row,
[string variableNames]
)
A RGUMENTS
row Result file row.
variableNames (optional)
Comma separated list of valid variable names. The next column with one of
the given variables is searched. If not set all variables are considered as valid
(default).
R ETURNS
≥0 column index
<0 no valid column found
E XAMPLE
The following example outputs all valid indicees of m:u in the first row of the results.
246
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
object case,
elmRes,
colObj;
set resObjs;
int columnIndex;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0);
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
columnIndex = elmRes.GetFirstValidVariable(0, 'm:u');
while(columnIndex>=0) {
printf('First Index of m:u: %d',columnIndex);
columnIndex = elmRes.GetNextValidVariable('m:u');
}
elmRes.Release();
GetNextValidObject*
Gets the index of the column for the next valid variable (after current iterator) in the given line.
Sets the internal iterator of the result file to the position found.
int ElmRes.GetNextValidObject([string classNames,]
[string variableName,]
[double limit,]
[int limitOperator,]
[double limit2,]
[int limitOperator2]
)
int ElmRes.GetNextValidObject(set objects)
A RGUMENTS
row Result file row.
classNames (optional)
Comma separated list of class names for valid objects. The next object of one
of the given classes is searched. If not set all objects are considered as valid
(default).
variableName (optional)
Name of the limiting variable. The searched object must have this variable. If not
set variables are not considered (default).
limit (optional)
Limiting value for the variable.
limitOperator (optional)
Operator for checking the limiting value:
0 all values are valid (default)
1 valid values must be < limit
2 valid values must be ≤ limit
247
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
limit2 (optional)
Second limiting value for the variable.
limitOperator2 (optional)
Operator for checking the second limiting value:
R ETURNS
≥0 column index
<0 no valid column found
E XAMPLE
! Find next line or generator whose loading is $>$= 80%
iCol = ResNextValidObject(oRes, 'ElmLne,ElmSym', 'c:loading', 80, 4);
GetNextValidObjectVariable*
Gets the index of the column for the next valid variable of the current object in the current line.
Starts at the internal iterator of the given result file and sets it to the found position.
int ElmRes.GetNextValidObjectVariable([string variableNames])
A RGUMENTS
variableNames (optional)
Comma separated list of valid variable names. The next column with one of
the given variables is searched. If not set all variables are considered as valid
(default).
R ETURNS
≥0 column index
<0 no valid column found
E XAMPLE
iCol = elmRes.GetNextValidObjectVariable('c:loading,c:loading_st');
248
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetNextValidVariable*
Gets the index of the column for the next valid variable in the given line. Starts at the internal
iterator of the given line and sets the internal iterator of the result file to the found position.
int ElmRes.GetNextValidVariable([string variableNames])
A RGUMENTS
variableNames (optional)
Comma separated list of valid variable names. The next column with one of
the given variables is searched. If not set all variables are considered as valid
(default).
R ETURNS
≥0 column index
<0 no valid column found
E XAMPLE
See example of ElmRes.GetFirstValidVariable.
GetNumberOfColumns*
Returns the number of variables (columns) in result file excluding the default variable (e.g. time
for time domain simulation).
int ElmRes.GetNumberOfColumns()
R ETURNS
Number of variables (columns) in result file.
E XAMPLE
See example of ElmRes.InitialiseWriting.
GetNumberOfRows*
Returns the number of values per column (rows) stored in result object.
int ElmRes.GetNumberOfRows()
R ETURNS
Returns the number of values per column stored in result object.
E XAMPLE
See example of ElmRes.InitialiseWriting.
GetObj*
Returns an object used in the result file. Positive index means objects for which parameters
are being monitored (i.e. column objects). Negative index means objects which occur in written
result rows as values.
object ElmRes.GetObj(int index)
249
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
index index of the object.
R ETURNS
The object found or NULL.
GetObject*
Get object of given column.
object ElmRes.GetObject([int column])
A RGUMENTS
col Column index. Object of default column is returned if col is not passed.
R ETURNS
The object of the variable stored in column ’column’.
E XAMPLE
The following example prints the name of the object in the default column and of the first
other column of the result file being used for simulation.
object case,
elmRes,
colObj;
set resObjs;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('All calculations.ElmRes',0);
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
colObj = elmRes.GetObject();
Info('Object in default column: \%s',colObj:loc_name);
colObj = elmRes.GetObject(0);
Info('Object in first other column: \%s',colObj:loc_name);
elmRes.Release();
GetObjectValue*
Returns a value from a result object for row iX of curve col.
int ElmRes.GetObjectValue(object& o,
int iX,
[int col])
A RGUMENTS
o (out) The object retrieved from the data.
250
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
iX The row.
col (optional)
The curve number, which equals the variable or column number, first column value
(time,index, etc.) is returned when omitted.
R ETURNS
0 when ok
1 when iX out of bound
2 when col out of bound
3 when invalid value is returned from a sparse file. Sparse files are written e.g.
by the contingency analysis, the value is invalid in case that it was not written,
because it was below the recording limit. Result files created using DPL/Python
are always full and will not return invalid values.
E XAMPLE
See example of ElmRes.SortAccordingToColumn.
GetRelCase*
Get the contingency object for the given case number from the reliability result file.
object ElmRes.GetRelCase(int caseNumber)
A RGUMENTS
caseNumber
The reliability case number
R ETURNS
Returns the contingency of case number. NULL is returned if there is no corresponding
contingency.
E XAMPLE
The following example lists all contingencies stored in the result file named Reliability Enu-
meration stored in the active study case.
int caseVar, ! column which contains contingency variable for casenum
row, ! current row
failed; ! error handling
object currObj, ! current contingency
elmRes; ! result file
double caseIdx; ! case index read from file
251
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetSubElmRes*
Get sub-result file stored inside this.
object ElmRes.GetSubElmRes(int value)
object ElmRes.GetSubElmRes(object obj)
A RGUMENTS
value The cnttime to look for
obj The pResElm to look for
R ETURNS
NULL The sub result file with value=cnttime (obj=pResElm) was not found.
any other value The sub result file with value=cnttime (obj=pResElm).
GetUnit*
Get the unit of a column.
string ElmRes.GetUnit([int column])
A RGUMENTS
column (optional)
The column index. The unit of the default variable is returned if the parameter is
nor passed to the function.
R ETURNS
Returns the unit which is empty in case that the column index is not part of the data.
E XAMPLE
See example of ElmRes.GetVariable.
252
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetValue*
Returns a value from a result object for row iX of curve col.
int ElmRes.GetValue(double& d,
int iX,
[int col])
A RGUMENTS
d (out) The value retrieved from the data.
iX The row.
col (optional)
The curve number, which equals the variable or column number, first column value
(time,index, etc.) is returned when omitted.
R ETURNS
0 when ok
1 when iX out of bound
2 when col out of bound
3 when invalid value is returned from a sparse file. Sparse files are written e.g.
by the contingency analysis, the value is invalid in case that it was not written,
because it was below the recording limit. Result files created using DPL/Python
are always full and will not return invalid values.
E XAMPLE
See example of ElmRes.SortAccordingToColumn.
GetVariable*
Get variable name of column
string ElmRes.GetVariable([int column])
A RGUMENTS
column (optional)
The column index. The variable name of the default variable is returned if the
parameter is nor passed to the function.
R ETURNS
Returns the variable name which is empty in case that the column index is not part of the
data.
E XAMPLE
object case,
elmRes;
string name,
unit,
short,
long;
set resObjs;
int variables,
column;
253
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
variables = elmRes.GetNumberOfColumns();
if (variables>0) {
printf('Name; unit; Short Description; Long Description');
for (column=-1; column<variables; column+=1) {
! -1 returns default column
name = elmRes.GetVariable(column);
unit = elmRes.GetUnit(column);
short= elmRes.GetDescription(column,1);
long = elmRes.GetDescription(column);
printf('%s; %s; %s; %s', name, unit, short,long);
}
}
elmRes.Release();
InitialiseWriting
Opens the result object for writing. This function must be called before writing data for result
files not stored in the script object. If arguments are passed to the function they specify the
variable name, unit... of the default variable (e.g. to be used by plots as x-axis).
int ElmRes.InitialiseWriting()
int ElmRes.InitialiseWriting(string variableName,
string unit,
string description,
[string shortDescription]
)
A RGUMENTS
variableName
The variable name for the default variable (e.g. “distance”).
unit The unit (e.g. “km”).
description
The description of the variable (e.g. “Distance from infeed”).
shortDescription
The short description (e.g. “Dist. Infeed”).
R ETURNS
Always 0 and can be ignored
D EPRECATED N AMES
Init
S EE ALSO
254
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example gets the result file named DPl from the study case, the default variable
to Length, runs a load flow and writes a line to the file. Thed default variable is set to 10 km.
object sumGrid, ! summary grid
ldfCmd, ! load flow command
elmRes; ! result file
sumGrid = GetSummaryGrid();
if (nullptr=sumGrid){
exit(1);
}
elmRes = GetFromStudyCase('DPL.ElmRes');
if (elmRes) {
ldfCmd = GetFromStudyCase('ComLdf');
if (ldfCmd){
ldfCmd.Execute();
elmRes.InitialiseWriting('len', 'km', 'Length','Len');
elmRes.Write(10);
elmRes.FinishWriting();
}
}
Load*
Loads the data of a result object (ElmRes) in memory for reading.
void ElmRes.Load()
E XAMPLE
object case,
elmRes;
set resObjs;
int variables,rows;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
variables = elmRes.GetNumberOfColumns();
rows = elmRes.GetNumberOfRows();
Info('The result file %s contains %d columns and %d rows',elmRes, variables, rows);
elmRes.Release();
255
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
Release*
Releases the data loaded to memory. This function should be used whenever several result
objects are processed in a loop. Data is always released from memory automatically after
execution of the current script.
void ElmRes.Release()
E XAMPLE
See example of ElmRes.Load.
SetAsDefault
Sets this results object as the default results object. Plots using the default result file will use
this file for displaying data.
void ElmRes.SetAsDefault()
SetObj
Adds an object to the objects assigned to the result file
int ElmRes.SetObj(object element)
A RGUMENTS
element Element to store in result file
R ETURNS
The index which can be used to retrieve the object from the results file. The index is < 0 if
no results are recorded for the given object (e.g. a contingency in reliability calculation). The
index is ≥ if variables are recorded for the object.
E XAMPLE
The following example disables terminal by terminal and calculates a load flow for every case.
The outaged terminal is written using SetObj
int failed,
outOfService,
index;
object ldf, bus;
set terminals;
256
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
SetSubElmResKey
Assigns a value or an object to the according ElmRes parameter.
void ElmRes.SetSubElmResKey(int value)
void ElmRes.SetSubElmResKey(object obj)
A RGUMENTS
value Value to be assigned to parameter cnttime of ElmRes
value Object to be assigned to parameter pResElm of ElmRes
SortAccordingToColumn*
Sorts all rows in the data loaded according to the given column. The ElmRes itself remains
unchanged.
int ElmRes.SortAccordingToColumn(int column)
A RGUMENTS
col The column number.
R ETURNS
0 The function executed correctly, the data was sorted correctly according to the
given column.
1 The column with index column does not exist.
E XAMPLE
The following example outputs column 1 and 2 for the first 50 rows. The output is repeated
after sorting the data according to column 1.
object case,
elmRes;
set resObjs;
int row,
rows,
column,
failed;
double value1, value2;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
column = 1;
rows = 50;
Info('Orginal data in first %d rows of column %d and %d',rows, column, column+1);
257
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
row = 0;
while (.not.failed) {
row += 1;
printf('%04d %f %f', row, value1, value2); ! report row starting with 1
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
if (row > rows) {
break;
}
}
failed = elmRes.SortAccordingToColumn(column);
Info('Sorted data in first %d rows in column %d and %d',rows,column, column+1);
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
row = 0;
while (.not.failed) {
row += 1;
printf('%04d %f %f', row, value1, value2); ! report row starting with 1
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
if (row > rows) {
break;
}
}
elmRes.Release();
Write
Writes the current results to the result object.
int ElmRes.Write([double defaultValue])
R ETURNS
0 on success
S EE ALSO
E XAMPLE
See example of ElmRes.InitialiseWriting.
WriteDraw
Writes current results to the result objects and updates all plots that display values from the
result object.
int ElmRes.WriteDraw()
R ETURNS
0 on success
258
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example performs load-flows for a number of load levels and writes the results
to the result object
int failed;
object ldf;
load:plini = minLoad;
ldf = GetFromStudyCase('ComLdf');
while (load:plini<maxLoad) {
failed = ldf.Execute();
if (failed) {
break;
}
load:plini+=step;
Results.WriteDraw();
}
3.2.25 ElmShnt
Overview
GetGroundingImpedance*
GetGroundingImpedance*
Returns the impedance of the internal grounding. Single phase shunts connected to neutral
are considered as grounding devices themselves; i.e. instead of the dedicated grounding
parameters, the shunt parameters are used.
int ElmShnt.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
259
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.26 ElmStactrl
Overview
GetControlledHVNode*
GetControlledLVNode*
GetStepupTransformer*
Info*
GetControlledHVNode*
Returns the corresponding voltage controlled HV node for the machine at the specified index.
Switch status are always considered.
object ElmStactrl.GetControlledHVNode([int index = 0])
A RGUMENTS
index (optional)
Index of machine (starting from 0 − . . . ). Default is 0.
R ETURNS
object Busbar/Terminal ()
NULL not found
E XAMPLE
set objs
object controlledNode,gen;
int index,gens;
objs = GetCalcRelevantObjects('ElmStactrl');
GetControlledLVNode*
Returns the corresponding voltage controlled LV node for the machine at specified index. Switch
status are always considered.
object ElmStactrl.GetControlledLVNode(int index)
A RGUMENTS
index Index of machine (starting from 0 − . . . ).
260
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
object Terminal ()
NULL not found
E XAMPLE
set objs
object controlledNode,gen;
int index,gens;
objs = GetCalcRelevantObjects('ElmStactrl');
GetStepupTransformer*
Performs a topological search to find the step-up transformer of the machine at the specified
index.
object ElmStactrl.GetStepupTransformer([int index,]
[int iBrkMode]
)
A RGUMENTS
index Index of machine (starting from 0 − . . . ).
iBrkMode (optional)
0 (default) All switch status (open,close) are considered
1 Ignore breaker status (jump over open breakers)
2 Ignore all switch status (jump over open switches)
R ETURNS
object step-up transformer
NULL step-up transformer not found
Info*
Prints the control information in the output window. It is the same information that the button
”Info” of the Station Control dialog prints.
int ElmStactrl.Info()
261
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.27 ElmSubstat
Overview
ApplyAndResetRA
GetSplit*
GetSplitCal*
GetSplitIndex*
GetSuppliedElements*
OverwriteRA
ResetRA
SaveAsRA
SetRA
ApplyAndResetRA
This function applies switch statuses of currently selected running arrangement to correspond-
ing switches and resets the running arrangement selection afterwards. Nothing happens if no
running arrangement is selected.
int ElmSubstat.ApplyAndResetRA()
R ETURNS
1 on success
0 otherwise, especially if no running arrangement is selected
GetSplit*
A split of a station is a group of topologically connected elements. Such a group is called split
if all contained components are energized and there is at least one busbar (terminal of usage
'busbar') contained or it has connections to at least two main components (= all components
except switch devices and terminals).
These splits are ordered according to the count of nodes contained and according to their
priority. So each split becomes a unique index.
The function GetSplit offers access to the elements contained in a split. By calling GetSplit with
an index from 0 to n, the elements belonging to the corresponding split are filled into given sets
and returned.
int ElmSubstat.GetSplit(int index,
set& mainNodes,
[set& connectionCubicles,]
[set& allElements]
)
A RGUMENTS
index Index of the split used to access the elements of the corresponding split. Value
must be ≥ 0.
mainNodes (out)
Terminals of same usage considered to form the most important nodes for that
group. In most cases, this is the group of contained busbars.
connectionCubicles (optional, out)
All cubicles (of terminals inside the station) that point to an element that sits out-
side the station or to an element that is connected to a terminal outside the station
262
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
are filled into the set connectionCubicles. (The connection element (branch) can
be accessed by calling GetBranch() on each of these cubicles. The terminals
of these cubicles (parents) must not necessarily be contained in any split. They
could also be separated by a disconnecting component.)
allElements(optional, out)
All elements (class Elm*) of the split that have no connection to elements outside
the station are filled into this set.
R ETURNS
0 success, split of that index exists and is returned.
1 indicates that there exists no split with given index. (Moreover, this means that
there is no split with index n greater than this value.)
E XAMPLE
set nodes;
set cubicles;
set elements;
int return, index;
object obj;
return = 0;
while (return <> 1) { !loop from 0 to n until there is no more split
return = station.GetSplit(index, nodes, cubicles, elements);
printf('Major Nodes:');
obj = nodes.First();
while(obj) {
obj.ShowFullName();
obj = nodes.Next();
}
printf('Connection Cubicles:');
obj = cubicles.First();
while(obj) {
obj.ShowFullName();
obj = cubicles.Next();
}
printf('All Elements:');
obj = elements.First();
while(obj) {
obj.ShowFullName();
obj = elements.Next();
}
index = index + 1;
}
S EE ALSO
ElmSubstat.GetSplitCal(), ElmSubstat.GetSplitIndex(),
263
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetSplitCal*
This function determines the elements that belong to a split. In contrast to ElmSubstat.GetSplit()
it is based on calculation instead of pure edit object topology. This means the returned nodes
correspond to the calculation nodes, the interconnecting cubicles are those connecting nodes
of different splits.
Note: As this function relies on calculation nodes it can only be executed after a calculation has
been performed (e.g. load flow calculation).
int ElmSubstat.GetSplitCal(int index,
set& nodes,
[set& connectionCubicles,]
[set& elements])
A RGUMENTS
index Index of the split used to access the elements of the corresponding split. Refers
to same split as index in ElmSubstat.GetSplit().
Value must be ≥ 0.
nodes (out)
A set that is filled with terminals. There is one terminal returned for each calcula-
tion node in the split.
connectionCubicles (optional, out)
This set is filled with all cubicles that point from a calculation node of current split
to another calculation node that does not belong to that split. The connecting
element can be accessed by calling GetBranch() on such a cubicle.
elements (optional, out)
This set is filled with network elements that are connected to a calculation node of
current split and have exactly one connection, i.e. these elements are completely
contained in the split.
R ETURNS
0 success, split of that index exists and is returned.
1 indicates that there exists no split with given index. (Moreover, this means that
there is no split with index n greater than this value.)
E XAMPLE
set nodes;
set cubicles;
set elements;
int return, index;
object obj;
return = 0;
while (return <> 1) { !loop from 0 to n until there is no more split
return = station.GetSplitCal(index, nodes, cubicles, elements);
if (return < 1) {
if (return = 0) {
printf('Split %d:', index);
}
else {
printf('(Pseudo)Split %d:', index);
}
printf('Major Nodes:');
obj = nodes.First();
while(obj) {
264
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
obj.ShowFullName();
obj = nodes.Next();
}
printf('Connection Cubicles:');
obj = cubicles.First();
while(obj) {
obj.ShowFullName();
obj = cubicles.Next();
}
printf('Elements:');
obj = elements.First();
while(obj) {
obj.ShowFullName();
obj = elements.Next();
}
}
index = index + 1;
}
S EE ALSO
ElmSubstat.GetSplit()
GetSplitIndex*
This function returns the index of the split that contains passed object.
int ElmSubstat.GetSplitIndex(object o)
A RGUMENTS
o Object for which the split index is to be determined.
R ETURNS
≥0 index of split in which element is contained
-1 given object does not belong to any split of that station
E XAMPLE
set stations, terms;
object substation, term;
string name;
int index;
stations = GetCalcRelevantObjects('*.ElmSubstat');
terms = substation.GetContents('*.ElmTerm');
265
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
index = substation.GetSplitIndex(term);
name = term.GetFullName(0);
if (index < 0) {
printf(' %s is not contained in any split of that substation', name);
}
else {
printf(' %s belongs to split %d', name, index);
}
}
}
S EE ALSO
ElmSubstat.GetSplit()
GetSuppliedElements*
Returns the network components that are supplied by the transformer (located in the station). A
network component is considered to be supplied by a transformer if a topological path from the
transformer to the component exists. A valid topological path in this sense is a path that starts
at the transformer’s HV side in direction of transformer (not in direction of HV connected node)
and stops at
• open switches,
• connections leading to a higher voltage level.
Generally, all network components of such a path are considered to be supplied by the trans-
former.
Exceptions are components that are out of calculation or in-active. Those components are never
considered to be supplied by any transformer. A transformer is never considered to supply itself.
Composite components such as ElmBranch, ElmSubstat, ElmTrfstat are considered to be sup-
plied by a transformer if all energized components inside that composite are supplied by the
transformer.
set ElmSubstat.GetSuppliedElements([int inclNested])
A RGUMENTS
inclNested (optional)
0 Do not include components that are supplied by nested supplying sta-
tions
1 (default) Include components that are supplied by nested stations
S EE ALSO
ElmTr2.GetSuppliedElements(), ElmTr3.GetSuppliedElements()
266
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
OverwriteRA
This function overwrites switch statuses stored in an existing running arrangement with actual
switch statuses of the substation. This is only possible if the substation has no running arrange-
ment selected and given running arrangement is valid for substation the method was called
on.
int ElmSubstat.OverwriteRA(object ra)
A RGUMENTS
ra Given running arrangement
R ETURNS
1 If given running arrangement was successfully overwritten;
0 otherwise
E XAMPLE
int res;
res = objsubstation.OverwriteRA(objra);
if (res = 1) {
printf('%o was successfully overwritten', objra);
}
else {
printf('%o was not overwritten', objra)
}
ResetRA
This function resets the running arrangement selection for the substation it was called on.
void ElmSubstat.ResetRA()
SaveAsRA
When called on a substation that has no running arrangement selected, a new running ar-
rangement is created and all switch statuses of all running arrangement relevant switches (for
that substation) are saved in it. The running arrangement is stored in project folder ”Running
Arrangement” and its name is set to given locname. The new running arrangement is not
selected automatically.
(No new running arrangement is created if this method is called on a substation that has
currently a running arrangement selected).
object ElmSubstat.SaveAsRA(string locname)
A RGUMENTS
locname Name of the new running arrangement (if name is already used, an increment
(postfix) is added to make it unique).
R ETURNS
Newly created 'IntRunarrange' object on success, otherwise NULL.
267
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
object myRA;
myRA = objsubstation.SaveAsRA('MyRA');
if (myRA) {
myRA.ShowFullName();
}
else {
printf('No RA created.');
}
SetRA
This function sets the running arrangement selection for the substation it was called on. The
switch statuses are now determined by the values stored in the running arrangement.
int ElmSubstat.SetRA(object ra)
A RGUMENTS
ra running arrangement that is valid for the substation
R ETURNS
1 If given running arrangement was successfully set;
0 otherwise (e.g. given ra is not valid for that substation)
E XAMPLE
int res;
res = objsubstation.SetRA(objra);
if (res = 1) {
printf('%o was successfully set', objra);
}
else {
printf('%o was not set', objra);
}
3.2.28 ElmSvs
Overview
GetStepupTransformer*
GetStepupTransformer*
Performs a topological search to find the step-up transformer of the static VAR system.
object ElmSvs.GetStepupTransformer(double voltage,
int swStatus
)
A RGUMENTS
voltage voltage level at which the search will stop
268
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Returns the first collected step-up transformer object. It is empty if not found (e.g. start
terminal already at hvVoltage).
3.2.29 ElmSym
Overview
CalcEfficiency
Derate
Disconnect
GetAvailableGenPower*
GetGroundingImpedance*
GetMotorStartingFlag*
GetStepupTransformer*
IsConnected*
Reconnect
ResetDerating
CalcEfficiency
Calculate efficiency for connected storage model at given active power value.
double ElmSym.CalcEfficiency(double activePowerMW)
A RGUMENTS
activePowerMW
Active power value to calculate efficiency for.
R ETURNS
Returns the resulting efficiency in p.u.
E XAMPLE
set objs;
object obj;
int err;
double eff, Ptherm, Pelect;
Pelect = 30.0;
objs = GetCalcRelevantObjects('*.ElmSym');
obj = objs.First();
if (obj) {
eff = obj.CalcEfficiency(Pelect);
Ptherm = Pelect/eff;
}
269
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
Derate
Derates the value of the Max. Active Power Rating according to the specified value given in
MW.
The following formula is used: P max uc = P max uc − ”Deratingvalue”.
void ElmSym.Derate(double deratingP)
A RGUMENTS
deratingP Derating value
Disconnect
Disconnects a synchronous machine by opening the first circuit breaker. The topological search
performed to find such a breaker, stops at any busbar.
int ElmSym.Disconnect()
R ETURNS
0 breaker already open or successfully opened
1 an error occurred (no breaker found, open action not possible (earthing / RA))
E XAMPLE
set objs;
object obj;
int err;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
GetAvailableGenPower*
Returns the available power that can be dispatched from the generator, for the particular study
time.
For the case of conventional generators (no wind generation selected), the available power is
equal to the nominal power specified.
For wind generators, the available power will depend on the wind model specified:
270
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
• Time Series Characteristics of Active Power Contribution: The available power is the
average of the power values (in MW) obtained from all the specified time characteristics
for the current study time.
• Time Series Characteristics of Wind Speed: The available power is calculated with the
average of the power values (in MW) calculated for all the specified time characteristics.
A power value for any time characteristic is calculated by obtaining the wind speed for the
current study time, and then calculating the power from the specified Power Curve. If the
units of the Power Curve are in MW, the returned value is directly the power value. In the
other hand, if the units are in PU, the returned value is multiplied by the nominal power of
the generator to return the power value.
R ETURNS
Available generation power
E XAMPLE
set generators;
object generator;
double totalpower, power;
generators = GetCalcRelevantObjects('*.ElmSym');
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmSym.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
271
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetMotorStartingFlag*
Returns the starting motor condition.
int ElmSym.GetMotorStartingFlag()
R ETURNS
Returns the motor starting condition. Possible values are:
GetStepupTransformer*
Performs a topological search to find the step-up transformer of the synchronous machine.
object ElmSym.GetStepupTransformer(double voltage,
int swStatus
)
A RGUMENTS
voltage voltage level at which the search will stop
swStatus consideration of switch status. Possible values are:
R ETURNS
Returns the first collected step-up transformer object. It is empty if not found (e.g. start
terminal already at hvVoltage).
IsConnected*
Checks if a synchronous machine is already connected to any busbar.
int ElmSym.IsConnected()
R ETURNS
0 false, not connected to a busbar
1 true, generator is connected to a busbar
E XAMPLE
set objs;
object obj;
int status;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
272
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
Reconnect
Connects a synchronous machine by closing all switches (breakers and isolators) up to the first
breaker on the HV side of a transformer. The topological search to find all the switches, stops
at any busbar.
int ElmSym.Reconnect()
R ETURNS
0 the machine was successfully closed
1 a error occurred and the machine could not be connected to any busbar
E XAMPLE
set objs;
object obj;
int err;
objs = GetCalcRelevantObjects('*.ElmSym,*.ElmGenstat,*.ElmPvsys');
ResetDerating
Resets the derating value, setting the Max. Active Power Rating according to the rating factor.
The following formula is used: P max uc = pmaxratf ∗ P n ∗ ngnum.
void ElmSym.ResetDerating()
273
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.30 ElmTerm
Overview
GetBusType*
GetCalcRelevantCubicles*
GetConnectedBrkCubicles*
GetConnectedCubicles*
GetConnectedMainBuses*
GetConnectionInfo*
GetEquivalentTerminals*
GetMinDistance*
GetNextHVBus*
GetNodeName*
GetSepStationAreas*
GetShortestPath*
HasCreatedCalBus*
IsElectrEquivalent*
IsEquivalent*
IsInternalNodeInStation*
UpdateSubstationTerminals
GetBusType*
Gets busbar calculation type.
int ElmTerm.GetBusType()
R ETURNS
0 No valid calculation (load flow).
1 PQ busbar.
2 PV busbar.
3 Slack busbar.
GetCalcRelevantCubicles*
This function gets calculation relevant cubicles of this terminal.
set ElmTerm.GetCalcRelevantCubicles()
R ETURNS
Set of calculation relevant cubicles.
GetConnectedBrkCubicles*
Function gets the set of cubicles connected with the breaker and this terminal.
set ElmTerm.GetConnectedBrkCubicles([int ignoreSwitchStates])
A RGUMENTS
ignoreSwitchStates (optional)
Ignore switch status flag 1 or not 0 (=default).
274
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Set of cubicles.
GetConnectedCubicles*
Function gets the set of cubicles connected with this terminal.
set ElmTerm.GetConnectedCubicles([int ignoreSwitchStates])
A RGUMENTS
ignoreSwitchStates (optional)
Ignore switch status flag 1 or not 0 (=default).
R ETURNS
Set of cubicles.
GetConnectedMainBuses*
Function gets the set of connected main buses.
set ElmTerm.GetConnectedMainBuses([int considerSwitches])
A RGUMENTS
considerSwitches (optional)
Consider switch state (default 1).
R ETURNS
Set of main buses connected to the terminal.
GetConnectionInfo*
Gets connection information of this terminal. Requires valid load flow calculation. Input argu-
ments are filled with the value after function call.
int ElmTerm.GetConnectionInfo(double& closedSwitches,
double& allSwitches,
double& nonSwitchingDevices,
double& closedAndNonSwitchingDevices,
double& allDevices,
double& connectedNodes,
double& mainNodes)
A RGUMENTS
closedSwitches
Number of closed switch devices.
allSwitches
Number of total switch devices.
nonSwitchingDevices
Number of non-switch devices.
closedAndNonSwitchingDevices
Number of total closed and non-switch devices (closedSwitches+nonSwitchingDevices).
275
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
allDevices
Number of total switch and non-switch devices (allSwitches+nonSwitchingDevices).
connectedNodes
Number of total nodes connected via couplers.
mainNodes
Number of total main nodes.
R ETURNS
Return value is always 0 and has no meaning.
GetEquivalentTerminals*
Returns a set of all terminals that are equivalent to current one. Euqivalent means that those
terminals are topologically connected only by
set ElmTerm.GetEquivalentTerminals()
R ETURNS
All terminals that are equivalent to current one. Current one is also included so the set is
never empty.
E XAMPLE
set terminals;
object curTerm;
int t;
S EE ALSO
ElmTerm.IsEquivalent()
276
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetMinDistance*
This function determines the shortest path between the terminal the function was called on and
the terminal that was passed as first argument. The distance is determined on network topology
regarding the length of the traversed component (i.e. only lines have an influence on distance).
double ElmTerm.GetMinDistance(object term,
[int considerSwitches,]
[set& path,]
[set limitToNodes,]
[set elementsToIgnore]
)
A RGUMENTS
term Terminal to which the shortest path is determined.
considerSwitches (optional)
0 Traverse all components, ignore switch states
1 Do not traverse open switch devices (default)
path (optional, out)
If given, all components of the found shortest path are put into this set.
limitToNodes(optional)
If given, the shortest path is searched only within this set of nodes. Please note,
when limiting search to a given set of nodes, the start and end terminals (for which
the distance is determined) must be part of this set (otherwise distance =-1).
elementsToIgnore(optional)
If given, these objects (e.g. nodes) are ignored in the search and not traversed
(=considered as not existing).
R ETURNS
<0 If there is no path between the two terminals
≥0 Distance of shortest path in km
E XAMPLE
!assume terminal1 and terminal2 are objects of class ElmTerm
double distance;
set path;
object obj;
S EE ALSO
ElmTerm.GetShortestPath()
277
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetNextHVBus*
This function returns the nearest connected busbar that has a higher voltage level. To detect
this bus, a breadth-first search on the net topology is executed. The traversal stops on each
element that is out of service and on each opened switch device. The criterion for higher voltage
level is passing a transformer to HV side. No junction nor internal nodes shall be considered.
Two winding transfomers with equal voltage on both sides are ignored (simply passed by the
search).
object ElmTerm.GetNextHVBus()
R ETURNS
object First busbar found.
NULL If no busbar was found.
E XAMPLE
object obj, result;
set bars;
result = obj.GetNextHVBus();
if (result) {
result.ShowFullName();
}
GetNodeName*
For terminals inside a station, this function returns a unique name for the split the terminal is
located in. The name is built on first five characters of the station‘s short name plus the split
index separated by an underscore. E.g. “USTAT 1”.
For terminals inside a branch (ElmBranch) the returned name is just a concatenation of the
branch name and the terminal‘s name.
For all other terminals not inside a branch or a station the node name corresponds to the
terminal‘s name.
string ElmTerm.GetNodeName()
R ETURNS
Node name as described above. Never empty.
D EPRECATED N AMES
GetEllaNodeName
GetSepStationAreas*
Function gets all separate areas within the substation linked to this terminal. In this manner,
area is any part between two nodes.
set ElmTerm.GetSepStationAreas([int considerSwitches])
278
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
considerSwitches (optional)
Consider switch state (default 1).
R ETURNS
Set of all separate areas in this substation.
GetShortestPath*
This function determines the shortest path between the terminal the function was called on and
the terminal that was passed as argument. The shortest path is determined on network topology
according to given criterion.
double ElmTerm.GetShortestPath(int criterion,
object term,
[int considerSwitches,]
[set& path,]
[set limitToNodes,]
[set elementsToIgnore]
)
A RGUMENTS
criterion
0 According to line length, same as ElmTerm.GetMinDistance()
1 According to node count
term Terminal to which the shortest path is determined.
considerSwitches (optional)
0 Traverse all components, ignore switch states
1 Do not traverse open switch devices (default)
path (optional, out)
If given, all components of the found shortest path are put into this set.
limitToNodes(optional)
If given, the shortest path is searched only within this set of nodes. Please note,
when limiting search to a given set of nodes, the start and end terminals (for which
the distance is determined) must be part of this set (otherwise distance =-1).
elementsToIgnore(optional)
If given, these objects (e.g. nodes) are ignored in the search and not traversed
(=considered as not existing).
R ETURNS
<0 If there is no path between the two terminals
≥0 Distance of shortest path according to given criterion
E XAMPLE
!assume terminal1 and terminal2 are objects of class ElmTerm
double distance;
set path;
object obj;
279
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
S EE ALSO
ElmTerm.GetMinDistance()
HasCreatedCalBus*
This function checks if the valid calculation exists for this terminal (i.e. load flow). If it exists,
then the calculation parameters could be retrieved.
int ElmTerm.HasCreatedCalBus()
R ETURNS
1 Valid calculation exists.
0 No valid calculation.
E XAMPLE
int ival;
double dval;
object oTerm;
set allTerminals;
allTerminals = GetAll('ElmTerm');
oTerm = allTerminals.First();
while (oTerm) {
ival = oTerm.HasCreatedCalBus();
if (ival) {
dval = oTerm:m:u;
printf('Voltage of %o is %f p.u.', oTerm, dval);
}
oTerm = allTerminals.Next();
}
IsElectrEquivalent*
Function checks if two terminals are electrically equivalent. Two terminals are said to be
electrically equivalent if they are topologically connected only by
280
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
terminal Terminal to which the 'method called terminal' is connected to.
maxR Given threshold for the resistance of branch elements (must be given in Ohm).
maxX Given threshold for the reactance of branch elements (must be given in Ohm).
R ETURNS
1 If terminal on which the method was called is electrical equivalent to terminal that
was passed as argument
0 Otherwise
E XAMPLE
int res;
res = Busbar1.IsElectrEquivalent(Busbar2, 0.05, 0.05);
if (res = 1) {
printf('%o is electrical equivalent to %o', Busbar1, Busbar2);
}
else {
printf('%o is not electrical equivalent to %o', Busbar1, Busbar2);
}
S EE ALSO
ElmTerm.IsEquivalent()
IsEquivalent*
Function checks if two terminals are topologically connected only by
A RGUMENTS
terminal Terminal (object of class ElmTerm) that is checked to be equivalent to the terminal
on which the function was called on. Passing NULL is not allowed and will result
in a scripting error.
281
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
1 If terminal on which the method was called is connected to terminal that was
passed as argument only by closed switching devices or by lines of zero length
0 Otherwise (terminals are not connected or connected by other components than
switching devices / lines of zero length)
E XAMPLE
int res;
! Assume Busbar1 and Busbar2 are two objects of class ElmTerm
res = Busbar1.IsEquivalent(Busbar2);
if (res = 1) {
printf('%o is equivalent to %o', Busbar1, Busbar2);
}
else {
printf('%o is not equivalent to %o', Busbar1, Busbar2);
}
S EE ALSO
ElmTerm.GetEquivalentTerminals() ElmTerm.IsElectrEquivalent()
IsInternalNodeInStation*
Function checks if the terminal is an internal node located in a station (ElmSubstat, ElmTrfstat).
int ElmTerm.IsInternalNodeInSubStation()
R ETURNS
1 Terminal is a node of usage ‘internal’ and is located in a station.
0 Not internal node or not in a station, or both.
D EPRECATED N AMES
IsInternalNodeInSubStation
UpdateSubstationTerminals
Updates all nodes within the substation to the new voltage and/or phase technology. Applicable
for all busbars and junction nodes. The highest voltage is taken as the leading one.
void ElmTerm.UpdateSubstationTerminals(int volt,
int phs
)
A RGUMENTS
volt Updates nominal voltages (<> 0)
phs Updates phase technology (<> 0)
282
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.31 ElmTow
Overview
Update
Update
Updates line couplings element depending on configuration of the associated tower types or
tower geometries.
void ElmTow.Update()
R ETURNS
1 Line couplings element was updated.
0 Update was not required.
3.2.32 ElmTr2
Overview
CreateEvent
GetGroundingImpedance*
GetSuppliedElements*
GetTapPhi*
GetTapRatio*
GetZ0pu*
GetZpu*
IsQuadBooster*
NTap*
CreateEvent
For the corresponding transformer, a Tap Event (EvtTap) is created for the simulation.
int ElmTr2.CreateEvent([int tapAction,]
[int tapPos]
)
A RGUMENTS
tapAction (optional)
0=increase tap; 1=decrease tap; 2=set tap to tapPos; 3=manual; 4=automatic
tapPos (optional)
Position of tap.
R ETURNS
0 on success
283
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmTr2.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
GetSuppliedElements*
Returns the network components that are supplied by the transformer.
A transformer is treated as supplying if it is located in a station. Transformers outside stations
are not supplying in this sense.
A network component is considered to be supplied by a transformer if a topological path from
the transformer to the component exists. A valid topological path in this sense is a path that
starts at the transformer's HV side in direction of transformer (not in direction of HV connected
node) and stops at
• network components that are not active (e.g. hidden or those of currently inactive grids),
• open switches,
• connections leading to a higher voltage level.
Generally all network components of such a path are considered to be supplied by the trans-
former. Exceptions are components that are out of calculation or in-active. Those components
are never considered to be supplied by any transformer.
A transformer is never considered to supply itself.
Composite components such as ElmBranch, ElmSubstat, ElmTrfstat are considered to be sup-
plied by a transformer if all energized components inside that composite are supplied by the
transformer.
set ElmTr2.GetSuppliedElements([int inclNested])
A RGUMENTS
inclNested (optional)
0 Only include components which are directly supplied by the transformer
(not nested components)
1 Include nested components and components that are directly supplied
by the transformer (default)
284
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Elements supplied by this transformer. The set is empty if the transfomer is located outside
a station or if no element is topologically connected its HV side.
S EE ALSO
GetTapPhi*
Gets the tap phase shift in deg of the transformer for given tap position.
double ElmTr2.GetTapPhi(int itappos,
int inclPhaseShift
)
A RGUMENTS
itappos Tap position
inclPhaseShift
1 = Includes the vector group phase shift, 0 = consider only the tap phase shift
R ETURNS
Returns the tap phase shift angle of the transformer for given tap position
GetTapRatio*
Gets the voltage ratio of the transformer for given tap position.
double ElmTr2.GetTapRatio(int itappos,
int onlyTapSide,
int includeNomRatio
)
A RGUMENTS
itappos Tap position
onlyTapSide
1 = ratio only for given side., 0 = total ratio
includeNomRatio
1 = Includes nominal ratio of the transformer, 0 = consider only tap ratio
R ETURNS
Returns the voltage ratio of the transformer for given tap position
GetZ0pu*
Gets the zero-sequence impedance in p.u. of the transformer for the specified tap position. If
the tap position is out of the tap changer range, the respective min. or max. position will be
used.
void ElmTr2.GetZ0pu(int itappos,
double& r0pu,
double& x0pu,
int systembase)
285
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
itappos Tap position
r0pu (out)
Resistance in p.u.
x0pu (out)
Reactance in p.u.
systembase
0 p.u. is based on rated power.
1 p.u. is based on system base (e.g. 100MVA).
GetZpu*
Gets the impedance in p.u. of the transformer for the specified tap position. If the tap position is
out of the tap changer range, the respective min. or max. position will be used.
void ElmTr2.GetZpu(int itappos,
double& rpu,
double& xpu,
int systembase)
A RGUMENTS
itappos Tap position
rpu (out) Resistance in p.u.
xpu (out) Reactance in p.u.
systembase
0 p.u. is based on rated power.
1 p.u. is based on system base (e.g. 100MVA).
IsQuadBooster*
Returns whether transformer is a quadbooster; i.e. checks phase shift angle modulus 180◦ .
int ElmTr2.IsQuadBooster()
R ETURNS
'1' if quadbooster, else '0'
E XAMPLE
set objsTr2;
object obj;
int isQuadBooster;
objsTr2 = GetCalcRelevantObjects('*.ElmTr2');
286
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
obj.ShowFullName();
}
}
NTap*
Gets the transformer tap position.
int ElmTr2.NTap()
R ETURNS
The tap position.
3.2.33 ElmTr3
Overview
CreateEvent
GetGroundingImpedance*
GetSuppliedElements*
GetTapPhi*
GetTapRatio*
GetTapZDependentSide*
GetZ0pu*
GetZpu*
IsQuadBooster*
NTap*
CreateEvent
For the corresponding transformer, a Tap Event (EvtTap) is created for the simulation.
void ElmTr3.CreateEvent([int tapAction = 2,]
[int tapPos = 0,]
[int busIdx = 0]
)
A RGUMENTS
tapAction (optional)
0=increase tap; 1=decrease tap; 2=set tap to tapPos; 3=manual; 4=automatic
tapPos (optional)
Position of tap.
busIdx (optional)
Bus index.
287
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmTr3.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
GetSuppliedElements*
Returns the network components that are supplied by the transformer.
A transformer is treated as supplying if it is located in a station. Transformers outside stations
are not supplying in this sense.
A network component is considered to be supplied by a transformer if a topological path from
the transformer to the component exists. A valid topological path in this sense is a path that
starts at the transformer's HV side in direction of transformer (not in direction of HV connected
node) and stops at
• network components that are not active (e.g. hidden or those of currently inactive grids),
• open switches,
• connections leading to a higher voltage level.
Generally all network components of such a path are considered to be supplied by the trans-
former. Exceptions are components that are out of calculation or in-active. Those components
are never considered to be supplied by any transformer.
A transformer is never considered to supply itself.
Composite components such as ElmBranch, ElmSubstat, ElmTrfstat are considered to be sup-
plied by a transformer if all energized components inside that composite are supplied by the
transformer.
set ElmTr3.GetSuppliedElements([int inclNested])
A RGUMENTS
inclNested (optional)
0 Only include components which are directly supplied by the transformer
(not nested components)
1 Include nested components and components that are directly supplied
by the transformer (default)
288
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Elements supplied by this transformer. The set is empty if the transfomer is located outside
a station or if no element is topologically connected its HV side.
S EE ALSO
GetTapPhi*
Gets the tap phase shift in deg of the transformer for given tap position and side.
double ElmTr3.GetTapPhi(int iSide,
int itappos,
int inclPhaseShift
)
A RGUMENTS
iSide for tap at side (0=Hv, 1=Mv, 2=Lv)
R ETURNS
Returns the tap phase shift angle of the transformer for given tap position and side
GetTapRatio*
Gets the voltage ratio of the transformer for given tap position and side.
double ElmTr3.GetTapRatio(int iSide,
int itappos,
int includeNomRatio
)
A RGUMENTS
iSide for tap at side (0=Hv, 1=Mv, 2=Lv)
itappos Tap position at corresponding side
includeNomRatio
1 = Includes nominal ratio of the transformer, 0 = consider only tap ratio
R ETURNS
Returns the voltage ratio of the transformer for given tap position and side
GetTapZDependentSide*
Get tap side used for the dependent impedance
int ElmTr3.GetTapZDependentSide()
289
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
-1 if no tap dependent impedance is defined
0 for HV tap
1 for MV tap
2 for LV tap
GetZ0pu*
Gets the zero-sequence impedance in p.u. of the transformer for the specified tap position. If
the tap position is out of the tap changer range, the respective min. or max. position will be
used.
void ElmTr3.GetZ0pu(int itappos,
int iSide,
double& r0pu,
double& x0pu,
int systembase)
A RGUMENTS
itappos Tap position of the z-dependent tap
iSide
0 Get the HV-MV impedance.
1 Get the MV-LV impedance.
2 Get the LV-HV impedance.
r0pu (out)
Resistance in p.u.
x0pu (out)
Reactance in p.u.
systembase
0 p.u. is based on rated power.
1 p.u. is based on system base (e.g. 100MVA).
GetZpu*
Gets the impedance in p.u. of the transformer for the specified tap position. If the tap position is
out of the tap changer range, the respective min. or max. position will be used.
void ElmTr3.GetZpu(int itappos,
int iSide,
double& rpu,
double& xpu,
int systembase)
A RGUMENTS
itappos Tap position of the z-dependent tap
iSide
0 Get the HV-MV impedance.
290
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
IsQuadBooster*
Returns whether transformer is a quadbooster or not, i.e. checks phase shift angle modulus
180◦ .
int ElmTr3.IsQuadBooster()
R ETURNS
'1' if the transformer phase shift angle modulus 180◦ does not equal 0 at any of the sides LV,
MV, HV, else '0'
NTap*
Gets the transformer tap position of a given bus.
int ElmTr3.NTap(int bus)
A RGUMENTS
bus 0=HV, 1=MV, 2=LV
R ETURNS
The tap position.
3.2.34 ElmTr4
Overview
CreateEvent
GetGroundingImpedance*
GetSuppliedElements*
GetTapPhi*
GetTapRatio*
GetTapZDependentSide*
GetZ0pu*
GetZpu*
IsQuadBooster*
NTap*
291
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CreateEvent
For the corresponding transformer, a Tap Event (EvtTap) is created for the simulation.
void ElmTr4.CreateEvent([int tapAction = 2,]
[int tapPos = 0,]
[int busIdx = 0]
)
A RGUMENTS
tapAction (optional)
0=increase tap; 1=decrease tap; 2=set tap to tapPos; 3=manual; 4=automatic
tapPos (optional)
Position of tap.
busIdx (optional)
Bus index.
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmTr4.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
GetSuppliedElements*
Returns the network components that are supplied by the transformer.
A transformer is treated as supplying if it is located in a station. Transformers outside stations
are not supplying in this sense.
A network component is considered to be supplied by a transformer if a topological path from
the transformer to the component exists. A valid topological path in this sense is a path that
starts at the transformer's HV side in direction of transformer (not in direction of HV connected
node) and stops at
292
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
Generally all network components of such a path are considered to be supplied by the trans-
former. Exceptions are components that are out of calculation or in-active. Those components
are never considered to be supplied by any transformer.
A transformer is never considered to supply itself.
Composite components such as ElmBranch, ElmSubstat, ElmTrfstat are considered to be sup-
plied by a transformer if all energized components inside that composite are supplied by the
transformer.
set ElmTr4.GetSuppliedElements([int inclNested])
A RGUMENTS
inclNested (optional)
0 Only include components which are directly supplied by the transformer
(not nested components)
1 Include nested components and components that are directly supplied
by the transformer (default)
R ETURNS
Elements supplied by this transformer. The set is empty if the transfomer is located outside
a station or if no element is topologically connected its HV side.
S EE ALSO
GetTapPhi*
Gets the tap phase shift in deg of the transformer for given tap position and side.
double ElmTr4.GetTapPhi(int iSide,
int itappos,
int inclPhaseShift
)
A RGUMENTS
iSide for tap at side (0=HV, 1=LV1, 2=Lv2, 3=Lv3)
itappos Tap position for corresponding side
inclPhaseShift
1 = Includes the vector group phase shift, 0 = consider only the tap phase shift
R ETURNS
Returns the tap phase shift angle of the transformer for given tap position and side
GetTapRatio*
Gets the voltage ratio of the transformer for given tap position and side.
double ElmTr4.GetTapRatio(int iSide,
int itappos,
int includeNomRatio
)
293
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
iSide for tap at side (0=HV, 1=LV1, 2=Lv2, 3=Lv3)
itappos Tap position at corresponding side
includeNomRatio
1 = Includes nominal ratio of the transformer, 0 = consider only tap ratio
R ETURNS
Returns the voltage ratio of the transformer for given tap position and side
GetTapZDependentSide*
Get tap side used for the dependent impedance
int ElmTr4.GetTapZDependentSide()
R ETURNS
-1 if no tap dependent impedance is defined
0 for HV tap
1 for LV1 tap
2 for LV2 tap
2 for LV3 tap
GetZ0pu*
Gets the zero-sequence impedance in p.u. of the transformer for the specified tap position. If
the tap position is out of the tap changer range, the respective min. or max. position will be
used.
void ElmTr4.GetZ0pu(int itappos,
int iSide,
double& r0pu,
double& x0pu,
int systembase)
A RGUMENTS
itappos Tap position of the z-dependent tap
iSide
0 Get the HV-LV1 impedance.
1 Get the HV-LV2 impedance.
2 Get the HV-LV3 impedance.
3 Get the LV1-LV2 impedance.
4 Get the LV1-LV3 impedance.
5 Get the LV2-LV3 impedance.
r0pu (out)
Resistance in p.u.
x0pu (out)
Reactance in p.u.
294
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
systembase
0 p.u. is based on rated power.
1 p.u. is based on system base (e.g. 100MVA).
GetZpu*
Gets the impedance in p.u. of the transformer for the specified tap position. If the tap position is
out of the tap changer range, the respective min. or max. position will be used.
void ElmTr4.GetZpu(int itappos,
int iSide,
double& rpu,
double& xpu,
int systembase)
A RGUMENTS
itappos Tap position of the z-dependent tap
iSide
0 Get the HV-LV1 impedance.
1 Get the HV-LV2 impedance.
2 Get the HV-LV3 impedance.
3 Get the LV1-LV2 impedance.
4 Get the LV1-LV3 impedance.
5 Get the LV2-LV3 impedance.
rpu (out) Resistance in p.u.
xpu (out) Reactance in p.u.
systembase
0 p.u. is based on rated power.
1 p.u. is based on system base (e.g. 100MVA).
IsQuadBooster*
Returns whether transformer is a quadbooster or not, i.e. checks phase shift angle modulus
180◦ .
int ElmTr4.IsQuadBooster()
R ETURNS
'1' if the transformer phase shift angle modulus 180◦ does not equal 0 at any of the sides HV,
LV1, LV2, LV3, else '0'
NTap*
Gets the transformer tap position.
int ElmTr4.NTap(double busIdx)
295
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
busIdx 0=HV, 1=MV, 2=LV
R ETURNS
The tap position.
3.2.35 ElmTrain
Overview
SetPosition
SetPosition
Set the position (line and postion in km) of the train
int ElmTrain.SetPosition(DBObject* line, double position)
R ETURNS
1 error, train position cannot be set
0 ok
3.2.36 ElmTrb
Overview
GetGroundingImpedance*
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmTrb.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
296
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
3.2.37 ElmTrfstat
Overview
GetSplit*
GetSplitCal*
GetSplitIndex*
GetSuppliedElements*
GetSplit*
A split of a station is a group of topologically connected elements. Such a group is called split
if all contained components are energized and there is at least one busbar (terminal of usage
'busbar') contained or it has connections to at least two main components (= all components
except switch devices and terminals).
These splits are ordered according to the count of nodes contained and according to their
priority. So each split becomes a unique index.
The function GetSplit offers access to the elements contained in a split. By calling GetSplit with
an index from 0 to n, the elements belonging to the corresponding split are filled into given sets
and returned.
int ElmTrfstat.GetSplit(int index,
set& mainNodes,
[set& connectionCubicles,]
[set& allElements]
)
A RGUMENTS
index Index of the split used to access the elements of the corresponding split. Value
must be ≥ 0.
mainNodes (out)
Terminals of same usage considered to form the most important nodes for that
group. In most cases, this is the group of contained busbars.
connectionCubicles (optional, out)
All cubicles (of terminals inside the station) that point to an element that sits out-
side the station or to an element that is connected to a terminal outside the station
are filled into the set connectionCubicles. (The connection element (branch) can
be accessed by calling GetBranch() on each of these cubicles. The terminals
of these cubicles (parents) must not necessarily be contained in any split. They
could also be separated by a disconnecting component.)
allElements(optional, out)
All elements (class Elm*) of the split that have no connection to elements outside
the station are filled into this set.
R ETURNS
0 success, split of that index exists and is returned.
1 indicates that there exists no split with given index. (Moreover, this means that
there is no split with index n greater than this value.)
E XAMPLE
set nodes;
set cubicles;
set elements;
297
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
return = 0;
while (return <> 1) { !loop from 0 to n until there is no more split
return = station.GetSplit(index, nodes, cubicles, elements);
printf('Major Nodes:');
obj = nodes.First();
while(obj) {
obj.ShowFullName();
obj = nodes.Next();
}
printf('Connection Cubicles:');
obj = cubicles.First();
while(obj) {
obj.ShowFullName();
obj = cubicles.Next();
}
printf('All Elements:');
obj = elements.First();
while(obj) {
obj.ShowFullName();
obj = elements.Next();
}
index = index + 1;
}
S EE ALSO
ElmTrfstat.GetSplitCal(), ElmTrfstat.GetSplitIndex(),
GetSplitCal*
This function determines the elements that belong to a split. In contrast to ElmTrfstat.GetSplit()
it is based on calculation instead of pure edit object topology. This means the returned nodes
correspond to the calculation nodes, the interconnecting cubicles are those connecting nodes
of different splits.
Note: As this function relies on calculation nodes it can only be executed after a calculation has
been performed (e.g. load flow calculation).
int ElmTrfstat.GetSplitCal(int index,
set& nodes,
[set& connectionCubicles,]
[set& elements])
A RGUMENTS
index Index of the split used to access the elements of the corresponding split. Refers
to same split as index in ElmTrfstat.GetSplit().
Value must be ≥ 0.
nodes (out)
A set that is filled with terminals. There is one terminal returned for each calcula-
298
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 success, split of that index exists and is returned.
1 indicates that there exists no split with given index. (Moreover, this means that
there is no split with index n greater than this value.)
E XAMPLE
set nodes;
set cubicles;
set elements;
int return, index;
object obj;
return = 0;
while (return <> 1) { !loop from 0 to n until there is no more split
return = station.GetSplitCal(index, nodes, cubicles, elements);
if (return < 1) {
if (return = 0) {
printf('Split %d:', index);
}
else {
printf('(Pseudo)Split %d:', index);
}
printf('Major Nodes:');
obj = nodes.First();
while(obj) {
obj.ShowFullName();
obj = nodes.Next();
}
printf('Connection Cubicles:');
obj = cubicles.First();
while(obj) {
obj.ShowFullName();
obj = cubicles.Next();
}
printf('Elements:');
obj = elements.First();
while(obj) {
obj.ShowFullName();
obj = elements.Next();
}
}
index = index + 1;
}
299
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
S EE ALSO
ElmTrfstat.GetSplit()
GetSplitIndex*
This function returns the index of the split that contains passed object.
int ElmTrfstat.GetSplitIndex(object o)
A RGUMENTS
o Object for which the split index is to be determined.
R ETURNS
≥0 index of split in which element is contained
-1 given object does not belong to any split of that station
E XAMPLE
set stations, terms;
object substation, term;
string name;
int index;
stations = GetCalcRelevantObjects('*.ElmSubstat');
terms = substation.GetContents('*.ElmTerm');
S EE ALSO
ElmTrfstat.GetSplit()
300
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetSuppliedElements*
Returns the network components that are supplied by the transformer (located in the station). A
network component is considered to be supplied by a transformer if a topological path from the
transformer to the component exists. A valid topological path in this sense is a path that starts
at the transformer’s HV side in direction of transformer (not in direction of HV connected node)
and stops at
• open switches,
• connections leading to a higher voltage level.
Generally, all network components of such a path are considered to be supplied by the trans-
former.
Exceptions are components that are out of calculation or in-active. Those components are never
considered to be supplied by any transformer. A transformer is never considered to supply itself.
Composite components such as ElmBranch, ElmSubstat, ElmTrfstat are considered to be sup-
plied by a transformer if all energized components inside that composite are supplied by the
transformer.
set ElmTrfstat.GetSuppliedElements([int inclNested])
A RGUMENTS
inclNested (optional)
0 Do not include components that are supplied by nested supplying sta-
tions
1 (default) Include components that are supplied by nested stations
S EE ALSO
ElmTr2.GetSuppliedElements(), ElmTr3.GetSuppliedElements()
3.2.38 ElmVac
Overview
GetGroundingImpedance*
GetGroundingImpedance*
Returns the impedance of the internal grounding. Single phase voltage source connected to
neutral are considered as grounding devices themselves; i.e. instead of the dedicated grounding
parameters, the R1,X1 parameters are used.
int ElmVac.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
301
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
3.2.39 ElmVoltreg
Overview
CreateEvent*
GetGroundingImpedance*
GetZpu*
NTap*
CreateEvent*
For the corresponding voltage regulator, a Tap Event (EvtTap) is created for the simulation.
void ElmVoltreg.CreateEvent([int tapAction = 2,]
[int tapPos = 0]
)
A RGUMENTS
tapAction (optional)
0=increase tap; 1=decrease tap; 2=set tap to tapPos; 3=manual; 4=automatic
tapPos (optional)
Position of tap
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmVoltreg.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
302
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetZpu*
Gets the impedance in p.u. of the voltage regulator for the specified tap position. If the tap
position is out of the tap changer range, the respective min. or max. position will be used.
void ElmVoltreg.GetZpu(int itappos,
double& rpu,
double& xpu,
int systembase)
A RGUMENTS
itappos Tap position
rpu (out) Resistance in p.u.
xpu (out) Reactance in p.u.
systembase
0 p.u. is based on rated power.
1 p.u. is based on system base (e.g. 100MVA).
NTap*
Gets the voltage regulator tap position.
int ElmVoltreg.NTap(int tap)
A RGUMENTS
tap 0=Tap 1, 1=Tap 2, 2=Tap 3
R ETURNS
The tap position.
3.2.40 ElmXnet
Overview
CalcEfficiency
Disconnect
GetGroundingImpedance*
GetStepupTransformer*
Reconnect
303
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CalcEfficiency
Calculate efficiency for connected storage model at given active power value.
double ElmXnet.CalcEfficiency(double activePowerMW)
A RGUMENTS
activePowerMW
Active power value to calculate efficiency for.
R ETURNS
Returns the resulting efficiency in p.u.
E XAMPLE
set objs;
object obj;
int err;
double eff, Ptherm, Pelect;
Pelect = 30.0;
objs = GetCalcRelevantObjects('*.ElmXnet');
obj = objs.First();
if (obj) {
eff = obj.CalcEfficiency(Pelect);
Ptherm = Pelect/eff;
}
Disconnect
Disconnects a static generator by opening the first circuit breaker. The topological search
performed to find such a breaker, stops at any busbar.
int ElmXnet.Disconnect()
R ETURNS
0 breaker already open or successfully opened
1 an error occurred (no breaker found, open action not possible (earthing / RA))
E XAMPLE
set objs;
object obj;
int err;
objs = GetCalcRelevantObjects('*.ElmXnet,*.ElmGenstat,*.ElmPvsys');
304
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
GetGroundingImpedance*
Returns the impedance of the internal grounding.
int ElmXnet.GetGroundingImpedance(int busIdx,
double& resistance,
double& reactance)
A RGUMENTS
busIdx Bus index where the grounding should be determined.
resistance (out)
Real part of the grounding impedance in Ohm.
reactance (out)
Imaginary part of the grounding impedance in Ohm.
R ETURNS
0 The values are invalid (e.g. because there is no internal grounding)
1 The values are valid.
GetStepupTransformer*
Performs a topological search to find the step-up transformer of an external grid
object ElmXnet.GetStepupTransformer(double voltage,
int swStatus
)
A RGUMENTS
voltage voltage level at which the search will stop
swStatus consideration of switch status. Possible values are:
0 consider all switch status
1 ignore breaker status
2 ignore all switch status
R ETURNS
Returns the first collected step-up transformer object. It is empty if not found (e.g. start
terminal already at hvVoltage).
Reconnect
Connects a static generator by closing all switches (breakers and isolators) up to the first breaker
on the HV side of a transformer. The topological search to find all the switches, stops at any
busbar.
int ElmXnet.Reconnect()
R ETURNS
0 the machine was successfully closed
1 a error occurred and the machine could not be connected to any busbar
305
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
set objs;
object obj;
int err;
objs = GetCalcRelevantObjects('*.ElmXnet,*.ElmGenstat,*.ElmPvsys');
3.2.41 ElmZone
Overview
CalculateInterchangeTo*
CalculateVoltageLevel*
CalculateVoltInterVolt*
DefineBoundary
GetAll*
GetBranches*
GetBuses*
GetObjs*
SetLoadScaleAbsolute
CalculateInterchangeTo*
Calculates interchange power to the given zone (calculated quantities are: Pinter, Qinter, Pex-
port, Qexport, Pimort, Qimport). Prior the calculation the valid load flow calculation is required.
int ElmZone.CalculateInterchangeTo(object zone)
A RGUMENTS
zone zone to which the interchange is calculated
R ETURNS
<0 calculation error (i.e. no valid load flow, empty zone...)
0 no interchange power to the given zone
1 interchange power calculated
E XAMPLE
object ZoneA, ZoneB; ! externally defined (i.e. input)
ZoneA = inputA;
ZoneB = inputB;
object Ldf = GetFromStudyCase('ComLdf');
Ldf.Execute();
ZoneA.CalculateInterchangeTo(ZoneB);
printf('Interchange Pinter from %o to %o is %f MW', ZoneA, ZoneB, ZoneA:c:Pinter);
306
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
CalculateVoltageLevel*
Internal funciton to calculate per voltage level the corresponding summary results. The values
are stored in current zone (values from the previous load flow calculation are overwritten):
int ElmZone.CalculateVoltageLevel(double U)
A RGUMENTS
U for voltage level (in kV)
R ETURNS
<0 error
=0 voltage level not exists in the zone
>0 ok
CalculateVoltInterVolt*
This function calculates the power flow from voltage level to voltage level. The values are stored
in current area in the following attributes (values from the previous load flow calculation are
overwritten):
A RGUMENTS
Ufrom from voltage level (in kV)
Uto to voltage level (in kV)
R ETURNS
<0 error
=0 voltage levels not exists in the area, no interchange exists
>0 ok
DefineBoundary
Defines boundary with this zone as interior part. Resulting cubicles of boundary are busbar-
oriented towards the zone.
object ElmZone.DefineBoundary(int shift)
307
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
shift Elements outside the zone that are within a distance of shift many elements to
a boundary cubicle of the zone are added to the interior part of the resulting
boundary
R ETURNS
The defined boundary is returned in case of success. Otherwise NULL, if an error appeared
in the definition of the boundary.
E XAMPLE
external object: "thisZone"
double shift;
object newBoundary;
shift = 2;
newBoundary = thisZone.DefineBoundary(shift);
if ({newBoundary <> NULL}) {
printf('Defined boundary %o by shifting %d elements!', newBoundary, shift);
}
GetAll*
Returns all objects which belong to this zone.
set ElmZone.GetAll()
R ETURNS
The set of objects.
E XAMPLE
set all,zones;
object prj,zone,obj;
! output elements in the zone
prj = GetActiveProject();
if (prj) {
zones = prj.GetContents('*.ElmZone',1);
zones.SortToVar(0,'loc_name');
for (zone=zones.First(); zone; zone=zones.Next()) {
printf('Elements in zone %s',zone:loc_name);
all = zone.GetAll();
for (obj=all.First(); obj; obj=all.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
GetBranches*
Returns all branches which belong to this zone.
set ElmZone.GetBranches()
308
3.2. NETWORK ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
The set of branch objects.
E XAMPLE
set all,zones;
object prj,zone,obj;
! output elements in the zone
prj = GetActiveProject();
if (prj) {
zones = prj.GetContents('*.ElmZone',1);
zones.SortToVar(0,'loc_name');
for (zone=zones.First(); zone; zone=zones.Next()) {
printf('Branches in zone %s',zone:loc_name);
all = zone.GetBranches();
for (obj=all.First(); obj; obj=all.Next()) {
printf('%s\\%s',obj:r:fold_id:loc_name,obj:loc_name);
}
}
}
GetBuses*
Returns all buses which belong to this zone.
set ElmZone.GetBuses()
R ETURNS
The set of objects.
GetObjs*
Returns all objects of the given class which belong to this zone.
set ElmZone.GetObjs(string classname)
A RGUMENTS
classname
name of the class (i.e. ”ElmTr2”)
R ETURNS
The set of contained objects.
E XAMPLE
set all,zones;
object prj,zone,obj;
! output cubicles in the zone
prj = GetActiveProject();
if (prj) {
zones = prj.GetContents('*.ElmZone',1);
zones.SortToVar(0,'loc_name');
for (zone=zones.First(); zone; zone=zones.Next()) {
printf('Cubicles in zone %s',zone:loc_name);
all = zone.GetObjs('StaCubic');
309
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
SetLoadScaleAbsolute
Readjusts zonal load scaling factor to the given active power. The zonal load scaling factor is
the ratio of the given active power and the loads total actual power.
void ElmZone.SetLoadScaleAbsolute(double Pin)
A RGUMENTS
Pin active power in MW used for the load scaling factor.
3.3.1 StaCt
Overview
SetPrimaryTap
SetPrimaryTap
Determines the best matching primary tap for the connected branch, so that IN om,Branch ·
mltF actor ≤ IP ri. If no tap satisfies the equation, the largest tap is used.
int StaCt.SetPrimaryTap([double mltFactor])
A RGUMENTS
mltFactor (optional)
Multiplication factor (default 1.0)
R ETURNS
0 Correctly set.
1 Error.
310
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
3.3.2 StaCubic
Overview
AddBreaker
GetAll*
GetBranch*
GetConnectedMajorNodes*
GetConnections*
GetNearestBusbars*
GetPathToNearestBusbar*
GetRemoteBorderCubicles
GetSwitch
IsClosed*
IsConnected*
RemoveBreaker
AddBreaker
This function creates a new switch (StaSwitch) inside this cubicle. The switch is created only if
no switch previously existed.
A switch object created by this function is always of usage 'circuit-breaker' and its state is
'closed'.
object StaCubic.AddBreaker()
R ETURNS
• StaSwitch object in case a new switch was created
• NULL if no object was created. This means a StaSwitch object already exists.
E XAMPLE
set cubics;
object cubic, staSwitch;
cubics = GetCalcRelevantObjects('*.StaCubic');
!create StaSwitches in all cubicles that do not contain a switch yet
for(cubic = cubics.First(); cubic; cubic = cubics.Next()) {
staSwitch = cubic.AddBreaker();
if (staSwitch) {
staSwitch.ShowFullName();
}
}
GetAll*
This function returns a set of network components that are collected by a topological traversal
starting from this cubicle.
set StaCubic.GetAll([int direction = 1,]
[int ignoreOpenSwitches = 0]
)
A RGUMENTS
direction (optional)
Specifies the direction in which the network topology is traversed.
311
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
ignoreOpenSwitches (optional)
Determines whether to pass open switches or to stop at them.
0 The traversal stops in a direction if an open switch is reached (default).
1 Ignore all switch statuses and pass every switch.
R ETURNS
A set of network components that are collected by a topological traversal starting at the
cubicle (StaCubic) where the function is called.
E XAMPLE
For a defined variable ”cubic” pointing to a cubicle in a net:
set components;
object component;
components.MarkInGraphics();
GetBranch*
Function gets the branch of this cubicle.
object StaCubic.GetBranch()
R ETURNS
Branch object.
GetConnectedMajorNodes*
This function returns all busbars being part of a split (inside a station) that can be reached by
starting a topology search from the cubicle in direction of the branch element.
set StaCubic.GetConnectedMajorNodes ([double swtStat])
312
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
swtStat
0 (default) First perform a search that respects switch states (stoping at open
switches). If no switches are found, an additional search with ignoring
switch states.
1 Perform one search ignoring switch states (passing open and closed
switches).
2 Search with respecting switch states. But do no additional search when
switch is found.
R ETURNS
A set of all busbars that can be reached starting a topology search from the cubicle in
direction of the branch element.
E XAMPLE
object substat, cub, obj;
set nodes, buses, cubicles, elements, allCubicles, terms;
int index, return;
string name;
nodes = GetCalcRelevantObjects('*.ElmSubstat');
index = 0;
return = 0;
while (return <> 1) {
return = substat.GetSplit(index, buses, cubicles, elements);
if (return = 0) {
allCubicles.Add(cubicles);
}
index = index +1;
}
for(cub = allCubicles.First(); cub; cub = allCubicles.Next()) {
name = cub.GetFullName(0);
printf('\nMajor Nodes cubicle %s is connected to:', name);
terms = cub.GetConnectedMajorNodes(0);
for (obj = terms.First(); obj; obj = terms.Next()) {
obj.ShowFullName();
}
}
}
GetConnections*
Function gets all elements connected with this cubicle.
set StaCubic.GetConnections(int swtStat)
A RGUMENTS
swtStat Consider switch status (1) or not (0).
313
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Set of elements.
GetNearestBusbars*
Function searches for connected and connectable nearest busbars starting at the cubicle.
Search stops at the nearest busbars and out of service elements. Internal and junction nodes,
all types of branch elements and all types of switches - i.e. circuit breakers and disconnectors -
are passed.
Connected busbars are all busbars which are topologically connected to the start cubicle without
passing open switches. Connectable busbars are all busbars which are connectable to the start
cubicle by closing switches. If the start cubicles terminal is a busbar then this busbar is not
included in the result sets.
If more than one path exists between cubicle and a nearest busbar the relevant busbar is added
only once to the result set.
void StaCubic.GetNearestBusbars(set& connectedBusbars,
set& connectableBusbars,
int searchDirection,
[int excludeZPUs])
A RGUMENTS
connectedBusbars (out)
Found connected busbars.
connectableBusbars (out)
Found connectable busbars.
searchDirection
Direction of the search relative to the cubicle. Possible values are
0 search in all directions
1 search in direction of cubicles terminal
2 search towards connected branch element
excludeZPUs (optional)
Whether ZPU (ElmZpu) should be ignored in the search. Default=0.
E XAMPLE
set switches, connected, connectable;
object switch, cubicle, element;
int direction;
switches = GetCalcRelevantObjects('ElmCoup');
if(cubicle){
cubicle.GetNearestBusbars(connected, connectable, direction);
314
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
printf('%o', element);
}
GetPathToNearestBusbar*
Function determines the path from the cubicle to the given busbar. The busbar must be
connected or connectable to the start cubicle without passing additional busbars. If the given
busbar is not a nearest busbar in relation to the cubicle an empty path is returned.
If more than one closed path exists between cubicle and busbar the elements of all these paths
are combined.
set StaCubic.GetPathToNearestBusbar(object nearestBusbar, [int excludeZPUs])
A RGUMENTS
nearestBusbar
Nearest busbar in relation to cubicle.
excludeZPUs (optional)
Whether ZPU (ElmZpu) should be ignored in the search. Default=0.
R ETURNS
Net elements of the path from cubicle to busbar.
E XAMPLE
set switches, connected, connectable, path;
object switch, cubicle, busbar, element;
int direction;
switches = GetCalcRelevantObjects('ElmCoup');
if(cubicle){
cubicle.GetNearestBusbars(connected, connectable, direction);
315
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetRemoteBorderCubicles
This function returns all border cubicles of opposing substations that can be reached when
starting a topological search on a cubicle. Search is always branch oriented.
void StaCubic.GetRemoteBorderCubicles(set& outCubicles,
set& outNodes,
int considerSwitchStates)
A RGUMENTS
outCubicles (out)
outNodes (out)
considerSwitchStates (out)
E XAMPLE
set nodes, cubicles;
set remoteCubicles, remoteNodes;
int return, index, i, count;
object obj, obj2, obj3;
return = 0;
while (1){ !loop from 0 to n until there is no more split
printf('-----------');
printf('Split %d:', index);
printf('\nMajor Nodes:');
obj = nodes.First();
while(obj){
obj.ShowFullName();
obj = nodes.Next();
}
printf('\nConnection Cubicles:');
obj = cubicles.First();
while(obj){
obj.ShowFullName();
obj.GetRemoteBorderCubicles(remoteCubicles, remoteNodes, 0);
count = remoteCubicles.Count();
printf(' Remote:');
for(i=0; i<count; i+=1) {
obj2 = remoteCubicles.Obj(i);
obj3 = remoteNodes.Obj(i);
printf(' cubicle: %component node %component', obj2, obj3);
}
obj = cubicles.Next();
316
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
}
index = index + 1;
}
GetSwitch
This function returns the switch stored in the cubicle.
object StaCubic.GetSwitch()
R ETURNS
Switch object.
IsClosed*
Function checks if this cubicle is directly connected with the busbar, considering the switch
status.
int StaCubic.IsClosed()
R ETURNS
0 Disconnected cubicle.
1 Connected cubicle.
IsConnected*
Function checks if the cubicle is connected to the passed terminal or coupler.
int StaCubic.IsConnected(object elm,
int swtStat
)
A RGUMENTS
elm Terminal or coupler to check connection with.
swtStat Consider switch status (1) or not (0).
R ETURNS
0 Not connected.
1 Connected.
RemoveBreaker
This function deletes all switches stored in the cubicle.
void StaCubic.RemoveBreaker()
317
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
E XAMPLE
set cubics;
object cubic;
cubics = GetCalcRelevantObjects('*.StaCubic');
!delete StaSwitches from all cubicles
for(cubic = cubics.First(); cubic; cubic = cubics.Next()) {
cubic.RemoveBreaker();
}
3.3.3 StaExtbrkmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtbrkmea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for the switch position currently stored in the measurement object.
int StaExtbrkmea.GetMeaValue(double& value)
A RGUMENTS
value (out)
Value for switch status.
R ETURNS
Return value has no meaning. It is always 0.
318
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtbrk-
mea.SetStatus() for details on the status bits.
int StaExtbrkmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtbrkmea.SetStatus() for details on the status bits.
int StaExtbrkmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtbrkmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtbrkmea.SetStatus() for details
on the status bits.
int StaExtbrkmea.IsStatusBitSet(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtbrk-
mea.SetStatus() for details on the status bits.
int StaExtbrkmea.IsStatusBitSetTmp(int mask)
319
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtbrkmea.SetStatus() for details on the status
bits.
void StaExtbrkmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtbrkmea.SetStatus()
for details on the status bits.
void StaExtbrkmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value for the switch position currently stored in the measurement object.
int StaExtbrkmea.SetMeaValue(int value)
A RGUMENTS
value New value for switch status.
R ETURNS
Return value has no meaning. It is always 0.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtbrkmea.SetMeaValue(double value)
A RGUMENTS
value New value.
320
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtbrkmea.SetStatus() for details on the status
bits.
void StaExtbrkmea.SetStatusBit(int mask, int dbSync)
321
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtbrkmea.SetStatus()
for details on the status bits.
void StaExtbrkmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtbrkmea.SetStatus() for details on
the status bits.
void StaExtbrkmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtbrkmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
322
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtbrkmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.4 StaExtcmdmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtcmdmea.CopyExtMeaStatusToStatusTmp()
323
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetMeaValue
Returns the value for command interpreted as floating point value.
int StaExtcmdmea.GetMeaValue(double& value)
A RGUMENTS
value (out)
Value obtained by parsing stored command string as floating point value.
R ETURNS
Return value has no meaning. It is always 0.
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtcmd-
mea.SetStatus() for details on the status bits.
int StaExtcmdmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtcmdmea.SetStatus() for details on the status bits.
int StaExtcmdmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtcmdmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtcmdmea.SetStatus() for details
on the status bits.
int StaExtcmdmea.IsStatusBitSet(int mask)
324
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtcmd-
mea.SetStatus() for details on the status bits.
int StaExtcmdmea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtcmdmea.SetStatus() for details on the
status bits.
void StaExtcmdmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtcmdmea.SetStatus()
for details on the status bits.
void StaExtcmdmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtcmdmea.SetMeaValue(double value)
A RGUMENTS
value New value.
325
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtcmdmea.SetStatus() for details on the status
bits.
void StaExtcmdmea.SetStatusBit(int mask, int dbSync)
326
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtcmdmea.SetStatus()
for details on the status bits.
void StaExtcmdmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtcmdmea.SetStatus() for details on
the status bits.
void StaExtcmdmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtcmdmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
327
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtcmdmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.5 StaExtdatmea
Overview
CopyExtMeaStatusToStatusTmp
CreateEvent
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtdatmea.CopyExtMeaStatusToStatusTmp()
CreateEvent
Creates a “parameter change” event for controller object (’pCtrl’) and attribute (’varName’). The
event is stored in simulation event list and executed immediately.
void StaExtdatmea.CreateEvent()
328
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetMeaValue
Returns the value stored in the measurement object.
int StaExtdatmea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
A RGUMENTS
value (out)
Value, optionally modified by configured multiplicator
unused Not used.
applyMultiplicator
If 1 (default), returned value will be modified by the multiplicator stored in the
measurement object (depending on Mode incremental/absolute). If 0, raw value
will be returned.
R ETURNS
Return value has no meaning. It is always 0.
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtdat-
mea.SetStatus() for details on the status bits.
int StaExtdatmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtdatmea.SetStatus() for details on the status bits.
int StaExtdatmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtdatmea.InitTmp()
329
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtdatmea.SetStatus() for details
on the status bits.
int StaExtdatmea.IsStatusBitSet(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtdat-
mea.SetStatus() for details on the status bits.
int StaExtdatmea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtdatmea.SetStatus() for details on the status
bits.
void StaExtdatmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtdatmea.SetStatus()
for details on the status bits.
void StaExtdatmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtdatmea.SetMeaValue(double value)
330
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
value New value.
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtdatmea.SetStatus() for details on the status
bits.
void StaExtdatmea.SetStatusBit(int mask, int dbSync)
331
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtdatmea.SetStatus()
for details on the status bits.
void StaExtdatmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtdatmea.SetStatus() for details on
the status bits.
void StaExtdatmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtdatmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
332
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtdatmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.6 StaExtfmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtfmea.CopyExtMeaStatusToStatusTmp()
333
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetMeaValue
Returns the value for frequency currently stored in the measurement object.
int StaExtfmea.GetMeaValue(double& value)
A RGUMENTS
value (out)
Value for frequency.
R ETURNS
Return value has no meaning. It is always 0.
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtfmea.SetStatus()
for details on the status bits.
int StaExtfmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtfmea.SetStatus() for details on the status bits.
int StaExtfmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtfmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtfmea.SetStatus() for details on
the status bits.
int StaExtfmea.IsStatusBitSet(int mask)
334
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtfmea.SetStatus()
for details on the status bits.
int StaExtfmea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtfmea.SetStatus() for details on the status
bits.
void StaExtfmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtfmea.SetStatus()
for details on the status bits.
void StaExtfmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtfmea.SetMeaValue(double value)
A RGUMENTS
value New value.
335
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtfmea.SetStatus() for details on the status bits.
void StaExtfmea.SetStatusBit(int mask, int dbSync)
336
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtfmea.SetStatus() for
details on the status bits.
void StaExtfmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtfmea.SetStatus() for details on the
status bits.
void StaExtfmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtfmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
337
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtfmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.7 StaExtfuelmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtfuelmea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for fuel currently stored in the measurement object.
int StaExtfuelmea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
338
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
value (out)
Value for fuel, optionally multiplied by configured multiplicator
unused Not used.
applyMultiplicator
If 1 (default), returned value will be multiplied by the multiplicator stored in the
measurement object. If 0, raw value will be returned.
R ETURNS
Return value has no meaning. It is always 0.
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtfu-
elmea.SetStatus() for details on the status bits.
int StaExtfuelmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtfuelmea.SetStatus() for details on the status bits.
int StaExtfuelmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtfuelmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtfuelmea.SetStatus() for details
on the status bits.
int StaExtfuelmea.IsStatusBitSet(int mask)
339
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtfu-
elmea.SetStatus() for details on the status bits.
int StaExtfuelmea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtfuelmea.SetStatus() for details on the status
bits.
void StaExtfuelmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtfuelmea.SetStatus()
for details on the status bits.
void StaExtfuelmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtfuelmea.SetMeaValue(double value)
A RGUMENTS
value New value.
340
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtfuelmea.SetStatus() for details on the status
bits.
void StaExtfuelmea.SetStatusBit(int mask, int dbSync)
341
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtfuelmea.SetStatus()
for details on the status bits.
void StaExtfuelmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtfuelmea.SetStatus() for details on
the status bits.
void StaExtfuelmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtfuelmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
342
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtfuelmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.8 StaExtimea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtimea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for current currently stored in the measurement object.
int StaExtimea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
343
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
value (out)
Value for current, optionally multiplied by configured multiplicator
unused Not used.
applyMultiplicator
If 1 (default), returned value will be multiplied by the multiplicator stored in the
measurement object. If 0, raw value will be returned.
R ETURNS
Return value has no meaning. It is always 0.
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaEx-
timea.SetStatus() for details on the status bits.
int StaExtimea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtimea.SetStatus() for details on the status bits.
int StaExtimea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtimea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtimea.SetStatus() for details on
the status bits.
int StaExtimea.IsStatusBitSet(int mask)
344
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaEx-
timea.SetStatus() for details on the status bits.
int StaExtimea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtimea.SetStatus() for details on the status
bits.
void StaExtimea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtimea.SetStatus()
for details on the status bits.
void StaExtimea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtimea.SetMeaValue(double value)
A RGUMENTS
value New value.
345
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtimea.SetStatus() for details on the status bits.
void StaExtimea.SetStatusBit(int mask, int dbSync)
346
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtimea.SetStatus() for
details on the status bits.
void StaExtimea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtimea.SetStatus() for details on the
status bits.
void StaExtimea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtimea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
347
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtimea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.9 StaExtpfmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtpfmea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for power factor currently stored in the measurement object.
int StaExtpfmea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
348
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
value (out)
Value for current, optionally multiplied by configured multiplicator
unused Not used.
applyMultiplicator
If 1 (default), returned value will be multiplied by the multiplicator stored in the
measurement object. If 0, raw value will be returned.
R ETURNS
Return value has no meaning. It is always 0.
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtpfmea.SetStatus()
for details on the status bits.
int StaExtpfmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtpfmea.SetStatus() for details on the status bits.
int StaExtpfmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtpfmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtpfmea.SetStatus() for details on
the status bits.
int StaExtpfmea.IsStatusBitSet(int mask)
349
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtpfmea.SetStatus()
for details on the status bits.
int StaExtpfmea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtpfmea.SetStatus() for details on the status
bits.
void StaExtpfmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtpfmea.SetStatus()
for details on the status bits.
void StaExtpfmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtpfmea.SetMeaValue(double value)
A RGUMENTS
value New value.
350
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtpfmea.SetStatus() for details on the status
bits.
void StaExtpfmea.SetStatusBit(int mask, int dbSync)
351
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtpfmea.SetStatus() for
details on the status bits.
void StaExtpfmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtpfmea.SetStatus() for details on
the status bits.
void StaExtpfmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtpfmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
352
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtpfmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.10 StaExtpmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtpmea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for active power stored in the measurement object.
int StaExtpmea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
353
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
value (out)
Value for active power, optionally multiplied by configured multiplicator
unused Not used.
applyMultiplicator
If 1 (default), returned value will be multiplied by the multiplicator stored in the
measurement object. If 0, raw value will be returned.
R ETURNS
Return value has no meaning. It is always 0.
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtp-
mea.SetStatus() for details on the status bits.
int StaExtpmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtpmea.SetStatus() for details on the status bits.
int StaExtpmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtpmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtpmea.SetStatus() for details on
the status bits.
int StaExtpmea.IsStatusBitSet(int mask)
354
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtp-
mea.SetStatus() for details on the status bits.
int StaExtpmea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtpmea.SetStatus() for details on the status
bits.
void StaExtpmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtpmea.SetStatus()
for details on the status bits.
void StaExtpmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtpmea.SetMeaValue(double value)
A RGUMENTS
value New value.
355
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtpmea.SetStatus() for details on the status
bits.
void StaExtpmea.SetStatusBit(int mask, int dbSync)
356
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtpmea.SetStatus() for
details on the status bits.
void StaExtpmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtpmea.SetStatus() for details on
the status bits.
void StaExtpmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtpmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
357
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtpmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.11 StaExtqmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtqmea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for reactive power currently stored in the measurement object.
int StaExtqmea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
358
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
value (out)
Value for reactive power, optionally multiplied by configured multiplicator
unused Not used.
applyMultiplicator
If 1 (default), returned value will be multiplied by the multiplicator stored in the
measurement object. If 0, raw value will be returned.
R ETURNS
Return value has no meaning. It is always 0.
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaEx-
tqmea.SetStatus() for details on the status bits.
int StaExtqmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtqmea.SetStatus() for details on the status bits.
int StaExtqmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtqmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtqmea.SetStatus() for details on
the status bits.
int StaExtqmea.IsStatusBitSet(int mask)
359
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaEx-
tqmea.SetStatus() for details on the status bits.
int StaExtqmea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtqmea.SetStatus() for details on the status
bits.
void StaExtqmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtqmea.SetStatus()
for details on the status bits.
void StaExtqmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtqmea.SetMeaValue(double value)
A RGUMENTS
value New value.
360
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtqmea.SetStatus() for details on the status
bits.
void StaExtqmea.SetStatusBit(int mask, int dbSync)
361
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtqmea.SetStatus() for
details on the status bits.
void StaExtqmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtqmea.SetStatus() for details on
the status bits.
void StaExtqmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtqmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
362
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtqmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.12 StaExtsmea
Overview
CopyExtMeaStatusToStatusTmp
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtsmea.CopyExtMeaStatusToStatusTmp()
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtsmea.SetStatus()
for details on the status bits.
int StaExtsmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
363
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtsmea.SetStatus() for details on the status bits.
int StaExtsmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtsmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtsmea.SetStatus() for details on
the status bits.
int StaExtsmea.IsStatusBitSet(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtsmea.SetStatus()
for details on the status bits.
int StaExtsmea.IsStatusBitSetTmp(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtsmea.SetStatus() for details on the status
bits.
void StaExtsmea.ResetStatusBit(int mask, int dbSync)
364
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtsmea.SetStatus()
for details on the status bits.
void StaExtsmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtsmea.SetMeaValue(double value)
A RGUMENTS
value New value.
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
365
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtsmea.SetStatus() for details on the status
bits.
void StaExtsmea.SetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtsmea.SetStatus() for
details on the status bits.
void StaExtsmea.SetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtsmea.SetStatus() for details on
the status bits.
void StaExtsmea.SetStatusTmp(int status)
366
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtsmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtsmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
367
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
3.3.13 StaExttapmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExttapmea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for tap position and tap info currently stored in the measurement object.
int StaExttapmea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
A RGUMENTS
value (out)
Value.
type type of value to return
0 tap position
1 operation mode
2 tap changer command
3 tap operation mode
4 tap operation mode command
useTranslationTable
Only supported if type=0 (tap step), if 1 (default) returned value will be translated
according to given table. If 0 is passed, the raw value will be returned.
R ETURNS
0 on success
1 on error, e.g. unsupported type
Returns 1 on erroReturn value has no meaning. It is always 0.
368
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExttap-
mea.SetStatus() for details on the status bits.
int StaExttapmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExttapmea.SetStatus() for details on the status bits.
int StaExttapmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExttapmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExttapmea.SetStatus() for details
on the status bits.
int StaExttapmea.IsStatusBitSet(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExttap-
mea.SetStatus() for details on the status bits.
int StaExttapmea.IsStatusBitSetTmp(int mask)
369
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExttapmea.SetStatus() for details on the status
bits.
void StaExttapmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExttapmea.SetStatus()
for details on the status bits.
void StaExttapmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExttapmea.SetMeaValue(double value)
A RGUMENTS
value New value.
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
370
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExttapmea.SetStatus() for details on the status
bits.
void StaExttapmea.SetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExttapmea.SetStatus()
for details on the status bits.
void StaExttapmea.SetStatusBitTmp(int mask)
371
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExttapmea.SetStatus() for details on
the status bits.
void StaExttapmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExttapmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExttapmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
372
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.14 StaExtv3mea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtv3mea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for voltage currently stored in the measurement object.
int StaExtv3mea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
A RGUMENTS
value (out)
Value for voltage, optionally multiplied by configured multiplicator
phase Index of desired phase. Index must be 0, 1 or 2.
applyMultiplicator
If 1 (default), returned value will be multiplied by the multiplicator stored in the
measurement object. If 0, raw value will be returned.
R ETURNS
0 on success
1 on error, e.g. phase index does not exist
373
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtv3mea.SetStatus()
for details on the status bits.
int StaExtv3mea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtv3mea.SetStatus() for details on the status bits.
int StaExtv3mea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtv3mea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtv3mea.SetStatus() for details
on the status bits.
int StaExtv3mea.IsStatusBitSet(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtv3mea.SetStatus()
for details on the status bits.
int StaExtv3mea.IsStatusBitSetTmp(int mask)
374
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtv3mea.SetStatus() for details on the status
bits.
void StaExtv3mea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtv3mea.SetStatus()
for details on the status bits.
void StaExtv3mea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtv3mea.SetMeaValue(double value)
A RGUMENTS
value New value.
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
375
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtv3mea.SetStatus() for details on the status
bits.
void StaExtv3mea.SetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtv3mea.SetStatus() for
details on the status bits.
void StaExtv3mea.SetStatusBitTmp(int mask)
376
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtv3mea.SetStatus() for details on
the status bits.
void StaExtv3mea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtv3mea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtv3mea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
377
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.15 StaExtvmea
Overview
CopyExtMeaStatusToStatusTmp
GetMeaValue
GetStatus
GetStatusTmp
InitTmp
IsStatusBitSet
IsStatusBitSetTmp
ResetStatusBit
ResetStatusBitTmp
SetMeaValue
SetStatus
SetStatusBit
SetStatusBitTmp
SetStatusTmp
UpdateControl
UpdateCtrl
CopyExtMeaStatusToStatusTmp
Copies the (persistent) status of current measurement object to temporary (in memory) status.
void StaExtvmea.CopyExtMeaStatusToStatusTmp()
GetMeaValue
Returns the value for voltage currently stored in the measurement object.
int StaExtvmea.GetMeaValue(double& value,
int unused,
int applyMultiplicator)
A RGUMENTS
value (out)
Value for voltage, optionally multiplied by configured multiplicator
unused Not used.
applyMultiplicator
If 1 (default), returned value will be multiplied by the multiplicator stored in the
measurement object. If 0, raw value will be returned.
R ETURNS
Return value has no meaning. It is always 0.
378
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
GetStatus
Returns the status flags. Please note, this value is interpreted as a bitfield. See StaExtvmea.SetStatus()
for details on the status bits.
int StaExtvmea.GetStatus()
R ETURNS
Status bitfield as an integer value.
GetStatusTmp
Returns the temporary (in memory) status flags. Please note, this value is interpreted as a
bitfield. See StaExtvmea.SetStatus() for details on the status bits.
int StaExtvmea.GetStatusTmp()
R ETURNS
Status bitfield as an integer value.
InitTmp
Initialises the temporary (in memory) fields of the measurement object with the values currently
stored in the corresponding persistent fields. This affects temporary measurement value and
temporary status fields. The temporary measurement value is used internally for comparison of
new and old values for deadband violation. The temporary status is used during calculation in
order to not modify initial value.
This function should be called once after the link has been established and before the calculation
loop is executed.
void StaExtvmea.InitTmp()
IsStatusBitSet
Checks if specific bit(s) are set in the status bitfield. See StaExtvmea.SetStatus() for details on
the status bits.
int StaExtvmea.IsStatusBitSet(int mask)
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
IsStatusBitSetTmp
Checks if specific bit(s) are set in the temporary (in memory) status bitfield. See StaExtvmea.SetStatus()
for details on the status bits.
int StaExtvmea.IsStatusBitSetTmp(int mask)
379
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 if at least one bit in mask is not set
1 if all bit(s) in mask are set
ResetStatusBit
Resets specific bits in the status bitfield. See StaExtvmea.SetStatus() for details on the status
bits.
void StaExtvmea.ResetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
ResetStatusBitTmp
Resets specific bits in the temporary (in memory) status bitfield. See StaExtvmea.SetStatus()
for details on the status bits.
void StaExtvmea.ResetStatusBitTmp(int mask)
A RGUMENTS
mask Mask of bits to set to 0. A bit is unchanged if already unset before.
SetMeaValue
Sets the value stored in the measurement object.
int StaExtvmea.SetMeaValue(double value)
A RGUMENTS
value New value.
R ETURNS
Return value has no meaning. It is always 0.
SetStatus
Sets the status flags of the measurement object. Please note, this value is interpreted as
a bitfield where the bits have the following meaning. An option is considered enabled if the
corresponding bit is set to 1.
380
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
status Bitfield for status flags, see above
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBit
Sets specific bits in the status bitfield. See StaExtvmea.SetStatus() for details on the status
bits.
void StaExtvmea.SetStatusBit(int mask, int dbSync)
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
dbSync (optional)
0 New status flags are applied in memory only
1 Default, new status flags are stored on db (persistent)
SetStatusBitTmp
Sets specific bits in the temporary (in memory) status bitfield. See StaExtvmea.SetStatus() for
details on the status bits.
void StaExtvmea.SetStatusBitTmp(int mask)
381
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mask Mask of bits to set to 1. A bit is unchanged if already set before.
SetStatusTmp
Sets the temporary (in memory) status flags of the measurement object. This temporary value
is used during calculations so that changes do not lead to object modifications and initial value
remains unchanged.
Please note, this value is interpreted as a bitfield. See StaExtvmea.SetStatus() for details on
the status bits.
void StaExtvmea.SetStatusTmp(int status)
A RGUMENTS
status Bitfield for status flags, see above
UpdateControl
Transfers the value of current measurement object to the controller object (target object 'pCtrl'
and target attribute 'varName'). If target object is a command, it is automatically executed
afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtvmea.UpdateControl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
UpdateCtrl
Transfers the value of current measurement object to the controlled object (target object 'pOb-
ject' and target attribute 'variabName'). If target object is a command, it is automatically exe-
cuted afterwards.
Note: Calculation results will not be reset by this value transfer.
int StaExtvmea.UpdateCtrl(int dbSync)
A RGUMENTS
dbSync (optional)
0 Value is copied in memory only
1 Default, copied value is stored on db (persistent)
382
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
R ETURNS
0 on success
1 on error, e.g. target object does not have an attribute with given name
3.3.16 StaSwitch
Overview
Close
IsClosed*
IsOpen*
Open
Close
Closes the switch by changing its status to ’close’. This action will fail if the status is currently
determined by an active running arrangement.
int StaSwitch.Close()
R ETURNS
0 On success
6= 0 On error
E XAMPLE
The following example gathers all open switches and closes them.
int open;
set switches;
object switch;
switches = GetCalcRelevantObjects('*.StaSwitch');
S EE ALSO
StaSwitch.Open()
IsClosed*
Returns information about current switch state.
int StaSwitch.IsClosed()
R ETURNS
1 switch is closed
0 switch is open
383
3.3. STATION ELEMENTS CHAPTER 3. OBJECT METHODS
S EE ALSO
StaSwitch.IsOpen()
IsOpen*
Returns information about current switch state.
int StaSwitch.IsOpen()
R ETURNS
1 switch is open
0 switch is closed
S EE ALSO
StaSwitch.IsClosed()
Open
Opens the switch by changing its status to ’open’. This action will fail if the status is currently
determined by an active running arrangement.
int StaSwitch.Open()
R ETURNS
0 On success
6= 0 On error
E XAMPLE
The following example gathers all closed switches and opens them.
int closed;
set switches;
object switch;
switches = GetCalcRelevantObjects('*.StaSwitch');
S EE ALSO
StaSwitch.Close()
384
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4 Commands
Overview
Execute
Execute
Executes the command.
int Com*.Execute()
3.4.1 ComAddlabel
Overview
Execute
Execute
This function executes the Add Statistic Labels command itself for a given plot and curve.
int ComAddlabel.Execute(object plot, int curveIndex)
A RGUMENTS
plot The plot to modify.
curveIndex
The index of the curve inside the plot’s table. The index is zero based, therefore
the index of the first curve is 0.
R ETURNS
0 The function executed without any errors.
1 The plot is visible on a single line graphic only.
2 The parameter plot is NULL.
3 The parameter plot is not a valid plot object (classname should either be PltLinebarplot
or it should start with Vis).
4 The object plot was found in any open graphic.
5 The object plot is not a diagram.
6 An internal error occured (plot is incomplete).
E XAMPLE
The following script searches for the plot named T1 on page Voltage and adds a statistic label
for the second curve.
object command,
desktop,
page,
plot;
command = GetFromStudyCase('ComAddlabel');
desktop = GetGraphicsBoard();
page = desktop.GetPage('Voltages',0);
385
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
plot = page.GetPlot('T1');
command.Execute(plot,1);
3.4.2 ComAddon
Overview
CreateModule
DefineDouble
DefineDoubleMatrix
DefineDoublePerConnection
DefineDoubleVector
DefineDoubleVectorPerConnection
DefineInteger
DefineIntegerPerConnection
DefineIntegerVector
DefineIntegerVectorPerConnection
DefineObject
DefineObjectPerConnection
DefineObjectVector
DefineObjectVectorPerConnection
DefineString
DefineStringPerConnection
DeleteModule
FinaliseModule
GetActiveModule
ModuleExists
SetActiveModule
CreateModule
Creates the calculation module of this AddOn. Volatile object parameters are created for all
variable definitions stored inside this command. They are accessible like any other built in
object parameter.
int ComAddon.CreateModule()
R ETURNS
0 Ok, module was created.
1 An error occurred.
S EE ALSO
ComAddon.FinaliseModule() ComAddon.DeleteModule()
DefineDouble
Creates a new floating-point-number parameter for the given type of objects.
int ComAddon.DefineDouble(string class,
string name,
string desc,
string unit,
double initial)
386
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
unit Parameter’s unit
initial Default value of new parameter
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
S EE ALSO
ComAddon.DefineDoublePerConnection()
DefineDoubleMatrix
Creates a new floating-point-matrix parameter for the given type of objects.
int ComAddon.DefineDoubleMatrix(string class,
string name,
string desc,
string unit,
double initial,
int rows,
int columns)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter.
desc Parameter description.
unit Parameter’s unit.
initial Default value for all entries of new parameter.
rows Number of initial rows. Number of rows will be 0 if a value smaller than 0 is given.
columns Number of initial columns. Number of columns will be 0 if a value smaller than 0
is given.
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
387
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
DefineDoublePerConnection
Creates a new floating-point-number parameter for every connection for the given type of ob-
jects.
int ComAddon.DefineDoublePerConnection(string class,
string name,
string desc,
string unit,
double initial)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
unit Parameter’s unit
initial Default value of new parameter
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
• The elements of class are not branch elements. Therefore there is no con-
nection count. DefineDouble shall be used instead.
S EE ALSO
ComAddon.DefineDouble()
DefineDoubleVector
Creates a new floating-point-number vector parameter for the given type of objects.
int ComAddon.DefineDoubleVector(string class,
string name,
string desc,
string unit,
double initial,
int size)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
unit Parameter’s unit
initial Default value of new parameter
size Initial size of vector. Size will be 0 if a value smaller than 0 is given.
388
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
S EE ALSO
ComAddon.DefineDouble() ComAddon.DefineDoublePerConnection()
DefineDoubleVectorPerConnection
Creates a new floating-point-number vector parameter for the given type of objects for every
connection of the object.
int ComAddon.DefineDoubleVectorPerConnection(string class,
string name,
string desc,
string unit,
double initial,
int size)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
size Initial size of vector. Size will be 0 if a value smaller than 0 is given.
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
• The elements of class are not branch elements. Therefore there is no con-
nection count. DefineDoubleVector shall be used instead.
S EE ALSO
ComAddon.DefineDoubleVector()
389
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
DefineInteger
Creates a new integer parameter for the given type of objects.
int ComAddon.DefineInteger(string class,
string name,
string desc,
string unit,
int initial)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
S EE ALSO
ComAddon.DefineIntegerPerConnection()
DefineIntegerPerConnection
Creates a new integer parameter for every connection for the given type of objects.
int ComAddon.DefineIntegerPerConnection(string class,
string name,
string desc,
string unit,
int initial)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
390
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
• The elements of class are not branch elements. Therefore there is no con-
nection count. DefineInteger shall be used instead.
S EE ALSO
ComAddon.DefineInteger()
DefineIntegerVector
Creates a new integer vector parameter for the given type of objects.
int ComAddon.DefineIntegerVector(string class,
string name,
string desc,
string unit,
int initial,
int size)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
S EE ALSO
ComAddon.DefineInteger() ComAddon.DefineIntegerPerConnection()
391
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
DefineIntegerVectorPerConnection
Creates a new integer vector parameter for the given type of objects for every connection of the
object.
int ComAddon.DefineIntegerVectorPerConnection(string class,
string name,
string desc,
string unit,
int initial,
int size)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
• The elements of class are not branch elements. Therefore there is no con-
nection count. DefineIntegerVector shall be used instead.
S EE ALSO
ComAddon.DefineIntegerVector()
DefineObject
Creates a new object parameter for the given type of objects.
int ComAddon.DefineObject(string class,
string name,
string desc,
object initial)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
392
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
S EE ALSO
ComAddon.DefineObjectPerConnection()
DefineObjectPerConnection
Creates a new object parameter for every connection for the given type of objects.
int ComAddon.DefineObjectPerConnection(string class,
string name,
string desc,
object initial)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
• The elements of class are not branch elements. Therefore there is no con-
nection count. DefineObject shall be used instead.
S EE ALSO
ComAddon.DefineObject()
DefineObjectVector
Creates a new object vector parameter for the given type of objects.
int ComAddon.DefineObjectVector(string class,
string name,
string desc,
object initial,
int size)
393
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter.
desc Parameter description.
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
S EE ALSO
ComAddon.DefineObject() ComAddon.DefineObjectPerConnection()
DefineObjectVectorPerConnection
Creates a new object vector parameter for the given type of objects for every connection of the
object.
int ComAddon.DefineObjectVectorPerConnection(string class,
string name,
string desc,
object initial,
int size)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter.
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
• The elements of class are not branch elements. Therefore there is no con-
nection count. DefineObjectVector shall be used instead.
394
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
S EE ALSO
ComAddon.DefineObjectVector()
DefineString
Creates a new text parameter for the given type of objects.
int ComAddon.DefineString(string class,
string name,
string desc,
string unit,
string initial)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
unit Parameter’s unit
initial Default value of new parameter
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
S EE ALSO
ComAddon.DefineStringPerConnection()
DefineStringPerConnection
Creates a new text parameter for every connection for the given type of objects.
int ComAddon.DefineStringPerConnection(string class,
string name,
string desc,
string unit,
string initial)
A RGUMENTS
class The type of objects for which the new parameter is to be created, e.g. ElmLne for
the line.
name Name of the new parameter
desc Parameter description
unit Parameter’s unit
initial Default value of new parameter
395
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Ok, Parameter was created.
Other than 0 An error occurred, possible reasons:
• The module of this add on does not exist.
• An object with the given class does not exist in PowerFactory.
• The parameter name for the given class already exists in the module.
• The elements of class are not branch elements. Therefore there is no con-
nection count. DefineString shall be used instead.
S EE ALSO
ComAddon.DefineString()
DeleteModule
Deletes the module of this add on.
int ComAddon.DeleteModule()
S EE ALSO
ComAddon.CreateModule()
FinaliseModule
Finalises a user defined module which was created using the mthod CreateModule. All user
defined variables defined for this module are read-only after the call of finalise module. The
module is the one being used in the flexible data, single line graphic text boxes and colouring.
It can be reset like any other built-in calculation using the reset button.
int ComAddon.FinaliseModule()
R ETURNS
0 Ok, module was finalised.
1 An error occurred, this command is not the one being currently active.
S EE ALSO
ComAddon.CreateModule()
GetActiveModule
Gets the key of the module being currently active. An empty string is returned if there is no
active module.
string ComAddon.GetActiveModule()
R ETURNS
The key of the active module. an empty string is returned if there is no active module.
396
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
S EE ALSO
ComAddon.SetActiveModule()
ModuleExists
Checks if the module for this add-on was already created using the method CreateModule.
int ComAddon.ModuleExists()
R ETURNS
0 The module was not created yet.
1 The module was already created.
S EE ALSO
SetActiveModule
Set this module as active module. This method is required only if several modules are created
concurrently. In case that only one module is being used, there is no need to use this method,
because CreateModule sets the created module automatically as active module.
int ComAddon.SetActiveModule()
R ETURNS
0 Success. This command is set as active module.
1 Failure. This command is already the active module.
S EE ALSO
3.4.3 ComAmpacity
Overview
ExecuteAmpacityCalc
ExecuteAmpacityCalc
The function executes ampacity calculation with or without the tabular report at the end.
int ComAmpacity.ExecuteAmpacityCalc([int ireport = 1])
A RGUMENTS
ireport (optional)
Show report or not, default = 1.
E XAMPLE
object cmdAmpacity;
int iret, ireport;
cmdAmpacity = GetFromStudyCase('ComAmpacity');
397
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
if (cmdAmpacity) {
ireport = 0;
iret = cmdAmpacity.ExecuteAmpacityCalc(ireport);
if (iret = 0) {
! tabular report not displayed since ireport = 0
}
}
3.4.4 ComArcreport
Overview
GetLocationsToReport
GetUnitFor
GetValueFor
IsDguv
GetLocationsToReport
Returns the accessible locations with stored results, i.e. which can be reported.
set ComArcreport.GetLocationsToReport()
R ETURNS
Container with reportable accessible locations.
GetUnitFor
Returns the unit for the given variable. The unit corresponds the selected display unit for each
variable at the time the result file was read.
string ComArcreport.GetUnitFor(string variable)
A RGUMENTS
variable Variable for which to retrieve the unit.
R ETURNS
The unit or an empty string if no stored result exists for the given arguments.
GetValueFor
Returns the stored value for the given location and variable.
double ComArcreport.GetValueFor(object location,
string variable,
[int arc])
A RGUMENTS
location Accessible location for which to retrieve the result.
variable Variable for which to retrieve the result. In addition to the arc-flash related monitor
variables stored in the result file, the following artificial variables can be retrieved.
398
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
The availablility of the artificial variables dependes on the arc-flash standard used
to write the result file.
R ETURNS
The stored value or 0.0 if no stored result exists for the given arguments.
IsDguv
Returns whether or not the results were written for a DGUV 203-077 calculation.
int ComArcreport.IsDguv()
R ETURNS
1 The results were written for a DGUV 203-077 calculation.
0 The results were written for a IEEE-1584 / NFPA calculation.
3.4.5 ComAuditlog
Overview
Check
Check
Checks integrity of Audit Log.
int ComAuditlog.Check()
R ETURNS
number of errors
399
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.6 ComBoundary
Overview
GetCreatedBoundaries
GetCreatedBoundaries
Gets created boundaries after the command has been executed.
set ComBoundary.GetCreatedBoundaries()
R ETURNS
Container of created boundaries.
3.4.7 ComCapo
Overview
ConnectShuntToBus
LossCostAtBusTech
TotalLossCost
ConnectShuntToBus
Connects the equivalent shunt in the specified terminal and executes the load flow command.
The shunt is not physically added in the database, just the susceptance is added for the
calculation.
int ComCapo.ConnectShuntToBus(object terminal,
double phtech,
double Q
)
A RGUMENTS
terminal The terminal to which the shunt will be connected
phtech Phase technology. Possible values are
0 three-phase
1 ph-ph a-b
2 ph-ph b-c
3 ph-ph a-c
4 ph-e a
5 ph-e b
6 ph-e c
Note: In balanced load flow, the technology will always be three-phase.
Q Reactive power value in Mvar
R ETURNS
0 On success.
1 An error occurred during load flow execution.
400
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
! This example connects a 0.25 Mvar three-phase shunt to obus
! and excutes load flow.
! Results can been compared to a load flow study after actually
! inserting and connecting a 0.4 kV, 0.25 Mvar shunt to the
! specified bus.
! NOTES:
! 1. Open Application Example "LV Distribution Network"
! 2. Open the "Optimal Capacitor Placement" command and
! select feeder "FD_242". Close command.
! 3. Define "obus" as an external object in the "Basic Options"
! page of the DPL Command
! 4. Select terminal "ND_2406" (0.4 kV System) as "obus"
object comcapo, comldf;
int iret;
iret = 0;
comcapo = GetFromStudyCase('ComCapo');
comldf = GetFromStudyCase('ComLdf');
if ({comldf}.and.{comcapo}) {
comldf:iopt_net = 0; ! balanced load flow
! obus is an external terminal
iret = comcapo.ConnectShuntToBus(obus,0,0.25);
}
LossCostAtBusTech
Returns the losses cost of the selected terminal and configuration calculated during the sensi-
tivity analysis or the optimization.
double ComCapo.LossCostAtBusTech(object terminal,
double phtech
)
A RGUMENTS
terminal Specified bus
phtech Phase technology. Possible values are
0 three-phase
1 ph-ph a-b
2 ph-ph b-c
3 ph-ph a-c
4 ph-e a
5 ph-e b
6 ph-e c
R ETURNS
Returns the losses cost
401
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
! This example gets the losses cost for the buses in the
! feeder with single-phase (A-B) configuration considered
! in the sensitivity analysis or in the optimization process.
! NOTES:
! 1. Open Application Example "LV Distribution Network"
! 2. Open the "Optimal Capacitor Placement" command and
! select feeder "FD_242".
! 3. In the "Available capacitors" page of the dialog,
! add one single phase, 0.05 Mvar capacitor and
! add one three-phase, 0.05 Mvar capacitor
! both with cost of 10 $/kWh.
! 4. Close command.
! 5. Define "ofeed" as an external object in the "Basic Options"
! page of the DPL Command
! 6. Select feeder "FD_242" as "ofeed"
object comcapo, pObj;
set aNodes;
int dret;
dret = 0;
comcapo = GetFromStudyCase('ComCapo');
comcapo:iopt_meth = 1; ! Sensitivity analysis
comcapo:iopt_ldf = 1; ! Unbalanced
comcapo.Execute();
if (comcapo) {
aNodes = ofeed.GetBuses(1);
aNodes.SortToName(0);
for (pObj=aNodes.First(); pObj; pObj=aNodes.Next()) {
dret = comcapo.LossCostAtBusTech(pObj,1); ! A-B configuration
if (dret >= 0.) {
printf('%o: Losses Cost: %f', pObj, dret);
}
}
}
TotalLossCost
Returns the total cost calculated after the sensitivity analysis or the optimization.
double ComCapo.TotalLossCost([int iopt])
A RGUMENTS
iopt (optional)
Type of cost. Possible values are
0 Losses in MW (default)
1 Cost of losses
2 Cost of voltage violations
3 Cost of shunts
R ETURNS
Returns losses in MW or cost value.
402
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
! This example gets the different costs calculated
! after the optimization process.
! NOTES:
! 1. Open Application Example "LV Distribution Network"
! 2. Open the "Optimal Capacitor Placement" command and
! select feeder "FD_242".
! 3. In the "Available capacitors" page of the dialog,
! add one single phase, 0.05 Mvar capacitor and
! add one three-phase, 0.05 Mvar capacitor,
! both with cost of 10 $/kWh.
! 4. Close command.
object comcapo;
int dret;
comcapo = GetFromStudyCase('ComCapo');
comcapo:iopt_meth = 0; ! Optimization
comcapo:iopt_ldf = 1; ! Unbalanced
comcapo:iopt_con = 0; ! Only do report
comcapo.Execute();
if (comcapo) {
dret = comcapo.TotalLossCost(0);
printf('Losses in MW: %f', dret);
dret = comcapo.TotalLossCost(1);
printf('Cost of Losses: %f', dret);
dret = comcapo.TotalLossCost(2);
printf('Cost of V Violations: %f', dret);
dret = comcapo.TotalLossCost(3);
printf('Cost of Shunts: %f', dret);
}
3.4.8 ComCheck
Overview
GetNextLoop
GetNextLoop
Get the next loop for any non-radial feeder.
set ComCheck.GetNextLoop()
R ETURNS
Returns the elements in of the loop.
403
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.9 ComCimdbexp
Overview
Execute
Execute
Executes the export. In case of a validation error the export is not performed.
int ComCimdbexp.Execute([int validate])
A RGUMENTS
validate (optional)
Option to execute CIM Data Validation before export. If not provided, the validation
is executed. Possible values are
0 Do not validate
1 Validate
R ETURNS
0 OK
1 Error: export failed
E XAMPLE
The following example exports CIM archive to a file using a preconfigured CIM Data Export
command from the active project.
object cimdbexp;
int error;
cimdbexp = GetFromStudyCase('ComCimdbexp');
error = cimdbexp.Execute();
if (error = 0) {
Info('OK');
} else {
Error('Error: export failed');
}
3.4.10 ComCimdbimp
Overview
Execute
ImportAndConvert
404
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
Execute
Executes the import.
int ComCimdbimp.Execute([int validate])
A RGUMENTS
validate (optional)
Option to execute CIM Data Validation after import. If not provided, the validation
is executed. Possible values are
0 Do not validate
1 Validate
R ETURNS
0 OK
1 Error: import failed
E XAMPLE
The following example creates a new CIM Data Import command, configures it and imports
the data into the active project.
object cimdbimp;
int error;
cimdbimp = GetFromStudyCase('ComCimdbimp');
cimdbimp.SetVal('testArchive', 'targetName');
cimdbimp.SetVal('E:\test\test.zip', 'fileName');
error = cimdbimp.Execute();
if (error = 0) {
Info('OK');
} else {
Error('Error: import failed');
}
ImportAndConvert
Imports CIM data from file path provided in the ’CIM Data Import’ command without storing
CIM data into database, and converts CIM to Grid using the ’CIM to Grid Conversion’ command
object provided in the function call as template. The CIM to Grid Conversion will be executed
with default settings if the command object is not provided in the function call.
int ComCimdbimp.ImportAndConvert([int validate],
[object cimToGrid])
A RGUMENTS
validate (optional)
Option to execute CIM Data Validation after import. If not provided, the validation
is executed. Possible values are
0 Do not validate
1 Validate
cimToGrid (optional)
ComCimtogrid object with preconfigured settings for converting imported CIM
data. If not provided, the default CIM to Grid Conversion settings will be used.
405
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 OK
1 Error: import failed
2 Error: conversion failed
E XAMPLE
The following example imports and converts a CimArchive from a specified ZIP file.
object cimdbimp;
int error;
cimdbimp = GetFromStudyCase('ComCimdbimp');
cimdbimp.SetVal('E:\test\test.zip', 'fileName');
error = cimdbimp.ImportAndConvert();
if (error = 0) {
Info('OK');
} else if (error = 1) {
Error('Error: import failed');
} else {
Error('Error: conversion failed');
}
3.4.11 ComCimvalidate
Overview
Execute
GetClassType
GetDescriptionText
GetInputObject
GetModel
GetModelId
GetNumberOfValidationMessages
GetObject
GetObjectId
GetProfile
GetSeverity
GetType
Execute
Executes the validation. Creates no validation report if no errors, or warnings were found.
int ComCimvalidate.Execute([int openReport])
A RGUMENTS
openReport (optional)
Option to open report after validation. If not provided, the report is opened.
Possible values are
0 Do not open report
1 Open report
406
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 OK
1 Error: validation failed
E XAMPLE
The following example executes the validation for the configured CIM Data Validation (Com-
Cimvalidate) command in the active project. In case of error the validation report is not
opened.
object cimvalidate;
int error;
cimvalidate = GetFromStudyCase('ComCimvalidate');
cimvalidate.Execute(0);
if (error = 0) {
Info('OK');
} else {
Error('Error: validation failed');
}
GetClassType
Returns the object class type from the selected validation message.
string ComCimvalidate.GetClassType(int messageIndex)
A RGUMENTS
messageIndex
Index of the validation message.
R ETURNS
Object class type.
E XAMPLE
The following example prints the object class type from each validation message.
object cimvalidate;
int nMessages, i;
string classType;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
classType = cimvalidate.GetClassType(i);
Info('%s', classType);
}
GetDescriptionText
Returns the description from the selected validation message.
string ComCimvalidate.GetDescriptionText(int messageIndex)
407
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
messageIndex
Index of the validation message.
R ETURNS
Message description.
E XAMPLE
The following example prints the description text from each validation message.
object cimvalidate;
int nMessages, i;
string descriptionText;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
descriptionText = cimvalidate.GetDescriptionText(i);
Info('%s', descriptionText);
}
GetInputObject
Returns the object selected for validation.
object ComCimvalidate.GetInputObject()
R ETURNS
Pointer to CimArchive, CimModel, or SetSelect.
E XAMPLE
The following example prints the class of object and object selected for validation in the active
project.
object cimvalidate, selectedObject;
string objectClass;
cimvalidate = GetFromStudyCase('ComCimvalidate');
selectedObject = cimvalidate.GetInputObject();
objectClass = selectedObject.GetClass();
Info('%s: %o', objectClass, selectedObject);
GetModel
Returns the CimModel object from the selected validation message.
object ComCimvalidate.GetModel(int messageIndex)
A RGUMENTS
messageIndex
Index of the validation message.
408
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
Pointer to CimModel.
E XAMPLE
The following example prints the CimModel object from each validation message.
object cimvalidate, cimModel;
int nMessages, i;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
cimModel = cimvalidate.GetModel(i);
Info('%o', cimModel);
}
GetModelId
Returns the model ID from the selected validation message.
string ComCimvalidate.GetModelId(int messageIndex)
A RGUMENTS
messageIndex
Index of the validation message.
R ETURNS
Model ID.
E XAMPLE
The following example prints the model ID from each validation message.
object cimvalidate;
int nMessages, i;
string modelId;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
modelId = cimvalidate.GetModelId(i);
Info('%s', modelId);
}
GetNumberOfValidationMessages
Returns the number of validation messages generated.
int ComCimvalidate.GetNumberOfValidationMessages()
R ETURNS
Number of validation messages.
409
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example prints the number of validation messages got for the last CIM data
validation.
object cimvalidate;
int nMessages;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
Info('Number of validation messages: %d', nMessages);
GetObject
Returns the CimObject object from the selected validation message.
object ComCimvalidate.GetObject(int messageIndex)
A RGUMENTS
messageIndex
Index of the validation message.
R ETURNS
Pointer to CimObject.
E XAMPLE
The following example prints the CimObject object from each validation message.
object cimvalidate, cimObject;
int nMessages, i;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
cimObject = cimvalidate.GetObject(i);
Info('%o', cimObject);
}
GetObjectId
Returns the object ID from the selected validation message.
string ComCimvalidate.GetObjectId(int messageIndex)
A RGUMENTS
messageIndex
Index of the validation message.
R ETURNS
Object ID.
410
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example prints the object ID from each validation message.
object cimvalidate;
int nMessages, i;
string objectId;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
objectId = cimvalidate.GetObjectId(i);
Info('%s', objectId);
}
GetProfile
Returns the model profile from the selected validation message.
string ComCimvalidate.GetProfile(int messageIndex)
A RGUMENTS
messageIndex
Index of the validation message.
R ETURNS
Model profile.
E XAMPLE
The following example prints the profile for each validation message.
object cimvalidate;
int nMessages, i;
string profile;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
profile = cimvalidate.GetProfile(i);
Info('%s', profile);
}
GetSeverity
Returns the severity of the selected validation message.
string ComCimvalidate.GetSeverity(int messageIndex)
A RGUMENTS
messageIndex
Index of the validation message.
R ETURNS
Message severity.
411
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example prints the severity for each validation message.
object cimvalidate;
int nMessages, i;
string severity;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
severity = cimvalidate.GetSeverity(i);
Info('%s', severity);
}
GetType
Returns the type of the selected validation message.
string ComCimvalidate.GetType(int messageIndex)
A RGUMENTS
messageIndex
Index of the validation message.
R ETURNS
Message type.
E XAMPLE
The following example prints the type for each validation message.
object cimvalidate;
int nMessages, i;
string type;
cimvalidate = GetFromStudyCase('ComCimvalidate');
nMessages = cimvalidate.GetNumberOfValidationMessages();
for (i = 0; i < nMessages; i = i + 1) {
type = cimvalidate.GetType(i);
Info('%s', type);
}
3.4.12 ComConreq
Overview
Execute
412
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
Execute
Performs a Connection Request Assessment according to the selected method. Results are
provided for connection request elements in the single line graphic, and are summarised in a
report in the output window.
int ComConreq.Execute()
R ETURNS
0 OK
1 Error: calculation function
2 Error: settings/initialisation/load flow
3.4.13 ComContingency
Overview
ContinueTrace
CreateRecoveryInformation
GetGeneratorEvent*
GetInterruptedPowerAndCustomersForStage
GetInterruptedPowerAndCustomersForTimeStep*
GetLoadEvent*
GetNumberOfGeneratorEventsForTimeStep*
GetNumberOfLoadEventsForTimeStep*
GetNumberOfSwitchEventsForTimeStep*
GetNumberOfTimeSteps*
GetObj*
GetSwitchEvent*
GetTimeOfStepInSeconds*
GetTotalInterruptedPower*
JumpToLastStep
RemoveEvents
StartTrace
StopTrace
ContinueTrace
Continues trace execution for this contingency.
int ComContingency.ContinueTrace()
R ETURNS
0 On success.
1 On error.
CreateRecoveryInformation
Creates recovery information for a contingency. The recovery information can later be retrieved
e.g. via ComContingency.GetInterruptedPowerAndCustomersForStage().
Can only save one contingency at the same time.
int ComContingency.CreateRecoveryInformation(object resultFileInput)
413
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
resultFileInput
Read from this result file.
R ETURNS
0 On success.
1 On error.
GetGeneratorEvent*
Gets generator event of a certain time step during recovery.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
void ComContingency.GetGeneratorEvent(int currentTimeStep,
int loadEvent,
object& generator,
double& changedP,
double& changedQ )
A RGUMENTS
currentTimeStep
Input: Number of time steps are get via ComContingency.GetNumberOfTimeSteps()
switchEvent
Input: Number of generator events for a certain time step are get via ComContin-
gency.GetNumberOfSwitchEventsForTimeStep()
generator (out)
Output: Generator that dispatched
changedP (out)
Output: Changed active power
changedQ (out)
Output: Changed reactive power
GetInterruptedPowerAndCustomersForStage
Gets recovery information of a contingency.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
int ComContingency.GetInterruptedPowerAndCustomersForStage(double timeOfStageInMinutes,
double& interruptedPower,
double& newInterruptedPower,
double& interruptedCustomers,
double& newInterruptedCustomers)
A RGUMENTS
timeOfStageInMinutes
Input: Get Information for this time.
interruptedPower (out)
Output: Interrupted Power at this time.
414
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
newInterruptedPower (out)
Output: New interrupted Power at this time.
interruptedCustomers (out)
Output: Interrupted Customers at this time.
newInterruptedCustomers (out)
Output: New interrupted Customers at this time.
R ETURNS
0 On success.
1 On error.
GetInterruptedPowerAndCustomersForTimeStep*
Gets recovery information of a contingency.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
int ComContingency.GetInterruptedPowerAndCustomersForTimeStep(int currentTimeStep,
double& interruptedPower,
double& newInterruptedPower,
double& interruptedCustomers,
double& newInterruptedCustomers)
A RGUMENTS
currentTimeStep
Input: Number of time steps are get via ComContingency.GetNumberOfTimeSteps()
interruptedPower (out)
Output: Interrupted Power at this time.
newInterruptedPower (out)
Output: New interrupted Power at this time.
interruptedCustomers (out)
Output: Interrupted Customers at this time.
newInterruptedCustomers (out)
Output: New interrupted Customers at this time.
GetLoadEvent*
Gets load event of a certain time step during recovery.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
void ComContingency.GetLoadEvent(int currentTimeStep,
int loadEvent,
object& load,
double& changedP,
double& changedQ,
int& isTransfer)
415
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
currentTimeStep
Input: Number of time steps are get via ComContingency.GetNumberOfTimeSteps()
switchEvent
Input: Number of load events for a certain time step are get via ComContin-
gency.GetNumberOfSwitchEventsForTimeStep()
load (out) Output: Load that is shed or transfered
changedP (out)
Output: Changed active power
changedQ (out)
Output: Changed reactive power
isTransfer (out)
Output: = 0 : is load shedding event. >0 is load transfer event.
GetNumberOfGeneratorEventsForTimeStep*
Returns the number of generator events of a certain step during recovery.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
int ComContingency.GetNumberOfGeneratorEventsForTimeStep([int currentTimeStep])
A RGUMENTS
currentTimeStep
Input: Number of time steps are get via ComContingency.GetNumberOfTimeSteps()
GetNumberOfLoadEventsForTimeStep*
Returns the number of load events of a certain step during recovery.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
int ComContingency.GetNumberOfLoadEventsForTimeStep([int currentTimeStep])
A RGUMENTS
currentTimeStep
Input: Number of time steps are get via ComContingency.GetNumberOfTimeSteps()
GetNumberOfSwitchEventsForTimeStep*
Returns the number of switch events of a certain step during recovery.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
int ComContingency.GetNumberOfSwitchEventsForTimeStep([int currentTimeStep])
416
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
currentTimeStep
Input: Number of time steps are get via ComContingency.GetNumberOfTimeSteps()
GetNumberOfTimeSteps*
Returns the number of time steps during recovery.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
int ComContingency.GetNumberOfTimeSteps()
GetObj*
Gets interrupted element by index (zero based).
object ComContingency.GetObj(int index)
A RGUMENTS
index Element order index, 0 for the first object.
R ETURNS
object Interupted element for given index.
NULL Index out of range.
GetSwitchEvent*
Gets switch event of a certain time step during recovery.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
void ComContingency.GetSwitchEvent(int currentTimeStep,
int switchEvent,
object& switchToBeActuated,
int& isClosed,
int& sectionalizingStep)
A RGUMENTS
currentTimeStep
Input: Number of time steps are get via ComContingency.GetNumberOfTimeSteps()
switchEvent
Input: Number of switch event for a certain time step are get via ComContin-
gency.GetNumberOfSwitchEventsForTimeStep()
switchToBeActuated (out)
Output: Switch to be actuated
isClosed (out)
Output: > 0 if switch is closed
sectionalizingStep (out)
Output: sectionalizing step when this switch is actuated
417
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetTimeOfStepInSeconds*
Returns the time of the current step during recovery.
ComContingency.CreateRecoveryInformation() has to be called beforehand to collect the data.
int ComContingency.GetTimeOfStepInSeconds(int currentTimeStep)
A RGUMENTS
currentTimeStep
Input: Number of time steps are get via ComContingency.GetNumberOfTimeSteps()
GetTotalInterruptedPower*
Gets the total interrupted power (in kW) during restoration. ComContingency.CreateRecoveryInformation()
has to be called beforehand to collect the data.
double ComContingency.GetTotalInterruptedPower()
JumpToLastStep
Gets the last trace execution for this contingency.
int ComContingency.JumpToLastStep([int timeDelay])
A RGUMENTS
timeDelay (optional)
time delay in seconds between trace steps
R ETURNS
0 On success.
1 On error.
RemoveEvents
Removes events from this contingency.
void ComContingency.RemoveEvents([double emitMessage])
void ComContingency.RemoveEvents(string whichEvents)
void ComContingency.RemoveEvents(double emitMessage,
string whichEvents
)
void ComContingency.RemoveEvents(string whichEvents,
double emitMessage
)
A RGUMENTS
emitMessage(optional)
0: no info message shall be issued after event removal
whichEvents(optional)
’lod’ removed load events, ’gen’ removes generator events, ’switch’ removes switch-
ing events
418
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
StartTrace
Starts trace execution for this contingency.
int ComContingency.StartTrace()
R ETURNS
0 On success.
1 Error, e.g. Contingency is not in trace.
2 On error.
StopTrace
Stops trace execution for this contingency.
int ComContingency.StopTrace([int emitMessage])
A RGUMENTS
emitMessage (optional)
= 0: no trace-stop info messages shall be issued
R ETURNS
0 On Success.
1 Contingency is not in Trace.
3.4.14 ComCoordreport
Overview
DevicesToReport
HasResultsForDirectionalBackup
HasResultsForFuse
HasResultsForInstantaneous
HasResultsForNonDirectionalBackup
HasResultsForOverload
HasResultsForOverreach
HasResultsForShortCircuit
HasResultsForZone
MaxZoneNumberFor
ResultForDirectionalBackupVariable
ResultForFuseVariable
ResultForInstantaneousVariable
ResultForMaxCurrent
ResultForNonDirectionalBackupVariable
ResultForOverloadVariable
ResultForOverreachVariable
ResultForShortCircuitVariable
ResultForZoneVariable
TopologyForDirectionalBackupVariable
TopologyForFuseVariable
TopologyForInstantaneousVariable
TopologyForMaxCurrent
TopologyForNonDirectionalBackupVariable
419
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
TopologyForOverloadVariable
TopologyForOverreachVariable
TopologyForShortCircuitVariable
TopologyForZoneVariable
TransferDirectionalBackupResultsTo
TransferNonDirectionalBackupResultsTo
TransferOverreachResultsTo
TransferResultsTo
TransferZoneResultsTo
DevicesToReport
Returns the devices with stored results, i.e. which can be reported.
set ComCoordreport.DevicesToReport()
R ETURNS
Container with reportable devices.
HasResultsForDirectionalBackup
Checks whether there is a stored directional backup result for the given device.
int ComCoordreport.HasResultsForDirectionalBackup(object device)
A RGUMENTS
device Device for which to check.
R ETURNS
1 A directional backup result is stored for this device.
0 The device has no stored results or no result for the directional backup.
S EE ALSO
ComCoordreport.HasResultsForZone(),
ComCoordreport.HasResultsForOverreach(),
ComCoordreport.HasResultsForNonDirectionalBackup()
HasResultsForFuse
Checks whether there is a stored fuse result for the given device.
int ComCoordreport.HasResultsForFuse(object device)
A RGUMENTS
device Device for which to check.
R ETURNS
1 An fuse result is stored for this device.
0 The device has no stored results or no fuse result.
420
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
HasResultsForInstantaneous
Checks whether there is a stored instantaneous stage result for the given device.
int ComCoordreport.HasResultsForInstantaneous(object device)
A RGUMENTS
device Device for which to check.
R ETURNS
1 An instantaneous stage result is stored for this device.
0 The device has no stored results or no result for the instantaneous stage.
S EE ALSO
ComCoordreport.HasResultsForOverload(),
ComCoordreport.HasResultsForShortCircuit()
HasResultsForNonDirectionalBackup
Checks whether there is a stored non-directional backup result for the given device.
int ComCoordreport.HasResultsForNonDirectionalBackup(object device)
A RGUMENTS
device Device for which to check.
R ETURNS
1 A non-directional backup result is stored for this device.
0 The device has no stored results or no result for the non-directional backup.
S EE ALSO
ComCoordreport.HasResultsForZone(),
ComCoordreport.HasResultsForOverreach(),
ComCoordreport.HasResultsForDirectionalBackup()
HasResultsForOverload
Checks whether there is a stored overload stage result for the given device.
int ComCoordreport.HasResultsForOverload(object device)
A RGUMENTS
device Device for which to check.
R ETURNS
1 An overload stage result is stored for this device.
0 The device has no stored results or no result for the overload stage.
S EE ALSO
ComCoordreport.HasResultsForShortCircuit(),
ComCoordreport.HasResultsForInstantaneous()
421
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
HasResultsForOverreach
Checks whether there is a stored overreach zone result for the given device.
int ComCoordreport.HasResultsForOverreach(object device)
A RGUMENTS
device Device for which to check.
R ETURNS
1 An overreach zone result is stored for this device.
0 The device has no stored results or no result for the overreach zone.
S EE ALSO
ComCoordreport.HasResultsForZone(),
ComCoordreport.HasResultsForDirectionalBackup(),
ComCoordreport.HasResultsForNonDirectionalBackup()
HasResultsForShortCircuit
Checks whether there is a stored short-circuit stage result for the given device.
int ComCoordreport.HasResultsForShortCircuit(object device)
A RGUMENTS
device Device for which to check.
R ETURNS
1 An short-circuit stage result is stored for this device.
0 The device has no stored results or no result for the short-circuit stage.
S EE ALSO
ComCoordreport.HasResultsForOverload(),
ComCoordreport.HasResultsForInstantaneous()
HasResultsForZone
Checks whether there is a stored result for the given device and zone number.
int ComCoordreport.HasResultsForZone(object device,
int zoneNumber)
A RGUMENTS
device Device for which to check.
zoneNumber
Zone number to check (1-4).
R ETURNS
1 A result is stored for this device and zone number.
0 The device has no stored results or no result for this zone number.
422
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
S EE ALSO
ComCoordreport.HasResultsForOverreach(),
ComCoordreport.HasResultsForDirectionalBackup(),
ComCoordreport.HasResultsForNonDirectionalBackup()
MaxZoneNumberFor
Returns the highest zone number in the stored results for the given device.
int ComCoordreport.MaxZoneNumberFor(object device)
A RGUMENTS
device Device for which to retrieve the zone number.
R ETURNS
Highest zone number in the stored results.
ResultForDirectionalBackupVariable
Provides access to the directional backup result for a given device and variable.
int ComCoordreport.ResultForDirectionalBackupVariable(object device,
string variable,
double& result)
A RGUMENTS
device Device for which to retrieve the result.
result (out)
Value of the stored result.
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
2 The corresponding topological search failed.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
S EE ALSO
ComCoordreport.ResultForZoneVariable(),
ComCoordreport.ResultForOverreachVariable(),
ComCoordreport.ResultForNonDirectionalBackupVariable()
423
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ResultForFuseVariable
Provides access to the fuse result for a given device and variable.
int ComCoordreport.ResultForFuseVariable(object device,
string variable,
double& result)
A RGUMENTS
device Device for which to retrieve the result.
variable Variable for which to retrieve the result:
char Overcurrent characteristic
dir Tripping direction
Iset Overcurrent setpoint
result (out)
Value of the stored result.
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
5 The calculated value exceeded the calculated maximum current.
S EE ALSO
ComCoordreport.ResultForMaxCurrent()
ResultForInstantaneousVariable
Provides access to the instantaneous result for a given device and variable.
int ComCoordreport.ResultForInstantaneousVariable(object device,
string variable,
double& result)
A RGUMENTS
device Device for which to retrieve the result.
424
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
5 The calculated value exceeded the calculated maximum current.
S EE ALSO
ComCoordreport.ResultForOverloadVariable(),
ComCoordreport.ResultForShortCircuitVariable(),
ComCoordreport.ResultForMaxCurrent()
ResultForMaxCurrent
Provides access to the maximum current result for a given device.
int ComCoordreport.ResultForMaxCurrent(object device,
double& result)
A RGUMENTS
device Device for which to retrieve the result.
result (out)
Value of the stored result.
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
6 The orientation of the device is ambuous.
S EE ALSO
ComCoordreport.ResultForOverloadVariable(),
ComCoordreport.ResultForShortCircuitVariable(),
ComCoordreport.ResultForInstantaneousVariable()
ResultForNonDirectionalBackupVariable
Provides access to the non-directional backup result for a given device and variable.
int ComCoordreport.ResultForNonDirectionalBackupVariable(object device,
string variable,
double& result)
425
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
device Device for which to retrieve the result.
variable Variable for which to retrieve the result:
dir Tripping direction
Tp Polygonal delay
Tc Circular delay
result (out)
Value of the stored result.
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
2 The corresponding topological search failed.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
S EE ALSO
ComCoordreport.ResultForZoneVariable(),
ComCoordreport.ResultForOverreachVariable(),
ComCoordreport.ResultForDirectionalBackupVariable()
ResultForOverloadVariable
Provides access to the overload result for a given device and variable.
int ComCoordreport.ResultForOverloadVariable(object device,
string variable,
double& result)
A RGUMENTS
device Device for which to retrieve the result.
variable Variable for which to retrieve the result:
char Overcurrent characteristic
dir Tripping direction
Iset Overcurrent setpoint
Tset Overcurrent delay
result (out)
Value of the stored result.
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
5 The calculated value exceeded the calculated maximum current.
426
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
S EE ALSO
ComCoordreport.ResultForShortCircuitVariable(),
ComCoordreport.ResultForInstantaneousVariable(),
ComCoordreport.ResultForMaxCurrent()
ResultForOverreachVariable
Provides access to the overreach result for a given device and variable.
int ComCoordreport.ResultForOverreachVariable(object device,
string variable,
double& result)
A RGUMENTS
device Device for which to retrieve the result.
variable Variable for which to retrieve the result:
X Polygonal reactance
R Polygonal phase-phase resistance
RE Polygonal phase-earth resistance
Z Circular impedance
phi Circular angle
dir Tripping direction
Tp Polygonal delay
Tc Circular delay
result (out)
Value of the stored result.
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
2 The corresponding topological search failed.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
S EE ALSO
ComCoordreport.ResultForZoneVariable(),
ComCoordreport.ResultForDirectionalBackupVariable(),
ComCoordreport.ResultForNonDirectionalBackupVariable()
ResultForShortCircuitVariable
Provides access to the short-circuit result for a given device and variable.
int ComCoordreport.ResultForShortCircuitVariable(object device,
string variable,
double& result)
427
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
device Device for which to retrieve the result.
variable Variable for which to retrieve the result:
char Overcurrent characteristic
dir Tripping direction
Iset Overcurrent setpoint
Tset Overcurrent delay
result (out)
Value of the stored result.
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
5 The calculated value exceeded the calculated maximum current.
S EE ALSO
ComCoordreport.ResultForOverloadVariable(),
ComCoordreport.ResultForInstantaneousVariable(),
ComCoordreport.ResultForMaxCurrent()
ResultForZoneVariable
Provides access to the result for a given device, zone number and variable.
int ComCoordreport.ResultForZoneVariable(object device,
int zoneNumber
string variable,
double& result)
A RGUMENTS
device Device for which to retrieve the result.
zoneNumber
Zone number for which to retrieve the result (1-4).
variable Variable for which to retrieve the result:
X Polygonal reactance
R Polygonal phase-phase resistance
RE Polygonal phase-earth resistance
Z Circular impedance
phi Circular angle
dir Tripping direction
Tp Polygonal delay
Tc Circular delay
result (out)
Value of the stored result.
428
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 The result is valid.
1 The result was not calculated or not found.
2 The corresponding topological search failed.
3 The corresponding topological search ended prematurely (e.g. end of network
reached).
4 The correponding equation required a nominal current and none could be deter-
mined.
S EE ALSO
ComCoordreport.ResultForOverreachVariable(),
ComCoordreport.ResultForDirectionalBackupVariable(),
ComCoordreport.ResultForNonDirectionalBackupVariable()
TopologyForDirectionalBackupVariable
Returns the associated directional backup topology for a given device and variable.
set ComCoordreport.TopologyForDirectionalBackupVariable(object device,
string variable)
A RGUMENTS
device Device for which to retrieve the topology.
variable Variable for which to retrieve the topology:
Tp Polygonal delay
Tc Circular delay
R ETURNS
Elements traversed by the topological search determining this variables result.
S EE ALSO
ComCoordreport.TopologyForZoneVariable(),
ComCoordreport.TopologyForOverreachVariable(),
ComCoordreport.TopologyForNonDirectionalBackupVariable()
TopologyForFuseVariable
Returns the associated fuse topology for a given device and variable.
set ComCoordreport.TopologyForFuseVariable(object device,
string variable)
A RGUMENTS
device Device for which to retrieve the topology.
variable Variable for which to retrieve the topology:
Iset Overcurrent setpoint
R ETURNS
Elements traversed by the topological search determining this variables result.
429
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
S EE ALSO
ComCoordreport.TopologyForMaxCurrent()
TopologyForInstantaneousVariable
Returns the associated instantaneous stage topology for a given device and variable.
set ComCoordreport.TopologyForInstantaneousVariable(object device,
string variable)
A RGUMENTS
device Device for which to retrieve the topology.
R ETURNS
Elements traversed by the topological search determining this variables result.
S EE ALSO
ComCoordreport.TopologyForOverloadVariable(),
ComCoordreport.TopologyForShortCircuitVariable(),
ComCoordreport.TopologyForMaxCurrent()
TopologyForMaxCurrent
Returns the associated maximum current topology for a given device.
set ComCoordreport.TopologyForMaxCurrent(object device)
A RGUMENTS
device Device for which to retrieve the topology.
R ETURNS
Elements traversed by the topological search determining this variables result.
S EE ALSO
ComCoordreport.TopologyForOverloadVariable(),
ComCoordreport.TopologyForShortCircuitVariable(),
ComCoordreport.TopologyForInstantaneousVariable()
TopologyForNonDirectionalBackupVariable
Returns the associated non-directional backup topology for a given device and variable.
set ComCoordreport.TopologyForNonDirectionalBackupVariable(object device,
string variable)
430
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
device Device for which to retrieve the topology.
variable Variable for which to retrieve the topology:
Tp Polygonal delay
Tc Circular delay
R ETURNS
Elements traversed by the topological search determining this variables result.
S EE ALSO
ComCoordreport.TopologyForZoneVariable(),
ComCoordreport.TopologyForOverreachVariable(),
ComCoordreport.TopologyForDirectionalBackupVariable()
TopologyForOverloadVariable
Returns the associated overload stage topology for a given device and variable.
set ComCoordreport.TopologyForOverloadVariable(object device,
string variable)
A RGUMENTS
device Device for which to retrieve the topology.
variable Variable for which to retrieve the topology:
Iset Overcurrent setpoint
Tset Overcurrent delay
R ETURNS
Elements traversed by the topological search determining this variables result.
S EE ALSO
ComCoordreport.TopologyForShortCircuitVariable(),
ComCoordreport.TopologyForInstantaneousVariable(),
ComCoordreport.TopologyForMaxCurrent()
TopologyForOverreachVariable
Returns the associated overreach zone topology for a given device and variable.
set ComCoordreport.TopologyForOverreachVariable(object device,
string variable)
A RGUMENTS
device Device for which to retrieve the topology.
variable Variable for which to retrieve the topology:
X Polygonal reactance
R Polygonal phase-phase resistance
431
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
Elements traversed by the topological search determining this variables result.
S EE ALSO
ComCoordreport.TopologyForZoneVariable(),
ComCoordreport.TopologyForDirectionalBackupVariable(),
ComCoordreport.TopologyForNonDirectionalBackupVariable()
TopologyForShortCircuitVariable
Returns the associated short-circuit stage topology for a given device and variable.
set ComCoordreport.TopologyForShortCircuitVariable(object device,
string variable)
A RGUMENTS
device Device for which to retrieve the topology.
variable Variable for which to retrieve the topology:
Iset Overcurrent setpoint
Tset Overcurrent delay
R ETURNS
Elements traversed by the topological search determining this variables result.
S EE ALSO
ComCoordreport.TopologyForOverloadVariable(),
ComCoordreport.TopologyForInstantaneousVariable(),
ComCoordreport.TopologyForMaxCurrent()
TopologyForZoneVariable
Returns the associated topology for a given device, zone number and variable.
set ComCoordreport.TopologyForZoneVariable(object device,
int zoneNumber
string variable)
A RGUMENTS
device Device for which to retrieve the topology.
zoneNumber
Zone number for which to retrieve the topology (1-4).
variable Variable for which to retrieve the topology:
432
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
X Polygonal reactance
R Polygonal phase-phase resistance
RE Polygonal phase-earth resistance
Z Circular impedance
phi Circular angle
Tp Polygonal delay
Tc Circular delay
R ETURNS
Elements traversed by the topological search determining this variables result.
S EE ALSO
ComCoordreport.TopologyForOverreachVariable(),
ComCoordreport.TopologyForDirectionalBackupVariable(),
ComCoordreport.TopologyForNonDirectionalBackupVariable()
TransferDirectionalBackupResultsTo
Transfers the results of the directional backup for the given variables to the device.
int ComCoordreport.TransferDirectionalBackupResultsTo(object device,
string variables)
A RGUMENTS
device Device to transfer the results to.
variable Variables to transfer as semi-colon separated string:
R ETURNS
0 Transfer did non succeed.
1 Result transfer successful.
S EE ALSO
ComCoordreport.TransferZoneResultsTo(),
ComCoordreport.TransferOverreachResultsTo(),
ComCoordreport.TransferNonDirectionalBackupResultsTo()
TransferNonDirectionalBackupResultsTo
Transfers the results of the non-directional backup for the given variables to the device.
int ComCoordreport.TransferNonDirectionalBackupResultsTo(object device,
string variables)
433
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
device Device to transfer the results to.
variable Variables to transfer as semi-colon separated string:
dir Tripping direction
Tp Polygonal delay
Tc Circular delay
R ETURNS
0 Transfer did non succeed.
1 Result transfer successful.
S EE ALSO
ComCoordreport.TransferZoneResultsTo(),
ComCoordreport.TransferOverreachResultsTo(),
ComCoordreport.TransferDirectionalBackupResultsTo()
TransferOverreachResultsTo
Transfers the results of the overreach zone for the given variables to the device.
int ComCoordreport.TransferOverreachResultsTo(object device,
string variables)
A RGUMENTS
device Device to transfer the results to.
R ETURNS
0 Transfer did non succeed.
1 Result transfer successful.
S EE ALSO
ComCoordreport.TransferZoneResultsTo(),
ComCoordreport.TransferDirectionalBackupResultsTo(),
ComCoordreport.TransferNonDirectionalBackupResultsTo()
434
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
TransferResultsTo
Transfers the results for the given variables to one or more devices.
int ComCoordreport.TransferResultsTo(object device,
string variables)
A RGUMENTS
devices Devices to transfer the results to.
variable Variables to transfer as semi-colon separated string:
X Polygonal reactance
R Polygonal phase-phase resistance
RE Polygonal phase-earth resistance
Z Circular impedance
phi Circular angle
dir Tripping direction
Tp Polygonal delay
Tc Circular delay
char Overcurrent characteristic
Iset Overcurrent setpoint
Tset Overcurrent delay
R ETURNS
0 At least one transfer did non succeed.
1 Result transfer successful.
TransferZoneResultsTo
Transfers the results of a particular zone for the given variables to the device.
int ComCoordreport.TransferZoneResultsTo(object device,
int zoneNumer,
string variables)
A RGUMENTS
device Device to transfer the results to.
zoneNumber
Zone number for which to to transfer the results (1-4).
variable Variables to transfer as semi-colon separated string:
X Polygonal reactance
R Polygonal phase-phase resistance
RE Polygonal phase-earth resistance
Z Circular impedance
phi Circular angle
dir Tripping direction
Tp Polygonal delay
Tc Circular delay
435
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Transfer did non succeed.
1 Result transfer successful.
S EE ALSO
ComCoordreport.TransferOverreachResultsTo(),
ComCoordreport.TransferDirectionalBackupResultsTo(),
ComCoordreport.TransferNonDirectionalBackupResultsTo()
3.4.15 ComDiff
Overview
Start
Stop
Start
Starts comparisons of calculation results. See SetDiffMode() for more information.
void ComDiff.Start()
S EE ALSO
Stop
Stops comparisons of calculation results. See SetDiffMode() for more information.
void ComDiff.Stop()
S EE ALSO
3.4.16 ComDllmanager
Overview
Report
Report
Prints a status report of currently available external user-defined dlls (e.g. dpl, exdyn) to the
output window. (Same as pressing the ’Report’ button in the dialog.)
void ComDllmanager.Report()
436
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.17 ComDpl
Overview
CheckSyntax
Encrypt
Execute
GetExternalObject*
GetInputParameterDouble*
GetInputParameterInt*
GetInputParameterString*
IsEncrypted*
ResetThirdPartyModule
SetExternalObject
SetInputParameterDouble
SetInputParameterInt
SetInputParameterString
SetResultString
SetThirdPartyModule
CheckSyntax
Checks the syntax and input parameter of the DPL script and all its subscripts.
int ComDpl.CheckSyntax()
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComDpl.Execute()
Encrypt
Encrypts a script and all its subscripts. An encrypted script can be executed without password
but decrypted only with password. If no password is given a ’Choose Password’ dialog appears.
int ComDpl.Encrypt([string password = ''],
[int removeObjectHistory = 1],
[int masterCode = 0])
A RGUMENTS
password (optional)
Password for decryption. If no password is given a ’Choose Password’ dialog
appears.
removeObjectHistory (optional)
Handling of unencrypted object history in database, e.g. used by project versions
or by undo:
0 Do not remove.
1 Do remove (default).
2 Show dialog and ask.
437
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
masterCode (optional)
Used for re-selling scripts. 3rd party licence codes already set in the script will be
overwritten by this value (default = 0).
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComDpl.IsEncrypted()
Execute
Executes the DPL script as subscript.
int ComDpl.Execute([input parameter])
A RGUMENTS
input parameter (optional)
All input parameter from the ’Basic Options’ page of the ’Edit’ dialog can be given
as arguments. If a parameter is not given then the value from the dialog is used.
The values from the dialog itself are not modified. These can be modified via
• ComDpl.SetInputParameterInt()
• ComDpl.SetInputParameterDouble()
• ComDpl.SetInputParameterString().
The arguments are given by reference, thus a subscript can change the value of
a variable from the main script.
R ETURNS
For scripts without the use of exit() the following values are returned:
0 On a successful execution.
1 An error occurred.
6 User hit the break button.
S EE ALSO
ComDpl.CheckSyntax()
E XAMPLE
The following example performs a load-flow and calls the DPL subroutine “CheckVoltages” to
check the voltage conditions.
int err;
err = Ldf.Execute();
if (.not.err) {
err = CheckVoltages.Execute(0.94, 1.05);
}
if (err) {
printf('Voltage conditions are violated');
}
438
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetExternalObject*
Gets the external object defined in the ComDpl edit dialog.
int ComDpl.GetExternalObject(string name,
object& value)
A RGUMENTS
name Name of the external object parameter.
value (out)
The external object.
R ETURNS
0 On success.
1 On error.
S EE ALSO
GetInputParameterDouble*
Gets the double input parameter value defined in the ComDpl edit dialog.
This method is intended to get the database value of the input parameter of another script only
and not to get the current value of an input parameter of another script executed as subscript
as it can be done via ’subscript:input’.
int ComDpl.GetInputParameterDouble(string name,
double& value)
A RGUMENTS
name Name of the double input parameter.
value (out)
Value of the double input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
GetInputParameterInt*
Gets the integer input parameter value defined in the ComDpl edit dialog.
This method is intended to get the database value of the input parameter of another script only
and not to get the current value of an input parameter of another script executed as subscript
as it can be done via ’subscript:input’.
int ComDpl.GetInputParameterInt(string name,
int& value)
439
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
name Name of the integer input parameter.
value (out)
Value of the integer input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
GetInputParameterString*
Gets the string input parameter value defined in the ComDpl edit dialog.
This method is intended to get the database value of the input parameter of another script only
and not to get the current value of an input parameter of another script executed as subscript
as it can be done via ’subscript:input’.
int ComDpl.GetInputParameterString(string name,
string& value)
A RGUMENTS
name Name of the string input parameter.
value (out)
Value of the string input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
IsEncrypted*
Returns the encryption state of the script.
int ComDpl.IsEncrypted()
R ETURNS
1 Script is encrypted.
0 Script is not encrypted.
S EE ALSO
ComDpl.Encrypt()
440
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ResetThirdPartyModule
Resets the third party licence. Only possible for non-encrypted scripts. Requires masterkey
licence for third party module currently set.
int ComDpl.ResetThirdPartyModule()
R ETURNS
0 On success.
1 On error.
SetExternalObject
Sets the external object defined in the ComDpl edit dialog.
This method is intended to change the database value of the external object of another script
only and not to change the current value of an external object of another script executed as
subscript.
Changing the current value of an external object of another script executed as subscript is not
possible. This use-case can only be fulfilled with input parameters of type object.
int ComDpl.SetExternalObject(string name,
object value
)
A RGUMENTS
name Name of the external object parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
SetInputParameterDouble
Sets the double input parameter value defined in the ComDpl edit dialog.
This method is intended to change the database value of the input parameter of another script
only and not to change the current value of an input parameter of another script executed as
subscript.
If you want to change the current value of an input parameter of another script executed as
subscript then you can pass the input parameter as argument to ComDpl.Execute() or set it
directly e.g. ’subscript:input = ...’.
int ComDpl.SetInputParameterDouble(string name,
double value
)
441
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
name Name of the double input parameter.
value Value of the double input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
SetInputParameterInt
Sets the integer input parameter value defined in the ComDpl edit dialog.
This method is intended to change the database value of the input parameter of another script
only and not to change the current value of an input parameter of another script executed as
subscript.
If you want to change the current value of an input parameter of another script executed as
subscript then you can pass the input parameter as argument to ComDpl.Execute() or set it
directly e.g. ’subscript:input = ...’.
int ComDpl.SetInputParameterInt(string name,
int value
)
A RGUMENTS
name Name of the integer input parameter.
value Value of the integer input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
SetInputParameterString
Sets the string input parameter value defined in the ComDpl edit dialog.
This method is intended to change the database value of the input parameter of another script
only and not to change the current value of an input parameter of another script executed as
subscript.
If you want to change the current value of an input parameter of another script executed as
subscript then you can pass the input parameter as argument to ComDpl.Execute() or set it
directly e.g. ’subscript:input = ...’.
int ComDpl.SetInputParameterString(string name,
string value
)
442
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
name Name of the string input parameter.
value Value of the string input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
SetResultString
Method for setting the ’sResultStr’ calc comment parameter of a ComDpl object. This parameter
is used by dpl driven textboxes.
void ComDpl.SetResultString(string result)
A RGUMENTS
result String to set to ’sResultStr’ calc comment parameter.
SetThirdPartyModule
Sets the third party licence to a specific value. Only possible for non-encrypted scripts with no
third party licence set so far. Requires masterkey licence for third party module to be set.
int ComDpl.SetThirdPartyModule(string companyCode,
string moduleCode
)
A RGUMENTS
companyCode
D isplay name or numeric value of company code.
moduleCode
D isplay name or numeric value of third party module.
R ETURNS
0 On success.
1 On error.
443
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.18 ComFlickermeter
Overview
Execute
Execute
Calculates the short- and long-term flicker according to IEC 61000-4-15.
int ComFlickermeter.Execute()
R ETURNS
0 OK
1 Error: column not found in file; other internal errors
2 Error: empty input file
3 Error: cannot open file
4 Internal error: matrix empty
3.4.19 ComGenrelinc
Overview
GetCurrentIteration
GetMaxNumIterations
GetCurrentIteration
The command returns the current iteration number of the ’Run Generation Adequacy’ command
(ComGenrel).
int ComGenrelinc.GetCurrentIteration()
R ETURNS
Returns the current iteration number.
E XAMPLE
object cominc, comexe;
int maxiter, curriter;
cominc = GetFromStudyCase('ComGenrelinc');
comexe = GetFromStudyCase('ComGenrel');
cominc.Execute();
curriter = cominc.GetCurrentIteration();
printf('Current Iter = %d', curriter);
comexe:maxit = 5000;
comexe.Execute();
maxiter = cominc.GetMaxNumIterations();
curriter = cominc.GetCurrentIteration();
printf('Max Iter = %d, Current Iter = %d', maxiter, curriter);
comexe:addit = 1000;
comexe.Execute();
444
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
maxiter = cominc.GetMaxNumIterations();
curriter = cominc.GetCurrentIteration();
printf('Max Iter = %d, Current Iter = %d', maxiter, curriter);
GetMaxNumIterations
The command returns the maximume number of iterations specified in the ’Run Generation
Adequacy’ command (ComGenrel).
int ComGenrelinc.GetMaxNumIterations()
R ETURNS
Returns the maximum number of iterations.
E XAMPLE
object cominc, comexe;
int maxiter, curriter;
cominc = GetFromStudyCase('ComGenrelinc');
comexe = GetFromStudyCase('ComGenrel');
cominc.Execute();
curriter = cominc.GetCurrentIteration();
printf('Current Iter = %d', curriter);
comexe:maxit = 5000;
comexe.Execute();
maxiter = cominc.GetMaxNumIterations();
curriter = cominc.GetCurrentIteration();
printf('Max Iter = %d, Current Iter = %d', maxiter, curriter);
comexe:addit = 1000;
comexe.Execute();
maxiter = cominc.GetMaxNumIterations();
curriter = cominc.GetCurrentIteration();
printf('Max Iter = %d, Current Iter = %d', maxiter, curriter);
3.4.20 ComGridtocim
Overview
AssignCimRdfIds
ConvertAndExport
SetAuthorityUri
SetBoundaries
SetGridsToExport
445
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
AssignCimRdfIds
Assigns CIM RDF IDs for all PowerFactory objects in the active project.
int ComGridtocim.AssignCimRdfIds()
R ETURNS
0 OK
1 Error: The active project was not found
2 Error: Duplicate CIM RDF IDs found in the active project
E XAMPLE
The following example sets CIM RDF IDs to all PowerFactory objects in the active project.
int result;
object gridtocim;
gridtocim = GetFromStudyCase('ComGridtocim');
result = gridtocim.AssignCimRdfIds();
if (result = 0) {
Info('CIM RDF IDs are successfully assigned.');
}
else if (result = 1) {
Error('The active project was not found.');
}
else if (result = 2) {
Error('Duplicate CIM RDF IDs found in the active project.');
}
ConvertAndExport
Convert Grid to CIM and export CIM data to given file path without storing into database. If
no file path is provided, the file path from the corresponding CIM Data Export command in the
study will be used. In case of a validation error the export is not performed.
int ComGridtocim.ConvertAndExport([int validate])
int ComGridtocim.ConvertAndExport(string filePath,
[int validate])
A RGUMENTS
filePath File path for CIM data.
validate (optional)
Option to execute CIM Data Validation before export. If not provided, the validation
is executed. Possible values are
0 Do not validate
1 Validate
R ETURNS
0 OK
1 Error: conversion failed
2 Error: export failed
446
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
This example converts the configured grids in the Grid to the CIM Conversion command, and
export the results to a specified ZIP archive.
object gridtocim;
int error;
gridtocim = GetFromStudyCase('ComGridtocim');
error = gridtocim.ConvertAndExport('e:\export.zip', 1);
if (error = 0) {
Info('OK');
} else if (error = 1) {
Error('Error: conversion failed');
} else {
Error('Error: export failed');
}
SetAuthorityUri
Sets the authority uri for a specific grid.
void ComGridtocim.SetAuthorityUri(object grid,
string uri)
A RGUMENTS
grid Grid for which the URI is to be set.
uri URI of the model authority to be set.
E XAMPLE
This example sets the URI of the model authority for all grids in Grid to the CIM Conversion
command in the active study case.
set grids;
object project, grid, gridtocim;
project = GetActiveProject();
gridtocim = GetFromStudyCase('ComGridtocim');
grids = project.GetContents('*.ElmNet', 1);
for (grid = grids.First(); grid; grid = grids.Next()) {
gridtocim.SetAuthorityUri(grid, 'testUri');
}
SetBoundaries
Sets ”Fictitious border grid” parameter on the grids.
void ComGridtocim.SetBoundaries(set grids)
A RGUMENTS
grids The grids to be set as boundary.
447
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
This example sets a selected grid as a boundary grid. The grid is selected in the grid variable
in External Objects.
object gridtocim;
set boundaries;
gridtocim = GetFromStudyCase('ComGridtocim');
boundaries.Add(grid);
gridtocim.SetBoundaries(boundaries);
SetGridsToExport
Sets the grids as ”Selected” and clears any previous setting.
void ComGridtocim.SetGridsToExport(set grids)
A RGUMENTS
grids The grids to be exported.
E XAMPLE
This example sets all non-boundary grids in the active project for conversion from grid to
CIM.
set grids, gridsToExport;
object project, grid, gridtocim;
int isBoundary;
project = GetActiveProject();
grids = project.GetContents('*.ElmNet', 1);
for (grid = grids.First(); grid; grid = grids.Next()) {
grid.GetVal(isBoundary, 'fictborder');
if (isBoundary = 0) {
gridsToExport.Add(grid);
}
}
gridtocim = GetFromStudyCase('ComGridtocim');
gridtocim.SetGridsToExport(gridsToExport);
3.4.21 ComHostcap
Overview
CalcMaxHostedPower
448
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
CalcMaxHostedPower
The function executes predefined hosting capacty analysis command and returns the max.
hosted power (P, Q) at the given terminal. In addition, object where the violation has occured is
returned.
int ComHostcap.CalcMaxHostedPower(object terminal,
double& P,
double& Q,
object& limitingComponent)
A RGUMENTS
terminal Hosting site.
P (out) Max. active power.
R ETURNS
-1 Selected object is not a terminal.
0 Calculation OK. No violations.
1 Calculation failed.
2 Thermal violation.
3 Voltage violation.
4 Thermal and voltage violation.
5 Protection violation.
6 Power quality violation.
E XAMPLE
external object terminalA;
object cmdHCA, violatedElm;
double dP, dQ;
int absRet;
int iret;
cmdHCA = GetFromStudyCase('ComHostcap');
if (cmdHCA) {
iret = cmdHCA.CalcMaxHostedPower(terminalA, dP, dQ, violatedElm);
! If the calculation was success then the data can be obtained
absRet = abs(iret);
if (absRet <> 1) {
printf('Max. hosted power P, Q is: %.3f MW, %.3f MVAr', dP, dQ);
if (iret .and. violatedElm) {
printf('The most critical element: %o', violatedElm);
printf('Violation type: %d', iret);
}
}
}
449
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.22 ComImport
Overview
GetCreatedObjects
GetModifiedObjects
GetCreatedObjects
Returns the newly created objects after execution of a DGS import.
set ComImport.GetCreatedObjects()
R ETURNS
Collection of objects that have been created during DGS import.
E XAMPLE
The following example returns the created objects after execution of a DGS import:
set created;
object obj;
printf('Created objects:');
created = ImportCmd.GetCreatedObjects();
for(obj = created.First(); obj; obj = created.Next()) {
printf('%o', obj);
}
GetModifiedObjects
Returns the modified objects after execution of a DGS import.
set ComImport.GetModifiedObjects()
R ETURNS
Collection of objects that have been modified during DGS import.
E XAMPLE
The following example returns the modified objects after execution of a DGS import:
set modified;
object obj;
printf('\nModified objects:');
modified = ImportCmd.GetModifiedObjects();
for(obj = modified.First(); obj; obj = modified.Next()) {
printf('%o', obj);
}
450
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.23 ComInc
Overview
ZeroDerivative*
ZeroDerivative*
This function returns 1 if the state variable derivatives are less than the tolerance for the initial
conditions, provided that the Simulation method is set to RMS values and the Verify initial
conditions option is selected in the Calculation of initial conditions command. The tolerance
is defined on the Solver options page in the Maximum error for dynamic model equations field.
The function returns 0 if the aforementioned conditions are not met, or if at least one state
variable has a derivative larger than the tolerance.
int ComInc.ZeroDerivative()
R ETURNS
0 At least one state variable has a derivative larger than the tolerance, or the re-
quired command options have not been set.
1 All state variable derivatives are less than the tolerance.
E XAMPLE
The following example checks whether the initial conditions for the RMS simulation were
calculated and if the command option Verify Initial Conditions has been set.
object oInc;
int result;
oInc = GetCaseObject('ComInc');
oInc.Execute();
result = IsRmsValid();
if (result = 1) {
if (oInc:iopt_show = 1) {
printf('Zero derivative = %d \n', oInc.ZeroDerivative();
}
}
3.4.24 ComLdf
Overview
CheckControllers*
DoNotResetCalc
EstimateOutage
Execute
IsAC*
IsBalanced*
IsDC*
PrintCheckResults
SetOldDistributeLoadMode
451
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
CheckControllers*
Check the conditions of all controllers based on available load flow results. The report will be
printed out in output window.
int ComLdf.CheckControllers()
R ETURNS
Always return 1.
DoNotResetCalc
The load flow results will not be reset even the load flow calculation fails.
int ComLdf.DoNotResetCalc(int doNotReset)
A RGUMENTS
doNotReset
Specifies whether the results shall be reset or not.
0 Reset load flow results if load flow fails.
1 Load flow results will remain even load flow fails.
R ETURNS
Always return 0.
EstimateOutage
Estimate the loading of all branches with outages of given set of branch elements.
int ComLdf.EstimateOutage(set branches,
int init
)
A RGUMENTS
branches The branch elements to be in outage.
init Initialisation of sensitivities.
0 No need to calculate sensitivities; it assumes that sensitivities have
been calculated before hand.
1 Sensitivities will be newly calculated.
R ETURNS
0 On success.
1 On error.
Execute
Performs a load flow analysis on a network. Results are displayed in the single line graphic and
available in relevant elements.
int ComLdf.Execute()
452
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 OK
1 Load flow failed due to divergence of inner loops.
2 Load flow failed due to divergence of outer loops.
IsAC*
Check whether this load flow is configured as AC method or not.
int ComLdf.IsAC()
R ETURNS
0 Is a DC method.
1 Is an AC method.
IsBalanced*
Check whether this load flow command is configured as balanced or unbalanced.
int ComLdf.IsBalanced()
R ETURNS
Returns true if the load flow is balanced.
IsDC*
Check whether this load flow is configured as DC method or not.
int ComLdf.IsDC()
R ETURNS
0 Is an AC method.
1 Is a DC method.
PrintCheckResults
Shows the verification report in the output window.
int ComLdf.PrintCheckResults()
R ETURNS
Always return 1.
SetOldDistributeLoadMode
Set the old scaling mode in case of Distributed Slack by loads.
void ComLdf.SetOldDistributeLoadMode(int iOldMode)
453
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
iOldMode The flag showing if the old model is used.
0 Use standard mode.
1 Use old mode.
3.4.25 ComLink
Overview
GetMicroSCADAStatus
LoadMicroSCADAFile
ReceiveData
SendData
SentDataStatus
SetMicroSCADAStatus
SetOPCReceiveQuality
SetSwitchShcEventMode
GetMicroSCADAStatus
Returns the current status of the link when used in MicroSCADA mode.
int ComLink.GetMicroSCADAStatus()
R ETURNS
Returns one of the following values
-1 undefined
0 dispatcher ldf
1 online state estimation
2 simulation
LoadMicroSCADAFile
Reads in a MicroSCADA snapshot file.
int ComLink.LoadMicroSCADAFile(string filename,
[int populate]
)
A RGUMENTS
filename name of the file to read
populate (optional)
determines whether new values should be populated to the network elements
(0=no, 1=yes)
R ETURNS
0 On success.
1 On error.
454
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ReceiveData
Reads and processes values for all (in PowerFactory configured) items from OPC server (OPC
only).
int ComLink.ReceiveData([int force])
A RGUMENTS
force (optional)
0 (default) Processes changed values (asynchronously) received by Pow-
erFactory via callback
1 Forces (synchronous) reading and processing of all values (independet
of value changes)
R ETURNS
Number of read items
SendData
Sends values from configured measurement objects to OPC server (OPC only).
int ComLink.SendData([int force])
A RGUMENTS
force (optional)
0 (default) Send only data that have been changed and difference be-
tween old and new value is greater than configured deadband
1 Forces writing of all values (independet of previous value)
R ETURNS
Number of written items
E XAMPLE
object measure;
set measureSet;
SentDataStatus
Outputs status of all items marked for sending to output window.
int ComLink.SentDataStatus()
455
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
Number of items configured for sending.
SetMicroSCADAStatus
Sets the current status of the link when used in MicroSCADA mode.
void ComLink.SetMicroSCADAStatus(double status)
A RGUMENTS
status) -1 undefined
0 dispatcher ldf
1 online state estimation
2 simulation
SetOPCReceiveQuality
Allows to override the actual OPC receive quality by this value. (Can be used for testing.)
int ComLink.SetOPCReceiveQuality(int quality)
A RGUMENTS
quality new receive quality (bitmask)
R ETURNS
0 On success.
1 On error.
SetSwitchShcEventMode
Configures whether value changes for switches are directly transferred to the object itself of
whether shc switch events shall be created instead.
void ComLink.SetSwitchShcEventMode(int enabled)
A RGUMENTS
enabled
0 Values are directly written to switches
1 For each value change a switch event will be created
456
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.26 ComMerge
Overview
CheckAssignments
Compare
CompareActive
ExecuteRecording
ExecuteWithActiveProject
GetCorrespondingObject
GetModification
GetModificationResult
GetModifiedObjects
Merge
PrintComparisonReport
PrintModifications
Reset
SetAutoAssignmentForAll
SetObjectsToCompare
ShowBrowser
WereModificationsFound
CheckAssignments
Checks if all assignments are correct and merge can be done.
int ComMerge.CheckAssignments()
R ETURNS
0 On success.
1 Cancelled by user.
2 Missing assignments found.
3 Conflicts found.
4 On other errors.
Compare
Starts a comparison according to the settings in this ComMerge object. The merge browser is
not shown.
int ComMerge.Compare()
CompareActive
Starts a comparison according to the settings in this ComMerge object. The merge browser is
not shown. Can compare with the active project.
int ComMerge.CompareActive()
457
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ExecuteRecording
Starts a comparison according to the settings in this ComMerge object and shows the merge
browser. Records modifications in the active scenario and/or expansion stage of the target
project.
int ComMerge.ExecuteRecording()
ExecuteWithActiveProject
Starts a comparison according to the settings in this ComMerge object and shows the merge
browser. Can compare with the active project.
void ComMerge.ExecuteWithActiveProject()
GetCorrespondingObject
Searches corresponding object for given object.
object ComMerge.GetCorrespondingObject(object sourceObj,
[int target]
)
A RGUMENTS
sourceObj
Object for which corresponding object is searched.
target
0 Get corresponding object from “Base” (default)
1 Get corresponding object from “1st”
2 Get corresponding object from “2nd”
R ETURNS
object Corresponding object.
NULL Corresponding object not found.
GetModification
Gets kind of modification between corresponding objects of “Base” and “1st” or “2nd”.
int ComMerge.GetModification(object sourceObj,
[int taget]
)
A RGUMENTS
sourceObj
Object from any source for which modification is searched.
target
1 Get modification from “Base” to “1st” (default)
2 Get modification from “Base” to “2nd”
458
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error.
1 No modifications (equal).
2 Modified.
3 Added in “1st”/“2nd”.
4 Removed in “1st”/“2nd”.
GetModificationResult
Gets kind of modifications between compared objects in “1st” and “2nd”.
int ComMerge.GetModificationResult(object obj)
A RGUMENTS
obj Object from any source for which modification is searched.
R ETURNS
0 On error.
1 No modifications (equal).
2 Same modifications in “1st” and “2nd” (no conflict).
3 Different modifications in “1st” and “2nd” (conflict).
GetModifiedObjects
Gets all objects with a certain kind of modification.
set ComMerge.GetModifiedObjects(int modType,
[int modSource]
)
A RGUMENTS
modType
1 get unmodified objects
2 get modified objects
3 get added objects
4 get removed obejcts
modSource
1 consider modification between “Base” and “1st” (default)
2 consider modification between “Base” and “2nd”
R ETURNS
Set with matching objects.
Unmodified, modified and added objects are always from given “modSource”, removed ob-
jects are always from “Base” .
459
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
Merge
Checks assignments, merges modifications according to assignments into target and prints
merge report to output window.
void ComMerge.Merge(int printReport)
A RGUMENTS
printReport
1 print merge report (default)
0 do not print merge report
always set to 0 in paste and split mode
PrintComparisonReport
Prints the modifications of all compared objects as a report to the output window.
void ComMerge.PrintComparisonReport(int mode)
A RGUMENTS
mode
0 no report
1 only modified compare objects
2 all compare objects
PrintModifications
Prints modifications of given objects (if any) to the output window.
int ComMerge.PrintModifications(set objs)
int ComMerge.PrintModifications(object obj)
A RGUMENTS
objs Set of objects for which the modifications are printed.
obj Object for which the modifications are printed.
R ETURNS
0 On error: object(s) not found in comparison.
1 On success: modifications were printed.
Reset
Resets/clears and deletes all temp. object sets, created internally for the comparison.
void ComMerge.Reset()
SetAutoAssignmentForAll
Sets the assignment of all compared objects automatically.
void ComMerge.SetAutoAssignmentForAll(int conflictVal)
460
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
conflictVal
Assignment of compared objects with undefined automatic values (e.g. conflicts)
0 no assignment
1 assign from “Base”
2 assign from 1st
3 assign from 2nd
SetObjectsToCompare
Sets top level objects for comparison.
void ComMerge.SetObjectsToCompare(object base,
[object first,]
[object second]
)
A RGUMENTS
base Top level object to be set as “Base”
ShowBrowser
Shows merge browser with initialized settings and all compared objects. Can only be called
after a comparison was executed.
int ComMerge.ShowBrowser()
R ETURNS
0 The browser was left with ok button.
1 The browser was left with cancel button.
2 On error.
WereModificationsFound
Checks, if modifications were found in comparison.
int ComMerge.WereModificationsFound()
R ETURNS
0 All objects in comparison are equal.
1 Modifications found in comparison.
461
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.27 ComMot
Overview
GetMotorConnections*
GetMotorSwitch*
GetMotorTerminal*
GetMotorConnections*
Finds the cables connecting the motor to the switch.
set ComMot.GetMotorConnections(object motor)
A RGUMENTS
motor The motor element
R ETURNS
Returns the set of cables connecting the motor to the switch.
GetMotorSwitch*
Finds the switch which will connect the motor to the network.
object ComMot.GetMotorSwitch(object motor)
A RGUMENTS
motor The motor element
R ETURNS
Returns the switch element.
GetMotorTerminal*
Finds the terminal to which the motor will be connected.
object ComMot.GetMotorTerminal(object motor)
A RGUMENTS
motor The motor element
R ETURNS
Returns the terminal element.
462
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.28 ComNmink
Overview
AddRef
Clear
GenerateContingenciesForAnalysis
GetAll*
AddRef
Adds shortcuts to the objects to the existing selection.
void ComNmink.AddRef(object O)
void ComNmink.AddRef(set S)
A RGUMENTS
O(optional)
an object
S(optional)
a Set of objects
E XAMPLE
The following prepares and executes an outage simulation for all high loaded lines.
PrepOut.Clear();
S = GetCalcRelevantObjects();
O = S.Firstmatch('ElmLne');
while (O) {
if (O:c:loading > 75) {
PrepOut.AddRef(O);
}
O = S.Nextmatch();
}
PrepOut.Execute();
Clear
Delete all contents, i.e. to empty the selection.
void ComNmink.Clear()
E XAMPLE
The following example creates a selection of all loads.
PrepOut.Clear();
objects = GetCalcRelevantObjects();
obj = objects.Firstmatch('ElmLne');
while (obj) {
if (obj:c:loading > 75) {
PrepOut.AddRef(obj);
}
obj = objects.Nextmatch();
}
PrepOut.Execute();
463
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GenerateContingenciesForAnalysis
Generates Contingencies for Contingency Analysis. Similar to calling ’Execute’ but does not
pop-up the contingency command.
int ComNmink.GenerateContingenciesForAnalysis()
R ETURNS
0 On success.
1 On error.
GetAll*
Returns all objects which are of the class 'ClassName'.
set ComNmink.GetAll(string className)
A RGUMENTS
className
The object class name.
R ETURNS
The set of objects
E XAMPLE
The following example writes all three winding transformers in the preparation command to
the output window.
set list;
object obj;
S = Prep.GetAll('ElmTr3');
obj = list.First();
while (obj) {
obj.ShowFullName();
obj = list.Next();
}
3.4.29 ComOmr
Overview
GetFeeders
GetOMR
GetRegionCount
464
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetFeeders
Get all feeders for which optimal manual switches have been determined. This function can be
used after execution of an Optimal Manual Restoration command only.
set ComOmr.GetFeeders()
R ETURNS
The set of all feeders used for optimisation.
E XAMPLE
The following example calculates a pre-configured Optimal Manual Restoration command
and shows the considered feeders in the output window.
int errCode;
object comOmr,
feeder;
set feeders;
comOmr = GetFromStudyCase('ComOmr');
errCode = comOmr.Execute();
if ( errCode=0 ) {
feeders = comOmr.GetFeeders();
printf('The following feeders participated in the optimisation:\n');
for ( feeder = feeders.First(); feeder ; feeder = feeders.Next() ) {
printf(' - %o\n', feeder);
}
}
GetOMR
Get terminal and connected optimal manual switches determined by the optimisation for the
given feeder and its region(pocket) of the given index. For a detailed description of a pocket,
please consult the manual. This function can be used after execution of an Optimal Manual
Restoration command only.
set ComOmr.GetOMR(object arg0,
int arg1
)
A RGUMENTS
arg0 The feeder to derive the resulting optimal terminal with its connected (optimal)
manual switches for.
arg1 The index of the region(pocket) inside the given feeder to derive the resulting
optimal terminal with its connected (optimal) manual switches for.
R ETURNS
The resulting optimal terminal with its connected (optimal) manual switches for the region in
the feeder.
E XAMPLE
The following example calculates a pre-configured Optimal Manual Restoration command
and shows the resulting optimal manual restoration points (together with its connected switches)
in the output window.
465
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
int errCode,
numRegions,
isClass,
regIdx;
object comOmr,
feeder,
obj;
set feeders,
termAndSwitches;
comOmr = GetFromStudyCase('ComOmr');
errCode = comOmr.Execute();
if ( errCode=0 ) {
feeders = comOmr.GetFeeders();
for ( feeder=feeders.First(); feeder; feeder=feeders.Next() ) {
numRegions = comOmr.GetRegionCount(feeder);
for ( regIdx=0; regIdx<numRegions; regIdx=regIdx+1 ) {
termAndSwitches = comOmr.GetOMR(feeder, regIdx);
for ( obj=termAndSwitches.First(); obj; obj=termAndSwitches.Next() ) {
isClass = obj.IsClass('ElmTerm');
if (isClass) {
printf('The optimal terminal in region %d is: %o', regIdx, obj);
}
isClass = obj.IsClass('ElmCoup');
if (isClass) {
printf('Optimal manual switches in region %d are: %o', regIdx, obj);
}
isClass = obj.IsClass('StaSwitch');
if (isClass) {
printf('Optimal manual switches in region %d are: %o', regIdx, obj);
}
}
}
}
}
GetRegionCount
Get total number of regions(pockets) separated by infeeding point, feeder ends and certain
switches for the provided feeder. For a detailed description of a pocket, please consult the
manual. This function can be used after execution of an Optimal Manual Restoration command
only.
int ComOmr.GetRegionCount(object feeder)
A RGUMENTS
feeder Feeder to derive number of regions(pockets) for.
R ETURNS
Number of regions(pockets) for the feeder.
E XAMPLE
The following example calculates a pre-configured Optimal Manual Restoration command
and shows the number of regions(pockets) for the considered feeders in the output window.
int errCode,
466
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
numRegions;
object comOmr,
feeder;
set feeders;
comOmr = GetFromStudyCase('ComOmr');
errCode = comOmr.Execute();
if ( errCode=0 ) {
feeders = comOmr.GetFeeders();
for ( feeder = feeders.First(); feeder ; feeder = feeders.Next() ) {
numRegions = comOmr.GetRegionCount(feeder);
printf(' %o: number of regions: %d\n', feeder, numRegions);
}
}
3.4.30 ComOpc
Overview
ReceiveData
SendData
ReceiveData
Reads and processes values for all (in PowerFactory configured) items from OPC server (OPC
only).
int ComOpc.ReceiveData([int force])
A RGUMENTS
force (optional)
1 Forces (synchronous) reading and processing of all values (independet
of value changes)
R ETURNS
1 if successfully received data -1 if an error occurred -2 if the link is not connected
SendData
Sends values from configured measurement objects to OPC server (OPC only).
int ComOpc.SendData([int force])
A RGUMENTS
force (optional)
0 (default) Send only data that have been changed and difference be-
tween old and new value is greater than configured deadband
1 Forces writing of all values (independet of previous value)
467
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
1 if successfully received data -1 if an error occurred -2 if the link is not connected
3.4.31 ComOutage
Overview
ContinueTrace
ExecuteTime
GetObject*
RemoveEvents
SetObjs
StartTrace
StopTrace
ContinueTrace
Continue the next step of the trace.
int ComOutage.ContinueTrace()
R ETURNS
0 On success.
6= 0 On error.
ExecuteTime
Execute contingency (with multiple time phase) for the given time.
int ComOutage.ExecuteTime(double time)
A RGUMENTS
time the given time to be executed.
R ETURNS
=0 On success.
6= 0 On error.
GetObject*
Get the element stored in line number “line” in the table of ComOutage. The line index starts
with 0.
object ComOutage.GetObject(int line)
A RGUMENTS
line line index, if index exceeds the range NULL is returned
R ETURNS
the element of line “line” in the table.
468
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example shows how to access elements in the table of all ComOutage whose
names start with “L”.
object command,
outage,
obj;
set outages;
int sizeElements,
line;
command = GetFromStudyCase('*.ComSimoutage');
! get rel. command from study case
if (command) {
! get all outages of which the names starts with "L"
outages = command.GetContents('L*.ComOutage');
! show the elements of all outages
for (outage=outages.First(); outage; outage=outages.Next()) {
outage.GetSize('Elements', sizeElements);
! get size of vector Elements
obj = outage.GetObject(line);
!outage.GetVal(obj, 'Elements', line); same like GetObject
obj.ShowFullName();
}
}
RemoveEvents
Remove all events defined in this contingency.
void ComOutage.RemoveEvents ([int info])
void ComOutage.RemoveEvents (string type)
void ComOutage.RemoveEvents (int info, string type)
void ComOutage.RemoveEvents (string type, int info)
A RGUMENTS
type
none Hidden objects are ignored and not added to the set
'Lod' remove all EvtLod
'Gen' remove all EvtGen
'Switch' remove all EvtSwitch
info(optional)
1 show info message in output window (default)
0 do not show info message
E XAMPLE
The following example shows how to remove events from ComOutage.
object command,
outage;
set outages;
command = GetFromStudyCase('*.ComSimoutage');
469
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
SetObjs
To fill up the ”interrupted components” with given elements.
Sets the list of objects according to S.
int ComOutage.SetObjs(set S)
A RGUMENTS
S the set of objects
R ETURNS
0 On success.
1 On error.
StartTrace
Start trace all post fault events of this contingency.
int ComOutage.StartTrace()
R ETURNS
=0 On success.
6= 0 On error.
StopTrace
To stop the trace.
int ComOutage.StopTrace([int msg])
A RGUMENTS
msg (optional)
Emit messages or not.
0 Suppress messages.
1 Emit messages.
R ETURNS
=0 On success.
6= 0 On error.
470
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.32 ComPfdimport
Overview
GetImportedObjects
GetImportedObjects
Returns the imported objects of last execution of command.
set ComPfdimport.GetImportedObjects()
R ETURNS
Returns the imported objects of the last execution of the command.
E XAMPLE
object com;
object importedObject;
set importedObjects;
com = GetFromStudyCase('ComPfdimport');
SetConsistencyCheck(0);
com:g_target = GetCurrentUser();
com:g_file = 'D:/test.pfd';
SetConsistencyCheck(1);
com.Execute();
importedObjects = com.GetImportedObjects();
printf('All imported objects:');
for (importedObject = importedObjects.First();
importedObject;
importedObject = importedObjects.Next())
{
printf('%o', importedObject);
}
3.4.33 ComPrjconnector
Overview
GetSuccesfullyConnectedItems
GetUnsuccesfullyConnectedItems
GetSuccesfullyConnectedItems
Returns a list of elements which were correctly processed in the last run of the command
set ComPrjconnector.GetSuccesfullyConnectedItems()
471
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetUnsuccesfullyConnectedItems
Returns a list of elements which were not correctly processed in the last run of the command
set ComPrjconnector.GetUnsuccesfullyConnectedItems()
3.4.34 ComProtgraphic
Overview
AddToUpdatePages
ClearUpdatePages
AddToUpdatePages
Adds pages (*.SetVipage) to the user-defined selection of plot pages to update.
void ComProtgraphic.AddToUpdatePages(set pages)
ClearUpdatePages
Clears the user-defined selection of plot pages to update.
void ComProtgraphic.ClearUpdatePages()
3.4.35 ComPvcurves
Overview
FindCriticalBus
FindCriticalBus
Returns the critical bus for a given PV-Curve result file. The critical bus is the one with the
highest gradient at the last iteration. If a bus is found, whose voltage drop is twice as high, as
the one with the highest gradient, the bus with the higher voltage drop is the critical one.
object ComPvcurves.FindCriticalBus(object resultfile)
3.4.36 ComPython
Overview
GetExternalObject*
GetInputParameterDouble*
GetInputParameterInt*
GetInputParameterString*
SetExternalObject
SetInputParameterDouble
SetInputParameterInt
SetInputParameterString
472
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetExternalObject*
Gets the external object defined in the ComPython edit dialog.
int ComPython.GetExternalObject(string name,
object& value)
A RGUMENTS
name Name of the external object parameter.
value (out)
The external object.
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComPython.SetExternalObject(), ComPython.GetInputParameterInt(),
ComPython.GetInputParameterDouble(), ComPython.GetInputParameterString()
GetInputParameterDouble*
Gets the double input parameter value defined in the ComPython edit dialog.
int ComPython.GetInputParameterDouble(string name,
double& value)
A RGUMENTS
name Name of the double input parameter.
value (out)
Value of the double input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComPython.SetInputParameterDouble(), ComPython.GetInputParameterInt(),
ComPython.GetInputParameterString(), ComPython.GetExternalObject()
GetInputParameterInt*
Gets the integer input parameter value defined in the ComPython edit dialog.
int ComPython.GetInputParameterInt(string name,
int& value)
A RGUMENTS
name Name of the integer input parameter.
value (out)
Value of the integer input parameter.
473
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComPython.SetInputParameterInt(), ComPython.GetInputParameterDouble(),
ComPython.GetInputParameterString(), ComPython.GetExternalObject()
GetInputParameterString*
Gets the string input parameter value defined in the ComPython edit dialog.
int ComPython.GetInputParameterString(string name,
string& value)
A RGUMENTS
name Name of the string input parameter.
value (out)
Value of the string input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComPython.SetInputParameterString(), ComPython.GetInputParameterInt(),
ComPython.GetInputParameterDouble(), ComPython.GetExternalObject()
SetExternalObject
Sets the external object defined in the ComPython edit dialog.
int ComPython.SetExternalObject(string name,
object value
)
A RGUMENTS
name Name of the external object parameter.
value The external object.
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComPython.GetExternalObject(), ComPython.SetInputParameterInt(),
ComPython.SetInputParameterDouble(), ComPython.SetInputParameterString()
474
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
SetInputParameterDouble
Sets the double input parameter value defined in the ComPython edit dialog.
int ComPython.SetInputParameterDouble(string name,
double value
)
A RGUMENTS
name Name of the double input parameter.
value Value of the double input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComPython.GetInputParameterDouble(), ComPython.SetInputParameterInt(),
ComPython.SetInputParameterString(), ComPython.SetExternalObject()
SetInputParameterInt
Sets the integer input parameter value defined in the ComPython edit dialog.
int ComPython.SetInputParameterInt(string name,
int value
)
A RGUMENTS
name Name of the integer input parameter.
value Value of the integer input parameter.
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComPython.GetInputParameterInt(), ComPython.SetInputParameterDouble(),
ComPython.SetInputParameterString(), ComPython.SetExternalObject()
SetInputParameterString
Sets the string input parameter value defined in the ComPython edit dialog.
int ComPython.SetInputParameterString(string name,
string value
)
A RGUMENTS
name Name of the string input parameter.
value Value of the string input parameter.
475
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On success.
1 On error.
S EE ALSO
ComPython.GetInputParameterString(), ComPython.SetInputParameterInt(),
ComPython.SetInputParameterDouble(), ComPython.SetExternalObject()
3.4.37 ComRed
Overview
LdfEquivalentVerification
ReductionInMemory
ResetReductionInMemory
SimEquivalentVerification
LdfEquivalentVerification
Right after Network Reduction execution, get the verification results of the load flow equivalents.
int ComRed.LdfEquivalentVerification()
R ETURNS
-1 Calculation is not available or the varification is not enabled.
0 The reduced network is equivalent to the original network.
1 The load flow doesn’t converge after reduction.
2 The load flow converges after reduction but the results differ from original net-
work.
ReductionInMemory
Execute network reduction in memory, no change to database. Note: afterwards, the function
ResetReductionInMemory() must be called to revert the reduction.
int ComRed.ReductionInMemory()
R ETURNS
Returns 0 if successfully executed.
E XAMPLE
object redCom;
redCom = GetCaseObject('ComRed');
if (redCom = NULL) {
Error('No Network Reduction Command found in active study case!');
exit();
}
redCom.ReductionInMemory();
476
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ResetReductionInMemory
Restore the network back to original after reduction in memory.
void ComRed.ResetReductionInMemory()
E XAMPLE
object redCom;
redCom = GetCaseObject('ComRed');
if (redCom = NULL) {
Error('No Network Reduction Command found in active study case!');
exit();
}
redCom.ResetReductionInMemory();
SimEquivalentVerification
Right after Network Reduction execution, get the verification results of the dynamic simulation
equivalents.
int ComRed.SimEquivalentVerification()
R ETURNS
-1 Calculation is not available or the varification cannot be carried out.
0 The reduced network is equivalent to the original network.
1 The dynamic simulation fails after reduction.
2 The dynamic simulation works after reduction but the results differ from original
network.
3.4.38 ComRel3
Overview
AnalyseElmRes
ExeEvt
OvlAlleviate
RemoveEvents
RemoveOutages
ValidateConstraints
AnalyseElmRes
Evaluate the results object created by the last calculation. Performs exactly the same as
pressing the button 'Perform Evaluation of Result File' in the dialogue box of the command.
int ComRel3.AnalyseElmRes([int error])
A RGUMENTS
error (optional)
477
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
=0 On success.
6= 0 On error.
E XAMPLE
The following example shows how to call the evaluation of the results.
object command,
resultFile;
int err;
command = GetFromStudyCase('.ComRel3');
! get the command from study case
if (command) {
err=command.AnalyseElmRes(0);
! hide error message
if (err) {
! display my own error message
resultFile = command:p_resenum;
if (resultFile) {
Error('Evaluation of results %s failed', resultFile:loc_name);
}
}
}
ExeEvt
Executes a given event.
void ComRel3.ExeEvt([object event])
A RGUMENTS
event The event that shall be executed.
OvlAlleviate
Performs an overload alleviation for given events.
int ComRel3.OvlAlleviate([set preCalcEvents])
A RGUMENTS
preCalcEvents (optional)
The events which will be executed before the calculation.
R ETURNS
0 On success.
1 Failure in load flow.
2 No overloading detected.
>2 On error.
478
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
RemoveEvents
Removes all events stored in all contingencies (*.ComContingency) inside the reliability com-
mand.
void ComRel3.RemoveEvents()
E XAMPLE
The following example shows how to remove events from all contingencies stored inside the
reliability command:
object command;
command = GetFromStudyCase('*.ComRel3');
! get reliability command from study case
if (command) {
command.RemoveEvents();
}
RemoveOutages
Removes all contingency definitions (*.ComContingencies) stored inside the reliability com-
mand.
void ComRel3.RemoveOutages([int msg])
A RGUMENTS
msg( optional)
1 Show info message in output window (default value).
0 Do not emit messages.
E XAMPLE
The following example removes all ComContingencies objects stored inside the reliability
command in the study case.
object command;
command = GetFromStudyCase('*.ComRel3');
! get the command from study case
if (command) {
command.RemoveOutages(0);
! suppress info message
}
ValidateConstraints
Checks if the restoration of a contingency violates any constraint according to the current
settings of the reliability calculation. These do not necessarily have to be the settings used
during calculation. Of course the selected calculation method of ComRel3 has to be ’Load flow
analysis’ to check for constraint violations.
int ComRel3.ValidateConstraints(object contingency)
479
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
contingency
The contingency which will be checked for constraint violations.
R ETURNS
0 No constraint violations, or all constraint violations could be solved.
1 Constraints are violated.
−1 Contingency not valid.
−2 Load flow did not converge.
−3 Network error.
3.4.39 ComRelpost
Overview
CalcContributions
GetContributionOfComponent
CalcContributions
Calculates the contributions to load interruptions of the loads that are passed to this function.
The loads can be e.g. inside a feeder or a zone as well. If nothing is passed as input all loads
will be analysed.
int ComRelpost.CalcContributions([set elements])
A RGUMENTS
elements (optional)
Elements (Loads) for which the contributions shall be calculated (default: all loads,
if no argument is passed).
R ETURNS
0 Calculation successful.
1 On error.
E XAMPLE
The following example shows how to calculate the contributions for all elements.
object command;
int err;
command = GetFromStudyCase('*.ComRelpost');
if (command) {
err=command.CalcContributions();
}
480
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetContributionOfComponent
Gets the contributions of a component to a certain reliability indice.
double ComRelpost.GetContributionOfComponent(int componentNr,
string indice)
A RGUMENTS
componentNr 1. Lines
2. Cables
3. Transformers
4. Busbars
5. Generators
6. Common Modes
7. Double Earth Faults
indice Avalaible indices are: ’SAIFI’, ’SAIDI’, ’ASIFI’, ’ASIDI’, ’ENS’, ’EIC’
R ETURNS
The contribution of this component to this reliability indice.
E XAMPLE
See ’Reliability Contributions Report’ . The link to this report can be found in the contribution
to reliability indices command.
3.4.40 ComRelreport
Overview
GetContingencies*
GetContributionOfComponent
GetContingencies*
Gets all contingencies of reliability for reporting.
set ComRelpost.GetContingencies()
R ETURNS
All contingencies of reliability for reporting.
GetContributionOfComponent
Is described in ComRelpost.GetContributionOfComponent().
double ComRelreport.GetContributionOfComponent(int componentNr,
string indice)
481
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.41 ComReltabreport
Overview
GetContingencies*
GetContributionOfComponent
GetContingencies*
Gets all contingencies of reliability for reporting.
set ComReltabreport.GetContingencies()
R ETURNS
All contingencies of reliability for reporting.
GetContributionOfComponent
Is described in ComRelpost.GetContributionOfComponent().
double ComReltabreport.GetContributionOfComponent(int componentNr,
string indice)
3.4.42 ComReport
Overview
ExecuteWithCustomSelection
SetParameter
ExecuteWithCustomSelection
Executes report generation with the given reports as well as front matter and header/footer
template.
This method allows to override the regular report selection configured for the currently active
calculation as well as the configured front matter and header/footer template, with a freely
defined selection.
Since virtually any report templates can be selected (even those that were not designed for the
currently active calculation), this method should be employed by experienced users only.
int ComReport.ExecuteWithCustomSelection(set reports,
[object frontMatter],
[object headerFooter])
A RGUMENTS
reports The reports to be selected.
frontMatter (optional)
The front matter template to be used. If not given, no front matter will be selected.
headerFooter (optional)
The header/footer template to be used. If not given, no header/footer will be
482
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
selected.
R ETURNS
The same return value as a regular ’Execute’ call.
SetParameter
Overrides the initial value of the given report’s parameter with the given value.
This method is the scripting equivalent of overriding the value of a report parameter in the Report
Generation command (ComReport) dialog and should only be employed by experienced users.
int ComReport.SetParameter(object report,
string parameterIdentifier,
int|double|string value)
A RGUMENTS
report The report that provides the desired parameter.
parameterIdentifier
The identifier (not the localised name) of the parameter.
R ETURNS
An error code. Possible values are
3.4.43 ComRes
Overview
ExportFullRange*
FileNmResNm
ExportFullRange*
Executes the export command for the whole data range.
void ComRes.ExportFullRange()
E XAMPLE
The following example exports the complete range of results
object obj,
483
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
export;
set range;
export = GetFromStudyCase('*.ComRes');
range = SEL.GetAll('ElmRes');
obj = range.First();
while (obj) {
export:pResult = obj;
export.ExportFullRange();
obj = range.Next();
}
FileNmResNm
Sets the filename for the data export to the name of the result object being exported (classes:
ElmRes, IntComtrade)
void ComRes.FileNmResNm()
E XAMPLE
The following example searches the export command in the study case, assigns the first
ElmRes found and sets the filename of the export command to the name of the result file
object.
object export,
res;
export = GetFromStudyCase('*.ComRes');
if (export=nullptr) {
exit(1);
}
res = GetFromStudyCase('*.ElmRes');
if (res=nullptr) {
exit(1);
}
export:pResult = res;
export.FileNmResNm();
3.4.44 ComShc
Overview
ExecuteRXSweep
GetFaultType*
GetOverLoadedBranches
GetOverLoadedBuses
484
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ExecuteRXSweep
Calculates RX Sweep. If no impedance passed, the value from the command shall be used. If
argument passed then the impedance changes are stored to the command (Rf, Xf).
int ComShc.ExecuteRXSweep()
int ComShc.ExecuteRXSweep(double Zr,
double Zi
)
A RGUMENTS
Zr Impedance real part
Zi Impedance imaginary part
R ETURNS
=0 On success.
6= 0 On error.
GetFaultType*
Returns the short-circuit fault type.
int ComShc.GetFaultType()
R ETURNS
0 three phase fault
1 single phase to ground
2 two phase fault
3 two phase to ground fault
4 three phase unbalanced fault
5 single phase to neutral fault
6 single phase, neutral to ground fault
7 two phase to neutral fault
8 two phase, neutral to ground fault
9 three phase to neutral fault
10 three phase, neutral to ground fault
20 DC fault
GetOverLoadedBranches
Get overloaded branches after a short-circuit calculation.
int ComShc.GetOverLoadedBranches(double ip,
double ith,
[set& branches]
)
A RGUMENTS
ip Max. peak-current loading, in %
ith Max. thermal loading, in %
branches (out)
Set of branches which are checked
485
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
=0 On error or 0 branches found.
6= 0 Number of branches.
E XAMPLE
object oShcCmd, oBranch;
double dIpload, dIthload;
set sBranch;
int iret;
dIpload = 500;
dIthload = 100;
oShcCmd = GetFromStudyCase('ComShc');
iret = oShcCmd.GetOverLoadedBranches(dIpload, dIthload, sBranch); ! Shall check all branches
if (iret > 0) {
oBranch = sBranch.First();
while (oBranch) {
printf('Overloaded branch: %o \n', oBranch);
oBranch = sBranch.Next();
}
}
GetOverLoadedBuses
Get overloaded buses after a short-circuit calculation.
int ComShc.GetOverLoadedBuses(double ip,
double ith,
[set& buses])
A RGUMENTS
ip Max. peak-current loading, in %
ith Max. thermal loading, in %
buses (optional, out)
Set of buses which are checked
R ETURNS
=0 On error or 0 buses found.
6= 0 Number of buses.
E XAMPLE
object oShcCmd, oBus;
double dIpload, dIthload;
set sBus;
int iret;
dIpload = 500;
dIthload = 100;
oShcCmd = GetFromStudyCase('ComShc');
iret = oShcCmd.GetOverLoadedBuses(dIpload, dIthload, sBus); ! Shall check all buses
if (iret > 0) {
oBus = sBus.First();
while (oBus) {
486
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.45 ComShctrace
Overview
BlockSwitch
ExecuteAllSteps
ExecuteInitialStep
ExecuteNextStep
GetBlockedSwitches
GetCurrentTimeStep
GetDeviceSwitches
GetDeviceTime
GetNonStartedDevices
GetStartedDevices
GetSwitchTime
GetTrippedDevices
NextStepAvailable
BlockSwitch
Blocks a switch from operating for the remainder of the trace.
int ComShctrace.BlockSwitch(object switchDevice)
A RGUMENTS
switchDevice
Switch device to block.
R ETURNS
0 Switch can not be blocked (e.g. because it already operated).
1 Switch is blocked.
ExecuteAllSteps
Executes all steps of the short circuit trace. This function requires the trace to be already
running
int ComShctrace.ExecuteAllSteps()
R ETURNS
0 No error occurred, trace is complete.
!=0 An error occurred, calculation was reset.
S EE ALSO
ComShctrce.ExecuteInitialStep()
487
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ExecuteInitialStep
Executes the first step of the short circuit trace.
int ComShctrace.ExecuteInitialStep()
R ETURNS
0 No error occurred, the short-circuit trace is now running.
!=0 An error occurred, calculation was reset.
ExecuteNextStep
Executes the next step of the short circuit trace. This function requires the trace to be already
running
int ComShctrace.ExecuteNextStep()
R ETURNS
0 No error occurred, step was executed .
!=0 An error occurred, calculation was reset.
S EE ALSO
ComShctrce.ExecuteInitialStep()
GetBlockedSwitches
Returns all switches which are currently blocked.
set ComShctrace.GetBlockedSwitches()
R ETURNS
All blocked switches.
GetCurrentTimeStep
Returns the current time step of the trace in seconds.
int ComShctrace.GetCurrentTimeStep()
R ETURNS
The current time step in [s].
GetDeviceSwitches
Returns all switches operated by a protection device.
set ComShctrace.GetDeviceSwitches(object device)
A RGUMENTS
device Protection device to get the switches for.
488
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
All switches devices operated by the protection device.
GetDeviceTime
Returns the time a protection device operated or will operate at.
int ComShctrace.GetDeviceTime(object device)
A RGUMENTS
device Protection device to get the time for.
R ETURNS
The tripping time of the device itself, if the device already tripped, or the prospective tripping
time.
GetNonStartedDevices
Returns all protection devices which are not started.
set ComShctrace.GetNonStartedDevices()
R ETURNS
All protection devices which are not started.
GetStartedDevices
Returns all started but not yet tripped protection devices.
set ComShctrace.GetStartedDevices()
R ETURNS
All started but not yet tripped protection devices.
GetSwitchTime
Returns the time a switch device operated or will operate at.
int ComShctrace.GetSwitchTime(object device,
object switchDevice
)
A RGUMENTS
device Reference protection device for the switch.
device Switch device to get the time for.
R ETURNS
The tripping time of the switch device, based on the tripping time of the reference protection
device. If the switch already operated, the time of operation will be returned.
489
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetTrippedDevices
Returns all protection devices already tripped.
set ComShctrace.GetTrippedDevices()
R ETURNS
All protection devices already tripped.
NextStepAvailable
Indicates whether or not a next time step can be executed.
int ComShctrace.NextStepAvailable()
R ETURNS
0 Next step is not available, the trace is completed.
1 A next step is available.
3.4.46 ComSim
Overview
GetSimulationTime
GetTotalWarnA
GetTotalWarnB
GetTotalWarnC
GetViolatedScanModules*
LoadSnapshot
SaveSnapshot
GetSimulationTime
Get the actual simulation time if the initial conditions are calculated.
int ComSim.GetSimulationTime()
R ETURNS
Returns the simulation time in seconds. If the initial conditions are not calculated, then the
function returns ’nan’.
GetTotalWarnA
Returns the total number of type-A (serious) warnings related to the time-domain simulation.
int ComSim.GetTotalWarnA()
R ETURNS
Returns the total number of type-A (serious) warnings.
490
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetTotalWarnB
Returns the total number of type-B (moderate) warnings related to the time-domain simulation.
int ComSim.GetTotalWarnB()
R ETURNS
Returns the total number of type-B (moderate) warnings.
GetTotalWarnC
Returns the total number of type-C (minor) warnings related to the time-domain simulation.
int ComSim.GetTotalWarnC()
R ETURNS
Returns the total number of type-C (minor) warnings.
GetViolatedScanModules*
Returns a set of scan modules of which each have at least one violation.
set ComSim.GetViolatedScanModules()
R ETURNS
Returns a set of scan modules of which each have at least one violation.
E XAMPLE
See example ScnFreq.GetViolationTime().
LoadSnapshot
Load the state of a dynamic simulation from a file.
int ComSim.LoadSnapshot([string snapshotFilePath], [int suppressUserMessage])
D EPRECATED N AMES
LoadSimulationState
A RGUMENTS
snapshotFilePath (optional)
The snapshot file to load. If no file is specified, the last snapshot stored in the
memory is used. (default = ”)
suppressUserMessage (optional)
The pop-up window asking for data overwrite is not displayed if this value is set to
1. (default = 0)
R ETURNS
0 Saved simulation state has been loaded.
1 Saved simulation state cannot be loaded.
2 Saved simulation state does not match actual model. Calculation will be reset.
491
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
SaveSnapshot
Save the state of a dynamic simulation to memory and to a file.
int ComSim.SaveSnapshot(string snapshotFilePath, [int suppressUserMessage])
D EPRECATED N AMES
SaveSimulationState
A RGUMENTS
snapshotFilePath (optional)
The snapshot file to save. If no file is specified, the last snapshot is saved in the
non-persistent memory slot. (default = ”)
suppressUserMessage (optional)
The pop-up window asking for file overwriting is not displayed if this value is set to
1. (default = 0)
R ETURNS
0 OK
1 Error
3.4.47 ComSimoutage
Overview
AddCntcy
AddContingencies
AddRas
ClearCont
CreateFaultCase
Execute
ExecuteAndCheck
GetNTopLoadedElms*
MarkRegions
RemoveAllRas
RemoveContingencies
RemoveRas
Reset
SetLimits
Update
AddCntcy
Executes an (additional) ComOutage, without resetting results. The results of the outage
analysis will be added to the intermediate results. Object “O” must be a ComOutage object.
If the outage definition has already been analyzed, it will be ignored. The ComOutage will be
renamed to “name” when “name” is given.
int ComSimoutage.AddCntcy(object O,
[string name]
)
A RGUMENTS
O The ComOutage object
492
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On success.
1 On error.
E XAMPLE
The following example analyses all selected outage definitions and adds the results to the
intermediate results.
set outages;
object limit;
outages = SEL.GetAll('ComOutage');
limit = outages.First();
while (limit) {
CA.AddCntcy(obj);
limit = outages.Next();
}
AddContingencies
Adds contingencies for fault cases/groups selected by the user to the command. Shows a modal
window with the list of available fault cases and groups. Functionality as “Add Cases/Groups”
button in dialog.
void ComSimoutage.AddContingencies()
E XAMPLE
object command;
command.AddContingencies();
AddRas
Adds a reference to a given IntRas to the ComSimoutage.
int ComSimoutage.AddRas(object ras)
A RGUMENTS
ras The IntRas object
R ETURNS
0 If the reference to the IntRas has been added.
1 If the reference to the IntRas has already been there or on error.
ClearCont
Reset existing contingency analysis results and delete existing contingency cases.
int ComSimoutage.ClearCont()
493
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On success.
1 On error.
CreateFaultCase
Create fault cases from the given elements.
int ComSimoutage.CreateFaultCase(set elms,
int mode,
[int createEvt],
[object folder]
)
A RGUMENTS
elms Selected elements to create fault cases.
mode How the fault cases are created:
createEvt (optional)
Switch event:
0 Do NOT create switch events.
1 Create switch events.
folder (optional)
Folder in which the fault case is stored.
R ETURNS
0 On success.
1 On error.
Execute
Execute contingency analysis.
int ComSimoutage.Execute()
R ETURNS
0 On success.
1 On error.
494
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ExecuteAndCheck
Executes contingency analysis and checks the violated constraints. The constraints are defined
in models, such as maximum and minimum voltage of buses, maximum loading of lines etc.
On the first occured constraint violation, the further contingency execution will be terminated,
making the calculation faster, but with less information.
int ComSimoutage.ExecuteAndCheck([int workMode,]
[int initMode,]
[int considerOPFflags,]
[int considerVstep]
)
A RGUMENTS
workMode (optional)
the mode how the contingency analysis is executed; default is 0
0 Normal execution (doesn’t check limits, write results file)
1 Check constraints (thermal loading, bus voltage range) and terminate
execution if violates any limit, writes result file
2 Check constraints (thermal loading, bus voltage range) and terminate
execution if violates any limit, does not write result file
3 Check thermal loading only and terminate execution if violates any
limit, writes result file
4 Check thermal loading only and terminate execution if violates any
limit, does not write result file
5 Check voltage limits only and terminate execution if violates any limit,
writes result file
6 Check voltage limits only and terminate execution if violates any limit,
does not write result file
7 Neither loading nor voltage limits are checked and terminate execution
if any contingency fails, writes result file
8 Neither loading nor voltage limits are checked and terminate execution
if any contingency fails, does not write result file
initMode (optional)
the mode how the contingency analysis is initialised; default is 0
0 full initialisation, new topology rebuild, and update all contingencies
1 new topology rebuild, but skip updating all contingencies
2 no topology rebuild, and no contingency update, which is the fastest
mode
considerOPFflags (optional)
whether the voltage limit settings on OPF page will be considered or not; default
is 1
0 the settings on OPF page are not considered.
1 the voltage limits are considered only when the check boxes on OPF
page are ticked.
considerVstep (optional)
whether the voltage step limits will be considered or not; default is 1
0 the voltage step limits are not considered.
1 the voltage step limits are considered.
495
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 contingencies successfully executed without any violation
1 calculation was interrupted by the user
2 error occurred during contingency analysis
3 initialisation failed, such as base case laod flow diverged
4 for AC/DC combined method, base case is already critical and calculation stopped
5 any loading constraint violated
6 any contingency cannot be analysed, non-convergent case
7 any voltage constraint violated
8 any constraint violated already in the base case
GetNTopLoadedElms*
To get certain number of top loaded components (most close to its limit).
void ComSimoutage.GetNTopLoadedElms(int number,
set& elements)
A RGUMENTS
number The number of elements to be found.
elements (out)
The top loaded elements.
MarkRegions
To execute Region marker for certain system status (like prefault, post fault etc.), which will
indentifies energizing mode for each element.
int ComSimoutage.MarkRegions(int stage)
A RGUMENTS
stage which system stage to be analyzed, 0¡=stage¡=2
R ETURNS
0 On success.
1 On error.
RemoveAllRas
Removes all IntRas from to the ComSimoutage. Only deletes the references not the IntRas
itself.
void ComSimoutage.RemoveAllRas()
RemoveContingencies
Removes all contingencies from the command. Functionality as ”Remove All” button in dialog.
void ComSimoutage.RemoveContingencies()
496
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
object command;
command.RemoveContingencies();
RemoveRas
Removes the reference to a given IntRas from the ComSimoutage.
int ComSimoutage.RemoveRas(object ras)
A RGUMENTS
ras The IntRas object
R ETURNS
0 If the reference to the IntRas has been successfully removed.
1 If the reference to the IntRas has not been in the container or on error.
Reset
Resets the intermediate results of the outage simulation.
int ComSimoutage.Reset()
R ETURNS
0 On success.
1 On error.
SetLimits
Sets the recording limits for the Contingency Analysis.
void ComSimoutage.SetLimits(double vlmin,
double vlmax,
double ldmax)
A RGUMENTS
vlmin The minimum voltage
vlmax The maximum voltage
ldmax The maximum loading
Update
To update contingency cases via topology search. It will find interrupted elements, required
switch actions for each contingency.
int ComSimoutage.Update()
497
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On success.
1 On error.
3.4.48 ComSvgexport
Overview
SetFileName
SetObject
SetObjects
SetFileName
Sets SVG file for export.
void ComSvgexport.SetFileName(string path)
A RGUMENTS
path Path of target SVG file
SetObject
Sets annotation layer or group for export.
void ComSvgexport.SetObject(object obj)
A RGUMENTS
obj Annotation layer (IntGrflayer) or group (IntGrfgroup) to be exported
SetObjects
Sets annotation layers and groups for export.
void ComSvgexport.SetObjects(set objs)
A RGUMENTS
objs Set of annotation layers (IntGrflayer) and/or groups (IntGrfgroup) to be exported
498
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.49 ComSvgimport
Overview
SetFileName
SetObject
SetFileName
Sets source SVG file for import.
void ComSvgimport.SetFileName(string path)
A RGUMENTS
path Path of SVG file to be imported
SetObject
Sets target annotation layer or group for import.
void ComSvgimport.SetObject(object obj)
A RGUMENTS
obj Target annotation layer (IntGrflayer) or group (IntGrfgroup)
3.4.50 ComTablereport
Overview
AddButton
AddCellAction
AddColumn
AddCurve
AddHeader
AddInvisibleFilter
AddListFilter
AddListFilterEntries
AddMultiListFilter
AddPlot
AddRow
AddTable
AddTabularFilter
AddTextFilter
AddXLabel
ClearAll
DisableAutomaticRowNumbering
DisableSingleFilterRefresh
DisplayButtonsCollapsible
DisplayFiltersCollapsible
DisplayFiltersIn2Columns
DisplayHeadersCollapsible
EnableAutomaticRowNumbering
499
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ExportToExcel
ExportToHTML
FindNextCell
FindNextRow
FindPreviousCell
FindPreviousRow
GetCellAccessObject
GetCellAlignment
GetCellBackgroundColor
GetCellColor
GetCellEditObjects
GetCellFontStyle
GetCellFormat
GetCellHelpText
GetCellValueType
GetCheckboxCellValue
GetColumnFilter
GetColumnHeader
GetColumnId
GetDateCellValue
GetDoubleCellValue
GetIntCellValue
GetNumberOfColumns
GetNumberOfRows
GetNumberOfSelectedCells
GetObjectCellValue
GetRowCaption
GetRowId
GetSelectedCell
GetSelectedElements
GetSelection
GetStringCellValue
GoToCell
HasCell
HasColumnAutoFilter
IsColumnScrollable
IsColumnSortable
IsRowVisible
RemoveRow
SetBarLimits
SetCellAccess
SetCellEdit
SetCellValueToBar
SetCellValueToCheckbox
SetCellValueToDate
SetCellValueToDouble
SetCellValueToInt
SetCellValueToObject
SetCellValueToString
SetColumnHeader
SetCurveValue
SetDialogSize
SetExportHtml
SetExportXls
SetListFilterSelection
SetNumberFormatForPlot
500
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
SetRefresh
SetSorting
SetStatusText
SetTextAxisDistForPlot
SetTicksForPlot
SetTitle
AddButton
Adds a button to the button section of the report.
int ComTablereport.AddButton(string id,
string label,
[int width,]
[int newLine,]
[int refresh]
)
A RGUMENTS
id Identifier
label Label text
width (optional)
Button width in pixel (default: 100)
newLine (optional)
0 Place button floating (default)
1 Place button in a new line
refresh (optional)
0 Do not refresh report after button was handled (default)
1 Refresh report after button was handled
R ETURNS
0 On error: button with given id already exists.
1 Button was added to the report.
AddCellAction
Adds a cell action to a table cell. This means that an entry is added to the right mouse button
menue of the cell.
int ComTablereport.AddCellAction(string tableId,
string columnId,
string rowId,
string actionId,
string displayText,
[set actionObjects,]
[int refresh]
)
501
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
actionId Identifier for the action
displayText (optional)
Text to be displayed in the right mouse button menue for this action
actionObjects (optional)
Objects needed to handle this action (default: empty). These objects are passed
as input to the “Action” script.
refresh (optional)
0 Do not refresh report after action was handled
1 Refresh report after action was handled (default)
R ETURNS
0 On error: cell with given ids does not exist.
1 Action was added.
AddColumn
Adds a column to the table.
void ComTablereport.AddColumn(string tableId,
string columnId,
string caption,
[int columnWidth,]
[int hasAutoFilter,]
[int isSortable,]
[int isScrollable]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier for the column to be inserted
caption Text to be displayed in the column header (lines separated by '\n')
columnWidth (optional)
>0 Initial column width in pixel
-1 Determine column width automatically according to values in the col-
umn (default)
hasAutoFilter (optional)
0 No auto filter (default)
1 Display an auto filter in the column header
isSortable (optional)
0 Column is not sortable
1 Column is sortable (default)
502
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
isScrollable (optional)
0 Column is fix (all columns left of this column must also be fix)
1 Column is scrollable (default)
E XAMPLE
object report;
report = this.GetParent();
if (!report) {
exit();
}
report.AddTable('table');
report.AddColumn('table', 'scenario', 'Scenario', 100, 1, 1, 0);
AddCurve
Adds a curve to a plot.
int ComTablereport.AddCurve(string plotId,
string yText,
[string yUnit,]
[int lineColor,]
[int lineWidth,]
[int lineStyle]
)
A RGUMENTS
plotId Identifier of the plot
yText Description for the curve
yUnit (optional)
Unit for the curve
lineColor (optional)
Line color for the curve (default: -1 = automatic)
lineWidth (optional)
Line width for the curve (default: -1 = automatic)
lineStyle (optional)
Line style for the curve (default: -1 = automatic)
R ETURNS
0 On error.
>0 Identifier of the inserted curve.
AddHeader
Adds a header to the report.
void ComTablereport.AddHeader(string label,
string text
)
503
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
label Label
text Text
AddInvisibleFilter
Adds an invisible filter to the report. This filter can be used for storing objects and/or strings that
can then be accessed again at the next refresh of the report.
int ComTablereport.AddInvisibleFilter(string id,
string value,
object obj
)
A RGUMENTS
id Identifier
value String value to be stored
obj Object to be stored
R ETURNS
0 On error: filter with given id already exists.
1 Filter was added to the report.
AddListFilter
Adds a list filter to the report.
int ComTablereport.AddListFilter(string id,
string label,
[string captions,]
[set filterObjects,]
[string selEntry,]
[int showObjects])
int ComTablereport.AddListFilter(string id,
string label,
int showObjects)
A RGUMENTS
id Identifier
label Label text
captions (optional)
Captions for list entries ('\n'-separated)
filterObjects (optional)
Objects for list entries (default: empty)
selEntry (optional)
Selected list entry (default: empty)
showObjects (optional)
0 Object dialogues are not accessible (default)
1 Object dialogues are accessible
504
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error: filter with given id already exists.
1 Filter was added to the report.
AddListFilterEntries
Adds entries to an existing list filter of the report.
int ComTablereport.AddListFilterEntries(string id,
string captions,
[set filterObjects]
)
A RGUMENTS
id Identifier
captions Captions for list entries ('\n'-separated)
filterObjects (optional)
Objects for list entries (default: empty)
R ETURNS
0 On error: filter with given id does not exist.
1 Entries were added to the filter.
AddMultiListFilter
Adds a multi-selection list filter to the report.
int ComTablereport.AddMultiListFilter(string id,
string label,
[string captions,]
[set filterObjects,]
[string selEntries,]
[int showObjects]
)
int ComTablereport.AddMultiListFilter(string id,
string label,
int showObjects
)
A RGUMENTS
id Identifier
label Label text
captions (optional)
Captions for list entries ('\n'-separated; default: empty)
filterObjects (optional)
Objects for list enries (default: empty)
selEntries (optional)
selected list entries ('\n'-separated; default: empty)
showObjects (optional)
0 Object dialogues are not accessible (default)
1 Object dialogues are accessible
505
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error: filter with given id already exists.
1 Filter was added to the report.
AddPlot
Adds a plot to the report.
void ComTablereport.AddPlot(string plotId,
string xText,
[string xUnit,]
[string header,]
[int textLabels,]
[int splitCurves,]
[int trueDots,]
[int niceTicks,]
[int legendPos]
)
A RGUMENTS
plotId Identifier for the plot
xText Description text for x-axis
xUnit (optional)
Unit for x-axis
header (optional)
Header text for plot
textLabels (optional)
0 Use values for x-axis (default)
1 Use text labels for x-axis
splitCurves (optional)
0 Interpolate missing values (default)
1 Split curve at missing values
trueDots (optional)
0 Draw only line (default)
1 Draw true dots additionally
niceTicks (optional)
0 No nice ticks (default)
1 Nice ticks on x-axis
2 Nice ticks on y-axis
3 Nice ticks on both axes
legendPos (optional)
0 No legend
1 Display legend below plot (default)
2 Display legend on right side of plot
506
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
AddRow
Adds a row to the table.
void ComTablereport.AddRow(string tableId,
string rowId,
[string caption]
)
A RGUMENTS
tableId Identifier of the table
rowId Identifier for the row to be inserted
caption (optional)
Text to be displayed in the row header (only one line, default: empty)
E XAMPLE
object report;
report = this.GetParent();
if (!report) {
exit();
}
report.AddTable('table');
report.AddColumn('table', 'scenario', 'Scenario', 100, 1, 1, 0);
report.AddRow('table', 'peak', 'Peak Load');
AddTable
Adds a table to the report. A report can contain only one table or one plot.
void ComTablereport.AddTable(string id)
A RGUMENTS
id Identifier
E XAMPLE
object report;
report = this.GetParent();
if (!report) {
exit();
}
report.AddTable('table');
507
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
AddTabularFilter
Adds a tabular filter to the report.
int ComTablereport.AddTabularFilter(string id,
string label,
string columnLabels,
string rowLabels,
[string values]
)
A RGUMENTS
id Identifier
label Label text for tabular filter
columnLabels
Label texts for table columns (';'-separated; several lines for one column separated
by '\n')
rowLabels
Label texts for table rows (';'-separated; only one line per table row)
values (optional)
Values for text fields (';'-separated)
R ETURNS
0 On error: filter with given id already exists.
1 Filter was added to the report.
AddTextFilter
Adds a text filter to the report.
int ComTablereport.AddTextFilter(string id,
string label,
[string unit,]
[string text]
)
A RGUMENTS
id Identifier
label Label text
unit (optional)
Unit text (default: empty)
text (optional)
Text for text field (default: empty)
R ETURNS
0 On error: filter with given id already exists.
1 Filter was added to the report.
508
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
AddXLabel
Sets a label for the next x-value.
void ComTablereport.AddXLabel(string plotId,
string label
)
A RGUMENTS
plotId Identifier of the plot
label Label text
ClearAll
Clears all report data.
void ComTablereport.ClearAll()
DisableAutomaticRowNumbering
Disables automatic row numbering. Row labels are filled with user-defined row labels. Auto-
matic row numbering is enabled per default.
void ComTablereport.DisableAutomaticRowNumbering(string tableId)
A RGUMENTS
tableId Identifier of the table
E XAMPLE
object report;
report = this.GetParent();
if (!report) {
exit();
}
report.AddTable('table');
report.DisableAutomaticRowNumbering('table');
DisableSingleFilterRefresh
Configures filter section to not refresh report immediatly after a filter value was changed. A
refresh button for the whole filter section is displayed instead.
void ComTablereport.DisableSingleFilterRefresh()
DisplayButtonsCollapsible
Makes button section collapsible and expandable.
void ComTablereport.DisplayButtonsCollapsible([int startExpanded])
509
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
startExpanded (optional)
0 Button section is initially collapsed
1 Button section is initially expanded (default)
DisplayFiltersCollapsible
Makes filter section collapsible and expandable.
void ComTablereport.DisplayFiltersCollapsible([int startExpanded])
A RGUMENTS
startExpanded (optional)
0 Filter section is initially collapsed.
1 Filter section is initially expanded (default).
DisplayFiltersIn2Columns
Displays filters in the filter section of the report in two columns.
int ComTablereport.DisplayFiltersIn2Columns(string id)
A RGUMENTS
id Identifier of filter to be displayed as first filter in the second column
R ETURNS
0 On error: filter with given id does not exist.
1 Filter was set.
DisplayHeadersCollapsible
Makes header section collapsible and expandable.
void ComTablereport.DisplayHeadersCollapsible([int startExpanded])
A RGUMENTS
startExpanded (optional)
0 Header section is initially collapsed
1 Header section is initially expanded (default)
EnableAutomaticRowNumbering
Enables automatic row numbering. Row labels are filled automatically with ascending numbers
(starting at 1), user-defined row labels are ignored. Automatic row numbering is enabled per
default.
void ComTablereport.EnableAutomaticRowNumbering(string tableId)
510
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
tableId Identifier of the table
ExportToExcel
Exports the report with its current filter settings and sorting to Excel.
void ComTablereport.ExportToExcel([string file,]
[int show]
)
A RGUMENTS
file (optional)
Path and name of file to be written (default: empty = temp. file is written)
show (optional)
0 Write only
1 Open written file in default application (default)
ExportToHTML
Exports the report with its current filter settings and sorting to HTML.
void ComTablereport.ExportToHTML([string file,]
[int show]
)
A RGUMENTS
file (optional)
Path and name of file to be written (default: empty = temp. file is written)
show (optional)
0 Write only
1 Open written file in default application (default)
FindNextCell
Searches for the next table cell with the given value and sets the selection to that cell. Searches
row-wise from the current position on until the table end and then from the top until the current
cell is reached again considering filters and sorting.
int ComTablereport.FindNextCell(string tableId,
string cellValue
)
A RGUMENTS
tableId Identifier of the table
511
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error: no matching cell found.
1 On success.
FindNextRow
Searches for the next row with the given values and sets the selection to that row. Searches
from the current position on until the table end and then from the top until the current row is
reached again considering filters and sorting.
int ComTablereport.FindNextRow(string tableId,
string columnId1,
string cellValue1,
[string columnId2,]
[string cellValue2,]
[string columnId3,]
[string cellValue3]
)
A RGUMENTS
tableId Identifier of the table
columnId1
Column identifier of cell for first criterion to be searched
cellValue1
Display text of cell for first criterion to be searched
columnId2
Column identifier of cell for second criterion to be searched
cellValue2
Display text of cell for second criterion to be searched
columnId3
Column identifier of cell for third criterion to be searched
cellValue3
Display text of cell for third criterion to be searched
R ETURNS
0 On error: no matching row found.
1 On success.
FindPreviousCell
Searches for previous table cell with the given value and sets the selection to that cell. Searches
row-wise from the current position on until table begin and then from the end until the current
cell is reached again considering filters and sorting.
int ComTablereport.FindPreviousCell(string tableId,
string cellValue
)
512
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
tableId Identifier of the table
cellValue Display text of cell to be searched
R ETURNS
0 On error: no matching cell found.
1 On success.
FindPreviousRow
Searches for the previous row with the given values and sets the selection to that row. Searches
from the current position on until the table begin and then from the end until the current row is
reached again considering filters and sorting.
int ComTablereport.FindPreviousRow(string tableId,
string columnId1,
string cellValue1,
[string columnId2,]
[string cellValue2,]
[string columnId3,]
[string cellValue3]
)
A RGUMENTS
tableId Identifier of the table
columnId1
Column identifier of cell for first criterion to be searched
cellValue1
Display text of cell for first criterion to be searched
columnId2
Column identifier of cell for second criterion to be searched
cellValue2
Display text of cell for second criterion to be searched
columnId3
Column identifier of cell for third criterion to be searched
cellValue3
Display text of cell for third criterion to be searched
R ETURNS
0 On error: no matching row found.
1 On success.
GetCellAccessObject
Gets the object accessible from a table cell.
int ComTablereport.GetCellAccessObject(string tableId,
string columnId,
string rowId,
object& obj)
513
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
obj (out) Object accessible from the cell if set, else NULL
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
GetCellAlignment
Gets the alignment of a cell.
int ComTablereport.GetCellAlignment(string tableId,
string columnId,
string rowId,
int& value
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value (out)
Alignment of the cell
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
GetCellBackgroundColor
Gets the value type of a cell.
int ComTablereport.GetCellBackgroundColor(string tableId,
string columnId,
string rowId,
int& value
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value (out)
Background color of the cell
514
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
GetCellColor
Gets the value type of a cell.
int ComTablereport.GetCellColor(string tableId,
string columnId,
string rowId,
int& value
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
GetCellEditObjects
Gets the objects linked to a table cell for editing the cell.
int ComTablereport.GetCellEditObjects(string tableId,
string columnId,
string rowId,
set& objs)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
515
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetCellFontStyle
Gets the font style of a cell.
int ComTablereport.GetCellFontStyle(string tableId,
string columnId,
string rowId,
int& value
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value (out)
Font style of the cell:
0 Normal (default)
1 Bold
2 Italic
3 Bold and italic
4 Underlined
5 Underlined and bold
6 Underlined and italic
7 Underlined, bold and italic
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
GetCellFormat
Gets the format of a cell.
int ComTablereport.GetCellFormat(string tableId,
string columnId,
string rowId,
string& value
)
A RGUMENTS
tableId Identifier of the table
516
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
GetCellHelpText
Gets the help text of a cell.
int ComTablereport.GetCellHelpText(string tableId,
string columnId,
string rowId,
string& value
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value (out)
Help text of the cell
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
GetCellValueType
Gets the value type of a cell.
int ComTablereport.GetCellValueType(string tableId,
string columnId,
string rowId
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
R ETURNS
0 Error: cell with given ids does not exist
1 String
2 Integer
3 Double
4 Check box
5 Bar
6 Date
7 Object
517
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetCheckboxCellValue
Gets the value of a check box cell.
int ComTablereport.GetCheckboxCellValue(string tableId,
string columnId,
string rowId,
int& value)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value (out)
Value of the cell
R ETURNS
0 On error: cell with given ids does not exist or has the wrong type.
1 On success.
GetColumnFilter
Get filter text of given column in table.
int ComTablereport.GetColumnFilter(string tableId,
string columnId,
string& filter
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column to be set
filter (out) Text that represents the filter of the column
R ETURNS
0 Column was found.
1 Column not found.
GetColumnHeader
Gets caption text of existing column of the table.
int ComTablereport.GetColumnHeader(string tableId,
string columnId,
string& caption
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
caption (out)
Text that is displayed in the column header (lines separated by '\n')
518
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On success.
1 On error: column with given ids does not exist.
E XAMPLE
object report;
string header;
report = this.GetParent();
if (!report) {
exit();
}
report.AddTable('table');
report.AddColumn('table', 'scenario', '', 100, 1, 1, 0);
report.SetColumnHeader('table', 'scenario', 'Scenario');
report.GetColumnHeader('table', 'scenario', header);
GetColumnId
Get the unique identifier of the n-th column.
int ComTablereport.GetColumnId(string tableId, int columnIndex, string& columnId)
A RGUMENTS
tableId Identifier of the table
columnIndex
Index of the column - 0 based
columnId (out)
Column identifier at the given index
R ETURNS
0 On success.
1 On error: No column with the given index was found.
GetDateCellValue
Gets the value of a date cell.
int ComTablereport.GetDateCellValue(string tableId,
string columnId,
string rowId,
int& value)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value (out)
Value of the cell
519
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error: cell with given ids does not exist or has the wrong type.
1 On success.
GetDoubleCellValue
Gets the value of a double cell.
int ComTablereport.GetDoubleCellValue(string tableId,
string columnId,
string rowId,
double& value)
A RGUMENTS
tableId Identifier of the table
R ETURNS
0 On error: cell with given ids does not exist or has the wrong type.
1 On success.
GetIntCellValue
Gets the value of an integer cell.
int ComTablereport.GetIntCellValue(string tableId,
string columnId,
string rowId,
int& value
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
R ETURNS
0 Error: cell with given ids does not exist or has the wrong type
1 Ok
520
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetNumberOfColumns
Returns the number of columns that were added to the table report.
int ComTablereport.GetNumberOfColumns(string tableId)
A RGUMENTS
tableId Identifier of the table
R ETURNS
>=0 On success: the number of columns in the table.
-1 On error: no table with the given ID was defined.
GetNumberOfRows
Returns the number of rows that were added to the table report.
int ComTablereport.GetNumberOfRows(string tableId)
A RGUMENTS
tableId Identifier of the table
R ETURNS
>=0 On success: the number of rows in the table.
-1 On error: no table with the given ID was defined.
GetNumberOfSelectedCells
Gets the number of (visible) cells selected in the table.
int ComTablereport.GetNumberOfSelectedCells(string tableId,
[string columnId,]
[string rowId]
)
A RGUMENTS
tableId Identifier of the table
columnId (optional)
set Count only selected cells with this column id
empty Count selected cells in all columns (default)
rowId (optional)
set Count only selected cells with this row id
empty Count selected cells in all rows (default)
R ETURNS
Number of selected cells
521
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetObjectCellValue
Gets the value of an object cell.
int ComTablereport.GetObjectCellValue(string tableId,
string columnId,
string rowId,
object& value)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value (out)
Value of the cell
R ETURNS
0 On error: cell with given ids does not exist or has the wrong type.
1 On success.
GetRowCaption
Gets caption text of existing row of the table.
int ComTablereport.GetRowCaption(string tableId,
string rowId,
string& caption
)
A RGUMENTS
tableId Identifier of the table
rowId Identifier of the row
caption (out)
Text that is displayed in the row caption
R ETURNS
0 On success.
1 On error: row with given ids does not exist.
GetRowId
Get the unique identifier of the n-th row.
int ComTablereport.GetRowId(string tableId, int rowIndex, string& rowId)
A RGUMENTS
tableId Identifier of the table
rowIndex Index of the row - 0 based
rowId (out)
Row identifier at the given index
522
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On success.
1 On error: No row with the given index was found.
GetSelectedCell
Gets the identifiers for a selected cell.
int ComTablereport.GetSelectedCell(string tableId,
int index,
string& columnId,
string& rowId
)
A RGUMENTS
tableId Identifier of the table
index Index of selected cell (1-based)
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
GetSelectedElements
Gets objects selected for the report filtered according to filter in the report.
set ComTablereport.GetSelectedElements()
R ETURNS
Filtered selected objects
GetSelection
Gets SetSelect with selected objects for the report.
object ComTablereport.GetSelection()
R ETURNS
SetSelect or NULL.
523
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetStringCellValue
Gets the value of a string cell.
int ComTablereport.GetStringCellValue(string tableId,
string columnId,
string rowId,
string& value
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value (out)
Value of the cell
R ETURNS
0 On error: cell with given ids does not exist or has the wrong type.
1 On success.
GoToCell
Sets the selection to a table cell.
int ComTablereport.GoToCell(string tableId,
string columnId,
string rowId
)
A RGUMENTS
tableId Identifier of the table
columnId Column identifier of the cell to be selected
rowId Row identifier of the cell to be selected
R ETURNS
0 On error: cell with given ids does not exist.
1 On success.
HasCell
Checks if a table cell exists.
int ComTablereport.HasCell(string tableId,
string columnId,
string rowId
)
524
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
R ETURNS
0 Cell with given ids does not exist.
1 Cell was found.
HasColumnAutoFilter
Checks if the column has an enabled auto filter.
int ComTablereport.HasColumnAutoFilter(string tableId, string columnId)
A RGUMENTS
tableId Identifier of the table
R ETURNS
-1 The column is not defined.
0 The column has no auto filter.
1 The column has an auto filter.
IsColumnScrollable
Checks if the column is marked as scrollable.
int ComTablereport.IsColumnScrollable(string tableId, string columnId)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
R ETURNS
-1 The column is not defined.
0 The column is not scrollable.
1 The column is scrollable.
IsColumnSortable
Checks if the column is marked as sortable.
int ComTablereport.IsColumnSortable(string tableId, string columnId)
525
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
R ETURNS
-1 The column is not defined.
0 The column is not sortable.
1 The column is sortable.
IsRowVisible
Checks if the row with the given ID is visible for the user. The result depends on the filter settings
of the report.
int ComTablereport.IsRowVisible(string tableId, string rowId)
A RGUMENTS
tableId Identifier of the table
rowId Identifier of the row
R ETURNS
-1 The row is not defined.
0 The row is invisible.
1 The row is visible.
RemoveRow
Removes a row from the table.
int ComTablereport.RemoveRow(string tableId,
string rowId
)
A RGUMENTS
tableId Identifier of the table
rowId Identifier of the row to be removed
R ETURNS
0 Row with given id does not exist.
1 Row was removed.
E XAMPLE
object report;
report = this.GetParent();
if (!report) {
exit();
}
526
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
report.AddTable('table');
report.AddColumn('table', 'scenario', 'Scenario', 100, 1, 1, 0);
report.AddRow('table', 'peak', 'Peak Load');
report.RemoveRow('table', 'peak');
SetBarLimits
Sets bar limits for all bar cells in an existing table column.
int ComTablereport.SetBarLimits(string tableId,
string columnId,
int min,
int max
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
min Minimum value for all bars in the column
max Maximum value for all bars in the column
R ETURNS
0 On error: column with given ids does not exis.
1 Limits were set.
SetCellAccess
Makes a cell accessible. Accessible means that an object dialogue is displayed on double click
and the right mouse button menu additionally provides the entries 'Edit', 'Edit and Browse' and
'Mark in Graphic'.
void ComTablereport.SetCellAccess(string tableId,
string columnId,
string rowId,
object accessObject,
[string parameterName]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
accessObject
Object to be accessible
parameterName (optional)
Set Dialog is shown at the page on that this variable is displayed
Empty Dialog is shown at stored dialog page (default)
527
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
SetCellEdit
Makes a table cell editable. This means that the cell value can be modified in the report window.
void ComTablereport.SetCellEdit(string tableId,
string columnId,
string rowId,
set editObjects,
[string selectableValues])
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
editObjects
Objects to handle the modification. These objects are passed as input to the “Edit”
script.
selectableValues
'\n '-separated list of selectable values:
Set A list dialogue with the given values is displayed for selection if the cell
is edited
Empty Any text can be entered into the cell (default)
SetCellValueToBar
Fills a table cell with a bar.
void ComTablereport.SetCellValueToBar(string tableId,
string columnId,
string rowId,
string barDesc,
[string helpText,]
[int border,]
[int align,]
[int backgroundColor]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
barDesc Bar description containing limits and segment widths and colours.
If limits are given the left cell side is considered to be the lower limit value and the
right cell side is considered to be the upper limit value.
If no limits are given the limits are implicitly set to 0 and 100.
The available formats are listed below.
helpText (optional)
Text shown in balloon help of the cell (multiple lines separated by '\n'; default:
empty)
528
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
border (optional)
Display a thin black border around the bar:
0 No border
1 Border (default)
align (optional)
Alignment for text:
backgroundColor (optional)
Color for background (default: 0=white)
B AR DESCRIPTION FORMATS
<width>,<colour>;<width>,<colour>;<...>
Relative widths in % (old style; e.g. “20,1;14,2;36,3;30,4”)
SetCellValueToCheckbox
Fills a table cell with a check box.
void ComTablereport.SetCellValueToCheckbox(string tableId,
string columnId,
string rowId,
int value,
[string helpText,]
[int align,]
[int backgroundColor]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value Integer value to be set in the checkbox:
529
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
helpText (optional)
Text shown in balloon help of the cell (multiple lines separated by '\n'; default:
empty)
align (optional)
Alignment for text:
0 Automatically according to data type (default)
1 Left
2 Center
3 Right
backgroundColor (optional)
Color for background (default: 0=white)
SetCellValueToDate
Fills a table cell with a date.
void ComTablereport.SetCellValueToDate(string tableId,
string columnId,
string rowId,
int timeStamp,
[string format,]
[string helpText,]
[int color,]
[int fontStyle,]
[int align,]
[int backgroundColor]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
timeStamp
Time stamp value for date and time
format (optional)
Format for displaying date (currently ignored; default: '')
helpText (optional)
Text shown in balloon help of the cell (multiple lines separated by '\n'; default:
empty)
color (optional)
Colour for text (default: 1=black)
fontStyle (optional)
0 Normal (default)
1 Bold
530
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
2 Italic
3 Bold and italic
4 Underlined
5 Underlined and bold
6 Underlined and italic
7 Underlined, bold and italic
align (optional)
Alignment for text:
0 Automatically according to data type (default)
1 Left
2 Center
3 Right
backgroundColor (optional)
Color for background (default: 0=white)
SetCellValueToDouble
Fills a table cell with a double value.
void ComTablereport.SetCellValueToDouble(string tableId,
string columnId,
string rowId,
double value,
[string format,]
[string helpText,]
[int color,]
[int fontStyle,]
[int align,]
[int backgroundColor]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value Double value to be set
format (optional)
Printf-like format for displaying the value (default: '%f')
helpText (optional)
Text shown in balloon help of the cell (multiple lines separated by '\n'; default:
empty)
color (optional)
Color for text (default: 1=black)
fontStyle(optional)
0 Normal (default)
1 Bold
531
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
2 Italic
3 Bold and italic
4 Underlined
5 Underlined and bold
6 Underlined and italic
7 Underlined, bold and italic
align (optional)
Alignment for text:
0 Automatically according to data type (default)
1 Left
2 Center
3 Right
backgroundColor (optional)
Color for background (default: 0=white)
SetCellValueToInt
Fills a table cell with an integer value.
void ComTablereport.SetCellValueToInt(string tableId,
string columnId,
string rowId,
int value,
[string format,]
[string helpText,]
[int color,]
[int fontStyle,]
[int align,]
[int backgroundColor]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value Integer value to be set
format (optional)
Printf-like format for displaying the value (default: '%d')
helpText (optional)
Text shown in balloon help of the cell (multiple lines separated by '\n'; default:
empty)
color (optional)
Color for text (default: 1=black)
fontStyle (optional)
0 Normal (default)
1 Bold
532
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
2 Italic
3 Bold and italic
4 Underlined
5 Underlined and bold
6 Underlined and italic
7 Underlined, bold and italic
align (optional)
Alignment for text:
0 Automatically according to data type (default)
1 Left
2 Center
3 Right
backgroundColor (optional)
Color for background (default: 0=white)
SetCellValueToObject
Fills a table cell with an object.
void ComTablereport.SetCellValueToObject(string tableId,
string columnId,
string rowId,
object obj,
[string format,]
[string helpText,]
[int color,]
[int fontStyle,]
[int align,]
[int backgroundColor]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
obj Object to be set
format (optional)
Format for displaying object (currently ignored; default: '')
helpText (optional)
Text shown in balloon help of the cell (multiple lines separated by '\n'; default:
empty)
color (optional)
Colour for text (default: 1=black)
fontStyle(optional)
0 Normal (default)
1 Bold
533
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
2 Italic
3 Bold and italic
4 Underlined
5 Underlined and bold
6 Underlined and italic
7 Underlined, bold and italic
align (optional)
Alignment for text:
0 Automatically according to data type (default)
1 Left
2 Center
3 Right
backgroundColor (optional)
Color for background (default: 0=white)
SetCellValueToString
Fills a table cell with a string value.
void ComTablereport.SetCellValueToString(string tableId,
string columnId,
string rowId,
string value,
[string format,]
[string helpText,]
[int color,]
[int fontStyle,]
[int align,]
[int backgroundColor]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column
rowId Identifier of the row
value String value to be set
format (optional)
Printf-like format for displaying the value (default: '%s')
helpText (optional)
Text shown in balloon help of the cell (multiple lines separated by '\n'; default:
empty)
color (optional)
Color for text (default: 1=black)
fontStyle (optional)
0 Normal (default)
1 Bold
534
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
2 Italic
3 Bold and italic
4 Underlined
5 Underlined and bold
6 Underlined and italic
7 Underlined, bold and italic
align (optional)
Alignment for text:
0 Automatically according to data type (default)
1 Left
2 Center
3 Right
backgroundColor (optional)
Color for background (default: 0=white)
E XAMPLE
The following example writes the name of the active scenario into a table cell:
object report, scenario;
string name;
report = this.GetParent();
if (!report) {
exit();
}
report.AddTable('table');
report.AddColumn('table', 'scenario', 'Scenario', 100, 1, 1, 0);
report.AddRow('table', 'active', 'Active');
scenario = GetActiveScenario();
name = scenario:loc_name;
report.SetCellValueToString('table', 'scenario', 'active', name);
SetColumnHeader
Sets caption text in existing column of the table.
void ComTablereport.SetColumnHeader(string tableId,
string columnId,
string caption
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column to be set
captionId Text to be displayed in the column header (lines separated by '\n')
535
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
object report;
report = this.GetParent();
if (!report) {
exit();
}
report.AddTable('table');
report.AddColumn('table', 'scenario', '', 100, 1, 1, 0);
report.SetColumnHeader('table', 'scenario', 'Scenario');
SetCurveValue
Adds a y-value at a certain x-value to a curve.
int ComTablereport.SetCurveValue(string plotId,
int curveId,
double xValue,
double yValue
)
A RGUMENTS
plotId Identifier of the plot
curveId Identifier of the curve (0: no curve / new x-value)
xValue x-value for given y-value
yValue y-value
R ETURNS
0 On error: curve not found.
1 On success.
SetDialogSize
Sets the width and height for the report dialog.
void ComTablereport.SetDialogSize(int width,
int height
)
A RGUMENTS
width Dialogue width in pixel
height Dialogue height in pixel
E XAMPLE
object report;
report = this.GetParent();
if (!report) {
536
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
exit();
}
report.SetDialogSize(700, 860);
SetExportHtml
Shows or hides html icon
void ComTablereport.SetExportHtml(int show)
A RGUMENTS
show
0 Hide html icon
1 Show html icon
SetExportXls
Shows or hides xlsx icon
void ComTablereport.SetExportXls(int show)
A RGUMENTS
show
0 Hide xlsx icon
1 Show xlsx icon
SetListFilterSelection
Sets selected entries in existing list filter.
int ComTablereport.SetListFilterSelection(string id,
string selEntries
)
A RGUMENTS
id Identifier
selEntries (optional)
Selected list entries ('\n'-separated; default: empty)
R ETURNS
0 On error: filter with given id does not exist.
1 Entries were set as selected filter entries.
537
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
SetNumberFormatForPlot
Sets the number format for the tick descriptions for an axis of a plot.
int ComTablereport.SetNumberFormatForPlot(string plotId,
string axis,
int characters,
int precision
)
A RGUMENTS
plotId Identifier of the plot
axis
X Set format for x-axis
Y Set format for y-axis
characters
Number of characters
precision Number of digits after the point
R ETURNS
0 On error: plot not found.
1 On success.
SetRefresh
Shows or hides refresh icon
void ComTablereport.SetRefresh(int show)
A RGUMENTS
show
0 Hide refresh icon
1 Show refresh icon
SetSorting
Sets initial sorting of table.
int ComTablereport.SetSorting(string tableId,
string columnId,
[int descending]
)
A RGUMENTS
tableId Identifier of the table
columnId Identifier of the column according to that is to be sorted
descending (optional)
0 Ascending order (default)
1 Descending order
538
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error.
1 Sorting set.
SetStatusText
Sets a text in the user-definable field of the report window's status bar.
void ComTablereport.SetStatusText(string tableId,
string text
)
A RGUMENTS
tableId Identifier of the table
SetTextAxisDistForPlot
Sets distance between axis and tick description for an axis of a plot.
int ComTablereport.SetTextAxisDistForPlot(string plotId,
string axis,
int distance
)
A RGUMENTS
plotId Identifier of the plot
axis
X Set distance for x-axis
Y Set distance for y-axis
distance Distance between text and axis
R ETURNS
0 On error: plot not found.
1 On success.
SetTicksForPlot
Sets the number of ticks for an axis of a plot.
int ComTablereport.SetTicksForPlot(string plotId,
string axis,
int main,
int number
)
539
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
plotId Identifier of the plot
axis
X Set ticks on x-axis
Y Set ticks on y-axis
main
0 Set help ticks
1 Set main ticks
number Number of ticks
R ETURNS
0 On error: plot not found.
1 On success.
SetTitle
Sets the text in the title bar of the report window.
void ComTablereport.SetTitle(string title)
A RGUMENTS
title Title text
E XAMPLE
object report;
report = this.GetParent();
if (!report) {
exit();
}
540
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.51 ComTasks
Overview
AppendCommand
AppendStudyCase
GetCommandsForStudyCase
GetNumberOfCommandsForStudyCase
GetNumberOfStudyCases
GetStudyCases
IsAdditionalResultsFlagSetForCommand
IsCommandIgnored
IsStudyCaseIgnored
RemoveCmdsForStudyCaseRow
RemoveCommand
RemoveStudyCase
RemoveStudyCases
SetAdditionalResultsFlagForCommand
SetIgnoreFlagForCommand
SetIgnoreFlagForStudyCase
SetResultsFolder
AppendCommand
Appends a command for calculation.
int ComTasks.AppendCommand(object command,
[int studyCaseRow]
)
R ETURNS
0 Command could not be added for calculation.
1 Command has been successfully added for calculation.
A RGUMENTS
command
Command to add for calculation.
studyCaseRow
≤0 Command is added to the list of commands for its study case.
>0 Optionally, the row in the study case table containing the study case
for which this command shall be added can be passed. This is helpful,
e.g., if a study case has been added multiple times for calculation with
different command lists.
E XAMPLE
In this example, we add the load flow command of a study case to the list of tasks to
calculate.
int isAdded;
object comLdf,
comTasks,
casesFolder;
set commands;
casesFolder = GetProjectFolder('study');
541
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
comLdf = GetFromStudyCase('ComLdf');
if ({comTasks<>nullptr}.and.{comLdf<>nullptr}) {
isAdded = comTasks.AppendCommand(comLdf);
if ( isAdded<>0 ) {
printf('Command %o has been added for calculation', comLdf);
}
else {
printf('Command %o could not be added for calculation', comLdf);
}
}
}
AppendStudyCase
Appends a study case to the list of study cases for calculation.
int ComTasks.AppendStudyCase(object studyCase)
R ETURNS
0 Study case could not be added for calculation.
1 Study case has been successfully added for calculation.
A RGUMENTS
studyCase
Study case to add for calculation.
E XAMPLE
In this example, we add the currently active study case to the list of study cases for calcula-
tion.
int isAdded;
object newCase,
comTasks,
casesFolder;
set commands;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
newCase = GetActiveStudyCase();
if ({comTasks<>nullptr}.and.{newCase<>nullptr}) {
isAdded = comTasks.AppendStudyCase(newCase);
if ( isAdded<>0 ) {
printf('Study Case %o has been added for calculation', newCase);
}
else {
printf('Study case %o could not be added for calculation.', newCase);
}
}
}
542
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetCommandsForStudyCase
Get all selected commands to be processed for a study case from the Task Automation com-
mand.
set ComTasks.GetCommandsForStudyCase(object studyCase,
[int studyCaseRow])
R ETURNS
Returns ordered set of all selected commands to be processed for a study case.
A RGUMENTS
studyCase
Study case to get all selected commands to be processed from.
studyCaseRow
≤0 Commands for the first matching study case found will be returned.
>0 Optionally, the row in the study case table containing the study case
for which commands shall be returned can be passed. This is helpful,
e.g., if a study case has been added multiple times for calculation with
different command lists.
E XAMPLE
In this example, we get all selected commands for study case of row 1 from the Task Automa-
tion command.
object comTasks,
casesFolder;
set commands,
allSelectedCommands;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
if (comTasks<>NULL) {
allSelectedCommands = comTasks.GetCommandsForStudyCase(NULL, 1);
}
}
GetNumberOfCommandsForStudyCase
Get number of all selected commands to be processed for a study case from the Task Automa-
tion command.
int ComTasks.GetNumberOfCommandsForStudyCase(object studyCase,
[int studyCaseRow])
R ETURNS
Returns number of all selected commands to be processed for a study case.
A RGUMENTS
studyCase
Study case to get number of selected commands to be processed from.
543
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
studyCaseRow
≤0 Number of commands for the first matching study case found will be
returned.
>0 Optionally, the row in the study case table containing the study case
for which number of commands shall be returned can be passed. This
is helpful, e.g., if a study case has been added multiple times for
calculation with different command lists.
GetNumberOfStudyCases
Get number of selected study cases from the Task Automation command.
int ComTasks.GetNumberOfStudyCases()
R ETURNS
Returns number of selected study cases from the Task Automation command.
GetStudyCases
Get all selected study cases from the Task Automation command.
set ComTasks.GetStudyCases()
R ETURNS
Returns ordered set of all selected study cases from the Task Automation command, set is
empty on failure.
E XAMPLE
In this example, we get all selected study cases from the Task Automation command.
object comTasks,
casesFolder;
set commands,
allSelectedCases;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
if (comTasks<>NULL) {
allSelectedCases = comTasks.GetStudyCases();
}
}
IsAdditionalResultsFlagSetForCommand
Returns whether additional results flag of a command is set or not (using study case row and
task row / using a command directly).
int ComTasks.IsAdditionalResultsFlagSetForCommand(int studyCaseRow,
int taskRow)
int ComTasks.IsAdditionalResultsFlagSetForCommand(object command)
544
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
studyCaseRow ≤ 0
The row in the study cases table of the command’s study case for which the
additional results flag shall be derived.
taskRow > 0
The row in the commands table for which the additional results flag shall be
derived.
command
The command to get the additional results flag for.
R ETURNS
0 Additional results flag of command is not set.
1 Additional results flag of command is set.
-1 Additional results flag was not found for provided study case row and task row /
provided command.
IsCommandIgnored
Returns whether the processing of a command will be ignored or not (using study case row and
task row / using provided command).
int ComTasks.IsCommandIgnored(int studyCaseRow,
int taskRow)
int ComTasks.IsCommandIgnored(object command)
A RGUMENTS
studyCaseRow ≤ 0
The row in the study cases table of the command’s study case for which the ignore
flag shall be derived.
taskRow > 0
The row in the commands table for which the ignore flag shall be derived.
command
The command to get the ignore-flag for.
R ETURNS
0 Processing of command will be done.
1 Processing of command will be ignored.
-1 Command was not found (for provided study case row and task row / at all).
IsStudyCaseIgnored
Returns whether the command processing for a study case will be ignored or not.
int ComTasks.IsStudyCaseIgnored(object studyCase,
[int studyCaseRow])
R ETURNS
0 Command processing for study case will be done.
1 Command processing for study case will be ignored.
-1 study case or row was not found.
545
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
studyCase
Study case to get ignore-flag from.
studyCaseRow
≤0 Ignore flag for the first matching study case found will be returned.
>0 Optionally, the row in the study case table containing the study case
for which ignore-flag shall be returned can be passed. This is helpful,
e.g., if a study case has been added multiple times for calculation with
different command lists.
RemoveCmdsForStudyCaseRow
Removes all commands selected for calculation for a given row in the study case table.
int ComTasks.RemoveCmdsForStudyCaseRow(int studyCaseRow)
R ETURNS
0 Commands could not be removed from calculation.
1 All commands of study case row were successfully removed from calculation.
A RGUMENTS
studyCaseRow> 0
The row in the study case table containing the study case for which all commands
shall be removed.
E XAMPLE
In this example, we remove all commands of the study case in row 1 from the calculation.
int isRemoved;
object comTasks,
casesFolder;
set commands;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
if (comTasks<>nullptr) {
isRemoved = comTasks.RemoveCmdsForStudyCaseRow(1);
if ( isRemoved<>0 ) {
printf('All commands are successfully removed for row %d', 1);
}
else {
printf('Commands could not be removed');
}
}
}
546
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
RemoveCommand
Remove a command from the calculation (for study case row and task row / for all appear-
ances).
int ComTasks.RemoveCommand(int studyCaseRow,
int taskRow
)
int ComTasks.RemoveCommand(object command)
A RGUMENTS
studyCaseRow> 0
The row in the study cases table of the command’s study case for which the
command shall be removed.
taskRow> 0
The row in the commands table for which the command shall be removed.
command
Command to remove.
R ETURNS
0 Command could not be removed.
1 Command has been successfully removed.
RemoveStudyCase
Removes a study case from the study cases table.
int ComTasks.RemoveStudyCase(object studyCase,
[int studyCaseRow]
)
R ETURNS
0 Study case could not be removed.
1 Study case has been successfully removed.
A RGUMENTS
studyCase
Study case which shall be removed.
studyCaseRow
≤0 Study case is removed for all entries in the study cases table matching
the provided study case.
>0 Optionally, the row in the study case table containing the study case
which shall be removed can be passed. This is helpful, e.g., if a
study case has been added multiple times for calculation with different
command lists.
RemoveStudyCases
Removes all study cases from calculation.
void ComTasks.RemoveStudyCases()
547
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
In this example we remove all study cases from the list of study cases for calculation.
object comTasks,
casesFolder;
set commands;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
if (comTasks<>nullptr) {
comTasks.RemoveStudyCases();
}
}
SetAdditionalResultsFlagForCommand
Set the flag whether to record an additional result file for a command of the calculation (using
study case row and task row / using command).
int ComTasks.SetAdditionalResultsFlagForCommand(int studyCaseRow,
int taskRow,
int addResVal
)
int ComTasks.SetAdditionalResultsFlagForCommand(object command,
int addResVal
)
A RGUMENTS
studyCaseRow> 0
The row in the study cases table of the command’s study case for which the flag
to record additional results shall be set.
taskRow> 0
The row in the commands table for which the flag to record additional results shall
be set.
command
The command for which the flag to record additional results shall be set.
addResVal
1 Will set the command to record additional results for the calculation.
0 Will set the command to avoid recording of results for calculation.
R ETURNS
0 Flag to record (or not record) additional results could not be set.
1 Flag to record (or not record) additional results has been successfully set.
E XAMPLE
In this example, we set the command of study case row 1 and command row 1 to record
additional results for calculation.
int isSet;
object comTasks,
548
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
casesFolder;
set commands;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
if (comTasks<>nullptr) {
isSet = SetAdditionalResultsFlagForCommand(1, 1, 1);
if ( isSet<>0 ) {
printf('Command in study case row 1 and command row 1 records additional results');
}
else {
printf('Flag to record additional results could not be set');
}
}
}
In this example, we add the load flow command to the calculation and set the flag to record
additional results afterwards.
int isAdded,
isRecordSet;
object comLdf,
comTasks,
casesFolder;
set commands;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
comLdf = GetFromStudyCase('ComLdf');
if ({comTasks<>nullptr}.and.{comLdf<>nullptr}) {
isAdded = comTasks.AppendCommand(comLdf);
if ( isAdded<>0 ) {
printf('Command %o has been added for calculation', comLdf);
isRecordSet = SetAdditionalResultsFlagForCommand(comLdf, 1);
if ( isRecordSet<>0 ) {
printf('Flag to record additional results set for cmd %o', comLdf);
}
else {
printf('Flag to record add. res. could not be set for %o', comLdf);
}
}
else {
printf('Command %o could not be added for calculation', comLdf);
}
}
}
SetIgnoreFlagForCommand
Set the flag whether to ignore a command for the calculation (using study case row and task
row / using command).
int ComTasks.SetIgnoreFlagForCommand(int studyCaseRow,
int taskRow,
549
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
int ignoreVal
)
int ComTasks.SetIgnoreFlagForCommand(object command,
int ignoreVal
)
A RGUMENTS
studyCaseRow> 0
The row in the study cases table of the command’s study case for which the ignore
flag shall be set.
taskRow> 0
The row in the commands table for which the ignore flag shall be set.
command
Command for which the ignore flag shall be set.
ignoreVal
1 Will set the command to be ignored for calculation.
0 Will set the command to be processed for calculation.
R ETURNS
0 Ignore flag could not be set.
1 Ignore flag has been successfully set.
E XAMPLE
In this example, we set the command of study case row 1 and command row 1 to ignored for
calculation.
int isIgnored;
object comTasks,
casesFolder;
set commands;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
if (comTasks<>nullptr) {
isIgnored = SetIgnoreFlagForCommand(1, 1, 1);
if ( isIgnored<>0 ) {
printf('Cmd in study case row 1, cmd row 1 is ignored');
}
else {
printf('Ignore status could not be set');
}
}
}
In this example, we add the load flow command to the calculation and set it to ignored
afterwards.
int isAdded,
isIgnored;
object comLdf,
comTasks,
casesFolder;
set commands;
550
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
comLdf = GetFromStudyCase('ComLdf');
if ({comTasks<>nullptr}.and.{comLdf<>nullptr}) {
isAdded = comTasks.AppendCommand(comLdf);
if ( isAdded<>0 ) {
printf('Command %o has been added for calculation', comLdf);
isIgnored = SetIgnoreFlagForCommand(comLdf, 1);
if ( isIgnored<>0 ) {
printf('Command %o will be igored for calculation', comLdf);
}
else {
printf('Ignore status for command %o could not be set', comLdf);
}
}
else {
printf('Command %o could not be added for calculation', comLdf);
}
}
}
SetIgnoreFlagForStudyCase
Set the flag whether to ignore the processing of commands of a study case for the calculation.
int ComTasks.SetIgnoreFlagForStudyCase(object studyCase,
int ignoreVal,
[int studyCaseRow]
)
R ETURNS
0 Ignore flag could not be set.
1 Ignore flag has been successfully set.
A RGUMENTS
studyCase
Study case for which the ignore flag shall be set.
ignoreVal
1 Will set the flag to ignore the processing of commands of a study case.
0 Will set the flag to process the commands of a study case.
studyCaseRow
≤0 Ignore flag is set for all entries in the study cases table matching the
provided study case.
>0 Optionally, the row in the study case table containing the study case
for which the ignore-flag shall be set can be passed. This is helpful,
e.g., if a study case has been added multiple times for calculation with
different command lists.
551
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
SetResultsFolder
Set a folder to store results for a given row in the study case table.
int ComTasks.SetResultsFolder(object folder, int studyCaseRow)
R ETURNS
0 New folder could not be set as results folder for the given row in the study case
table.
1 Folder was successfully set as resuls folder for given row in the study case table.
A RGUMENTS
folder The new folder to store results in.
studyCaseRow
The row in the study case table containing the study case for which results folder
shall be set.
E XAMPLE
In this example, we set the active study case as new results folder for the study case in row
1 from the calculation.
int isSet;
object comTasks,
casesFolder,
activeCase;
set commands;
casesFolder = GetProjectFolder('study');
commands = casesFolder.GetContents('*.ComTasks');
if (commands.Count()=1) {
comTasks = commands.First();
activeCase = GetActiveStudyCase();
if ({comTasks<>nullptr}.and{activeCase<>nullptr}) {
isSet = comTasks.SetResultsFolder(activeCase, 1);
if ( isSet<>0 ) {
printf('Results folder successfully changed.');
}
else {
printf('Results folder could not be changed');
}
}
}
3.4.52 ComTececo
Overview
UpdateTablesByCalcPeriod
552
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
UpdateTablesByCalcPeriod
Update all calculation points with respect to a new start- and end year
int ComTececo.UpdateTablesByCalcPeriod(double start,
double end
)
A RGUMENTS
start Start year of the study period
end End year of the study period
R ETURNS
0 Calculation points have been successfully set.
1 Invalid input data: end year of study period must be greater or equal to start year.
E XAMPLE
The following example configures a Techno-economical calculation with a study period 1.1.2015-
31.12.2020 and executes it.
object tececoCmd;
tececoCmd = GetFromStudyCase('ComTececo');
if ( tececoCmd<>nullptr ) {
tececoCmd:e:CalcPoints = 0; ! yearly calculation points
tececoCmd.UpdateTablesByCalcPeriod(2015, 2020); ! Set the study period to 1.1.2015-31.12
tececoCmd.Execute();
}
3.4.53 ComTececocmp
Overview
AppendStudyCase
CalcDiscountedEstimatedPaybackPeriod
CalcEstimatedPaybackPeriod
CalcInternalRateOfReturn
RemoveStudyCases
AppendStudyCase
Appends a study case to the list of study cases.
int ComTececocmp.AppendStudyCase(object studyCase, [int isIgnored])
R ETURNS
0 Study case could not be added for calculation.
1 Study case has been successfully added for calculation.
A RGUMENTS
studyCase
Study case to add for calculation.
isIgnored Sets the flag to ignore the study case to add or not.
553
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
CalcDiscountedEstimatedPaybackPeriod
Calculates the discounted estimated payback period (in years) for a grid expansion w.r.t. a
base grid configuration. The grid expansion and base configurations must be given by means
of two study cases and their configured variation. Moreover, these study cases must contain
corresponding result files calculated by techno-economical calculations. The calculatory interest
rate from the result file written by the Techno-economical Calculation to evaluate will be used
for discounting.
int CalcDiscountedEstimatedPaybackPeriod(object strategyToEval,
object baseStrategy,
double& epp)
A RGUMENTS
strategyToEval
Study case defining grid expansion to evaluate.
baseStrategy
Study case defining base grid configuration.
R ETURNS
Returns 0, if calculation was successfull and 1 otherwise.
CalcEstimatedPaybackPeriod
Calculates the estimated payback period (in years) for a grid expansion w.r.t. a base grid
configuration. The grid expansion and base configurations must be given by means of two study
cases and their configured variation. Moreover, these study cases must contain corresponding
result files calculated by techno-economical calculations.
int CalcEstimatedPaybackPeriod(object strategyToEval,
object baseStrategy,
double& epp)
A RGUMENTS
strategyToEval
Study case defining grid expansion to evaluate.
baseStrategy
Study case defining base grid configuration.
R ETURNS
Returns 0, if calculation was successfull and 1 otherwise.
CalcInternalRateOfReturn
Calculates the internal rate of return for a grid expansion w.r.t. a base grid configuration.
The grid expansion and base configurations must be given by means of two study cases and
their configured variation. Moreover, these study cases must contain corresponding result files
calculated by techno-economical calculations.
554
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
strategyToEval
Study case defining grid expansion to evaluate.
baseStrategy
Study case defining base grid configuration.
R ETURNS
Returns 0, if calculation was successfull and 1 otherwise.
RemoveStudyCases
Removes all study cases from calculation.
void ComTececocmp.RemoveStudyCases()
3.4.54 ComTransfer
Overview
GetTransferCalcData
IsLastIterationFeasible
GetTransferCalcData
The function returns the calculated transfer capacity and the total number of iteration after the
transfer capacity command has been executed.
void ComTransfer.GetTransferCalcData(double& transferCapacity, int& totalIterations)
A RGUMENTS
transferCapacity (out)
Transfer capacity value at the last feasible iteration.
totalIterations (out)
Total iteration number.
E XAMPLE
object cmdTransfer;
double dTotCapacity;
int iret, maxIteration;
cmdTransfer = GetFromStudyCase('ComTransfer');
if (cmdTransfer) {
iret = cmdTransfer.Execute(); ! Performs transfer capacity calculation
! If the calculation was success then the data can be obtained
if (iret = 0) {
cmdTransfer.GetTransferCalcData(dTotCapacity, maxIteration);
printf('Transfer capacity: %f MW, Total iteration: %d',dTotCapacity,maxIteration);
555
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
}
}
IsLastIterationFeasible
The function verifies if the last transfer calculation iteration resulted in a feasible solution or not.
int ComTransfer.IsLastIterationFeasible()
R ETURNS
1 Last transfer calculation iteration resulted in a feasible solution.
0 Last transfer calculation iteration did not result in a feasible solution.
E XAMPLE
object cmdTransfer;
int iret;
cmdTransfer = GetFromStudyCase('ComTransfer');
if (cmdTransfer) {
iret = cmdTransfer.Execute(); ! Performs transfer capacity calculation
! If the calculation was success then the data can be obtained
if (iret = 0) {
iret = cmdTransfer.IsLastIterationFeasible();
if (iret) {
printf('Transfer capacity: the last iteration was feasible!');
}
else {
printf('Transfer capacity: the last iteration was NOT feasible!');
}
}
}
3.4.55 ComUcte
Overview
SetBatchMode
SetBatchMode
The batch mode allows to suppress all messages except error and warnings. This can be useful
when used in scripts where additional output might be confusing.
void ComUcte.SetBatchMode(int enabled)
A RGUMENTS
enabled
0 disables batch mode, all messages are printed to output window (de-
fault).
1 enables batch mode, only error and warning messages are printed to
output window.
556
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
3.4.56 ComUcteexp
Overview
BuildNodeNames
DeleteCompleteQuickAccess
ExportAndInitQuickAccess
GetConnectedBranches
GetFromToNodeNames
GetOrderCode
GetUcteNodeName
InitQuickAccess
QuickAccessAvailable
ResetQuickAccess
SetGridSelection
BuildNodeNames
Builds the node names as used in UCTE export and makes them accessible via :UcteNode-
Name attribute. The node names will only be available as long as topology has not been
changed. They must be re-build after any topology relevant modification.
Furthermore, the method fills the quick access cache given by the cache index for node names
and branch topologies as used in UCTE export. The quick access cache endures also topology
changes. The cache index is optional. If no cache index is given the default quick access cache
is used.
int ComUcteexp.BuildNodeNames([int cacheIndex])
A RGUMENTS
cacheIndex (optional)
Index of the quick access cache (must be greater than or equals to 0)
R ETURNS
0 On success.
1 0n error (e.g. load flow calculation failed).
D EPRECATED N AMES
BuildExportStructure
E XAMPLE
object command, term;
set terms;
int err,
available,
cacheIndex;
cacheIndex = 1;
err = command.BuildNodeNames(cacheIndex);
if (err > 0) {
Error('Error in determination of UCTE node names');
557
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
exit();
}
available = command.QuickAccessAvailable(cacheIndex);
DeleteCompleteQuickAccess
Deletes all quick access caches.
void ComUcteexp.DeleteCompleteQuickAccess()
E XAMPLE
object command;
int err, cacheIndex, available;
cacheIndex = 1;
err = command.BuildNodeNames(cacheIndex);
if (err > 0) {
Error('Error during filling quick access cache for cache index %d.', cacheIndex);
exit();
}
available = command.QuickAccessAvailable(cacheIndex);
printf('Quick access for cache index %d available: %d', cacheIndex, available);
command.DeleteCompleteQuickAccess();
available = command.QuickAccessAvailable(cacheIndex);
printf('Quick access for cache index %d available: %d', cacheIndex, available);
ExportAndInitQuickAccess
Performs an UCTE export and fills the quick access cache given by the cache index.
void ComUcteexp.ExportAndInitQuickAccess(int cacheIndex)
A RGUMENTS
cacheIndex
Index of the quick access cache (must be greater than or equals to 0)
558
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
E XAMPLE
object command;
int err, cacheIndex, available;
cacheIndex = 1;
err = command.ExportAndInitQuickAccess(cacheIndex);
if (err > 0) {
Error('Error during filling quick access cache for cache index %d.', cacheIndex);
exit();
}
available = command.QuickAccessAvailable(cacheIndex);
GetConnectedBranches
Determines the connected branches for the given terminal from the quick access cache given
by the optional cache index. If no cache index is given the default quick access cache is used.
void ComUcteexp.GetConnectedBranches(object terminal,
set& connectedBranches,
[int cacheIndex])
A RGUMENTS
terminal Terminal to determine the connected branches from
connectedBranches (out)
Connected branches for the given terminal
cacheIndex (optional)
Index of the quick access cache (must be greater than or equals to 0)
E XAMPLE
object command, term, branch;
set terms, branches;
int err, cacheIndex;
cacheIndex = 1;
err = command.BuildNodeNames(cacheIndex);
if (err > 0) {
Error('Error during filling quick access cache with index %d.', cacheIndex);
exit();
}
559
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
terms = GetCalcRelevantObjects('*.ElmTerm');
for(term = terms.First(); term; term = terms.Next()) {
command.GetConnectedBranches(term, branches, cacheIndex);
printf('Terminal %o has the following connected branches:', term);
GetFromToNodeNames
Determines the UCTE node names of the branch ends from the quick access cache given by
the optional cache index. If no cache index is given the default quick access cache is used.
void ComUcteexp.GetFromToNodeNames(object branch,
string& nodeNameFrom,
string& nodeNameTo,
[int cacheIndex])
A RGUMENTS
branch Branch to find the UCTE node names from
nodeNameFrom (out)
UCTE node name of start node
nodeNameTo (out)
UCTE node name of end node
cacheIndex (optional)
Index of the quick access cache (must be greater than or equals to 0)
E XAMPLE
object command, line;
set lines;
int err, cacheIndex;
string nodeFrom, nodeTo;
cacheIndex = 1;
err = command.BuildNodeNames(cacheIndex);
if (err > 0) {
Error('Error during filling quick access cache for cache index %d.', cacheIndex);
exit();
}
560
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
GetOrderCode
Determines the order code of the given branch element as used for UCTE export from the quick
access cache given by the optional cache index. If no cache index is given the default quick
access cache is used.
void ComUcteexp.GetOrderCode(object branch,
string& orderCode,
[int cacheIndex])
A RGUMENTS
branch Branch element to get the UCTE order code from
orderCode (out)
Order code of the given branch element
cacheIndex (optional)
Index of the quick access cache (must be greater than or equals to 0)
E XAMPLE
object command, line;
set lines;
int err, cacheIndex;
string orderCode;
cacheIndex = 1;
err = command.BuildNodeNames(cacheIndex);
if (err > 0) {
Error('Error during filling quick access cache for cache index %d.', cacheIndex);
exit();
}
GetUcteNodeName
Determines the node name of the given terminal as used for UCTE export from the quick access
cache given by the optional cache index. If no cache index is given the default quick access
cache is used.
void ComUcteexp.GetUcteNodeName(object terminal,
string& ucteNodeName,
[int cacheIndex])
A RGUMENTS
terminal Terminal to get the UCTE node name from
561
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
ucteNodeName (out)
UCTE node name of the given terminal
cacheIndex (optional)
Index of the quick access cache (must be greater than or equals to 0)
E XAMPLE
object command, term;
set terms;
int err, cacheIndex;
string nodeName;
cacheIndex = 1;
err = command.BuildNodeNames(cacheIndex);
if (err > 0) {
Error('Error during filling quick access cache for cache index %d.', cacheIndex);
exit();
}
InitQuickAccess
Initializes the quick access cache given by the optional cache index. The quick acess cache
contains node names and branch topologies as used in UCTE export and endures topology
changes. InitQuickAccess() requires a successful executed UCTE export as pre-condition. The
cache index is optional. If no cache index is given the default quick access cache is used.
void ComUcteexp.InitQuickAccess([int cacheIndex])
A RGUMENTS
cacheIndex (optional)
Index of the quick access cache (must be greater than or equals to 0)
E XAMPLE
object command;
int err, cacheIndex, available;
cacheIndex = 1;
err = command.Execute();
562
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
if (err > 0) {
Error('Error during filling quick access cache for cache index %d.', cacheIndex);
exit();
}
command.InitQuickAccess(cacheIndex);
available = command.QuickAccessAvailable(cacheIndex);
QuickAccessAvailable
Checks if the quick access cache given by the optional cache index is available. If no cache
index is given the default quick access cache is checked for availability.
int ComUcteexp.QuickAccessAvailable([int cacheIndex])
A RGUMENTS
cacheIndex (optional)
Index of the quick access cache (must be greater than or equals to 0)
R ETURNS
0 on success and 1 on error.
E XAMPLE
object command;
int err, available, cacheIndex;
cacheIndex = 1;
err = command.BuildNodeNames(cacheIndex);
if (err > 0) {
Error('Error during filling quick access cache for cache index %d.', cacheIndex);
exit();
}
available = command.QuickAccessAvailable(cacheIndex);
printf('Quick access cache for cache index %d available: %d', cacheIndex, available);
ResetQuickAccess
Resets the given quick access cache for node names and branch topologies as used in UCTE
export. The cache index is optional. If no cache index is given the default quick access cache
is reset.
void ComUcteexp.ResetQuickAccess([int cacheIndex])
563
3.4. COMMANDS CHAPTER 3. OBJECT METHODS
A RGUMENTS
cacheIndex (optional)
Index of the quick access cache (must be greater than or equals to 0)
SetGridSelection
Configures the selected grids in the UCTE export command.
void ComUcteexp.SetGridSelection(set gridsToExport)
A RGUMENTS
gridsToExport
Grids (instances of class ElmNet) to be selected for export. All not contained grids
will be de-selected.
3.4.57 ComWktimp
Overview
GetCreatedObjects
GetModifiedObjects
GetCreatedObjects
Returns the newly created objects after execution of a WKT import.
set ComWktimp.GetCreatedObjects()
R ETURNS
Collection of objects that have been created during WKT import.
E XAMPLE
The following example returns the created objects after execution of a WKT import:
set created;
object obj;
printf('Created objects:');
created = ImportCmd.GetCreatedObjects();
for(obj = created.First(); obj; obj = created.Next()) {
printf('%o', obj);
}
GetModifiedObjects
Returns the modified objects after execution of a WKT import.
set ComWktimp.GetModifiedObjects()
564
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
R ETURNS
Collection of objects that have been modified during WKT import.
E XAMPLE
The following example returns the modified objects after execution of a WKT import:
set modified;
object obj;
printf('\nModified objects:');
modified = ImportCmd.GetModifiedObjects();
for(obj = modified.First(); obj; obj = modified.Next()) {
printf('%o', obj);
}
3.5 Settings
3.5.1 SetCluster
Overview
CalcCluster
GetNumberOfClusters
CalcCluster
Performs a load flow calculation for the cluster index passed to the function. To execute properly
this function requires that a valid load flow result is already calculated before calling it.
int SetCluster.CalcCluster(int clusterIndex,
[int messageOn]
)
A RGUMENTS
clusterIndex
The cluster index. Zero based value, the first cluster has index 0.
messageOn (optional)
Possible values:
0 Do not emit a message in the output window.
1 Emit a message in the output window in case that the function does
not execute properly.
R ETURNS
0 On success.
1 There are no clusters, the number of clusters is 0.
2 The cluster index exceeds the number of clusters.
3 There is no load flow in memory before running CalcCluster.
565
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
E XAMPLE
See example of SetCluster.GetNumberOfClusters.
GetNumberOfClusters
Get the number of clusters.
int SetCluster.GetNumberOfClusters()
R ETURNS
The number of clusters.
E XAMPLE
The following example gets the SetCluster object from the reliability and prints the active
power sum of loads for every load state to the output window.
object rel3,
clusterObj,
ldf,
sumGrd;
set temp;
int nrOfClusters,
clusterIndex,
errorCode;
rel3 = GetFromStudyCase('ComRel3');
ldf = GetFromStudyCase('ComLdf');
temp = rel3.GetContents('*.SetCluster',0);
clusterObj = temp.First();
if (clusterObj = nullptr) {
exit();
}
ldf.Execute(); ! ldf result required by CalcCluster
sumGrd = GetSummaryGrid();
nrOfClusters = clusterObj.GetNumberOfClusters();
Info('Calculating %d clusters found in %o', nrOfClusters,clusterObj);
for (clusterIndex=0; clusterIndex<nrOfClusters; clusterIndex+=1) {
errorCode = clusterObj.CalcCluster(clusterIndex,1);
if (errorCode>0) {
break;
}
printf('%f',sumGrd:m:Pload);
}
566
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
3.5.2 SetColscheme
Overview
CreateFilter
GetAlarmColouringMode
GetColouringMode
GetEnergisingColouringMode
SetColouring
SetFilter
CreateFilter
Creates filter used to determine objects to be colored.
int SetColscheme.CreateFilter([int pageNr])
A RGUMENTS
pageNr empty Create filter for currently valid calculation
set Dialog page number for which filter is created (see table below)
567
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
Table 3.5.3
R ETURNS
0 On success.
1 On error.
GetAlarmColouringMode
Returns the alarm colouring number for the given or currently valid calculation.
int SetColscheme.GetAlarmColouringMode(string page)
A RGUMENTS
page
568
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
R ETURNS
The colouring number of ”Alarm” colouring or negative value if not set.
GetColouringMode
Returns the alarm colouring number for the given or currently valid calculation.
int SetColscheme.GetColouringMode(string page)
A RGUMENTS
page
empty for currently valid calculation
set page (see dialog page name table)
R ETURNS
The colouring number of ”Other” colouring or negative value if not set.
GetEnergisingColouringMode
Returns the energising status colouring number for the given or currently valid calculation.
int SetColscheme.GetEnergisingColouringMode(string page)
A RGUMENTS
page
empty for currently valid calculation
set page (see dialog page name table)
R ETURNS
The colouring number of ”Energising Status” colouring or negative value if not set.
SetColouring
Sets colouring for given or currently valid calculation.
int SetColscheme.SetColouring(string page,
int energizing,
[int alarm,]
[int normal]
)
A RGUMENTS
page
empty set for currently valid calculation
set page for which modes are set (see dialog page name table)
569
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
energizing
Colouring for Energizing Status
570
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
Table 3.5.4
Table 3.5.5
571
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
Table 3.5.6
572
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
Table 3.5.7
Note: User-defined filters can be set with a “normal” value of 1000 or higher. The first filter in
the list has the value 1000, the next one has 1001 and so on.
R ETURNS
0 error (at least one of the given colourings cannot be set, e.g. not available for
given page). Nothing is changed.
1 ok
SetFilter
Sets filter for given or currently valid calculation.
int SetColscheme.SetFilter(int filter,
[int page]
)
int SetColscheme.SetFilter(object obj,
[int page]
)
A RGUMENTS
filter number of filter to be set
obj user-defined filter to be set
page (optional)
Dialog page number for which filter is set (for numbers see table listed in Set-
Colscheme.CreateFilter())
R ETURNS
0 ok
1 error (filter or page not found)
S EE ALSO
SetColscheme.CreateFilter()
3.5.3 SetDatabase
Overview
EmptyCache
EmptyCache
Empties characteristics cache for this database connection.
void SetDatabase.EmptyCache()
574
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
3.5.4 SetDataext
Overview
AddConfiguration
GetConfiguration
GetConfigurations
RemoveAllConfigurations
RemoveConfiguration
AddConfiguration
Adds a new IntAddonvars configuration object for the given classFilter with the descriptiveName
as object name. For the classFilter expressions like Elm* or ElmTr? are possible. If there
already is an object matching classFilter and descriptiveName exactly, this object is returned
instead.
object SetDataext.AddConfiguration(string classFilter, string descriptiveName)
A RGUMENTS
classFilter
The class filter of the IntAddonvars object
descriptiveName
The object name of the IntAddonvars object
R ETURNS
The IntAddonvars object which exactly matches the classFilter and descriptive name or a
newly created one. Returns nothing if the object cannot be modified.
S EE ALSO
GetConfiguration
Returns the IntAddonvars object which exactly matches the classFilter and descriptiveName, if
the latter is specified. If there are multiple matches the first object will be returned. Otherwise
nothing is returned.
object SetDataext.GetConfiguration(string classFilter, [string descriptiveName])
A RGUMENTS
classFilter
The class filter of the IntAddonvars object
descriptiveName (optional)
The object name of the IntAddonvars object
R ETURNS
The IntAddonvars object which exactly matches the classFilter and optionally the descriptive-
Name or nothing.
575
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
S EE ALSO
GetConfigurations
Returns all IntAddonvars objects by a given classFilter.
set SetDataext.GetConfigurations(string classFilter)
set SetDataext.GetConfigurations()
A RGUMENTS
classFilter
The class filter for the IntAddonvars object
R ETURNS
A list of IntAddonvars objects matching the classFilter exactly. If no filter is specified all
IntAddonvars are returned.
S EE ALSO
RemoveAllConfigurations
Removes all IntAddonvars objects effectively removing all Data Extensions.
void SetDataext.RemoveAllConfigurations()
RemoveConfiguration
Removes the IntAddonvars object exactly matching classFilter and descriptive name.
void SetDataext.RemoveConfiguration(string classFilter, [string descriptiveName])
A RGUMENTS
classFilter
The class filter of the IntAddonvars object
descriptiveName (optional)
The object name of the IntAddonvars object
576
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
3.5.5 SetDeskpage
Overview
Close
Show
Close
Closes the graphic page, if currently shown in the graphics board.
int SetDeskpage.Close()
R ETURNS
0 On success, no error occurred.
1 Otherwise
Show
Displays the diagram page in the graphics board.
int SetDeskpage.Show()
R ETURNS
0 On success, no error occurred.
1 Otherwise
3.5.6 SetDesktop
Overview
AddPage
Close
DoAutoScaleX
Freeze
GetActivePage
GetCanvasSize
GetPage
IsFrozen
IsOpened
RemovePage
SetAdaptX
SetAutoScaleX
SetResults
SetScaleX
SetViewArea
SetXVar
Show
Unfreeze
WriteWMF
ZoomAll
577
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
AddPage
Adds an existing page to a graphics and activates it
A RGUMENTS
page2add
The page to add to the desktop.
• Page is a plot page (GrpPage or SetVipage): A copy of the page is added.
• Page is an IntGrfnet (Single line graphic, block diagram): The graphic is
added.
R ETURNS
The page displayed or NULL if the desktop was not changed.
E XAMPLE
object desktop; ! graphic board
object pagecopied; ! page created by AddPage
desktop = GetGraphicsBoard();
if (desktop) {
! add PageTemplate to desktop (it is assumed that PageTemplate is a
! virtual instrument panel stored in the "Contents" of the DPL script.
pagecopied = desktop.AddPage(PageTemplate);
pagecopied.ShowFullName();
}
Close
Closes the graphics board, if it is currently shown.
int SetDesktop.Close()
R ETURNS
0 on success
1 on error
DoAutoScaleX
Scales the x-axes of all plots in the graphics board which use the x-axis scale defined in the
graphics board.
void SetDesktop.DoAutoScaleX()
578
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example performs an automatic scaling of x.
object graphBoard;
! Look for opened graphics board.
graphBoard=GetGraphicsBoard();
if (graphBoard) {
graphBoard.DoAutoScaleX();
}
Freeze
Enables the graphical freeze mode, preventing changes to open diagrams.
int SetDesktop.Freeze()
R ETURNS
0 on success
1 on error
GetActivePage
Returns the page object of the currently shown page.
object SetDesktop.GetActivePage()
R ETURNS
Page object of the active page, or 0 if no page is active.
GetCanvasSize
Returns the pixel dimensions of the currently active (top-most) graphic page.
int SetDesktop.GetCanvasSize(int& width,
int& height
)
A RGUMENTS
width (out)
Pixel width of the canvas. -1 if no graphics page is open.
height (out)
Pixel height of the canvas. -1 if no graphics page is open.
R ETURNS
0 on success: canvas size could be determined
1 on error: no graphics page is open
579
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
GetPage
Searches, activates and returns a graphics page in the currently open graphics board. If “create”
is true, then a new page will be created and added to the graphics board if no page with name
was found.
object SetDesktop.GetPage(string name,
[int create,]
[string class]
)
A RGUMENTS
name Name of the page.
create (optional)
Possible values:
R ETURNS
Plot page (GrpPage or SetVipage), or network graphic page (SetDeskpage)
E XAMPLE
The following example looks for the plot pages named 'Voltage', 'Current' and 'Power' in the
graphics board currently open. The plot pages are created if they do not exist.
object graphBoard;
object pageVoltage;
object pageCurrent;
object pagePower;
! Look for opened graphics board.
graphBoard=GetGraphicsBoard();
if (graphBoard) {
! Search or create plot pages
pageVoltage=graphBoard.GetPage('Voltage',1);
pageCurrent=graphBoard.GetPage('Current',1);
pagePower=graphBoard.GetPage('Power',1);
}
IsFrozen
Returns whether the graphical freeze mode is currently enabled.
int SetDesktop.IsFrozen()
R ETURNS
0 freeze mode is disabled, or the graphics board is not open
1 graphics board is open and freeze mode is enabled
580
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
IsOpened
Returns whether the graphics board is currently shown.
int SetDesktop.IsOpened()
R ETURNS
1 if graphics board is shown
0 otherwise
RemovePage
Removes a graphic page. The page to be removed can be identified either by its name or by its
page object.
int SetDesktop.RemovePage(string pageName)
int SetDesktop.RemovePage(object pageObject)
A RGUMENTS
pageName
Name of graphics page.
pageObject
A graphics page object.
R ETURNS
0 on success
1 on error
SetAdaptX
Sets the Adapt Scale option of the x-scale.
void SetDesktop.SetAdaptX(int mode,
[double trigger]
)
A RGUMENTS
mode Possible values:
0 off
1 on
trigger (optional)
Trigger value, unused if mode is off or empty
E XAMPLE
The following example looks for an opened graphics board and sets its adapt scale option.
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
! Turn on adapt scale, use a trigger value of 3
graphBoard.SetAdaptX(1,3);
! Turn off adapt scale
581
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
graphBoard.SetAdaptX(0,3);
! Turn on adapt scale again, do not change the trigger value
graphBoard.SetAdaptX(1);
}
SetAutoScaleX
Sets automatic scaling mode of the x-scale. A warning is issued if an invalid mode is passed to
the function.
void SetDesktop.SetAutoScaleX(int mode)
A RGUMENTS
mode Possible values:
0 never
1 after simulation
2 during simulation
E XAMPLE
The following example looks for an open graphics boards and sets its Auto Scale setting to
Off.
! Set Auto Scale to Off
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
! Turn off automatic scaling
graphBoard.SetAutoScaleX(0);
}
SetResults
Sets default results object of graphics board.
void SetDesktop.SetResults(object res)
A RGUMENTS
res Result object to set or NULL to reset. Valid result object is any of class ElmRes,
IntComtrade and IntComtradeset.
E XAMPLE
The following example looks for an open graphics board and sets its default results to the
results object named 'Results'.
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
graphBoard.SetResults(Results);
}
582
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
SetScaleX
Sets x-axis scale. A function call without arguments sets the Auto Scale setting to On without
changing the scale itself.
void SetDesktop.SetScaleX()
void SetDesktop.SetScaleX(double min,
double max,
[int log]
)
A RGUMENTS
min (optional)
Minimum of x-scale.
max (optional)
Maximum of x-scale.
log (optional)
Possible values:
0 linear
1 logarithmic
E XAMPLE
The following examples look for an open graphics board and set its x-axis scale. There are
three different examples. 1. Example: Set 'Auto Scale' of x axis to 'On'. 2. Example: Set
minimum to 0 and maximum to 20. 3. Example: Set minimum to 1 and maximum to 1000.
Changes to a logarithmic scale.
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
graphBoard.SetScaleX();! Automatic Scaling to On
}
! Set minimum and maximum without changing linear/log
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
! Set minimum and maximum
graphBoard.SetScaleX(0,20);
}
! Set minimum and maximum, change to logarithmic scale
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
! Set minimum and maximum
graphBoard.SetScaleX(1,1000,1);
}
583
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
SetViewArea
Adjusts the view area of the currently active (top-most) graphic page. Coordinates are expected
in millimetres for schematic diagrams or in geographic coordinates for geographic diagrams,
respectively.
void SetDesktop.SetViewArea(double left,
double right,
double bottom,
double top)
SetXVar
Sets x-axis variable. If The default x-axis variable (time) is set if no argument is passed.
void SetDesktop.SetXVar()
void SetDesktop.SetXVar(object obj,
string varname
)
A RGUMENTS
obj (optional)
x-axis object
varname (optional)
variable of obj
E XAMPLE
The following examples look for an open graphics board and sets its x-axis variable. The first
example sets an user defined x-axis variable of the graphics board. The second one sets the
default x-axis (in simulation: time).
! set x-axis variable 'm:U1:bus1' of object line
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
graphBoard.SetXVar(line,'m:U1:bus1');
}
Show
Shows the virtual instrument panel with the same name as 'pageObject' or the page with
name 'pageName' in the graphics board. The object 'pageObject' is typically a object of class
'SetVipage' (virtual instrument panel) but, as only its name is used, it may be any other type of
object. Calling the function without an argument opens the graphics board.
int SetDesktop.Show()
int SetDesktop.Show(string pageName)
int SetDesktop.Show(object pageObject)
584
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
A RGUMENTS
pageName (optional)
Name of graphics page.
pageObject (optional)
A graphics page oject.
R ETURNS
0 on success
1 on error
E XAMPLE
The following example activates all pages in the graphics board one by one and exports them
as WMF figures.
object graphicsBoard,page;
set pages;
int n;
string FileName;
graphicsBoard = GetGraphicsBoard();
if (graphicsBoard) {
pages = graphicsBoard.GetContents();
page = pages.First();
while (page) {
graphicsBoard.Show(page);
FileName = sprintf('c:\\temp\%s%d', page:loc_name, n);
graphicsBoard.WriteWMF(FileName);
page = pages.Next();
}
}
Unfreeze
Disables the graphical freeze mode, allowing changes to open diagrams.
int SetDesktop.Unfreeze()
R ETURNS
0 on success
1 on error
WriteWMF
Writes the currently open graphic to a windows metafile file (*.wmf).
Please use the Save File command (ComWr) for writing to other formats like *.pdf, *.png, *.svg,
*.emf or *.bmp.
int SetDesktop.WriteWMF(string filename)
A RGUMENTS
filename Filename without extension.
585
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On error.
1 On success.
E XAMPLE
The following example exports the open graphic to a windows metafile.
object graphicsBoard;
graphicsBoard = GetGraphicsBoard();
if (graphicsBoard) {
graphicsBoard.WriteWMF('c:\temp\DPLExample');
}
ZoomAll
Adjusts the zoom level of the currently active (top-most) graphic page such that the entire
diagram is shown.
int SetDesktop.ZoomAll()
R ETURNS
0 on success
1 on error
3.5.7 SetDistrstate
Overview
CalcCluster
CalcCluster
Calculates a load flow with a given load distribution state applied.
int SetDistrstate.CalcCluster(int clusterIndex,
[int messageOn]
)
A RGUMENTS
clusterIndex
The cluster index. Zero based value, the first cluster has index 0.
messageOn (optional)
Possible values:
0 Do not emit a message in the output window.
1 Emit a message in the output window in case that the function does
not execute properly.
R ETURNS
0 if ok. -1 if load flow of cluster did not converge.
586
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
3.5.8 SetFilt
Overview
Get*
Get*
Returns a container with the filtered objects.
set SetFilt.Get()
R ETURNS
The set of filtered objects.
3.5.9 SetLevelvis
Overview
AdaptWidth
Align
ChangeFont
ChangeFrameAndWidth
ChangeLayer
ChangeRefPoints
ChangeWidthVisibilityAndColour
Mark
Reset
AdaptWidth
This function resizes the in the object specified group of text boxes regarding their text contents.
void SetLevelvis.AdaptWidth()
Align
This function aligns the text within a text box.
void SetLevelvis.Align(int iPos)
A RGUMENTS
iPos Alignment position
0 left
1 middle
2 right
587
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
ChangeFont
This function sets the font number for the specified group of text boxes.
void SetLevelvis.ChangeFont(int iFont)
A RGUMENTS
iFont Font number (default fonts range from 0 to 13)
ChangeFrameAndWidth
This method is not available anymore. Please use SetLevelvis.ChangeWidthVisibilityAndColour()
instead.
void SetLevelvis.ChangeFrameAndWidth([int iFrame,]
[int iWidth,]
[int iVisibility,]
[int iColour]
)
ChangeLayer
This function sets the specified group of text boxes to a given layer.
void SetLevelvis.ChangeLayer(string sLayer)
A RGUMENTS
sLayer Layer name (e.g. 'Object Names', 'Results', 'Invisible Objects',..)
ChangeRefPoints
This function sets the reference points between a text box (second parameter) and its parent
object (first parameter), e.g. if the result box of a busbar shall be shown on top of a drawn
bar instead of below the bar the values change from (6,4) to (4,6). The first number specifies
the reference number of the text box. The integer values describe the position of the reference
points within a rectangle (0=centre, 1=middle right, 2=top right,..):
432
501
678
A RGUMENTS
iParRef Defines the reference point on the parent object (e.g. busbar)
588
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
ChangeWidthVisibilityAndColour
This function sets the visibility of the frame, the width (in number of letters), the visibility and the
colour of text boxes.
void SetLevelvis.ChangeWidthVisibilityAndColour([int iWidth,]
[int iVisibility,]
[int iColour]
)
A RGUMENTS
iWidth Sets the width in number of letters
0..n width
iVisibility Sets the visibility
0 not visible
1 visible
iColour Sets the colour
0..255 colour
Mark
Marks the specified group of text boxes in the currently shown diagram.
void SetLevelvis.Mark()
Reset
This function resets the individually modified text box settings.
void SetLevelvis.Reset(int iMode)
A RGUMENTS
iMode
0 Reset to default (changed reference points are not reset)
1 Only font
2 Shift to original layer (result boxes to layer 'Results', object names to
layer 'Object Names')
3.5.10 SetLvscale
Overview
AddCalcRelevantCoincidenceDefinitions
589
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
AddCalcRelevantCoincidenceDefinitions
Adds all calculation relevant coincidence definitions.
void SetLvscale.AddCalcRelevantCoincidenceDefinitions()
3.5.11 SetParalman
Overview
GetNumSlave*
SetNumSlave
SetTransfType
GetNumSlave*
To get the number of slaves which is currently configured.
int SetParalman.GetNumSlave()
R ETURNS
the number of slaves which is currently configured.
SetNumSlave
To configue the number of slaves to be used for parallel computing.
int SetParalman.SetNumSlave(int numSlaves)
A RGUMENTS
numSlaves
Number of slaves to be used for parallel computing
R ETURNS
Always return 0.
SetTransfType
To change the data transfer type: via file or via socket communication.
int SetParalman.SetTransfType(int viaFile)
A RGUMENTS
viaFile
0 The data will be transferred via socket communication.
1 The data will be transferred via file.
590
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
R ETURNS
0 the data will be transferred via socket communication.
1 the data will be transferred via file.
3.5.12 SetPath
Overview
AllBreakers*
AllClosedBreakers*
AllOpenBreakers*
AllProtectionDevices*
Create
GetAll*
GetBranches*
GetBuses*
GetPathFolder
AllBreakers*
Returns all breakers in the path definition.
set SetPath.AllBreakers()
R ETURNS
The set of breakers.
AllClosedBreakers*
Returns all closed breakers in the path definition.
set SetPath.AllClosedBreakers()
R ETURNS
The set of closed breakers.
AllOpenBreakers*
Returns all open breakers in the path definition.
set SetPath.AllOpenBreakers()
R ETURNS
The set of open breakers.
AllProtectionDevices*
Returns all protection devices in the path definition for a given direction.
set SetPath.AllProtectionDevices(int reverse)
591
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
A RGUMENTS
reverse
0 Return devices in forward direction.
1 Return devices in reverse direction.
R ETURNS
The set of protection devices.
Create
Creates or extends the path with the elements provided.
object SetPath.Create(set elements)
A RGUMENTS
elements Elements the path shall be created or extended with.
R ETURNS
object Modification was successful.
NULL Modification failed. (e.g. elements form an incomplete path)
E XAMPLE
The following emulates Path → New from the context menu, by creating a new path definition
with the contents of the general selection selection of the script.
object folder, path, return;
folder = GetDataFolder('IntPath');
path = folder.CreateObject('SetPath', 'Path');
return = path.Create(SEL.All());
if (return) {
printf('Path %o was modified', path);
}
else {
printf('An error occurred while modifing path %o', path);
}
GetAll*
Returns all objects in the path definition.
set SetPath.GetAll()
R ETURNS
The set of objects.
E XAMPLE
The following example writes all objects in the path definition to the output window, assuming
aPath is an external SetPath object.
set list;
object obj;
592
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
list = aPath.GetAll();
obj = list.First();
while (obj) {
obj.ShowFullName();
obj = list.Next();
}
GetBranches*
Returns all breanches in the path definition.
set SetPath.GetBranches([int reverse])
A RGUMENTS
reverse (optional)
0 Sort the branches in forward direction.
1 Sort the branches in reverse direction.
R ETURNS
The set of branches.
GetBuses*
Returns all busbars and terminals in the path definition.
set SetPath.GetBuses()
R ETURNS
The set of busbars and terminals.
GetPathFolder
Returns the default folder for storing path objects.
object SetPath.GetPathFolder([int create])
A RGUMENTS
create (optional)
0 Return only if the folder exists.
1 Create the folder if it does not exist.
R ETURNS
object Default folder for storing path.
NULL Default folder does not exist or could not be created.
593
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
3.5.13 SetPrj
Overview
GetFontID
SetFontFor
GetFontID
Determines the ID for given font. The font is automatically internally registered if it has not been
used before.
int SetPrj.GetFontID(const char* fontName,
int fontSize,
[int fontStyle = 0])
A RGUMENTS
fontName
Font name
fontSize Font size
fontStyle (optional)
Bitfield if bold, italic and/or underline
0 Regular (no style used
1 Bold
2 Italic
3 Bold and italic
4 Underline
R ETURNS
Returns the font ID. The value is always greater than zero.
E XAMPLE
In this example the new font ’Consolas’ with size 12 is created and becomes the default font
for all node labels on the currently visible diagram.
int fontID;
object intGrfnet, prj, setPrj;
prj = GetActiveProject();
setPrj = prj:pPrjSettings;
intGrfnet = GetCurrentDiagram();
if (intGrfnet) {
fontID = setPrj.GetFontID('Consolas', 12);
intGrfnet:fontNodLabel = fontID;
intGrfnet:allowFontsIndivTBs = 0; ! making changes visible for current diagram (overrulin
intGrfnet:usePrjFonts = 0; ! do not use project fonts for this diagram
Rebuild(1); ! once at the end of the sript
}
594
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
SetFontFor
Sets a font for a specified group of text boxes.
void SetPrj.SetFontFor(int sglOrBlock,
int labelResultOrTitle,
int nodesOrBranches,
string fontName,
int fontSize,
int fontStyle)
A RGUMENTS
sglOrBlock
Font settings for single line or block diagrams
0 Single line diagrams
1 Block diagrams
labelResultOrTitle
Type of text box to be modified.
0 Labels
1 Results
2 Title and Legends
nodesOrBranches
Type of parent object
0 Nodes
1 Branches
fontName
Font name
fontSize Font size
fontStyle Font style
1 Bold
2 Italic
3 Bold and italic
4 Underline
3.5.14 SetScenario
Overview
Check
Default
Print
595
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
Check
Checks the scenario configuration. The action is identical to pressing the corresponding button
in the dialog.
NB: This function is only available if called on the configuration (SetScenario) of the currently
active project.
int IntScenario.Check()
R ETURNS
0 Ok, check did not reveal any problems
1 Not ok, check found some problems. See the output window for details.
Default
Resets the scenario configuration to the default, built-in configuration. The action is identical to
pressing the corresponding button in the dialog.
NB: This function is only available if no scenario is active and called on the configuration
(SetScenario) of the currently active project.
void IntScenario.Default()
Print
Prints the scenario configuration to the output window. The action is identical to pressing the
corresponding button in the dialog.
NB: This function is only available if called on the configuration (SetScenario) of the currently
active project.
void IntScenario.Print()
3.5.15 SetSelect
Overview
AddRef*
All*
AllAsm*
AllBars*
AllBreakers*
AllClosedBreakers*
AllElm*
AllLines*
AllLoads*
AllOpenBreakers*
AllSym*
AllTypLne*
Clear
GetAll*
596
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
AddRef*
Adds a reference to the objects to the existing selection.
void SetSelect.AddRef(object O)
void SetSelect.AddRef(set S)
A RGUMENTS
O An object.
S A set of objects.
E XAMPLE
The following example adds all loads and lines from the general DPL selection to the selection
“MySelection”.
set lines;
lines = SEL.AllLines();
MySelection.AddRef(lines);
lines = SEL.AllLoads();
MySelection.AddRef(lines);
All*
Returns all objects in the selection.
set SetSelect.All()
R ETURNS
The set of objects
E XAMPLE
The following example writes objects in the general DPL selection to the output window.
set list;
object obj;
list = SEL.All();
obj = list.First();
while (obj) {
obj.ShowFullName();
obj = list.Next();
}
AllAsm*
Returns all asynchronous machines in the selection.
set SetSelect.AllAsm()
R ETURNS
The set of objects
597
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example writes all asynchronous machines in the general DPL selection to the
output window.
set list;
object asynMachines;
list = SEL.AllAsm();
asynMachines = list.First();
while (asynMachines) {
asynMachines.ShowFullName();
asynMachines = list.Next();
}
AllBars*
Returns all busbars and terminals in the selection.
set SetSelect.AllBars()
R ETURNS
The set of objects
E XAMPLE
The following example writes all busbars in the general DPL selection to the output window.
set list;
object bar;
list = SEL.AllBars();
bar = list.First();
while (bar) {
bar.ShowFullName();
bar = list.Next();
}
AllBreakers*
Returns all breakers in the selection.
set SetSelect.AllBreakers()
R ETURNS
The set of objects
E XAMPLE
The following example writes all breakers in the general DPL selection to the output window.
set list;
object breaker;
list = SEL.AllBreakers();
breaker = list.First();
while (breaker) {
breaker.ShowFullName();
breaker = list.Next();
}
598
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
AllClosedBreakers*
Returns all closed breakers in the selection.
set SetSelect.AllClosedBreakers()
R ETURNS
The set of objects
E XAMPLE
The following example writes all closed breakers in the general DPL selection to the output
window.
set list;
object closedbreaker;
list = SEL.AllClosedBreakers();
closedbreaker = list.First();
while (closedbreaker) {
closedbreaker.ShowFullName();
closedbreaker = list.Next();
}
AllElm*
Returns all elements (Elm*) in the selection.
set SetSelect.AllElm()
R ETURNS
The set of containing objects
E XAMPLE
The following example writes all objects in the general DPL selection to the output window.
set list;
object obj;
list = SEL.AllElm();
obj = list.First();
while (obj) {
obj.ShowFullName();
obj = list.Next();
}
AllLines*
Returns all lines and line routes in the selection.
set SetSelect.AllLines()
R ETURNS
The set of objects
599
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example writes all lines and line routes in the general DPL selection to the
output window.
set list;
object line;
list = SEL.AllLines();
line = list.First();
while (line) {
line.ShowFullName();
line = list.Next();
}
AllLoads*
Returns all loads in the selection.
set SetSelect.AllLoads()
R ETURNS
The set of objects
E XAMPLE
The following example writes all loads in the general DPL selection to the output window.
set list;
object load;
list = SEL.AllLoads();
load = list.First();
while (load) {
load.ShowFullName();
load = list.Next();
}
AllOpenBreakers*
Returns all open breakers in the selection.
set SetSelect.AllOpenBreakers()
R ETURNS
The set of objects
E XAMPLE
The following example writes all open breakers in the general DPL selection to the output
window.
set list;
object openbreaker;
list = SEL.AllOpenBreakers();
openbreaker = list.First();
while (openbreaker) {
openbreaker.ShowFullName();
openbreaker = list.Next();
}
600
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
AllSym*
Returns all synchronous machines in the selection.
set SetSelect.AllSym()
R ETURNS
The set of objects
E XAMPLE
The following example writes all synchronous machines in the general DPL selection to the
output window.
set list;
object synMachines;
list = SEL.AllSym();
synMachines = list.First();
while (synMachines) {
synMachines.ShowFullName();
synMachines = list.Next();
}
AllTypLne*
Returns all line types in the selection.
set SetSelect.AllTypLne()
R ETURNS
The set of objects
E XAMPLE
The following example writes objects in the general DPL selection to the output window.
set list;
object obj;
list = SEL.All();
obj = list.First();
while (obj) {
obj.ShowFullName();
obj = list.Next();
}
Clear
Clears (deletes) the selection.
void SetSelect.Clear()
601
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example clears the set from the previous content, then adds all loads in the
general DPL selection.
set loads;
loads = SEL.AllLoads();
MySelection.Clear();
MySelection.AddRef(loads);
GetAll*
Returns all objects in the selection which are of the class 'ClassName'.
set SetSelect.GetAll(string ClassName)
A RGUMENTS
ClassName
The object class name.
R ETURNS
The set of objects
E XAMPLE
The following example writes all three winding transformers in the general DPL selection to
the output window.
set list;
object transformer;
list = SEL.GetAll('ElmTr3');
transformer = list.First();
while (transformer) {
transformer.ShowFullName();
transformer = list.Next();
}
3.5.16 SetTboxconfig
Overview
Check
GetAvailableButtons
GetDisplayedButtons
Purge
SetDisplayedButtons
602
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
Check
Checks buttons to be displayed for invalid or duplicate ids and prints error messages.
int SetTboxconfig.Check()
R ETURNS
0 No errors found.
1 Errors found.
GetAvailableButtons
Gets buttons available for selected tool bar.
string SetTboxconfig.GetAvailableButtons()
R ETURNS
String ids of all buttons available for selected tool bar; ids are separated by '\n'.
GetDisplayedButtons
Gets buttons configured to be displayed in selected tool bar.
string SetTboxconfig.GetDisplayedButtons()
R ETURNS
String ids of all buttons configured to be displayed in selected tool bar; ids are separated by
'\n'.
Purge
Purges buttons to be displayed from invalid or duplicate ids.
int SetTboxconfig.Purge()
R ETURNS
0 No problems found.
1 Configuration was adapted.
SetDisplayedButtons
Sets buttons to be displayed in selected tool bar. Purges given buttons from invalid or duplicate
buttons (duplicate separators or breaks are kept).
int SetTboxconfig.SetDisplayedButtons(string buttonIds)
A RGUMENTS
buttonIds String ids of all buttons to be set as displayed buttons; ids have to be separated
by '\n'
603
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Given buttons were stored without modification.
1 Given buttons were purged from invalid or duplicate ids.
3.5.17 SetTime
Overview
Date
SetTime
SetTimeUTC
Time
Date
Sets date component to current system date.
void SetTime.Date()
E XAMPLE
The following example sets the study time of active project to current date:
object studytime;
studytime = GetFromStudyCase('SetTime');
studytime.Date();
S EE ALSO
SetTime.Time(), SetTime.SetTimeUTC()
SetTime
Sets the time in the current year. There is no restriction to the values for H, M and S, except
for the fact that negative values are interpreted as zero. Values higher than 24 or 60 will be
processed normally by adding the hours, minutes and seconds into an absolute time, from
which a new hour-of-year, hour-of-day, minutes and seconds are calculated.
void SetTime.SetTime(double H,
[double M,]
[double S]
)
A RGUMENTS
H The hours
M (optional)
The minutes
S (optional)
The seconds
E XAMPLE
The following sets the time to 1134.45 hours, 91.2 minutes and 675.3 seconds, which results
in the time 08:09:27 on the 48th day of the year.
604
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
object studytime;
studytime = GetFromStudyCase('SetTime');
studytime.SetTime(1134.45, 91.2, 675.3);
SetTimeUTC
Sets date and time to given time. The time must be given in UTC format as seconds since
01.01.1970 00:00 GMT.
void SetTime.SetTimeUTC(int time)
A RGUMENTS
time UTC time in seconds since 01.01.1970 00:00 GMT
E XAMPLE
Example demonstrates how to change date and time of active study case:
object studytime;
studytime = GetFromStudyCase('SetTime');
studytime.SetTimeUTC(1200478788); !Wed, 16 Jan 2008 10:19:48 GMT
S EE ALSO
SetTime.Date(), SetTime.Time()
Time
Sets time component to current system time.
void SetTime.Time()
E XAMPLE
The following example sets the study time of active project to current time:
object studytime;
studytime = GetFromStudyCase('SetTime');
studytime.Time();
S EE ALSO
SetTime.Date(), SetTime.SetTimeUTC()
605
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
3.5.18 SetUser
Overview
GetNumProcesses*
GetNumProcesses*
This function returns the actual number of processes for parallel computation.
int SetUser.GetNumProcesses()
R ETURNS
The actual number of processes for parallel computation.
E XAMPLE
The following example obtains the number of processes used by Parallel Contingency Anal-
ysis.
object oComSimoutage;
object oUserSetting;
int numProcesses;
oComSimoutage = GetCaseObject('ComSimOutage');
oUserSetting = oComSimoutage:e:parallelSetting;
if (oUserSetting = NULL) {
Error('No user setting object found.');
exit();
}
numProcesses = oUserSetting.GetNumProcesses();
Info('%d processes will be used in parallel computation.', numProcesses);
3.5.19 SetVipage
Overview
Close
DoAutoScaleX
DoAutoScaleY
GetOrInsertPlot
InsertPlot
MigratePage
SetAdaptX
SetAutoScaleX
SetResults
SetScaleX
SetStyle
SetTile
SetXVar
Show
606
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
Close
Closes the graphic page, if currently shown, and deletes it from the database.
int SetVipage.Close()
R ETURNS
0 On success, no error occurred.
1 Otherwise
DoAutoScaleX
Scales the x-axes of all plots on the virtual instrument panel automatically.
void SetVipage.DoAutoScaleX()
E XAMPLE
The following example looks for a page named voltage and performs an automatic scaling of
the x-axes.
object page;
object graphBoard;
! Look for opened graphics board.
graphBoard=GetGraphicsBoard();
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1);
if (page) {
page.DoAutoScaleX();
}
}
DoAutoScaleY
Scales the y-axes of all plots on the virtual instrument panel automatically.
void SetVipage.DoAutoScaleY()
E XAMPLE
The following example looks for a page named voltage and performs an automatic scaling of
the y-axes.
object page;
object graphBoard;
graphBoard=GetGraphicsBoard();
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1);
if (page) {
page.DoAutoScaleY();
}
}
607
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
GetOrInsertPlot
Get or create a virtual instrument of the virtual instrument panel.
object SetVipage.GetOrInsertPlot (string name,
[string class,]
[int create]
)
D EPRECATED N AMES
GetVI
A RGUMENTS
name Name of virtual instrument
class='VisPlot' (optional)
classname of virtual instrument.
create (optional)
Possible values:
0 do not create new virtual instrument
1 create virtual instrument if it does not exist already
R ETURNS
Virtual instrument
E XAMPLE
The following example looks for a subplot (VisPlot) named RST on a virtual instrument panel.
The plot is created if it was not found.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop
if (graphBoard) {
! Get Virtual Instrument Panel named 'Voltage'
page=graphBoard.GetPage('Voltage',1);
if (page) {
! Get plot named RST. Create the plot if not exists
plot=page.GetOrInsertPlot('RST','VisPlot',1);
}
}
InsertPlot
Creates a copy of the virtual instrument passed and displays the copy on this panel.
object SetVipage.InsertPlot(object vi)
D EPRECATED N AMES
CreateVI
A RGUMENTS
vi The virtual instrument which will be copied. Only virtual instruments are allowed
(classname 'Vis*').
608
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
R ETURNS
Returns the created virtual instrument.
E XAMPLE
The following example creates a copy of the plot stored inside the script on page 'Page 1'.
object desktop; ! graphics board
object page; ! page
object newPlot; ! plot created by InsertPlot
desktop = GetGraphicsBoard();
page = desktop.GetPage('Page 1',1); ! get panel, create if not there
newPlot = page.InsertPlot(plot); ! copy of the plot stored inside ComDpl
newPlot.ShowFullName(); ! report full name of the created plot
MigratePage
Converts this SetVipage to the new plot framework introduced in PowerFactory 2021, creating
a GrpPage:
void SetVipage.MigratePage()
R ETURNS
The migrated plot page (GrpPage)
E XAMPLE
The following example looks for a SetVipage named 'Plot Generators' , migrates it, and makes
the migrated GrpPage visible.
object graphicsBoard;
object setVipage, grpPage;
graphicsBoard = GetGraphicsBoard();
if (graphicsBoard) {
setVipage = graphicsBoard.GetPage('Plot Generators', 0);
if (setVipage) {
grpPage = setVipage.MigratePage();
grpPage.Show();
}
}
SetAdaptX
Sets the Adapt Scale option of the x-scale.
void SetVipage.SetAdaptX(int mode,
[double trigger]
)
609
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mode Possible values:
0 off
1 on
trigger (optional)
Trigger value, unused if mode is off or empty
E XAMPLE
The following examples look for a virtual instrument panel named 'Voltage' and sets its adapt
scale option.
object page;
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1);! Get panel named 'Voltage'
if (page) {
! Turn on adapt scale, use a trigger value of 3
page.SetAdaptX(1,3);
! Turn off adapt scale
page.SetAdaptX(0,3);
! Turn on adapt scale again, do not change the trigger value
page.SetAdaptX(1);
}
}
SetAutoScaleX
Sets automatic scaling mode of the x-scale. A warning is issued if an invalid mode is passed to
the function.
void SetVipage.SetAutoScaleX(int mode)
A RGUMENTS
mode Possible values:
0 never
1 after simulation
2 during simulation
E XAMPLE
The following examples look for a virtual instrument panel named 'Voltage' and change its
Auto Scale setting to Off.
! Set Auto Scale to Off
object page;
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
! Set new limits to change x-scale of page to used scale
page.SetScaleX(0,10);
610
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
SetResults
Sets default results object of virtual instrument panel.
void SetVipage.SetResults(object res)
A RGUMENTS
res Result object to set or NULL to reset. Valid result object is any of class ElmRes,
IntComtrade and IntComtradeset.
E XAMPLE
The following example looks for a virtual instrument panel named 'Voltage' and resets its
default results.
object graphBoard;
object page;
! Look for open graphics board.
graphBoard=GetGraphicsBoard();
if (graphBoard) {
! Get Virtual Instrument Panel named Voltage
page=graphBoard.GetPage('Voltage',1);
if (page) {
page.SetResults(nullptr);! reset default results
}
}
SetScaleX
Sets x-axis scale. A function call without arguments sets the Auto Scale setting to On without
changing the scale itself.
void SetVipage.SetScaleX()
void SetVipage.SetScaleX(double min,
double max,
[int log]
)
A RGUMENTS
min (optional)
Minimum of x-scale.
max (optional)
Maximum of x-scale.
log (optional)
Possible values:
0 linear
1 logarithmic
611
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following examples look for a virtual instrument panel named 'Voltage' and sets the x-
axis variable. There are three different examples. 1. Example: Set 'Auto Scale' of x axis to
'On'. 2. Example: Set minimum to 0 and maximum to 20. 3. Example: Set minimum to 1 and
maximum to 1000. Changes to a logarithmic scale.
object graphBoard;
object page;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
! Get Virtual Instrument Panel named Voltage
page=graphBoard.GetPage('Voltage',1);
if (page) {
page.SetScaleX();! Automatic Scaling to On
}
}
SetStyle
Sets style of virtual instrument panel. A warning message is issued in the case that a style with
the given name does not exist.
void SetVipage.SetStyle(string name)
A RGUMENTS
name Style Name
612
3.5. SETTINGS CHAPTER 3. OBJECT METHODS
SetTile
Rearranges the virtual instrument on the panel.
void SetVipage.SetTile([int tile])
A RGUMENTS
tile=1 (optional) tile =0 arrange virtual instruments automatically (like tiles)
tile=1 arrange them horizontally
E XAMPLE
The following example looks for a virtual instrument panel named 'Voltage' and rearranges
the Virtual Instrument.
object graphBoard;
object page;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
! Get Virtual Instrument Panel named 'Voltage'
page=graphBoard.GetPage('Voltage',1);
if (page) {
! Arrange vis horizontally (default input parameter is 1)
page.SetTile();
}
}
SetXVar
Sets x-axis variable. If The default x-axis variable (time) is set if no argument is passed.
void SetVipage.SetXVar()
void SetVipage.SetXVar(object obj,
string varname
)
A RGUMENTS
obj (optional)
x-axis object
varname (optional)
variable of obj
E XAMPLE
The following examples look for a virtual instrument panel named 'Voltage' and set the x-axis
variable. The first example sets an user defined x-axis variable of the panel. The second one
sets the default x-axis (in simulation: time).
! set x-axis variable 'm:U1:bus1' of object line
object graphBoard;
object page;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'voltage'
if (page) {
! Set x-scale variable
page.SetXVar(line,'m:U1:bus1');
613
3.6. OTHERS CHAPTER 3. OBJECT METHODS
}
}
Show
Displays the plot page in the graphics board.
int SetVipage.Show()
R ETURNS
0 On success, no error occurred.
1 Otherwise
3.6 Others
3.6.1 BlkDef
Overview
Check
Compile
Encrypt
GetCheckSum
Pack
PackAsMacro
ResetThirdPartyModule
SetThirdPartyModule
Check
Verify the DSL model equations.
int BlkDef.Check()
R ETURNS
0 BlkDef is OK.
1 Error during parsing.
2 Compiled model, no check is possible.
614
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Compile
Compiles the model to a DLL. Can be called on an already compiled model. A study case of a
project has to be active.
void BlkDef.Compile([string modelPath])
A RGUMENTS
modelPath (optional)
Full path to a location where the model should be stored. Leave empty to use
default.
Encrypt
Encrypts this block definition. It has to be packed as macro before.
int BlkDef.Encrypt([int removeObjectHistory])
A RGUMENTS
removeObjectHistory (optional)
H andling of unencrypted object history in database, e.g. used by project versions
or by undo:
0 Do not remove.
1 Do remove (default).
2 Show dialog and ask.
R ETURNS
0 On success.
1 On error.
S EE ALSO
BlkDef.PackAsMacro()
GetCheckSum
string BlkDef.GetCheckSum()
D EPRECATED N AMES
CalculateCheckSum
R ETURNS
The checksum of the block definition (0000-0000-0000-0000 for frames).
Pack
Copies all used macros (i.e. referenced BlkDef) to this block.
int BlkDef.Pack()
615
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 On success.
1 On error.
PackAsMacro
Collects all equations, stores them to this model and deletes block diagram and all macro
references.
int BlkDef.PackAsMacro()
R ETURNS
0 On success.
1 On error.
S EE ALSO
BlkDef.Encrypt()
ResetThirdPartyModule
Resets the third party licence. Only possible for non-encrypted, non-compiled blocks. Requires
masterkey licence for third party module currently set.
int BlkDef.ResetThirdPartyModule()
R ETURNS
0 On success.
1 On error.
SetThirdPartyModule
Sets the third party licence to a specific value. Only possible for non-encrypted, non-compiled
blocks with no third party licence set so far. Requires masterkey licence for third party module
to be set.
int BlkDef.SetThirdPartyModule(string companyCode,
string moduleCode
)
A RGUMENTS
companyCode
D isplay name or numeric value of company code.
moduleCode
D isplay name or numeric value of third party module.
R ETURNS
0 On success.
1 On error.
616
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.2 BlkSig
Overview
GetFromSigName
GetToSigName
GetFromSigName
string BlkSig.GetFromSigName()
R ETURNS
The name of the output from which the signal is connected. In cases of no connection, an
empty string.
GetToSigName
string BlkSig.GetToSigName()
R ETURNS
The name of the input to which the signal is connected. In cases of no connection, an empty
string.
3.6.3 ChaVecfile
Overview
Update
Update
Reloads the file from disk. Same behaviour like button update.
int ChaVecfile.Update([int msgOn = 0])
A RGUMENTS
msgOn (optional)
Reporting of errors:
0 No error message is shown in case that the file can not be loaded
(default).
1 Emit an error message in case that the file can not be loaded.
R ETURNS
The number of samples (rows) read from the file.
617
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.4 CimArchive
Overview
ConvertToBusBranch
ConvertToBusBranch
Performs the conversion of CimModels in the selected CimArchive to Bus-Branch model repre-
sentation.
void CimArchive.ConvertToBusBranch()
E XAMPLE
This example converts a CimArchive to a Bus-Branch model. The CimArchive is selected in
the archive variable in External Objects.
archive.ConvertToBusBranch();
3.6.5 CimModel
Overview
DeleteParameterAtIndex
GetAttributeEnumerationType
GetModelsReferencingThis
GetParameterCount
GetParameterNamespace
GetParameterValue
HasParameter
RemoveParameter
SetAssociationValue
SetAssociationValue
SetAttributeEnumeration
SetAttributeEnumeration
SetAttributeValue
SetAttributeValue
DeleteParameterAtIndex
Removes the parameter (attribute, or association) value at the given index.
void CimModel.DeleteParameterAtIndex(string parameter, int index)
A RGUMENTS
parameter
Full-name specifier of the attribute, or association (e.g. ”Model.profile”)
E XAMPLE
This example deletes the ”Model.profile” parameter of the CimModel at index 1. The Cim-
Model is selected in the model variable in External Objects.
618
3.6. OTHERS CHAPTER 3. OBJECT METHODS
model.DeleteParameterAtIndex('Model.profile', 1);
GetAttributeEnumerationType
Returns the enumeration type of the attribute.
string CimModel.GetAttributeEnumerationType(string attribute)
A RGUMENTS
attribute Full-name specifier of the attribute (e.g. ”GeneratingUnit.genControlSource”)
GetModelsReferencingThis
Returns all CIM models (CimModel) that reference the calling model.
set CimModel.GetModelsReferencingThis()
R ETURNS
CIM models that reference the calling model. The order of the set is undefined.
E XAMPLE
This example prints the profile of CIM models referencing a selected CimModel. The Cim-
Model is selected in the model variable in External Objects.
set cimModels;
object cimModel;
cimModels = model.GetModelsReferencingThis();
for (cimModel = cimModels.First(); cimModel; cimModel = cimModels.Next()) {
Info(cimModel.GetParameterValue('Model.profile'));
}
GetParameterCount
Returns the number of parameters (attribute, or association) of given type.
int CimModel.GetParameterCount(string parameter)
A RGUMENTS
parameter
Full-name specifier of the attribute, or association (e.g. ”Model.profile”)
E XAMPLE
This example prints the ”Model.profile” attributes for all CIM models from the active project.
set cimModels;
object project, cimModel;
string profile;
int nProfiles, i;
619
3.6. OTHERS CHAPTER 3. OBJECT METHODS
project = GetActiveProject();
cimModels = project.GetContents('*.CimModel', 1);
for (cimModel = cimModels.First(); cimModel; cimModel = cimModels.Next()) {
nProfiles = cimModel.GetParameterCount('Model.profile');
Info('Model: %o has %d profiles', cimModel, nProfiles);
for (i = 0; i < nProfiles; i = i + 1) {
profile = cimModel.GetParameterValue('Model.profile', i);
Info('Profile:%d = %s', i, profile);
}
}
GetParameterNamespace
Returns the namesace of the parameter (attribute, or association).
string CimModel.GetParameterNamespace(string parameter)
A RGUMENTS
parameter
Full-name specifier of the attribute, or association (e.g. ”Model.created”)
E XAMPLE
This example prints the namespace of the ”Model.created” parameter for the CimModel that
is selected in the model variable in External Objects.
string namespace;
namespace = model.GetParameterNamespace('Model.created');
Info(namespace);
GetParameterValue
Returns the value of the parameter (attribute, or association) at the given index if available. If the
parameter (attribute, or association) is not available, or the index is out of bounds the function
returns an empty string.
string CimModel.GetParameterValue(string parameter, [int index])
A RGUMENTS
parameter
Full-name specifier of the attribute, or association (e.g. ”Model.modelingAuthoritySet”)
index Index of the parameter:
0 Default index
E XAMPLE
This example prints the ”Model.modelingAuthoritySet” parameter for a CimModel. The Cim-
Model is selected in the model variable in External Objects.
string modelAuthoritySet;
modelAuthoritySet = model.GetParameterValue('Model.modelingAuthoritySet');
Info(modelAuthoritySet);
620
3.6. OTHERS CHAPTER 3. OBJECT METHODS
HasParameter
Checks whether the CimModel has the parameter (attribute, or association) specified.
int CimModel.HasParameter(string parameter)
A RGUMENTS
parameter
Full-name specifier of the attribute, or association (e.g. ”Model.modelingAuthoritySet”)
R ETURNS
1 if parameter is specified
0 if parameter is not specified
E XAMPLE
This example checks if a selected CimModel contains the ”Model.scenarioTime” parameter.
The CimModel is selected in the model variable in External Objects.
int hasParameter;
hasParameter = model.HasParameter('Model.scenarioTime');
if (hasParameter = 1) {
Info('Parameter exists');
} else {
Info('Parameter does not exist');
}
RemoveParameter
Removes all occurrences of the parameter (attribute, or association).
void CimModel.RemoveParameter(string parameter)
A RGUMENTS
parameter
Full-name specifier of the attribute, or association (e.g. ”Model.scenarioTime”)
E XAMPLE
This example removes the ”Model.scenarioTime” parameter from all CIM models from the
active project.
set cimModels;
object project, cimModel;
project = GetActiveProject();
cimModels = project.GetContents('*.CimModel', 1);
for (cimModel = cimModels.First(); cimModel; cimModel = cimModels.Next()) {
cimModel.RemoveParameter('Model.scenarioTime');
}
621
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetAssociationValue
Adds the association if not available yet, and sets its value at the given index. If the association
is already added, the function sets a new value at the given index only.
void CimModel.SetAssociationValue(string association,
string value,
[int index])
A RGUMENTS
association
Full-name specifier of the association (e.g. ”Model.DependentOn”)
value Value of the association
E XAMPLE
This example sets the ”Model.DependentOn” parameter at index 1 for a selected CimModel.
The CimModel is selected in the model variable in External Objects.
string dependentOnId;
dependentOnId = '21df3d4d-3f82-4998-be21-772e3d2d573f';
model.SetAssociationValue('Model.DependentOn', dependentOnId, 1);
SetAssociationValue
Adds the association if not available yet, and sets its namespace and value. If the association
is already added, the function sets its namespace and value only.
void CimModel.SetAssociationValue(string association,
string value,
string nspace)
A RGUMENTS
attribute Full-name specifier of the association (e.g. ”Model.DependentOn”)
value Value of the association
E XAMPLE
This example sets the ”Model.DependentOn” parameter for a selected CimModel. The Cim-
Model is selected in the model variable in External Objects.
string dependentOnId;
dependentOnId = '21df3d4d-3f82-4998-be21-772e3d2d573f';
model.SetAssociationValue('Model.DependentOn', dependentOnId, 'md');
622
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetAttributeEnumeration
Adds the attribute if not available yet, and sets its enumeration type and value. If the attribute is
already added, the function sets its enumeration type and value only.
void CimModel.SetAttributeEnumeration(string attribute,
string enumerationType,
string value)
A RGUMENTS
attribute Full-name specifier of the attribute (e.g. ”GeneratingUnit.genControlSource”)
enumerationType
Enumeration type of the attribute (e.g. ”GeneratorControlSource”)
SetAttributeEnumeration
Adds the attribute if not available yet, and sets its namespace, enumeration type and value.
If the attribute is already added, the function sets its namespace, enumeration type and value
only.
void CimModel.SetAttributeEnumeration(string attribute,
string enumerationType,
string value,
string nspace)
A RGUMENTS
attribute Full-name specifier of the attribute (e.g. ”GeneratingUnit.genControlSource”)
enumerationType
Enumeration type of the attribute (e.g. ”GeneratorControlSource”)
value Value of the attribute (e.g. ”offAGC”)
nspace Namespace of the attribute (e.g. ”cim”)
SetAttributeValue
Adds the attribute if not available yet, and sets its value at the given index. If the attribute is
already added, the function sets a new value at the given index only.
void CimModel.SetAttributeValue(string attribute,
string value,
[int index])
A RGUMENTS
attribute Full-name specifier of the attribute (e.g. ”Model.modelingAuthoritySet”)
value Value of the attribute
623
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
This example sets the ”Model.profile” parameter at index 2 for a selected CimModel. The
CimModel is selected in the equipmentModel variable in External Objects.
string equipmentShortCircuit;
equipmentShortCircuit = 'http://entsoe.eu/CIM/EquipmentShortCircuit/3/1';
equipmentModel.SetAttributeValue('Model.profile', equipmentShortCircuit, 2);
SetAttributeValue
Adds the attribute if not available yet, and sets its namespace and value. If the attribute is
already added, the function sets its namespace and value only.
void CimModel.SetAttributeValue(string attribute,
string value,
string nspace)
A RGUMENTS
attribute Full-name specifier of the attribute (e.g. ”Model.modelingAuthoritySet”)
E XAMPLE
This example sets the ”Model.modelingAuthoritySet” parameter for all CIM models from the
active project.
set cimModels;
object project, cimModel;
project = GetActiveProject();
cimModels = project.GetContents('*.CimModel', 1);
for (cimModel = cimModels.First(); cimModel; cimModel = cimModels.Next()) {
cimModel.SetAttributeValue('Model.modelingAuthoritySet', 'mas', 'md');
}
3.6.6 CimObject
Overview
DeleteParameterAtIndex
GetAttributeEnumerationType
GetObjectsReferencingThis
GetObjectsWithSameId
GetParameterCount
GetParameterNamespace
GetParameterValue
GetPfObjects
HasParameter
RemoveParameter
624
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetAssociationValue
SetAssociationValue
SetAttributeEnumeration
SetAttributeEnumeration
SetAttributeValue
SetAttributeValue
DeleteParameterAtIndex
Removes the parameter (attribute, or association) value at the given index.
void CimObject.DeleteParameterAtIndex(string parameter, int index)
A RGUMENTS
parameter
Full-name of the attribute, or association (e.g. ”TopologicalIsland.TopologicalNodes”)
index Index of the parameter
E XAMPLE
This example removes all ”TopologicalIsland.TopologicalNodes” parameters values from all
”TopologicalIsland” CIM objects in the active project.
set cimObjects;
object project, cimObject;
string topoNodesParameter, cimClass;
int isTopologicalIsland, nNodes, i;
project = GetActiveProject();
topoNodesParameter = 'TopologicalIsland.TopologicalNodes';
cimObjects = project.GetContents('*.CimObject', 1);
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
cimObject.GetVal(cimClass, 'cimClass');
isTopologicalIsland = strcmp(cimClass, 'TopologicalIsland');
if (isTopologicalIsland = 0) {
nNodes = cimObject.GetParameterCount(topoNodesParameter);
Info('TP-island %o has %d TP-nodes', cimObject, nNodes);
for (i = nNodes; i >= 0; i = i - 1) {
cimObject.DeleteParameterAtIndex(topoNodesParameter, i);
}
}
}
GetAttributeEnumerationType
Returns the enumeration type of the attribute.
string CimObject.GetAttributeEnumerationType(string attribute)
A RGUMENTS
attribute Full-name of the attribute (e.g. ”SynchronousMachine.shortCircuitRotorType”)
E XAMPLE
This example prints the enumeration type of the ”SynchronousMachine.shortCircuitRotorType”
attribute of a ”SynchronousMachine” CimObject. The CimObject is selected in the cimObject
variable in External Objects.
625
3.6. OTHERS CHAPTER 3. OBJECT METHODS
attributeName = 'SynchronousMachine.shortCircuitRotorType';
enumerationType = cimObject.GetAttributeEnumerationType(attributeName);
Info(enumerationType);
GetObjectsReferencingThis
Returns all CIM objects (CimObject) that reference the calling object. The set of objects returned
is also determined by the DependentOn and Supersedes references set in parent CIM model
objects. In order for a CIM object to reference another CIM object, the parent CIM model of the
former object has to hold a reference to the parent CIM model of the later object.
set CimObject.GetObjectsReferencingThis()
R ETURNS
CIM objects that reference the calling object. The order of the set is undefined.
E XAMPLE
This example prints all CIM objects which reference the ”SynchronousMachine” CimObject.
The SynchronousMachine is selected in the machine variable in External Objects.
set cimObjects;
object cimObject;
cimObjects = machine.GetObjectsReferencingThis();
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
Info('%o', cimObject);
}
GetObjectsWithSameId
Returns all CIM objects (CimObject) that have the same Resource ID as this object.
set CimObject.GetObjectsWithSameId()
R ETURNS
CIM objects that have the same Resource ID as this object.
E XAMPLE
This example prints all CIM objects with the same CIM RDF ID as the ”SynchronousMa-
chine” CimObject. The SynchronousMachine is selected in the machine variable in External
Objects.
set cimObjects;
object cimObject;
cimObjects = machine.GetObjectsWithSameId();
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
Info('%o', cimObject);
}
626
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetParameterCount
Returns the number of parameters (attribute, or association) of given type.
int CimObject.GetParameterCount(string parameter)
A RGUMENTS
parameter
Full-name of the attribute, or association (e.g. ”TopologicalIsland.TopologicalNodes”)
E XAMPLE
This example prints the IDs of all ”TopologicalNode” CIM objects from all ”TopologicalIsland”
CIM objects in the active project.
set cimObjects;
object project, cimObject;
string topoNodesParameter, cimClass, nodeId;
int isTopologicalIsland, nNodes, i;
project = GetActiveProject();
topoNodesParameter = 'TopologicalIsland.TopologicalNodes';
cimObjects = project.GetContents('*.CimObject', 1);
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
cimObject.GetVal(cimClass, 'cimClass');
isTopologicalIsland = strcmp(cimClass, 'TopologicalIsland');
if (isTopologicalIsland = 0) {
nNodes = cimObject.GetParameterCount(topoNodesParameter);
Info('TP-island %o has %d TP-nodes', cimObject, nNodes);
for (i = 0; i < nNodes; i = i + 1) {
nodeId = cimObject.GetParameterValue(topoNodesParameter, i);
Info('CIM RDF ID of TP-node %d is: %s', i, nodeId);
}
}
}
GetParameterNamespace
Returns the namesace of the parameter (attribute, or association).
string CimObject.GetParameterNamespace(string parameter)
A RGUMENTS
parameter
Full-name of the attribute, or association (e.g. ”IdentifiedObject.name”)
E XAMPLE
This example prints the namespace of the ”IdentifedObject.name” parameter of a CimObject.
The CimObject is selected in the acLineSegment variable in External Objects.
string namespace;
namespace = acLineSegment.GetParameterNamespace('IdentifiedObject.name');
Info(namespace);
627
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetParameterValue
Returns the value of the parameter (attribute, or association) at the given index if available. If the
parameter (attribute, or association) is not available, or the index is out of bounds the function
returns an empty string.
string CimObject.GetParameterValue(string parameter, [int index])
A RGUMENTS
parameter
Full-name of the attribute, or association (e.g. ”IdentifiedObject.name”)
E XAMPLE
This example prints the ”IdentifedObject.name” parameter of a selected CimObject. The
CimObject is selected in the cimObject variable in External Objects.
string name;
name = cimObject.GetParameterValue('IdentifiedObject.name');
Info(name);
GetPfObjects
Returns all PF objects that have the same Resource ID as this CIM object.
set CimObject.GetPfObjects()
R ETURNS
PF objects that have the same Resource ID as this CIM object.
E XAMPLE
This example prints all PowerFactory objects with the same CIM RDF ID as the ”Synchronous-
Machine” CimObject. The SynchronousMachine is selected in the machine variable in Exter-
nal Objects.
set pfObjects;
object pfObject;
pfObjects = machine.GetPfObjects();
for (pfObject = pfObjects.First(); pfObject; pfObject = pfObjects.Next()) {
Info('%o', pfObject);
}
HasParameter
Checks whether the CimObject has the parameter (attribute, or association) specified.
int CimObject.HasParameter(string parameter)
628
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
parameter
Full-name of the attribute, or association (e.g. ”IdentifiedObject.name”)
R ETURNS
1 if parameter is specified
0 if parameter is not specified
E XAMPLE
This example checks if a CimObject contains the ”IdentifiedObject.name” parameter. The
CimObject is selected in the cimObject variable in External Objects.
int hasParameter;
hasParameter = cimObject.HasParameter('IdentifiedObject.name');
if (hasParameter = 1) {
Info('Parameter exists.');
} else {
Info('Parameter does not exist.');
}
RemoveParameter
Removes all occurrences of the parameter (attribute, or association).
void CimObject.RemoveParameter(string parameter)
A RGUMENTS
parameter
Full-name of the attribute, or association (e.g. ”SynchronousMachine.shortCircuitRotorType”)
E XAMPLE
This example removes the ”SynchronousMachine.shortCircuitRotorType” parameter from all
”SynchronousMachine” CIM objects in the active project.
set cimObjects;
object project, cimObject;
string cimClass;
int isSynchronousMachine;
project = GetActiveProject();
cimObjects = project.GetContents('*.CimObject', 1);
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
cimObject.GetVal(cimClass, 'cimClass');
isSynchronousMachine = strcmp(cimClass, 'SynchronousMachine');
if (isSynchronousMachine = 0) {
cimObject.RemoveParameter('SynchronousMachine.shortCircuitRotorType');
}
}
629
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetAssociationValue
Adds the association if not available yet, and sets its value at the given index. If the association
is already added, the function sets a new value at the given index only.
void CimObject.SetAssociationValue(string association,
string value,
[int index])
A RGUMENTS
association
Full-name of the association (e.g. ”Equipment.EquipmentContainer”)
value Value of the association
SetAssociationValue
Adds the association if not available yet, and sets its namespace and value. If the association
is already added, the function sets its namespace and value only.
void CimObject.SetAssociationValue(string association,
string value,
string nspace)
A RGUMENTS
attribute Full-name of the association (e.g. ”NonConformLoad.LoadGroup”)
value Value of the association
nspace Namespace of the association (e.g. ”cim”)
E XAMPLE
This example adds the missing association ”NonConformLoad.LoadGroup” on ”NonConform-
Load” CIM objects in the active project. The association is set to the object defined in the
loadGroup variable in External Objects.
set cimObjects;
object project, cimObject;
string loadGroupId, loadGroupParameter, cimClass;
int isNonConformLoad, isConcrete, hasLoadGroup;
project = GetActiveProject();
loadGroup.GetVal(loadGroupId, 'resID');
loadGroupParameter = 'NonConformLoad.LoadGroup';
cimObjects = project.GetContents('*.CimObject', 1);
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
cimObject.GetVal(cimClass, 'cimClass');
isNonConformLoad = strcmp(cimClass, 'NonConformLoad');
if (isNonConformLoad = 0) {
cimObject.GetVal(isConcrete, 'about');
if (isConcrete = 0) {
hasLoadGroup = cimObject.HasParameter(loadGroupParameter);
if (hasLoadGroup = 0) {
cimObject.SetAssociationValue(loadGroupParameter, loadGroupId, 'cim');
630
3.6. OTHERS CHAPTER 3. OBJECT METHODS
}
}
}
}
SetAttributeEnumeration
Adds the attribute if not available yet, and sets its enumeration type and value. If the attribute is
already added, the function sets its enumeration type and value only.
void CimObject.SetAttributeEnumeration(string attribute,
string enumerationType,
string value)
A RGUMENTS
attribute Full-name of the attribute (e.g. ”SynchronousMachine.shortCircuitRotorType”)
enumerationType
Enumeration type of the attribute (e.g. ”ShortCircuitRotorKind”)
value Value of the enumeration (e.g. ”salientPole1”)
E XAMPLE
This example adds the missing attribute ”SynchronousMachine.shortCircuitRotorType” on
”SyncronousMachine” CIM objects in the active project.
set cimObjects;
object project, cimObject;
string cimClass, parameter, type, value;
int isSyncMachine, isConcrete, hasParameter;
parameter = 'SynchronousMachine.shortCircuitRotorType';
type = 'ShortCircuitRotorKind';
value = 'salientPole1';
project = GetActiveProject();
cimObjects = project.GetContents('*.CimObject', 1);
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
cimObject.GetVal(cimClass, 'cimClass');
isSyncMachine = strcmp(cimClass, 'SynchronousMachine');
if (isSyncMachine = 0) {
cimObject.GetVal(isConcrete, 'about');
if (isConcrete = 0) {
hasParameter = cimObject.HasParameter(parameter);
if (hasParameter = 0) {
cimObject.SetAttributeEnumeration(parameter, type, value);
}
}
}
}
631
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetAttributeEnumeration
Adds the attribute if not available yet, and sets its namespace, enumeration type and value.
If the attribute is already added, the function sets its namespace, enumeration type and value
only.
void CimObject.SetAttributeEnumeration(string attribute,
string enumerationType,
string value,
string nspace)
A RGUMENTS
attribute Full-name of the attribute (e.g. ”SynchronousMachine.shortCircuitRotorType”)
enumerationType
Enumeration type of the attribute (e.g. ”ShortCircuitRotorKind”)
value Value of the attribute (e.g. ”salientPole1”)
nspace Namespace of the attribute (e.g. ”cim”)
E XAMPLE
This example adds the missing attribute ”SynchronousMachine.shortCircuitRotorType” on
”SyncronousMachine” CIM objects in the active project.
set cimObjects;
object project, cimObject;
string cimClass, parameter, type, value, namespace;
int isSyncMachine, isConcrete, hasParameter;
parameter = 'SynchronousMachine.shortCircuitRotorType';
type = 'ShortCircuitRotorKind';
value = 'salientPole1';
namespace = 'cim';
project = GetActiveProject();
cimObjects = project.GetContents('*.CimObject', 1);
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
cimObject.GetVal(cimClass, 'cimClass');
isSyncMachine = strcmp(cimClass, 'SynchronousMachine');
if (isSyncMachine = 0) {
cimObject.GetVal(isConcrete, 'about');
if (isConcrete = 0) {
hasParameter = cimObject.HasParameter(parameter);
if (hasParameter = 0) {
cimObject.SetAttributeEnumeration(parameter, type, value, namespace);
}
}
}
}
SetAttributeValue
Adds the attribute if not available yet, and sets its value at the given index. If the attribute is
already added, the function sets a new value at the given index only.
void CimObject.SetAttributeValue(string attribute,
string value,
[int index])
632
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
attribute Full-name of the attribute (e.g. ”IdentifiedObject.name”)
value Value of the attribute
index Index of the attribute:
0 Default index
E XAMPLE
This example adds the prefix ”Load ” to the ”IdentifiedObjet.name” attribute for all concrete
”NonConformLoad” CIM objects in the active project.
set cimObjects;
object project, cimObject;
string cimClass, oldName, newName;
int isNonConformLoad, isConcrete;
project = GetActiveProject();
cimObjects = project.GetContents('*.CimObject', 1);
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
cimObject.GetVal(cimClass, 'cimClass');
isNonConformLoad = strcmp(cimClass, 'NonConformLoad');
if (isNonConformLoad = 0) {
cimObject.GetVal(isConcrete, 'about');
if (isConcrete = 0) {
oldName = cimObject.GetParameterValue('IdentifiedObject.name');
newName = sprintf('Load_%s', oldName);
cimObject.SetAttributeValue('IdentifiedObject.name', newName);
}
}
}
SetAttributeValue
Adds the attribute if not available yet, and sets its namespace and value. If the attribute is
already added, the function sets its namespace and value only.
void CimObject.SetAttributeValue(string attribute,
string value,
string nspace)
A RGUMENTS
attribute Full-name of the attribute (e.g. ”Equipment.aggregate”)
value Value of the attribute
nspace Namespace of the attribute (e.g. ”cim”)
E XAMPLE
This example sets the ”Equipment.aggregate” attribute to ”false” for all concrete ”NonCon-
formLoad” CIM objects in the active project.
set cimObjects;
object project, cimObject;
string cimClass;
int isNonConformLoad, isConcrete;
633
3.6. OTHERS CHAPTER 3. OBJECT METHODS
project = GetActiveProject();
cimObjects = project.GetContents('*.CimObject', 1);
for (cimObject = cimObjects.First(); cimObject; cimObject = cimObjects.Next()) {
cimObject.GetVal(cimClass, 'cimClass');
isNonConformLoad = strcmp(cimClass, 'NonConformLoad');
if (isNonConformLoad = 0) {
cimObject.GetVal(isConcrete, 'about');
if (isConcrete = 0) {
cimObject.SetAttributeValue('Equipment.aggregate', 'false', 'cim');
}
}
}
3.6.7 GrpPage
Overview
ChangeStyle
DoAutoScale
DoAutoScaleX
DoAutoScaleY
GetOrInsertCurvePlot
GetOrInsertDiscreteBarPlot
GetOrInsertModalAnalysisPlot
GetOrInsertVectorPlot
GetOrInsertXYPlot
GetPlot
RemovePage
SetAutoScaleModeX
SetAutoScaleModeY
SetLayoutMode
SetResults
SetScaleTypeX
SetScaleTypeY
SetScaleX
SetScaleY
Show
ChangeStyle
Applies the plot style identified by the given name to all plots on this page.
void GrpPage.ChangeStyle(string styleName)
A RGUMENTS
styleName
Name of the style template to apply
R ETURNS
0 on success
1 on error
634
3.6. OTHERS CHAPTER 3. OBJECT METHODS
DoAutoScale
Adapts axis ranges of all plots on the page such that they show the entire data range.
void GrpPage.DoAutoScale([int axisDimension])
A RGUMENTS
axisDimension (optional)
Limits auto-scaling to one dimension. Possible values:
0 scale only x-axes
1 scale only y-axes
E XAMPLE
The following example looks for a page named 'Voltage' and performs an automatic scaling
of both the x-axes and y-axes.
object page;
object graphicsBoard;
! Look for opened graphics board.
graphicsBoard=GetGraphicsBoard();
if (graphicsBoard) {
page=graphicsBoard.GetPage('Voltage', 0);
if (page) {
page.DoAutoScale();
}
}
DoAutoScaleX
Adapts x-axis ranges of all plots on the page such that they show the entire data range.
void GrpPage.DoAutoScaleX()
DoAutoScaleY
Adapts y-axis ranges of all plots on the page such that they show the entire data range.
void GrpPage.DoAutoScaleY()
GetOrInsertCurvePlot
Finds a curve plot by name, or creates it if not found.
object GrpPage.GetOrInsertCurvePlot(string name,
[int create]
)
A RGUMENTS
name Name of plot
create=1 (optional)
Possible values:
0 do not create new plot
1 create plot if it does not exist already
635
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
PltLinebarplot object
GetOrInsertDiscreteBarPlot
Finds a discrete bar plot by name, or creates it if not found. A discrete bar plot is a PltLinebarplot
whose x-axis mode is set to 'Discrete', i.e., it shows net elements on the x-axis.
object GrpPage.GetOrInsertDiscreteBarPlot(string name,
[int create]
)
A RGUMENTS
name Name of plot
create=1 (optional)
Possible values:
0 do not create new plot
1 create plot if it does not exist already
R ETURNS
PltLinebarplot object
GetOrInsertModalAnalysisPlot
Finds a modal analysis plot by name, or creates it if not found.
object GrpPage.GetOrInsertModalAnalysisPlot(string name,
int type,
[int create]
)
A RGUMENTS
name Name of plot
type Type of modal analysis plot to create:
0 eigenvalue plot
1 mode polar plot
2 mode bar plot
create=1 (optional)
Possible values:
R ETURNS
PltLinebarplot (eigenvalue plot, mode bar plot) or PltVectorplot (mode polar plot)
636
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetOrInsertVectorPlot
Finds a vector plot by name, or creates it if not found.
object GrpPage.GetOrInsertVectorPlot(string name,
[int create]
)
A RGUMENTS
name Name of plot
create=1 (optional)
Possible values:
0 do not create new plot
1 create plot if it does not exist already
R ETURNS
PltVectorplot object
GetOrInsertXYPlot
Finds a XY plot by name, or creates it if not found. A XY plot is a PltLinebarplot whose x-axis
mode is set to 'XY'.
object GrpPage.GetOrInsertXYPlot(string name,
[int create]
)
A RGUMENTS
name Name of plot
create=1 (optional)
Possible values:
0 do not create new plot
1 create plot if it does not exist already
R ETURNS
PltLinebarplot object
GetPlot
Returns the plot on this page with the given name.
object GrpPage.GetPlot(string name)
A RGUMENTS
name Name of the plot to look for
R ETURNS
Plot object if found, or NULL otherwise
637
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example looks for a plot named 'RST' on the plot page named 'Voltage'.
object graphicsBoard;
object page;
object plot;
graphicsBoard=GetGraphicsBoard(); ! Look for open desktop
if (graphicsBoard) {
page=graphicsBoard.GetPage('Voltage',1);
if (page) {
plot=page.GetPlot('RST');
}
}
RemovePage
Closes the graphic page, if currently shown, and deletes it from the database.
int GrpPage.RemovePage()
SetAutoScaleModeX
Defines whether the x-axes on the page should automatically adapt their range on data changes.
A RGUMENTS
mode Possible values:
0 off (do not react to data changes)
1 adapt scale after calculation has finished
2 adapt scale during live plotting
SetAutoScaleModeY
Defines whether the y-axes on the page should automatically adapt their range on data changes.
A RGUMENTS
mode Possible values:
638
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetLayoutMode
Defines the automatic arrangement of plots on the page.
void GrpPage.SetLayoutMode(int mode)
A RGUMENTS
mode Possible values:
0 off (do not arrange plots automatically)
1 arrange plots vertically
2 arrange plots on grid
SetResults
Sets the default results object of page.
void GrpPage.SetResults(object res)
A RGUMENTS
res Result object to set or NULL to reset. Valid result object is any of class ElmRes,
IntComtrade and IntComtradeset.
SetScaleTypeX
Sets the scale type (linear, logarithmic) of all x-axes on the page.
void GrpPage.SetScaleTypeX(int scaleType)
A RGUMENTS
scaleType
Possible values:
0 linear
1 logarithmic
SetScaleTypeY
Set the scale type (linear, logarithmic, dB) of all y-axes on the page.
void GrpPage.SetScaleTypeY(int scaleType)
A RGUMENTS
scaleType
Possible values:
0 linear
1 logarithmic
2 dB
639
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetScaleX
Sets the scale of all x-axes on the page.
void GrpPage.SetScaleX(double min,
double max
)
A RGUMENTS
min Minimum of x-scale.
max Maximum of x-scale.
E XAMPLE
The following example looks for a page named 'Voltage' and sets its x-axis range to [1.0;2.5].
object page;
object graphicsBoard;
! Look for opened graphics board.
graphicsBoard=GetGraphicsBoard();
if (graphicsBoard) {
page=graphicsBoard.GetPage('Voltage', 0);
if (page) {
page.SetScaleX(1.0, 2.5);
}
}
SetScaleY
Sets the scale of all y-axes on the page.
void GrpPage.SetScaleY(double min,
double max
)
A RGUMENTS
min Minimum of y-scale.
max Maximum of y-scale.
Show
Displays the diagram page in the graphics board.
int GrpPage.Show()
R ETURNS
0 On success, no error occurred.
1 Otherwise
640
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.8 IntAddonvars
Overview
AddDouble
AddDoubleMatrix
AddDoubleVector
AddInteger
AddIntegerVector
AddObject
AddObjectVector
AddString
RemoveParameter
SetConstraint
AddDouble
Adds a new double parameter to the Data Extension configuration object.
int IntAddonvars.AddDouble(string parameterName,
string desc,
string unitText,
double initialValue
)
A RGUMENTS
parameterName
The name of the new parameter
desc The description of the new parameter
R ETURNS
0 attribute was successfully added
-1 error (object cannot be modified)
-2 error (parameter name contains illegal characters)
row error (parameter with same name already exists in returned row)
AddDoubleMatrix
Adds a new double vector parameter to the Data Extension configuration object.
int IntAddonvars.AddDoubleMatrix(string parameterName,
string desc,
int initialRows,
int initialColumns,
string unitText,
double initialValue
)
641
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
parameterName
The name of the new parameter
desc The description of the new parameter
initialRows
The initial number of rows for the matrix
initialColumns
The initial number of columns for the matrix
unitText The unit of the new parameter
initialValue
The initial value for the elements
R ETURNS
0 attribute was successfully added
-1 error (object cannot be modified)
-2 error (parameter name contains illegal characters)
row error (parameter with same name already exists in returned row)
AddDoubleVector
Adds a new double vector parameter to the Data Extension configuration object.
int IntAddonvars.AddDoubleVector(string parameterName,
string desc,
int initialSize,
string unitText,
double initialValue
)
A RGUMENTS
parameterName
The name of the new parameter
desc The description of the new parameter
R ETURNS
0 attribute was successfully added
-1 error (object cannot be modified)
-2 error (parameter name contains illegal characters)
row error (parameter with same name already exists in returned row)
642
3.6. OTHERS CHAPTER 3. OBJECT METHODS
AddInteger
Adds a new integer parameter to the Data Extension configuration object.
int IntAddonvars.AddInteger(string parameterName,
string desc,
string unitText,
int initialValue
)
A RGUMENTS
parameterName
The name of the new parameter
desc The description of the new parameter
unitText The unit of the new parameter
initialValue
The initial value of the new parameter
R ETURNS
0 attribute was successfully added
-1 error (object cannot be modified)
-2 error (parameter name contains illegal characters)
row error (parameter with same name already exists in returned row)
AddIntegerVector
Adds a new integer vector parameter to the Data Extension configuration object.
int IntAddonvars.AddIntegerVector(string parameterName,
string desc,
int initialSize,
string unitText,
int initialValue)
A RGUMENTS
parameterName
The name of the new parameter
desc The description of the new parameter
R ETURNS
0 attribute was successfully added
-1 error (object cannot be modified)
-2 error (parameter name contains illegal characters)
row error (parameter with same name already exists in returned row)
643
3.6. OTHERS CHAPTER 3. OBJECT METHODS
AddObject
Adds a new string parameter to the Data Extension configuration object.
int IntAddonvars.AddObject(string parameterName,
string desc,
string classFilter
)
A RGUMENTS
parameterName
The name of the new parameter
desc The description of the new parameter
classFilter
The filter for the objects which are allowed for selection
R ETURNS
Zero if attribute was successfully added. One based row number if there already is a param-
eter with the same name. Returns -1 if the object cannot be modified.
AddObjectVector
Adds a new object vector parameter to the Data Extension configuration object.
int IntAddonvars.AddObjectVector(string parameterName,
string desc,
int initialSize,
string classFilter
)
A RGUMENTS
parameterName
The name of the new parameter
desc The description of the new parameter
initialSize The initial size of the vector
classFilter
The filter for the objects which are allowed for selection
R ETURNS
0 attribute was successfully added
-1 error (object cannot be modified)
-2 error (parameter name contains illegal characters)
row error (parameter with same name already exists in returned row)
AddString
Adds a new string parameter to the Data Extension configuration object.
int IntAddonvars.AddString(string parameterName,
string desc,
string unitText,
string initialValue
)
644
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
parameterName
The name of the new parameter
desc The description of the new parameter
unitText The unit of the new parameter
initialValue
The initial value of the new parameter
R ETURNS
0 attribute was successfully added
-1 error (object cannot be modified)
-2 error (parameter name contains illegal characters)
row error (parameter with same name already exists in returned row)
RemoveParameter
Removes the given parameter from the Data Extension configuration.
void IntAddonvars.RemoveParameter(string parameterName)
A RGUMENTS
parameterName
The name of the parameter to be removed
SetConstraint
Adds a constraint for the parameter to the Data Extension configuration object.
The arguments passed must be convertible into the configured data type for the parameter.
Upper and lower bounds are mutually exclusive with a list of values. An empty string should be
passed when a constraint should not be used or removed.
int IntAddonvars.SetConstraint(string parameterName,
string minValue,
string maxValue,
string allowedValues
)
A RGUMENTS
parameterName
The name of the parameter to be modified
minValue The minimum value
maxValue
The maximum value
allowedValues
List of the allowed values (;-separated)
645
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 ok
-1 error (parameter does not exist)
-2 error (upper/lower bounds and list of values are mutually exclusive)
-3 error (underlying type does not support constraints)
-4 error (upper/lower bounds cannot be used for strings)
-5 error (the values passed cannot be converted into the underlying type)
3.6.9 IntCase
Overview
Activate
ApplyNetworkState
ApplyStudyTime
Consolidate
Deactivate
SetStudyTime
Activate
Activates the study case. Deactivates other study cases first.
int IntCase.Activate()
R ETURNS
0 on success
1 on error
ApplyNetworkState
For a study case in a combined project, copy the network state from another case.
Copies the active grids, scenarios and network variations configuration to the current case. The
data will be added to any already existing configuration.
int IntCase.ApplyNetworkState(object other)
A RGUMENTS
other The source Study Case to copy data from
R ETURNS
0 On success
1 Source object is not an IntCase object
2 Case where function is called on is not the active case
3 Source case is not from active project
4 Source Study Case is not from a source project in a combined project
5 Other error. Details are given in an error message
646
3.6. OTHERS CHAPTER 3. OBJECT METHODS
ApplyStudyTime
For a study case in a combined project, apply the study time from another study case.
int IntCase.ApplyStudyTime(object other)
A RGUMENTS
other The source study case to copy study time from
R ETURNS
0 On success
1 Source object is not an IntCase object
2 Study case where function is called on is not the active case
3 Source case is not from active project
4 Source case is not from a project part of a combined project
Consolidate
Changes that are recorded in a project’s active Variations are permanently applied to the Net-
work Data folder (like right mouse button Consolidate Network Variation)
Note: Modified scenarios are not saved!
Works only:
int IntCase.Consolidate()
R ETURNS
0 On success
1 If an error has occured
S EE ALSO
IntScheme.Consolidate()
Deactivate
De-activates the study case.
int IntCase.Deactivate()
R ETURNS
0 on success
1 on error
SetStudyTime
Sets the current Study Case time to seconds since 01.01.1970 00:00:00. Use IntCase:iStudyTime
for getting current Study Case time.
void IntCase.SetStudyTime(int dateTime)
647
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
dateTime Seconds since 01.01.1970 00:00:00.
3.6.10 IntComtrade
Overview
ConvertToASCIIFormat*
ConvertToBinaryFormat*
FindColumn*
FindMaxInColumn*
FindMinInColumn*
GetAnalogueDescriptions
GetColumnValues*
GetDescription*
GetDigitalDescriptions
GetNumberOfAnalogueSignalDescriptions
GetNumberOfColumns*
GetNumberOfDigitalSignalDescriptions
GetNumberOfRows*
GetObjectValue*
GetSignalHeader
GetUnit*
GetValue*
GetVariable*
Load*
Release*
SortAccordingToColumn*
ConvertToASCIIFormat*
Creates new comtrade configuration and data files in ASCII format in the file system directory of
the original files. The new configuration file is linked automatically to a new IntComtrade object
created in the same PowerFactory folder like this object. An existing IntComtrade object is
already in ASCII format when its parameter ’Binary’ is set to 0.
int IntComtrade.ConvertToASCIIFormat()
R ETURNS
0 File successfully converted.
1 Error occurred, e.g. file is already in ASCII format.
ConvertToBinaryFormat*
Creates new comtrade configuration and data files in binary format in the file system directory of
the original files. The new configuration file is linked automatically to a new IntComtrade object
created in the same PowerFactory folder like this object. An existing IntComtrade object is
already in binary format when its parameter ’Binary’ is set to 1.
int IntComtrade.ConvertToBinaryFormat()
R ETURNS
0 File successfully converted.
648
3.6. OTHERS CHAPTER 3. OBJECT METHODS
FindColumn*
Returns the first column matching the variable name.
int IntComtrade.FindColumn(string variable,
[int startCol]
)
A RGUMENTS
variable The variable name to look for.
startCol (optional)
The index of the column at which to start the search.
R ETURNS
≥0 The column index found.
<0 The column with name variable was not found.
E XAMPLE
The following example searches a variable in the first comtrade object found in the study
case.
object intComtrade;
string variable;
int index;
intComtrade = GetFromStudyCase('IntComtrade');
if (nullptr=intComtrade){
exit();
}
variable = 'U RMS Feeder 1 (c)';
intComtrade.Load();
index = intComtrade.FindColumn(variable);
printf('Column index of %s is %d',variable,index);
! this will not find the variable again, because we are starting
! the search after the match
index = intComtrade.FindColumn(variable,index+1);
printf('Column index of %s is %d',variable,index);
intComtrade.Release();
FindMaxInColumn*
Find the maximum value of the variable in the given column.
int IntComtrade.FindMaxInColumn(int column,
[double& value])
A RGUMENTS
column The column index.
value (optional, out)
The maximum value found. The value is 0. in case that the maximum value was
not found.
649
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
<0 The maximum value of column was not found.
≥0 The row with the maximum value of the column.
E XAMPLE
object case,
elmRes;
set resObjs;
int row,
column;
double value;
column = 1;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('All calculations.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (elmRes) {
elmRes.Load();
row = elmRes.FindMaxInColumn(column,value);
if (row<0) {
Info('The maximum of column %d was not found',column);
}
else {
Info('The maximum of column %d is %f (row: %d)',column, value,row);
}
row = elmRes.FindMinInColumn(column,value);
if (row<0) {
Info('The minimum of column %d was not found',column);
}
else {
Info('The minimum of column %d is %f (row: %d)',column, value,row);
}
elmRes.Release();
}
FindMinInColumn*
Find the minimum value of the variable in the given column.
int IntComtrade.FindMinInColumn(int column,
[double& value])
A RGUMENTS
column The column index.
value (optional, out)
The minimum value found. The value is 0. in case that the minimum value was
not found.
R ETURNS
<0 The minimum value of column was not found.
≥0 The row with the minimum value of the column.
650
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
See example of IntComtrade.FindMaxInColumn.
GetAnalogueDescriptions
Get the descriptions of the analogue channel Please note that the comtrade info file contains
proprietary data from PFM. Info files not written by DIgSILENT PFM are not supported.
string IntComtrade.GetAnalogueDescriptions(int index)
A RGUMENTS
index Digital channel index.
R ETURNS
Descriptions for analogue channel in the comtrade info file.
GetColumnValues*
Get complete column values.
int IntComtrade.GetColumnValues(object dataVector,
int column)
A RGUMENTS
dataVector
IntVec which will be filled with column values.
column The column index. -1 for default (e.g. time).
R ETURNS
=0 Column values were found.
=1 dataVector is NULL.
=2 dataVector is not of class IntVec.
=3 Column index is out of range.
GetDescription*
Get the description of a column.
string IntComtrade.GetDescription([int column],
[int short]
)
A RGUMENTS
column (optional)
The column index. The description name of the default variable is returned if the
parameter is nor passed to the function.
short (optional)
0 long desc. (default)
1 short description
651
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
Returns the description which is empty in case that the column index is not part of the data.
E XAMPLE
See example of IntComtrade.GetVariable.
GetDigitalDescriptions
Get the descriptions of the digital channel Please note that the comtrade info file contains
proprietary data from PFM. Info files not written by DIgSILENT PFM are not supported.
string IntComtrade.GetDigitalDescriptions(int index)
A RGUMENTS
index Digital channel index
R ETURNS
Descriptions for digital channel in the comtrade info file.
GetNumberOfAnalogueSignalDescriptions
Gets the number of descriptions for analogue channels in the comtrade info file. Please note that
the comtrade info file contains proprietary data from PFM. Info files not written by DIgSILENT
PFM are not supported.
int IntComtrade.GetNumberOfAnalogueSignalDescriptions()
R ETURNS
Number of descriptions for analogue channels in the comtrade info file.
GetNumberOfColumns*
Returns the number of variables (columns) in result file excluding the default variable (e.g. time
for time domain simulation).
int IntComtrade.GetNumberOfColumns()
R ETURNS
Number of variables (columns) in result file.
E XAMPLE
See example of IntComtrade.InitialiseWriting.
GetNumberOfDigitalSignalDescriptions
Get the number of descriptions for digital channels in the comtrade info file. Please note that
the comtrade info file contains proprietary data from PFM. Info files not written by DIgSILENT
PFM are not supported.
int IntComtrade.GetNumberOfDigitalSignalDescriptions()
652
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
Number of descriptions for digital channels in the comtrade info file.
GetNumberOfRows*
Returns the number of values per column (rows) stored in result object.
int IntComtrade.GetNumberOfRows()
R ETURNS
Returns the number of values per column stored in result object.
E XAMPLE
See example of IntComtrade.InitialiseWriting.
GetObjectValue*
Returns a value from a result object for row iX of curve col.
int IntComtrade.GetObjectValue(object& o,
int iX,
[int col])
A RGUMENTS
o (out) The object retrieved from the data.
iX The row.
col (optional)
The curve number, which equals the variable or column number, first column value
(time,index, etc.) is returned when omitted.
R ETURNS
0 when ok
1 when iX out of bound
2 when col out of bound
3 when invalid value is returned from a sparse file. Sparse files are written e.g.
by the contingency analysis, the value is invalid in case that it was not written,
because it was below the recording limit. Result files created using DPL/Python
are always full and will not return invalid values.
E XAMPLE
See example of IntComtrade.SortAccordingToColumn.
GetSignalHeader
Get the headline of the channel section in the comtrade info file. Please note that the comtrade
info file contains proprietary data from PFM. Info files not written by DIgSILENT PFM are not
supported.
string IntComtrade.GetSignalHeader()
653
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
Headline of signal descriptions
GetUnit*
Get the unit of a column.
string IntComtrade.GetUnit([int column])
A RGUMENTS
column (optional)
The column index. The unit of the default variable is returned if the parameter is
nor passed to the function.
R ETURNS
Returns the unit which is empty in case that the column index is not part of the data.
E XAMPLE
See example of IntComtrade.GetVariable.
GetValue*
Returns a value from a result object for row iX of curve col.
int IntComtrade.GetValue(double& d,
int iX,
[int col])
A RGUMENTS
d (out) The value retrieved from the data.
iX The row.
col (optional)
The curve number, which equals the variable or column number, first column value
(time,index, etc.) is returned when omitted.
R ETURNS
0 when ok
1 when iX out of bound
2 when col out of bound
3 when invalid value is returned from a sparse file. Sparse files are written e.g.
by the contingency analysis, the value is invalid in case that it was not written,
because it was below the recording limit. Result files created using DPL/Python
are always full and will not return invalid values.
E XAMPLE
See example of IntComtrade.SortAccordingToColumn.
654
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetVariable*
Get variable name of column
string IntComtrade.GetVariable([int column])
A RGUMENTS
column (optional)
The column index. The variable name of the default variable is returned if the
parameter is nor passed to the function.
R ETURNS
Returns the variable name which is empty in case that the column index is not part of the
data.
E XAMPLE
object case,
elmRes;
string name,
unit,
short,
long;
set resObjs;
int variables,
column;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
variables = elmRes.GetNumberOfColumns();
if (variables>0) {
printf('Name; unit; Short Description; Long Description');
for (column=-1; column<variables; column+=1) {
! -1 returns default column
name = elmRes.GetVariable(column);
unit = elmRes.GetUnit(column);
short= elmRes.GetDescription(column,1);
long = elmRes.GetDescription(column);
printf('%s; %s; %s; %s', name, unit, short,long);
}
}
elmRes.Release();
Load*
Loads the data of a result object (IntComtrade) in memory for reading.
void IntComtrade.Load()
655
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
object case,
elmRes;
set resObjs;
int variables,rows;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
variables = elmRes.GetNumberOfColumns();
rows = elmRes.GetNumberOfRows();
Info('The result file %s contains %d columns and %d rows',elmRes, variables, rows);
elmRes.Release();
Release*
Releases the data loaded to memory. This function should be used whenever several result
objects are processed in a loop. Data is always released from memory automatically after
execution of the current script.
void IntComtrade.Release()
E XAMPLE
See example of IntComtrade.Load.
SortAccordingToColumn*
Sorts all rows in the data loaded according to the given column. The IntComtrade itself remains
unchanged.
int IntComtrade.SortAccordingToColumn(int column)
A RGUMENTS
col The column number.
R ETURNS
0 The function executed correctly, the data was sorted correctly according to the
given column.
1 The column with index column does not exist.
E XAMPLE
The following example outputs column 1 and 2 for the first 50 rows. The output is repeated
after sorting the data according to column 1.
object case,
elmRes;
656
3.6. OTHERS CHAPTER 3. OBJECT METHODS
set resObjs;
int row,
rows,
column,
failed;
double value1, value2;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
column = 1;
rows = 50;
Info('Orginal data in first %d rows of column %d and %d',rows, column, column+1);
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
row = 0;
while (.not.failed) {
row += 1;
printf('%04d %f %f', row, value1, value2); ! report row starting with 1
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
if (row > rows) {
break;
}
}
failed = elmRes.SortAccordingToColumn(column);
Info('Sorted data in first %d rows in column %d and %d',rows,column, column+1);
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
row = 0;
while (.not.failed) {
row += 1;
printf('%04d %f %f', row, value1, value2); ! report row starting with 1
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
if (row > rows) {
break;
}
}
elmRes.Release();
657
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.11 IntComtradeset
Overview
FindColumn*
FindMaxInColumn*
FindMinInColumn*
GetAnalogueDescriptions
GetColumnValues*
GetDescription*
GetDigitalDescriptions
GetNumberOfAnalogueSignalDescriptions
GetNumberOfColumns*
GetNumberOfDigitalSignalDescriptions
GetNumberOfRows*
GetObjectValue*
GetSignalHeader
GetUnit*
GetValue*
GetVariable*
Load*
Release*
SortAccordingToColumn*
FindColumn*
Returns the first column matching the variable name.
int IntComtradeset.FindColumn(string variable,
[int startCol]
)
A RGUMENTS
variable The variable name to look for.
startCol (optional)
The index of the column at which to start the search.
R ETURNS
≥0 The column index found.
<0 The column with name variable was not found.
E XAMPLE
The following example searches a variable in the first comtrade object found in the study
case.
object intComtradeset;
string variable;
int index;
intComtradeset = GetFromStudyCase('IntComtradeset');
if (nullptr=intComtradeset){
exit();
}
variable = 'U Step-Up T1 (c)';
intComtradeset.Load();
index = intComtradeset.FindColumn(variable);
printf('Column index of %s is %d',variable,index);
658
3.6. OTHERS CHAPTER 3. OBJECT METHODS
! this will not find the variable again, because we are starting
! the search after the match
index = intComtradeset.FindColumn(variable,index+1);
printf('Column index of %s is %d',variable,index);
intComtradeset.Release();
FindMaxInColumn*
Find the maximum value of the variable in the given column.
int IntComtradeset.FindMaxInColumn(int column,
[double& value])
A RGUMENTS
column The column index.
value (optional, out)
The maximum value found. The value is 0. in case that the maximum value was
not found.
R ETURNS
<0 The maximum value of column was not found.
≥0 The row with the maximum value of the column.
E XAMPLE
object case,
elmRes;
set resObjs;
int row,
column;
double value;
column = 1;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('All calculations.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (elmRes) {
elmRes.Load();
row = elmRes.FindMaxInColumn(column,value);
if (row<0) {
Info('The maximum of column %d was not found',column);
}
else {
Info('The maximum of column %d is %f (row: %d)',column, value,row);
}
row = elmRes.FindMinInColumn(column,value);
if (row<0) {
Info('The minimum of column %d was not found',column);
}
else {
Info('The minimum of column %d is %f (row: %d)',column, value,row);
}
elmRes.Release();
}
659
3.6. OTHERS CHAPTER 3. OBJECT METHODS
FindMinInColumn*
Find the minimum value of the variable in the given column.
int IntComtradeset.FindMinInColumn(int column,
[double& value])
A RGUMENTS
column The column index.
value (optional, out)
The minimum value found. The value is 0. in case that the minimum value was
not found.
R ETURNS
<0 The minimum value of column was not found.
≥0 The row with the minimum value of the column.
E XAMPLE
See example of IntComtradeset.FindMaxInColumn.
GetAnalogueDescriptions
Get the descriptions of the analogue channel Please note that the comtrade info file contains
proprietary data from PFM. Info files not written by DIgSILENT PFM are not supported.
string IntComtradeset.GetAnalogueDescriptions(int index)
A RGUMENTS
index Digital channel index.
R ETURNS
Descriptions for analogue channel in the comtrade info file.
GetColumnValues*
Get complete column values.
int IntComtradeset.GetColumnValues(object dataVector,
int column)
A RGUMENTS
dataVector
IntVec which will be filled with column values.
column The column index. -1 for default (e.g. time).
660
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
=0 Column values were found.
=1 dataVector is NULL.
=2 dataVector is not of class IntVec.
=3 Column index is out of range.
GetDescription*
Get the description of a column.
string IntComtradeset.GetDescription([int column],
[int short]
)
A RGUMENTS
column (optional)
The column index. The description name of the default variable is returned if the
parameter is nor passed to the function.
short (optional)
0 long desc. (default)
1 short description
R ETURNS
Returns the description which is empty in case that the column index is not part of the data.
E XAMPLE
See example of IntComtradeset.GetVariable.
GetDigitalDescriptions
Get the descriptions of the digital channel Please note that the comtrade info file contains
proprietary data from PFM. Info files not written by DIgSILENT PFM are not supported.
string IntComtradeset.GetDigitalDescriptions(int index)
A RGUMENTS
index Digital channel index
R ETURNS
Descriptions for digital channel in the comtrade info file.
GetNumberOfAnalogueSignalDescriptions
Gets the number of descriptions for analogue channels in the comtrade info file. Please note that
the comtrade info file contains proprietary data from PFM. Info files not written by DIgSILENT
PFM are not supported.
int IntComtradeset.GetNumberOfAnalogueSignalDescriptions()
661
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
Number of descriptions for analogue channels in the comtrade info file.
GetNumberOfColumns*
Returns the number of variables (columns) in result file excluding the default variable (e.g. time
for time domain simulation).
int IntComtradeset.GetNumberOfColumns()
R ETURNS
Number of variables (columns) in result file.
E XAMPLE
See example of IntComtradeset.InitialiseWriting.
GetNumberOfDigitalSignalDescriptions
Get the number of descriptions for digital channels in the comtrade info file. Please note that
the comtrade info file contains proprietary data from PFM. Info files not written by DIgSILENT
PFM are not supported.
int IntComtradeset.GetNumberOfDigitalSignalDescriptions()
R ETURNS
Number of descriptions for digital channels in the comtrade info file.
GetNumberOfRows*
Returns the number of values per column (rows) stored in result object.
int IntComtradeset.GetNumberOfRows()
R ETURNS
Returns the number of values per column stored in result object.
E XAMPLE
See example of IntComtradeset.InitialiseWriting.
GetObjectValue*
Returns a value from a result object for row iX of curve col.
int IntComtradeset.GetObjectValue(object& o,
int iX,
[int col])
A RGUMENTS
o (out) The object retrieved from the data.
iX The row.
662
3.6. OTHERS CHAPTER 3. OBJECT METHODS
col (optional)
The curve number, which equals the variable or column number, first column value
(time,index, etc.) is returned when omitted.
R ETURNS
0 when ok
1 when iX out of bound
2 when col out of bound
3 when invalid value is returned from a sparse file. Sparse files are written e.g.
by the contingency analysis, the value is invalid in case that it was not written,
because it was below the recording limit. Result files created using DPL/Python
are always full and will not return invalid values.
E XAMPLE
See example of IntComtradeset.SortAccordingToColumn.
GetSignalHeader
Get the headline of the channel section in the comtrade info file. Please note that the comtrade
info file contains proprietary data from PFM. Info files not written by DIgSILENT PFM are not
supported.
string IntComtradeset.GetSignalHeader()
R ETURNS
Headline of signal descriptions
GetUnit*
Get the unit of a column.
string IntComtradeset.GetUnit([int column])
A RGUMENTS
column (optional)
The column index. The unit of the default variable is returned if the parameter is
nor passed to the function.
R ETURNS
Returns the unit which is empty in case that the column index is not part of the data.
E XAMPLE
See example of IntComtradeset.GetVariable.
GetValue*
Returns a value from a result object for row iX of curve col.
int IntComtradeset.GetValue(double& d,
int iX,
[int col])
663
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
d (out) The value retrieved from the data.
iX The row.
col (optional)
The curve number, which equals the variable or column number, first column value
(time,index, etc.) is returned when omitted.
R ETURNS
0 when ok
1 when iX out of bound
2 when col out of bound
3 when invalid value is returned from a sparse file. Sparse files are written e.g.
by the contingency analysis, the value is invalid in case that it was not written,
because it was below the recording limit. Result files created using DPL/Python
are always full and will not return invalid values.
E XAMPLE
See example of IntComtradeset.SortAccordingToColumn.
GetVariable*
Get variable name of column
string IntComtradeset.GetVariable([int column])
A RGUMENTS
column (optional)
The column index. The variable name of the default variable is returned if the
parameter is nor passed to the function.
R ETURNS
Returns the variable name which is empty in case that the column index is not part of the
data.
E XAMPLE
object case,
elmRes;
string name,
unit,
short,
long;
set resObjs;
int variables,
column;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
664
3.6. OTHERS CHAPTER 3. OBJECT METHODS
exit(1);
}
elmRes.Load();
variables = elmRes.GetNumberOfColumns();
if (variables>0) {
printf('Name; unit; Short Description; Long Description');
for (column=-1; column<variables; column+=1) {
! -1 returns default column
name = elmRes.GetVariable(column);
unit = elmRes.GetUnit(column);
short= elmRes.GetDescription(column,1);
long = elmRes.GetDescription(column);
printf('%s; %s; %s; %s', name, unit, short,long);
}
}
elmRes.Release();
Load*
Loads the data of a result object (IntComtradeset) in memory for reading.
void IntComtradeset.Load()
E XAMPLE
object case,
elmRes;
set resObjs;
int variables,rows;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
variables = elmRes.GetNumberOfColumns();
rows = elmRes.GetNumberOfRows();
Info('The result file %s contains %d columns and %d rows',elmRes, variables, rows);
elmRes.Release();
Release*
Releases the data loaded to memory. This function should be used whenever several result
objects are processed in a loop. Data is always released from memory automatically after
execution of the current script.
void IntComtradeset.Release()
E XAMPLE
See example of IntComtradeset.Load.
665
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SortAccordingToColumn*
Sorts all rows in the data loaded according to the given column. The IntComtradeset itself
remains unchanged.
int IntComtradeset.SortAccordingToColumn(int column)
A RGUMENTS
col The column number.
R ETURNS
0 The function executed correctly, the data was sorted correctly according to the
given column.
1 The column with index column does not exist.
E XAMPLE
The following example outputs column 1 and 2 for the first 50 rows. The output is repeated
after sorting the data according to column 1.
object case,
elmRes;
set resObjs;
int row,
rows,
column,
failed;
double value1, value2;
case = GetActiveStudyCase();
if (nullptr=case) {
exit(1); ! there is no active study case
}
resObjs = case.GetContents('*.ElmRes',0); ! get all ElmRes stored in case
elmRes = resObjs.First();
if (nullptr=elmRes) {
exit(1);
}
elmRes.Load();
column = 1;
rows = 50;
Info('Orginal data in first %d rows of column %d and %d',rows, column, column+1);
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
row = 0;
while (.not.failed) {
row += 1;
printf('%04d %f %f', row, value1, value2); ! report row starting with 1
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
if (row > rows) {
break;
}
}
failed = elmRes.SortAccordingToColumn(column);
Info('Sorted data in first %d rows in column %d and %d',rows,column, column+1);
failed = elmRes.GetValue(value1,row,column);
failed = elmRes.GetValue(value2,row,column+1);
row = 0;
while (.not.failed) {
row += 1;
666
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.12 IntDataset
Overview
AddRef
All
Clear
GetAll
AddRef
Adds new reference(s) for passed object(s) as children to the dataset object. Nothing happens
if there exists already a reference for the passed object.
void IntDataset.AddRef(object obj)
void IntDataset.AddRef(set objects)
A RGUMENTS
obj/objects
Object(s) for which references should be created and added to the dataset object
All
Returns all children of the dataset object.
set IntDataset.All()
R ETURNS
All objects contained in dataset object.
Clear
Deletes all children of the dataset object.
void IntDataset.Clear()
GetAll
Returns all children of the dataset filtered according to given class name.
set IntDataset.GetAll(string className)
667
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
className
class name filter, e.g. ElmTerm
R ETURNS
All objects of given class stored in dataset object.
3.6.13 IntDocument
Overview
Export
Import
Reset
View
Export
Exports the embedded data as new file on disk. The embedded data remains unmodified. If
desired it can be removed by calling the Reset() function afterwards
int IntDocument.Export(string filename)
A RGUMENTS
filename Name of export file on disk
R ETURNS
0 On success.
1 On error.
S EE ALSO
IntDocument.Import()
Import
Imports the content of selected file into the PowerFactory object. The data is afterwards em-
bedded in the PowerFactory database.
int IntDocument.Import()
R ETURNS
0 On success.
1 On error.
S EE ALSO
IntDocument.Export()
668
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Reset
Resets embedded data and reference to an external file.
int IntDocument.Reset()
View
Views the file in external application. If the file is embedded, it’s extracted into a temporary file
that is opened afterwards. Please note, the action is only executed if access to given file (type)
is enabled in the 'External Access' configuration of PowerFactory (IntExtaccess).
int IntDocument.View()
R ETURNS
0 Success, file was opened
1 Error, file not opened (because of invalid address or security reasons)
S EE ALSO
IntUrl.View()
3.6.14 IntDplmap
Overview
Clear*
Contains*
First*
GetValue*
Insert*
Next*
Remove*
Size*
Update*
Clear*
Removes all key/value pairs from the container and resets type information.
void IntDplmap.Clear()
E XAMPLE
See example of IntDplmap.GetValue().
Contains*
Checks if a key/value pair with given key is contained in the container.
int IntDplmap.Contains(int | double | string | object | set key)
A RGUMENTS
key Key of the associated pair in the container
669
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
1 if an entry of same key is contained, otherwise 0.
E XAMPLE
See example of IntDplmap.GetValue().
First*
Outputs the first key/value pair stored in the container.
Note:
• The sequence of the returned pairs is determined by internal criteria and cannot be
changed.
• It is not allowed to modify a container while iterating over it. If doing so, the next call of the
Next command will return a value of 1.
Exception: Update() does not invalidate current position.
A RGUMENTS
key (out) Key of the associated pair in the container
value (out)
Value of the associated pair in the container
R ETURNS
1 if no next entry is available in the container (e.g. end is reached), otherwise 0.
E XAMPLE
Iteration over a map:
!'map'refers to an object of class IntDplmap that is stored inside the
!script
int t, key, m;
string value;
!change value of all odd keys into upper-case while iterating over map
printf('Modifying map...');
for (t = map.First(key, value); t = 0; t = map.Next(key, value)) {
m = modulo(key, 2);
if (m = 1) {
value = toupper(value);
670
3.6. OTHERS CHAPTER 3. OBJECT METHODS
map.Update(key, value);
}
}
GetValue*
Returns the associated value for given key.
int|double|string|object|set IntDplmap.GetValue(int|double|string|object|set key,
[int& error])
A RGUMENTS
key Key of the associated pair in the container to find.
error (optional, out)
1 Key was not found in container.
0 Key was found in the container.
R ETURNS
The value which is associated to the given key or an undefined value if key is not associated
with any value.
E XAMPLE
The following example shows how to use the different IntDplmap methods:
!'map'refers to an IntDplmap object stored inside the script
int count, i, tmp;
object o;
set aSet, bSet;
string s, s2;
!clear map
map.Clear();
count = map.Size();
printf('Map Size: %d', count);
671
3.6. OTHERS CHAPTER 3. OBJECT METHODS
s = map.GetValue(i);
printf('%d = %s', i, s);
}
else {
printf('%d not contained', i);
}
}
map.Clear();
count = map.Size();
printf('Map Size: %d', count);
672
3.6. OTHERS CHAPTER 3. OBJECT METHODS
tmp = map.Contains(2);
if (tmp > 0){
o = map.GetValue(2);
o.ShowFullName();
}
map.Clear();
printf('\n');
printf('\n');
673
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Insert*
Inserts given key and value as an associated pair into the container.
On the first insertion, the container is (automatically) typed by given data types of key and value.
From now on, only keys and values of that types are accepted. (This type information is removed
when IntDplmap.Clear() is called.)
If given key already exists in the container, its associated value will be overwritten. (Each key
can only be contained once in a map (no multi-map support).)
Note:
A RGUMENTS
key Key of the associated pair in the container.
value Value of the associated pair in the container.
E XAMPLE
See example of IntDplmap.GetValue().
Next*
Outputs the next key/value pair relative to the last key/value pair in the container.
Note:
• The sequence of the returned pairs is determined by internal criteria and cannot be
changed.
• It is not allowed to modify a container while iterating over it. If doing so, the next call of the
Next command will return a value of 1.
Exception: Update() does not invalidate current position.
A RGUMENTS
key (out) Key of the associated pair in the container.
value (out)
Value of the associated pair in the container.
R ETURNS
1 if no next entry is available in the container (e.g. end is reached), otherwise 0.
674
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
See example of IntDplmap.First().
Remove*
Removes the key/value pair for given key from the container. No error will occur, if the key is not
contained in the container.
void IntDplmap.Remove (int | double | string | object | set key)
A RGUMENTS
key Key of the associated pair in the container
E XAMPLE
See example of IntDplmap.GetValue().
Size*
Returns the number of key/value pairs stored in the container.
int IntDplmap.Size()
R ETURNS
Number of key-value pairs stored in the container.
E XAMPLE
See example of IntDplmap.GetValue().
Update*
Is a special insert function that can be used for updating key/value pairs in the map. It can only
be used if the key is already contained in the map.
void IntDplmap.Update(int | double | string | object | set key,
int | double | string | object | set value)
A RGUMENTS
key Key of the associated pair in the container
E XAMPLE
See example of IntDplmap.GetValue().
675
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.15 IntDplvec
Overview
Clear*
Get*
IndexOf*
Insert*
Remove*
Size*
Sort*
Clear*
Removes all elements from the container and resets the typ information.
void IntDplvec.Clear()
E XAMPLE
See example of IntDplvec.Get().
Get*
Returns the element stored at given position in the container.
int|double|string|object|set IntDplvec.Get(int position)
A RGUMENTS
position Position in the container. It is zero-based and must always be lesser than the
container’s size.
R ETURNS
Element stored at given position in the container.
E XAMPLE
The following example shows how to use the different IntDplvec methods:
! 'vec' always refers to an IntDplvec object that is stored inside the script
int count, i, tmp;
676
3.6. OTHERS CHAPTER 3. OBJECT METHODS
tmp = vec.Get(i);
printf('Vector[%d] = %d', i, tmp);
}
! replace elements
for (i = 0; i < count; i += 1) {
tmp = vec.Get(i);
tmp = tmp * 10;
vec.Insert(i, tmp);
}
677
3.6. OTHERS CHAPTER 3. OBJECT METHODS
IndexOf*
Returns the position where the given element is stored in the container.
int IntDplvec.IndexOf(int|double|string|object|set element,
[int startPosition]
)
A RGUMENTS
element Element for which the position will be searched.
startPosition
Start position from which the next occurrence greater or equal to this position is
searched.
R ETURNS
Position of the the given element in the container. The returned position is zero-based. If no
occurrence was found, -1 is returned.
E XAMPLE
See example of IntDplvec.Get().
Insert*
Inserts an element at given position into the container. If no position is given then the element
is appended to the back. Inserting an element to an empty container fixes the type of elements
which can be hold by itself. Clearing the container resets this type information.
void IntDplvec.Insert(int|double|string|object|set element)
void IntDplvec.Insert(int position,
int|double|string|object|set element,
)
A RGUMENTS
element Element to be inserted.
position Position (zero-based) to insert the element at. Any old entry at that position will
be overwritten. Note: The size of the vector is automatically increased if given
position is greater than current size.
E XAMPLE
See example of IntDplvec.Get().
Remove*
Removes the element stored at given position from the container.
void IntDplvec.Remove(int position)
A RGUMENTS
position Given position (zero-based) at which the element is to be removed.
678
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
See example of IntDplvec.Get().
Size*
Returns the number of elements stored in the container.
int IntDplvec.Size()
R ETURNS
Number of elements stored in the container.
E XAMPLE
See example of IntDplvec.Get().
Sort*
Sorts the elements of the vector depending on the type of elements stored inside the vector:
string lexically
double/int
according to value
object according to full name (path + name) or given attribute
A RGUMENTS
descending (optional)
1 Descending sorting order
0 Ascending sorting order (default)
attribute (optional)
For objects only: Attribute according to which the sorting is done (default is full
name)
E XAMPLE
See example of IntDplvec.Get().
3.6.16 IntEvt
Overview
CreateCBEvents
RemoveSwitchEvents
679
3.6. OTHERS CHAPTER 3. OBJECT METHODS
CreateCBEvents
Create boundary breaker events for all shc locations which occur simultaneously in this fault
case.
void IntEvt.CreateCBEvents([int iRemoveExisting])
A RGUMENTS
iRemoveExisting (optional)
-1 Query user if circuit breaker events exist.
0 Do not create circuit breaker events if circuit breaker events are already
defined events exist (default)
1 Remove existing circuit breaker events.
RemoveSwitchEvents
Remove all switch events of this fault case.
void IntEvt.RemoveSwitchEvents([int onlyContingency])
A RGUMENTS
onlyContingency (optional)
Condition to remove.
0 Remove all switch events regardless of the calculation type.
1 Remove all switch events only when this fault case is used for contin-
gency analysis.
3.6.17 IntExtaccess
Overview
CheckUrl
CheckUrl
Checks whether access to given url will be granted or not according to the security settings.
See also IntUrl.View() for accessing that url.
int IntExtaccess.CheckUrl(string url)
A RGUMENTS
url url to check
E XAMPLE
int i;
object extAccess;
680
3.6. OTHERS CHAPTER 3. OBJECT METHODS
i = extAccess.CheckUrl('http://www.digsilent.de');
if (i=0) {
printf('OK');
}
else {
printf('No access');
}
R ETURNS
0 access granted
1 access denied
3.6.18 IntGate
Overview
AddTrigger
AddTrigger
Adds either a condition or a gate to the gate.
void IntGate.AddTrigger(object newTrigger)
A RGUMENTS
newTrigger
The condition or gate that shall be added.
3.6.19 IntGrf
Overview
MoveToLayer
MoveToLayer
Moves an IntGrf object to the selected target layer, provided that the object is a valid object
for that layer. Annotation elements stored as (obsolete) IntGrf objects can be moved to any
annotation layer (IntGrflayer ) or group (IntGrfgroup).
void IntGrf.MoveToLayer(object layer)
A RGUMENTS
layer Target IntGrflayer or IntGrfgroup object.
681
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.20 IntGrfgroup
Overview
ClearData
Export
ExportToVec
Import
ImportFromVec
ClearData
Removes all annotation elements from this group.
void IntGrfgroup.ClearData()
Export
Exports all objects of a group into svg-file.
void IntGrfgroup.Export(string path,
[int OpenDialog])
A RGUMENTS
path Full export file path
OpenDialog (optional)
Prompt for export path in dialog
0 Export directly and do not show any dialog (default)
1 Show dialog with path before exporting
ExportToVec
Fills string description of annotation elements of this group into an IntDplvec. Clears IntDplvec
before filling it.
void IntGrfgroup.ExportToVec(object intDplVec)
A RGUMENTS
intDplVec IntDplvec object to be filled.
E XAMPLE
This example exports the referred group object to a DPL-vector stored inside the DPL-script
and prints all lines.
int iSize, i;
string sLine;
682
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Import
Imports svg-file into group object.
void IntGrfgroup.Import(string path)
A RGUMENTS
path Path of file to be imported.
ImportFromVec
Fills this group with the string description of annotation elements from an IntDplvec. Clears the
group before filling it.
void IntGrfgroup.ImportFromVec(object intDplVec)
A RGUMENTS
intDplVec IntDplvec containg description of annotation elements.
E XAMPLE
This example imports the lines from an internally stored DPL-vector to a group object.
oGroup.ImportFromVec(DPLVec); ! group from External Objects, DPLVec stored in this
3.6.21 IntGrflayer
Overview
AdaptWidth
Align
ChangeFont
ChangeLayer
ChangeRefPoints
ChangeWidthVisibilityAndColour
ClearData
Export
ExportToVec
Import
ImportFromVec
Mark
Reset
683
3.6. OTHERS CHAPTER 3. OBJECT METHODS
AdaptWidth
Resizes the specified group of text boxes regarding their maximum text length.
void IntGrflayer.AdaptWidth(int objectType,
[string symbolName])
A RGUMENTS
objectType
Object type
0 Nodes and branches
1 Nodes
2 Branches
3 Symbol dependent
symbolName
Symbol name (only relevant if objectType == 3)
Align
Aligns the text within a text box.
void IntGrflayer.Align(int alignPos,
int objectType,
[string symbolName])
A RGUMENTS
alignPos Alignment within bounding box
0 left
1 middle
2 right
objectType
Object type
0 Nodes and branches
1 Nodes
2 Branches
3 Symbol dependent
symbolName
Symbol name (only relevant if objectType == 3)
ChangeFont
Sets the font number for the specified group of text boxes.
void IntGrflayer.ChangeFont(string fontName,
int fontSize,
int fontStyle,
int objectType,
[string symbolName])
684
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
fontName
Font name
fontSize Font size
fontStyle Font style
0 Regular
1 Bold
2 Italic
3 Bold and Italic
4 Underline
objectType
Object type
0 Nodes and branches
1 Nodes
2 Branches
3 Symbol dependent
symbolName
Symbol name (only relevant if objectType == 3)
ChangeLayer
Sets the specified group of text boxes to a given layer.
void IntGrflayer.ChangeLayer(object newLayer,
int objectType,
[string symbolName])
A RGUMENTS
newLayer Layer object
objectType
Object type
symbolName
Symbol name (only relevant if objectType == 3)
685
3.6. OTHERS CHAPTER 3. OBJECT METHODS
ChangeRefPoints
Sets the reference points between a text box (second parameter) and its parent object (first
parameter), e.g. if the result box of a busbar shall be shown on top of a drawn bar instead of
below the bar the values change from (6,4) to (4,6). The first number specifies the reference
number of the text box. The integer values describe the position of the reference points within a
rectangle (0=centre, 1=middle right, 2=top right,..):
432
501
678
A RGUMENTS
parentRef
Defines the reference point on the parent object (e.g. busbar)
textBoxRef
Defines the reference point on the text box
objectType
Object type
0 Nodes and branches
1 Nodes
2 Branches
3 Symbol dependent
symbolName
Symbol name (only relevant if objectType == 3)
ChangeWidthVisibilityAndColour
Sets the visibility of the frame, the width (in number of letters), the visibility and the colour of text
boxes.
void IntGrflayer.ChangeWidthVisibilityAndColour(int objectType,
[string symbolName],
[int columns],
[int visibility],
[int colorNumber])
A RGUMENTS
objectType
Object type
0 Nodes and branches
1 Nodes
2 Branches
3 Symbol dependent
686
3.6. OTHERS CHAPTER 3. OBJECT METHODS
symbolName
Symbol name (only relevant if objectType == 3)
0 not visible
1 visible
colorNumber
Sets the colour
0..255 colorNumber
ClearData
Removes all annotation elements on this layer (keeps contained groups and annotation ele-
ments).
void IntGrflayer.ClearData()
Export
Exports all objects of a layer into svg-file or plain text (.txt), inclusive annotation objects of
contained group objects.
void IntGrflayer.Export(string path,
[int OpenDialog])
A RGUMENTS
path Full export file path. Supported formats: .svg and .txt.
OpenDialog (optional)
Prompt for export path in dialog
0 Export directly and do not show any dialog (default)
1 Show dialog with path before exporting
ExportToVec
Fills string description of annotation elements of this layer into an IntDplvec. Clears IntDplvec
before filling it.
void IntGrflayer.ExportToVec(object intDplVec)
A RGUMENTS
intDplVec IntDplvec object to be filled.
687
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
This example exports the referred layer object to a DPL-vector stored inside the DPL-script
and prints all lines.
int iSize, i;
string sLine;
Import
Imports svg file or plain text (.txt) into layer.
void IntGrflayer.Import(string path)
A RGUMENTS
path Path of file to be imported. Supported formats: .svg and .txt.
ImportFromVec
Fills this layer with the string description of annotation elements from an IntDplvec. Clears layer
before filling it.
void IntGrflayer.ImportFromVec(object intDplVec)
A RGUMENTS
intDplVec IntDplvec containg description of annotation elements.
E XAMPLE
This example imports the lines from an internally stored DPL-vector to a layer object.
oLayer.ImportFromVec(DPLVec); ! layer from External Objects, DPLVec stored in this
Mark
Marks the specified group of text boxes in the currently shown diagram.
void IntGrflayer.Mark(int objectType,
[string symbolName])
A RGUMENTS
objectType
Object type
0 Nodes and branches
688
3.6. OTHERS CHAPTER 3. OBJECT METHODS
1 Nodes
2 Branches
3 Symbol dependent
symbolName
Symbol name (only relevant if objectType == 3)
Reset
Resets the individually modified text box settings.
void IntGrflayer.Reset(int mode,
int objectType,
[string symbolName])
A RGUMENTS
iMode
0 Reset to default (changed reference points are not reset)
1 Only font
2 Shift to original layer (result boxes to layer 'Results', object names to
layer 'Labels')
objectType
Object type
0 Nodes and branches
1 Nodes
2 Branches
3 Symbol dependent
symbolName
Symbol name (only relevant if objectType == 3)
3.6.22 IntGrfnet
Overview
Close
SetFontFor
SetLayerVisibility
SetSymbolComponentVisibility
Show
Close
Closes the graphic page that displays this diagram.
int IntGrfnet.Close()
R ETURNS
0 On success, no error occurred.
689
3.6. OTHERS CHAPTER 3. OBJECT METHODS
1 Otherwise
SetFontFor
Sets a font for a specified group of text boxes.
void IntGrfnet.SetFontFor(int labelResultOrTitle,
int nodesOrBranches,
string fontName,
int fontSize,
int fontStyle)
A RGUMENTS
labelResultOrTitle
Type of text box to be modified.
0 Labels
1 Results
2 Title and Legends
nodesOrBranches
Type of parent object
0 Nodes
1 Branches
fontName
Font name
fontSize Font size
fontStyle Font style
1 Bold
2 Italic
3 Bold and italic
4 Underline
SetLayerVisibility
Sets a layer visible or invisible.
void IntGrfnet.SetLayerVisibility(string sLayer,
int iVis)
A RGUMENTS
sLayer Layer to be modified.
iVis Visibility
0 Make layer invisible.
1 Make layer visible.
690
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetSymbolComponentVisibility
Determines which parts of net element symbols are shown in the diagram.
void IntGrfnet.SetSymbolComponentVisibility(int componentID,
int visible)
A RGUMENTS
componentID
Component to be modified.
5 Connection points
7 Tap positions
8 Vector groups
9 Load flow arrows
11 Phases
13 Line sections and loads
14 Connection arrows
21 Connection numbers (block diagrams only)
22 Connection names (block diagrams only)
33 Remotely controlled substation markers
38 Tie open point markers
39 Open standby switch markers
40 Normally open switch markers
visible Visibility
Show
Opens a diagram.
int IntGrfnet.Show()
R ETURNS
0 On success, no error occurred.
1 Otherwise
E XAMPLE
int err;
object project, grfnet, desktop, diagramsfolder;
set objs;
project = GetActiveProject();
if (.not. project) {
Error('No project found!');
exit();
}
diagramsfolder = GetProjectFolder('dia');
objs = diagramsfolder.GetContents('*.IntGrfnet',1);
691
3.6. OTHERS CHAPTER 3. OBJECT METHODS
grfnet = objs.First();
if (.not. grfnet) {
Error('No diagram found!');
exit();
}
err = grfnet.Show();
printf('%o.Show() returned %d', grfnet, err);
3.6.23 IntIcon
Overview
Export
Import
Export
Exports current icon as a bitmap file.
int IntIcon.Export(string filename)
A RGUMENTS
filename Name of export image on disk. Extension needs to be ’.bmp’
R ETURNS
0 On success.
1 On error.
S EE ALSO
IntIcon.Import()
Import
Imports icon from a bitmap file.
int IntIcon.Import(string filename)
A RGUMENTS
filename Name of bitmap file on disk. Extension and format needs to be ’.bmp’
R ETURNS
0 On success.
1 On error.
S EE ALSO
IntIcon.Export()
692
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.24 IntLibrary
Overview
Activate
Deactivate
Activate
Activates this library. If another library is already activated it will be deactivated first.
int IntLibrary.Activate()
R ETURNS
1 if successful
0 otherwise
Deactivate
Deactivates this library.
int Library.Deactivate()
R ETURNS
1 if successful
0 otherwise
3.6.25 IntMat
Overview
ColLbl*
Get*
GetColumnLabel*
GetColumnLabelIndex*
GetNumberOfColumns*
GetNumberOfRows*
GetRowLabel*
GetRowLabelIndex*
Init*
Invert*
Multiply*
Resize*
RowLbl*
Save*
Set*
SetColumnLabel*
SetRowLabel*
SortToColumn*
693
3.6. OTHERS CHAPTER 3. OBJECT METHODS
ColLbl*
Deprecated function to get or set the label of the given column. Please use IntMat.GetColumnLabel()
or IntMat.SetColumnLabel() instead.
string IntMat.ColLbl(int column)
string IntMat.ColLbl(string label,
int column
)
Get*
Returns the value at the position (row, column) of the matrix. A run-time error will occur when
'row' or 'column' is out of range.
double IntMat.Get(int row,
int column
)
A RGUMENTS
row Row in matrix: 1 ... GetNumberOfRows().
column column in matrix: 1 ... GetNumberOfColumn()
R ETURNS
Value in matrix.
S EE ALSO
IntMat.Set()
E XAMPLE
The following example multiplies two matrices
int r,c,z,s,s1r,s2c;
double v1,v2,v;
s = M1.GetNumberOfColumns();
r = M2.GetNumberOfRows();
if (s<>r) {exit()};
s1r = M1.GetNumberOfRows();
s2c = M2.GetNumberOfColumns();
M3.Init(s1r,s2c);
r=1;
while (r<=s1r) {
c=1;
while (c<=s2c) {
z=1; v=0.0;
while (z<=s) {
v1=M1.Get(r,z);
v2=M2.Get(z,c);
v+=v1*v2;
z+=1;
}
M3.Set(r,c,v);
c+=1;
}
r+=1;
}
694
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetColumnLabel*
Returns the label of a column.
string IntMat.GetColumnLabel(int column)
A RGUMENTS
column Column index (first column has index 1).
R ETURNS
Column label of given column.
D EPRECATED N AMES
ColLbl
S EE ALSO
E XAMPLE
The following example assigns the label of the first column to the string label
string label;
label = Mat.GetColumnLabel(1);
GetColumnLabelIndex*
Gets the index of a label in all column labels.
int IntMat.GetColumnLabelIndex(string label)
A RGUMENTS
label Label to search.
R ETURNS
≥1 The index in the column labels, if label was found.
0 Otherwise
S EE ALSO
IntMat.GetColumnLabel()
GetNumberOfColumns*
Returns the number of columns in the matrix.
int IntMat.GetNumberOfColumns()
R ETURNS
The number of columns of the matrix.
D EPRECATED N AMES
NCol, SizeY
695
3.6. OTHERS CHAPTER 3. OBJECT METHODS
S EE ALSO
IntMat.GetNumberOfRows()
E XAMPLE
See example of IntMat.Get().
GetNumberOfRows*
Returns the number of rows in the matrix.
int IntMat.GetNumberOfRows()
R ETURNS
The number of rows.
D EPRECATED N AMES
NRow, SizeX
S EE ALSO
IntMat.GetNumberOfColumns()
E XAMPLE
See example of IntMat.Get().
GetRowLabel*
Returns the label of a row.
string IntMat.GetRowLabel(int row)
A RGUMENTS
row Row index (first row has index 1).
R ETURNS
Row label of given row.
D EPRECATED N AMES
RowLbl
S EE ALSO
E XAMPLE
The following example assigns the label of the first row to the string label
string label;
label = Mat.GetRowLabel(1);
696
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetRowLabelIndex*
Gets the index of a label in all row labels.
int IntMat.GetRowLabelIndex(string label)
A RGUMENTS
label Label to search.
R ETURNS
≥1 The index in the row labels, if it was found.
0 Otherwise
S EE ALSO
IntMat.GetRowLabel()
Init*
Initializes the matrix with given size and values, regardless of the previous size and data.
This operation is performed in memory only. Use IntMat.Save() to save the modified matrix to
database.
int IntMat.Init(int numberOfRows,
int numberOfColumns,
[double initialValue = 0.0]
)
A RGUMENTS
numberOfRows
The number of rows.
numberOfColumns
The number of columns.
initialValue (optional)
Initial values: All matrix entries are initialised with this value. Matrix is initialized
with 0 if ommitted.
R ETURNS
Always 1 and can be ignored.
E XAMPLE
See example of IntMat.Get().
S EE ALSO
IntMat.Resize()
Invert*
Inverts the matrix.
This operation is performed in memory only. Use IntMat.Save() to save the modified matrix to
database.
int IntMat.Invert()
697
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Success, the matrix is replaced by its inversion.
1 Error, inversion not possible. Original matrix was not changed.
E XAMPLE
The following example inverts a matrix named Matrix stored inside the script.
int err;
err = Matrix.Invert();
if (err) {
printf('Matrix %o is not invertible', Matrix);
}
else {
printf('Matrix %o successfully inverted', Matrix);
}
Multiply*
Multiplies 2 matrixes and stores the result in this matrix.
This operation is performed in memory only. Use IntMat.Save() to save the modified matrix to
database.
int IntMat.Multiply(object M1,
object M2
)
A RGUMENTS
object M1
Matrix 1 to be multiplied.
object M2
Matrix 2 to be multiplied.
R ETURNS
Always 0 and can be ignored.
Resize*
Resizes the matrix to a given size. Existing values will not be changed. Added values will be
set to the optional value, otherwise to 0.
This operation is performed in memory only. Use IntMat.Save() to save the modified matrix to
database.
int IntMat.Resize(int numberOfRows,
int numberOfColumns,
[double initialValue = 0.0]
)
A RGUMENTS
numberOfRows
The number of rows.
numberOfColumns
The number of columns.
698
3.6. OTHERS CHAPTER 3. OBJECT METHODS
initialValue (optional)
Initial values: Additional matrix entries are initialised with this value. Additional
values are initialized with 0. if ommitted.
R ETURNS
Always 1 and can be ignored.
S EE ALSO
IntMat.Init()
RowLbl*
Deprecated function to get or set the label of the given row. Please use IntMat.GetRowLabel()
or IntMat.SetRowLabel() instead.
string IntMat.RowLbl(int row)
string IntMat.RowLbl(string label,
int row
)
Save*
Saves the current state of this matrix to database.
If the matrix is calculation relevant, an optional parameter allows to control whether available
calculation results shall be reset afterwards or not.
Note: In QDSL, the calculation results are never reset and the parameter ”resetCalculation” is
ignored.
void IntMat.Save()
void IntMat.Save(int resetCalculation)
A RGUMENTS
resetCalculation (optional)
1 reset calculation results (default)
0 keep calculation results
Set*
Sets a value at the position (row, column) of the matrix. The matrix is resized automatically if
the given coordinates exceed the size.
This operation is performed in memory only. Use IntMat.Save() to save the modified matrix to
database.
int IntMat.Set(int row,
int column,
double value
)
A RGUMENTS
row Row index, 1 based. The first row has index 1. Invalid index (leq0) leads to
scripting error.
699
3.6. OTHERS CHAPTER 3. OBJECT METHODS
column Column index, 1 based. The first column has index 1. Invalid index (leq0) leads to
scripting error.
value Value to assign.
R ETURNS
Always 1 and can be ignored.
S EE ALSO
IntMat.Get()
E XAMPLE
See example of IntMat.Get().
SetColumnLabel*
Sets the label of a column.
This operation is performed in memory only. Use IntMat.Save() to save the modified matrix to
database.
void IntMat.SetColumnLabel(int column,
string label
)
A RGUMENTS
column Column index (first column has index 1).
label Label to set.
S EE ALSO
E XAMPLE
The following example labels some columns.
Mat.SetColumnLabel(1, 'transformers');
Mat.SetColumnLabel(2, 'lines');
Mat.SetColumnLabel(3, 'busbars');
SetRowLabel*
Sets the label of a row.
This operation is performed in memory only. Use IntMat.Save() to save the modified matrix to
database.
string IntMat.SetRowLabel(int row,
string label
)
A RGUMENTS
row Row index (first row has index 1).
label Label to set.
700
3.6. OTHERS CHAPTER 3. OBJECT METHODS
S EE ALSO
E XAMPLE
The following example labels some rows.
Mat.SetRowLabel(1, 'transformers');
Mat.SetRowLabel(2, 'lines');
Mat.SetRowLabel(3, 'busbars');
SortToColumn*
Sorts the matrix alphanumerically according to a column, which is specified by the input param-
eter. The row labels are sorted accordingly (if input parameter storeInDB is 1).
int IntMat.SortToColumn(int columnIndex,
[double epsilon = 0.0,]
[int storeInDB = 1])
D EPRECATED N AMES
SortToColum
A RGUMENTS
columnIndex
The column index, 1 based. The first column has index 1.
epsilon (optional)
Accuracy for comparing equal values. Values which differ less than epsilon are
treated as being equal. Default value is 0.
storeInDb (optional)
Possible Values:
0 Non-persistent change. Values are not stored in database.
1 Values are stored in database. (default)
R ETURNS
0 On success.
1 Error. Original matrix was not changed.
3.6.26 IntMon
Overview
AddVar
AddVars
ClearVars
GetVar*
NVars*
PrintAllVal*
PrintVal*
RemoveVar
701
3.6. OTHERS CHAPTER 3. OBJECT METHODS
AddVar
Appends the variable “name” to the list of selected variable names.
void IntMon.AddVar(string name)
A RGUMENTS
name The variable name to add.
E XAMPLE
See example of IntMon.GetVar.
AddVars
Appends the filtered variables to the list of selected variables.
void IntMon.AddVars(string varFilter)
A RGUMENTS
varFilter The filter for variables to add. For example: ’e:*’ to add all parameters of element
to variable selection.
ClearVars
Clears the list of selected variable names.
void IntMon.ClearVars()
E XAMPLE
See example of IntMon.GetVar.
GetVar*
Returns the variable name on the given row of the variable selection text on the second page of
the IntMon dialogue, which should contain one variable name per line.
string IntMon.GetVar(int row)
A RGUMENTS
row Given row
R ETURNS
The variable name in line row.
E XAMPLE
The following example script gets the variable set object stored inside the scripting object,
removes all variables, add two new ones and outputs the variable names previously added
in the input window.
object mon;
string name;
set tmp;
702
3.6. OTHERS CHAPTER 3. OBJECT METHODS
int count,
index;
tmp = this.GetContents('monitor.IntMon',0);
mon = tmp.First();
if (mon=nullptr) {
mon = this.CreateObject('IntMon', 'monitor');
}
mon.ClearVars();
mon.AddVar('e:plini');
mon.AddVar('e:qlini');
Info('Variables stored');
count = mon.NVars();
for (index=0; index<count;index+=1) {
name = mon.GetVar(index);
printf('%d. %s',index+1,name);
}
Info('Variables stored after removing e:plini');
mon.RemoveVar('e:plini');
count = mon.NVars();
for (index=0; index<count;index+=1) {
name = mon.GetVar(index);
printf('%d. %s',index+1,name);
}
NVars*
Returns the number of selected variables or, more exact, the number of lines in the variable
selection text on the second page of the IntMon dialogue, which usually contains one variable
name per line.
int IntMon.NVars()
R ETURNS
The number of variables selected.
E XAMPLE
See example of IntMon.GetVar.
PrintAllVal*
Writes all calculation results of the object assigned in obj id to the output window. The output
includes the variable name followed by the value, its unit and the description.
It should be noted that the variable set itself is modified by this method.
void IntMon.PrintAllVal()
E XAMPLE
The following example script gets the variable set object stored inside the scripting object
and reports all variables for the current calculation. Input data is not reported.
object mon,
load,
ldf;
703
3.6. OTHERS CHAPTER 3. OBJECT METHODS
set tmp;
tmp = this.GetContents('monitor.IntMon',0);
mon = tmp.First();
if (mon=nullptr) {
mon = this.CreateObject('IntMon', 'monitor');
}
ldf = GetFromStudyCase('ComLdf');
ldf.Execute();
tmp = GetCalcRelevantObjects('ElmLod');
for (load = tmp.First(); load; load = tmp.Next()) {
mon:obj_id = load;
mon.PrintAllVal();
}
PrintVal*
Prints the values of the selected variables to the output window.
void IntMon.PrintVal()
E XAMPLE
The following example script gets the variable set object stored inside the scripting object,
adds two variables and reports the results for all loads found after calculating a load flow.
object mon,
ldf,
load;
set tmp;
tmp = this.GetContents('monitor.IntMon',0);
mon = tmp.First();
if (mon=nullptr) {
mon = this.CreateObject('IntMon', 'monitor');
}
mon.ClearVars();
mon.AddVar('e:plini');
mon.AddVar('e:qlini');
ldf = GetFromStudyCase('ComLdf');
ldf.Execute();
tmp = GetCalcRelevantObjects('ElmLod');
for (load = tmp.First(); load; load = tmp.Next()) {
mon:obj_id = load;
mon.PrintVal();
}
RemoveVar
Removes the variable “name” from the list of selected variable names.
int IntMon.RemoveVar(string name)
A RGUMENTS
name The variable name.
704
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 If variable with name was found and removed.
1 If the variable name was not found.
E XAMPLE
See example of IntMon.GetVar.
3.6.27 IntOutage
Overview
Apply
ApplyAll
Check*
CheckAll*
IsInStudyTime*
ResetAll
Apply
void IntOutage.Apply([int reportSwitches])
Applies the outage object. The functionality corresponds to pressing the ’Apply’ button in edit
dialog with the difference that the scripting function can also be used without an active scenario.
A RGUMENTS
reportSwitches (optional)
Flag to enable the reporting of changed switches to the output window.
0 No output (default)
1 Print switches to output window
ApplyAll
void IntOutage.ApplyAll([int reportSwitches])
Applies all currently relevant (=in study time and not out-of-service) outage objects of current
project. The functionality corresponds to pressing the ’ApplyAll’ button in edit dialog with the
difference that the scripting function can also be used without an active scenario. It applies all
relevant outages independent of the one it was called on.
A RGUMENTS
reportSwitches (optional)
Flag to enable the reporting of changed switches to the output window.
0 No output (default)
1 Print switches to output window
705
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Check*
int IntOutage.Check([int outputMessage])
This function checks if the outage is correctly reflected by the network elements.
A RGUMENTS
outputMessage (optional)
Flag to enable detailed output to the output window.
0 No output (default)
1 Detailed report of mismatch to output window
R ETURNS
0 Ok, outage is correctly reflected
1 Not ok, status of network elements does not reflect outage
CheckAll*
This function checks if all outages are correctly reflected by the network components for current
study time. It checks all outages independent of the one it was called on.
void IntOutage.CheckAll([int emitMsg,]
[object gridfilter,]
[set& notOutaged,]
[set& wronglyOutaged]
)
A RGUMENTS
int emitMsg (optional)
whether to report inconistencies to the output window
-1 No output
0 (Default) print inconsistencies but without start / end message
1 Full output, including start / end message
gridfilter (optional)
Possibility to restrict checking for accidentally outaged elements to given object
(e.g. grid) and its children (by default, all elements for all active grids are checked).
706
3.6. OTHERS CHAPTER 3. OBJECT METHODS
IsInStudyTime*
int IntOutage.IsInStudyTime()
Checks if outage is relevant for current study time, i.e. the study time lies within the outage’s
validity period.
R ETURNS
0 Outage is not relevant for current study time (outside validity period)
1 Outage is relevant for current study time (inside validity period)
D EPRECATED N AMES
IsInStudytime
ResetAll
void IntOutage.ResetAll([int reportSwitches])
Resets all currently relevant (=in study time and not out-of-service) outage objects of current
project. The functionality corresponds to pressing the ’Reset’ button in all outage objects with
difference that the scripting function can also be used without an active scenario. It resets all
relevant outages independent of the one it was called on.
A RGUMENTS
reportSwitches (optional)
Flag to enable the reporting of changed switches to the output window.
0 No output (default)
1 Print switches to output window
3.6.28 IntPlannedout
Overview
SetRecurrence
SetRecurrence
Copies the settings of a Recurrence Pattern object to the planned outage object and enables
the flag Recurrent.
int IntPlannedout.SetRecurrence(object recurrencePattern)
A RGUMENTS
recurrencePattern
Recurrence pattern object, classname IntRecurrence
R ETURNS
0 Ok, settings copied successful
1 Failed, passed object is NULL or not of class IntRecurrence
707
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.29 IntPlot
Overview
SetAdaptY
SetAutoScaleY
SetScaleY
SetAdaptY
Sets the Adapt Scale option of the x-scale.
void IntPlot.SetAdaptY(int mode,
[double offset]
)
A RGUMENTS
mode Possible values:
0 off
1 on
offset (optional)
Offset, unused if mode is off or empty
E XAMPLE
The following examples look for a subplot named 'RST', gets its plot type and changes the
adapt scale option of the scale.
! Modify adapt scale option of Plot Type
object page;
object graphBoard;
object plot;
object scale;
graphBoard=GetGraphicsBoard(); ! get open graphics board
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! Get subplot named 'RST'
if (plot) {
plot.SetDefScaleY(); ! reset option 'Use local y-Axis'
scale=plot.GetScaleObjY(); ! get plot type
if (scale) {
scale.SetAdaptY(1,3);! Turn on adapt scale, offset is 3
}
}
}
}
SetAutoScaleY
Sets automatic scaling mode of the y-scale. A warning is issued if an invalid mode is passed to
the function.
void IntPlot.SetAutoScaleY(int mode)
708
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mode Possible values:
0 never
1 after simulation
2 during simulation
E XAMPLE
The following example sets the Auto Scale setting of the plot type to On.
object page;
object graphBoard;
object plot;
object scale;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get subplot named 'RST'
if (plot) {
plot.SetDefScaleY(); ! reset option 'Use local y-Axis'
scale=plot.GetScaleObjY(); ! get plot type
if (scale) {
scale.SetAutoScaleY(1);
}
}
}
}
SetScaleY
Sets y-axis scale limits. A function call without arguments sets the Auto Scale setting to On
without changing the scale itself.
void IntPlot.SetScaleY()
void IntPlot.SetScaleY(double min,
double max,
[int log]
)
A RGUMENTS
min (optional)
Minimum of y-scale.
max (optional)
Maximum of y-scale.
log (optional)
Possible values:
0 linear
1 logarithmic
709
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example looks for a Subplot named 'RST' and set its y-axis scale to a logarith-
mic scale in the range s[1,1000]
object page;
object graphBoard;
object plot;
object scale;
graphBoard=GetGraphicsBoard(); ! get open graphics board
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1);
if (plot) {
plot.SetDefScaleY();! Reset option 'Use local y-Axis'
scale=plot.GetScaleObjY(); ! get plot type
if (scale) {
scale.SetScaleY(1,1000,1);
}
}
}
}
3.6.30 IntPrj
Overview
Activate
AddProjectToCombined
AddProjectToRemoteDatabase
Archive
BeginDataExtensionModification
CanAddProjectToRemoteDatabase
CanSubscribeProjectReadOnly
CanSubscribeProjectReadWrite
ClearInvalidReferences
CopyDataExtensionFrom
CreateVersion
Deactivate
EndDataExtensionModification
GetDerivedProjects
GetExternalReferences
GetGeoCoordinateSystem
GetLatestVersion
GetVersions
HasExternalReferences
LoadData
MergeToBaseProject
Migrate
NormaliseCombined
PackExternalReferences
Purge
PurgeObjectKeys
RemoveProjectFromCombined
Restore
710
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetGeoCoordinateSystem
SubscribeProjectReadOnly
SubscribeProjectReadWrite
TransformGeoCoordinates
TransformToGeographicCoordinateSystem
UnsubscribeProject
UpdateStatistics
UpdateToDefaultStructure
UpdateToMostRecentBaseVersion
Activate
Activates the project. If another project is already activated it will be deactivated first.
int IntPrj.Activate()
R ETURNS
0 on success
1 on error
AddProjectToCombined
Adds a project to this using the Project Combination logic. The passed object must be an
IntVersion. The receiving project must be activated but not have a Study Case active, otherwise
this method will fail.
int IntPrj.AddProjectToCombined(object projectVersion)
A RGUMENTS
projectVersion
The verson of a project to add
R ETURNS
0 operation was successful
1 an error occurred
AddProjectToRemoteDatabase
Adds a project to the online database if possible.
Can only be used if the database driver is set to Offline Mode.
void IntPrj.AddProjectToRemoteDatabase()
Archive
Archives the project if the functionality is configured and activated. Does nothing otherwise.
int IntPrj.Archive()
711
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 project has been archived
1 project has not been archived
BeginDataExtensionModification
Signals the start of a Data Extension modification.
Must be terminated with EndDataExtensionModification, otherwise all changes will be discarded.
Data Extensions can only be modified when the project is active.
object IntPrj.BeginDataExtensionModification()
R ETURNS
The SetDataext configuration object in the settings folder for further processing.
S EE ALSO
CanAddProjectToRemoteDatabase
Checks if the project can be pushed to the remote database.
The project must be subscribable as read and write and it must be unsubscribed. Can only be
used if the database driver is set to Offline Mode.
int IntPrj.CanAddProjectToRemoteDatabase()
R ETURNS
0 project cannot be added to the remote database
1 project can be added to the remote database
CanSubscribeProjectReadOnly
Checks if a project can be subscribed read-only by the user executing the script.
int IntPrj.CanSubscribeProjectReadOnly()
R ETURNS
0 no permission to subscribe project
1 project can be subscribed
CanSubscribeProjectReadWrite
Checks if a project can be subscribed read-write by the user executing the script.
int IntPrj.CanSubscribeProjectReadWrite()
712
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 no permission to subscribe project
1 project can be subscribed
ClearInvalidReferences
Removes all references from the project which can no longer be resolved due to target objects
being deleted or projects no longer being available in the database, i.e. project stubs and non-
migrated projects.
int IntPrj.ClearInvalidReferences(int type)
A RGUMENTS
type
0 Remove references to deleted objects
1 Remove references to project stubs and non-migrated projects
2 Remove both
R ETURNS
Number of references cleared.
CopyDataExtensionFrom
Copies the Data Extension configuration from another project into this project. The configuration
is applied immediately. The target project must be active.
int IntPrj.CopyDataExtensionFrom(object other)
A RGUMENTS
other Project to copy the Data Extension configuration from.
R ETURNS
0 Copied successfully
1 Target project is not active
2 Source object is not a project
3 Error during copying, see Output Window
CreateVersion
Creates a new version of project it was called on.
Optionally allows to pass the version name, the timestamp, a bool for user notification, a bool to
enforce project approval and a description.
object IntPrj.CreateVersion([string name = '',]
[int timestamp = 0,]
[int notifyUsers = 0,]
[int approvalRequired = 0,]
[string description = '']
)
object IntPrj.CreateVersion(int notifyUsersAndApprovalRequired,
713
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
name Version name. The default version name e.g. ’Project Version’ is used on an
empty string. (default: empty string)
timestamp
Seconds since 01.01.1970 00:00:00. On zero the current date and time is used.
(default: 0)
notifyUsers
User notifications activated:
0 Create version and do not notify users (default).
1 Notify users.
approvalRequired
Project approval required:
0 Create version without approval (default).
1 Require approval.
notifyUsersAndApprovalRequired
Project approval required and user notifications activated:
0 Create version without approval and do not notify users (default).
1 Require approval and notify users.
description
Version description. (default: empty string)
R ETURNS
object Newly created IntVersion object.
NULL On failure e.g. missing permission rights.
Deactivate
De-activates the project if it is active. Does nothing otherwise.
int IntPrj.Deactivate()
R ETURNS
0 on success
1 on error
714
3.6. OTHERS CHAPTER 3. OBJECT METHODS
EndDataExtensionModification
Terminates a Data Extension modification previously initiated with BeginDataExtensionModifi-
cation.
This will deactivate the Study Case if the new Data Extension configuration can be applied. In
case of errors the project will be deactivated and rolled back. Omitting the call to EndDataEx-
tensionModification and exiting from the script will discard all changes to the Data Extension
configuration.
void IntPrj.EndDataExtensionModification()
S EE ALSO
IntPrj.BeginDataExtensionModification()
GetDerivedProjects
Return a set holding all versions created in the project.
set IntPrj.GetDerivedProjects()
R ETURNS
Set holding all versions of a project.
GetExternalReferences
Fills the given map with objects from this project mapping to its external references.
int IntPrj.GetExternalReferences(object resultMap,
[object externalReferencesSettings])
A RGUMENTS
resultMap
DPL map (IntDplmap) which will contain objects mapping to its external refer-
ences. Objects without external references are not mapped.
externalReferencesSettings (optional)
External References settings object (SetExtref). Defines the properties for objects
being external references. The External References settings object from current
user is used if ommitted.
R ETURNS
0 Getting external references succeeded.
1 Getting external references cancelled in dialogue or failed e.g project inactive or
not migrated.
S EE ALSO
IntPrj.HasExternalReferences(), IntPrj.PackExternalReferences()
GetGeoCoordinateSystem
Returns the EPSG code of the geographic coordinate system in which the geo coordinates of
the project’s net elements are stored.
int IntPrj.GetGeoCoordinateSystem()
715
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
EPSG code of the project’s geographic coordinate system, or 0 if the coordinate system is
not known.
GetLatestVersion
Returns the most recent version available in the project which has the notify users option set.
Optionally allows to consider all versions, regardless of notify users option.
object IntPrj.GetLatestVersion([int onlyregular])
A RGUMENTS
onlyregular (optional)
1 consider only regular version (default)
0 consider all versions
R ETURNS
Latest version of the project
GetVersions
Returns a set containing all versions of the project.
set IntPrj.GetVersions()
R ETURNS
Set that contains all versions of the project
HasExternalReferences
Checks if any object inside the project references external non-system objects and prints a
report to the Output Window.
int IntPrj.HasExternalReferences([int considerGlobal = 1,]
[int considerRemoteVariants = 0]
)
int IntPrj.HasExternalReferences(object externalReferencesSettings)
A RGUMENTS
considerGlobal (optional)
0 References to global (non-system) objects are not considered as ex-
ternal references.
1 References to global (non-system) objects are considered as external
references (default).
considerRemoteVariants (optional)
0 References to remote variants are not considered as external refer-
ences (default).
1 References to remote variants are considered as external references.
externalReferencesSettings (optional)
External References settings object (SetExtref). Defines the properties for objects
being external references.
716
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 No external reference was found.
1 An external reference was found.
S EE ALSO
IntPrj.PackExternalReferences(), IntPrj.GetExternalReferences()
LoadData
Loads all objects of the project from the data base. Does nothing when called on an active
project.
This function is useful to optimise searches which would traverse deep into an inactive project.
void IntPrj.LoadData()
MergeToBaseProject
Merges the modifications of a derived project to the base project.
int IntPrj.MergeToBaseProject(int conflictMode)
A RGUMENTS
conflictMode
Assignment in case of modification conflict:
R ETURNS
Migrate
Migrates a project from version V13 to V14. Migration is only executed if project has been
created in build 400 or earlier (and is not yet migrated).
void IntPrj.Migrate([int createCopy])
717
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
createCopy (optional)
1 Creates a copy of current project (original copy is maintained) (default)
0 Does an ”in-place” migration of the project (original is overwritten)
NormaliseCombined
Normalises a combined project so it appears to be a regular project. This will remove all
intermediate folders which were added when creating the combined project. This might lead
to naming duplications which will be resolved by the normal logic of numbering duplicates.
int IntPrj.NormaliseCombined()
R ETURNS
0 operation was successful
1 operation was cancelled because the project is active
PackExternalReferences
Packs external references of this project and prints a report to the Output Window.
int IntPrj.PackExternalReferences([object externalReferencesSettings])
A RGUMENTS
externalReferencesSettings (optional)
External References settings object (SetExtref). Defines the properties for objects
being external references. The External References settings object from current
user is used if ommitted.
R ETURNS
0 Packing external references succeeded.
1 Packing external references cancelled in dialogue or failed e.g project inactive or
not migrated.
S EE ALSO
IntPrj.HasExternalReferences(), IntPrj.GetExternalReferences()
Purge
Purges project storage and updates storage statistics.
Requires write access to the project; the functions does nothing when the project is locked by
another user.
void IntPrj.Purge()
PurgeObjectKeys
Purges project’s object key table.
718
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
Number of purged records. −1 in case of errors.
int IntPrj.PurgeObjectKeys()
RemoveProjectFromCombined
Removes a project from a combined project. For the removal the mapping key must be specified.
Mapping keys are stored in the project, parameter project mapped. The project this method is
called on must be activated but not have a Study Case active, otherwise this method will fail.
int IntPrj.RemoveProjectFromCombined(string mappingKey)
A RGUMENTS
mappingKey
The mapping key for the project that should be removed
R ETURNS
0 operation was successful
1 an unknown error occurred
2 an error occurred and is documented in the output window
Restore
Restores an archived project so it can be used again. Does nothing if the project is not an
archived one.
int IntPrj.Restore()
R ETURNS
0 project has not been restored
1 project has been restored
SetGeoCoordinateSystem
Defines the the geographic coordinate system in which the geo coordinates of the project’s net
elements are stored.
void IntPrj.SetGeoCoordinateSystem(int epsgCode)
A RGUMENTS
epsgCode
EPSG code of the geographic coordinate system to be used for this project. A
value of 0 denotes an unknown coordinate system.
719
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SubscribeProjectReadOnly
Subscribes a project read only if the permission is granted.
Can only be used if the database driver is set to Offline Mode.
void IntPrj.SubscribeProjectReadOnly()
SubscribeProjectReadWrite
Subscribes a project read/write if the permission is granted.
Can only be used if the database driver is set to Offline Mode.
void IntPrj.SubscribeProjectReadWrite()
TransformGeoCoordinates
Transforms geographic coordinates from a source coordinate system to a destination coordinate
system. Geodetic coordinates (longitude/latitude) are specified in decimal degrees. Projected
coordinates are specified in meters.
int IntPrj.TransformGeoCoordinates(double xIn, double yIn,
double& xOut, double& yOut,
int sourceEpsg, int destEpsg
)
A RGUMENTS
xIn horizontal component of the input location: x position or longitude, resp.
yIn vertical component of the input location: y position or latitude, resp.
xOut (out)
horizontal component of the output location: x position or longitude, resp.
yOut (out)
vertical component of the output location: y position or latitude, resp.
sourceEpsg
EPSG code of the source coordinate system
R ETURNS
0 operation was successful
1 an error occurred
TransformToGeographicCoordinateSystem
Transforms geographic coordinates of all net elements contained by the project to a destina-
tion coordinate system, and updates the configured project coordinate system accordingly.
Please note: The project’s geographic diagram needs to be shown when this function is called.
Otherwise, annotations will not be transformed.
int IntPrj.TransformToGeographicCoordinateSystem(int destEpsg)
720
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
destEpsg EPSG code of the destination coordinate system
R ETURNS
0 operation was successful
1 an error occurred
E XAMPLE
The following example transforms the active project to Gauss-Krueger Zone 3 coordinates
(EPSG code: 31467):
object prj;
prj = GetActiveProject();
prj.TransformToGeographicCoordinateSystem(31467);
UnsubscribeProject
Unsubscribes a project.
Can only be used if the database driver is set to Offline Mode.
void IntPrj.UnsubscribeProject()
UpdateStatistics
Updates the storage statistics for a project. The statistics are displayed on the page Storage of
a project.
Note: This function requires write access to the project otherwise the update is not executed
and an error message is printed to the output window.
void IntPrj.UpdateStatistics()
UpdateToDefaultStructure
Updates folder structure of currently active project to that of the default project (used for creation
of new projects). Existing folders will be moved to a new location within the project. Folders that
have no correspondence in the default project will remain untouched.
NB: Folders might get moved or additional ones might be created, but no folder is deleted by
this routine.
int IntPrj.UpdateToDefaultStructure(int createMissingFolders, int updateForeignKeys)
A RGUMENTS
createMissingFolders (optional)
0 Missing folders will not be created. Only existing ones will be moved to
new locations, if required.
1 Missing folders will be created (default).
updateForeignKeys (optional)
0 Foreign-keys of folders will not be updated.
1 Foreign-keys of folders will be updated (default).
721
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 operation was successful
1 operation was not successful, e.g. project not active
UpdateToMostRecentBaseVersion
Updates a derived project to the most recent version of the base project. This is done by creating
a new derived project from the new version and (optionally) merging the modifications from the
existing derived project into it.
int IntPrj.UpdateToMostRecentBaseVersion(object& newDerivedProject,
int versionWithNotification,
int discardOwnModifications,
[int conflictMode = 0]
)
A RGUMENTS
newDerivedProject (out)
New derived project if no error occured.
versionWithNotification
0 Update to the most recent version independent of the ”Notify users”
setting.
1 Update to the most recent version with ”Notify users” enabled.
discardOwnModifications
0 Merge modifications of new version and derived project.
1 Discard modifications of derived project. The Compare and Merge Tool
is not used at all.
conflictMode (optional)
Assignment in case of modification conflict (only used if not discarding derived
modifications):
R ETURNS
0 Merge finished sucessfully.
1 Merge failed (no further information).
2 Merge failed due to failing assignment check.
3 Merge failed due to invalid projects (e.g. no derived project).
4 Merge was canceled by user.
5 Merge completed with errors (see output window).
722
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.31 IntPrjfolder
Overview
GetProjectFolderType*
IsProjectFolderType*
GetProjectFolderType*
Returns the type of the project folder stored in attribute “iopt type”.
The following types are currently available (language independent):
723
3.6. OTHERS CHAPTER 3. OBJECT METHODS
• scheme - Variations
• script - Scripts
• study - Study Cases
• sw - StationWare
• tariff - Tariffs
• templ - Templates
• therm - Thermal Ratings
• ucc - V-Control-Curves
string IntPrjfolder.GetProjectFolderType()
R ETURNS
The type of the project folder as string. For possible return values see list above.
S EE ALSO
GetProjectFolder()
IsProjectFolderType*
This function checks if a project folder is of given type.
int IntPrjfolder.IsProjectFolderType(string type)
A RGUMENTS
type Folder type; for possible type values see IntPrjfolder.GetProjectFolderType()
R ETURNS
1 true, is of given type
0 false, is not of given type
S EE ALSO
GetProjectFolder(), IntPrjfolder.GetProjectFolderType()
3.6.32 IntQlim
Overview
GetQlim*
GetQlim*
Returns either the current maximum or the minimum reactive power limit, given the specified
active power and voltage.
The active power must be given in the same units as the input mode definition of the capability
curve object (parameter ”inputmod” is 0 for MW/Mvar and 1 for p.u.).
double IntQlim.GetQlim(double p,
double v,
724
3.6. OTHERS CHAPTER 3. OBJECT METHODS
[double minmax]
)
A RGUMENTS
p the current value of active power in MW or p.u.
v the current value of voltage in p.u.
minmax (optional)
Returns either the maximum or minimum value. Possible values are:
-1 minimum value
1 maximum value. This is the default value
R ETURNS
Returns the minimum/maximum limit. The units might be Mvar or p.u., depending on the
input mode of the capability curve. Also, the limits are calculated for a single machine.
E XAMPLE
set generators;
object generator, qlim;
double minlim, maxlim;
int inp;
725
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.33 IntRas
Overview
AddEvent
AddTrigger
IsValid
AddEvent
Adds an event to the Remedial Action Scheme.
void IntRas.AddEvent(object newEvent)
A RGUMENTS
newEvent
The event that shall be added.
AddTrigger
Adds either a condition or a gate to the Remedial Action Scheme.
void IntRas.AddTrigger(object newTrigger)
A RGUMENTS
newTrigger
The condition or gate that shall be added.
IsValid
Checks if the Remedial Action Scheme is valid.
int IntRas.IsValid(int emitMessage = 0)
A RGUMENTS
emitMessage
Emit messages if not equal to zero.
R ETURNS
0 If invalid.
1 If valid.
726
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.34 IntReport
Overview
AddObject
AddObjects
CreateField
CreateTable
GetFieldCount
GetFieldDataType
GetFieldName
GetObjects
GetParameterValueAsDouble
GetParameterValueAsInteger
GetParameterValueAsString
GetRowCount
GetTableCount
GetTableName
GetValueAsDouble
GetValueAsInteger
GetValueAsObject
GetValueAsString
Reset
SetDefaultValue
SetValue
AddObject
Adds the given object to the set of objects that are considered during report creation.
Typically, objects are automatically collected based on the Variable Selections in the report.
In some cases, however, it might be necessary to manually add objects to the report creation
mechanism.
The added object will be included in the return value of IntReport.GetObjects(). Moreover, if a
Variable Selection for the class of the given object exists in the report, the corresponding table
will include a row for the given object.
If the given object is already present in the set of collected objects (regardless if it was automat-
ically collected or added with a previous call of this method or IntReport.SetObjects()), it will not
be added a second time.
void IntReport.AddObject(object objectToAdd)
A RGUMENTS
objectToAdd
The object to be added to the report generation mechanism. Null objects are
ignored.
S EE ALSO
IntReport.AddObjects(), IntReport.GetObjects()
727
3.6. OTHERS CHAPTER 3. OBJECT METHODS
AddObjects
Adds the given list of objects to the set of objects that are considered during report creation.
See IntReport.AddObject() for more details on adding objects.
void IntReport.AddObjects(set objectsToAdd)
A RGUMENTS
objectsToAdd
List of objects to be added to the report generation mechanism.
S EE ALSO
IntReport.AddObject(), IntReport.GetObjects()
CreateField
Creates a new field (i.e. a column) with the specified name and data type, appending it
to the specified table. The referenced table must have been previously created using the
IntReport.CreateTable() method.
int IntReport.CreateField(string tableName, string fieldName, int dataType)
A RGUMENTS
tableName
The name of a table (previously created using IntReport.CreateTable()).
fieldName
The name of the new field, which must satisfy all of the following conditions:
• The name is not empty.
• The name only includes characters of the English alphabet, digits and under-
scores.
• The name does not start with a digit or a capital (upper-case) character.
dataType An integer specifying the data type of the field. Possible values are
0 String
1 Integer
2 Floating point number (double)
3 Object
R ETURNS
An error code. Possible values are
728
3.6. OTHERS CHAPTER 3. OBJECT METHODS
S EE ALSO
CreateTable
Creates a new table with the given name.
In order to be visible in the Report Designer, a table needs to have at least one field (i.e. a
column). Fields are created using the IntReport.CreateField() method.
Using the IntReport.SetValue() method, a table with fields can be filled with values, which are
stored in rows (containing one value per table field).
Please note that the name of the table will be shown with the prefix ’Scripted’ in the Report
Designer (e.g. a table created with the name ’MyTable’ will be shown as ’ScriptedMyTable’ in
the Report Designer). This mechanism helps to avoid name collisions with other, automatically
generated tables (e.g. tables based on Variable Selections) and allows to quickly identify tables
created by scripts in the Report Designer.
int IntReport.CreateTable(string name)
A RGUMENTS
name The name of the new table, which may only include characters of the English
alphabet, digits and underscores and must not be empty.
R ETURNS
An error code. Possible values are
GetFieldCount
Returns the number of fields in the specified table.
int IntReport.GetFieldCount(string tableName)
A RGUMENTS
tableName
The name of the table.
R ETURNS
The number of fields in the specified table or -1 if the specified table does not exist.
S EE ALSO
729
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetFieldDataType
Returns the data type (encoded as integer) of the specified field in the specified table.
int IntReport.GetFieldDataType(string tableName, string fieldName)
A RGUMENTS
tableName
The name of the table.
fieldName
The name of the field.
R ETURNS
An integer specifying the data type of the field or signalling an error. Possible values are
-1 Error. The specified table or the specified field does not exist.
0 String
1 Integer
2 Floating point number (double)
3 Object
S EE ALSO
GetFieldName
Determines the name of the field at the given field index of the specified table.
The given field index must be a non-negative number that is smaller than the field count of the
specified table, which can be determined by calling IntReport.GetFieldCount().
string IntReport.GetFieldName(string tableName, int fieldIndex, string& name)
A RGUMENTS
tableName
The name of the table.
fieldIndex The index of the field (non-negative integer that is smaller than the field count of
the specified table).
name (out)
The name of the field.
R ETURNS
An error code. Possible values are:
0 No error has occurred, the field name has been successfully determined.
1 The specified table does not exist or the field index is out of bounds.
S EE ALSO
730
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetObjects
Returns all objects that were collected by the report generation mechanism.
Besides objects that were automatically collected based the Variable Selections of a report,
this set also includes objects that were added in the AddObjects script of the report (see
IntReport.AddObject() for details).
set IntReport.GetObjects()
R ETURNS
A list of all collected objects.
S EE ALSO
IntReport.AddObject(), IntReport.AddObjects()
GetParameterValueAsDouble
Returns the current value of the report parameter with the specified identifier as double.
This method is intended to be used with report parameters of data type ’Double’ only.
int IntReport.GetParameterValueAsDouble(string identifier, double& value)
A RGUMENTS
identifier The identifier of the report parameter.
value (out)
The current value of the report parameter.
R ETURNS
An error code. Possible values are
S EE ALSO
IntReport.GetParameterValueAsString(), IntReport.GetParameterValueAsInteger()
GetParameterValueAsInteger
Returns the current value of the report parameter with the specified identifier as integer.
This method is intended to be used with report parameters of data type ’Integer’ or ’Boolean’
only.
Please note that the values of boolean report parameters are treated as integers, with 0 repre-
senting ’false’ and 1 representing ’true’.
int IntReport.GetParameterValueAsInteger(string identifier, int& value)
A RGUMENTS
identifier The identifier of the report parameter.
value (out)
The current value of the report parameter.
731
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
An error code. Possible values are
S EE ALSO
IntReport.GetParameterValueAsString(), IntReport.GetParameterValueAsDouble()
GetParameterValueAsString
Returns the current value of the report parameter with the specified identifier as string.
This method is intended to be used with report parameters of data type ’String’ only.
int IntReport.GetParameterValueAsString(string identifier, string& value)
A RGUMENTS
identifier The identifier of the report parameter.
value (out)
The current value of the report parameter.
R ETURNS
An error code. Possible values are
S EE ALSO
IntReport.GetParameterValueAsInteger(), IntReport.GetParameterValueAsDouble()
GetRowCount
Returns the number of rows of the specified table.
The row count of a table is determined by the highest position, for which any of its field was
assigned a value using the method IntReport.SetValue(). As positions start with zero (i.e. the
first table row has position zero, the second table row has position one, and so on), the row
count is always the highest position plus one. If the method IntReport.SetValue() method has
not been called on any field of the table, the row count will be zero. The value returned by this
method can thus be used to determine the position for a new table row.
int IntReport.GetRowCount(string tableName)
A RGUMENTS
tableName
The name of the table.
R ETURNS
The number of rows in the specified table or -1 if the specified table does not exist.
732
3.6. OTHERS CHAPTER 3. OBJECT METHODS
S EE ALSO
IntReport.SetValue(), IntReport.GetValue()
GetTableCount
Returns the number of tables that have been created (using IntReport.CreateTable()).
int IntReport.GetTableCount()
R ETURNS
The number of tables that have been created (using IntReport.CreateTable()).
S EE ALSO
IntReport.GetTableName()
GetTableName
Determines the name of the table with the given table index.
The given table index must be a non-negative number that is smaller than the current table
count, which can be determined by calling IntReport.GetTableCount().
string IntReport.GetTableName(int tableIndex, string& name)
A RGUMENTS
tableIndex
The index of the table (a non-negative integer that is smaller than the current table
count).
name (out)
The name of the table.
R ETURNS
An error code. Possible values are:
S EE ALSO
IntReport.GetTableCount()
GetValueAsDouble
Determines the double value at the given position (row) of the specified field in the specified
table.
If the value at the given position of the specified field was not previously set (see IntReport.SetValue()),
the default value of the field is returned instead (see IntReport.SetDefaultValue()).
This method is intended to be used with double fields only.
int IntReport.GetValueAsDouble(string tableName, string fieldName,
int position, double& value)
733
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
tableName
The name of the table.
fieldName
The name of the field.
R ETURNS
An error code. Possible values are
S EE ALSO
GetValueAsInteger
Determines the integer value at the given position (row) of the specified field in the specified
table.
If the value at the given position of the specified field was not previously set (see IntReport.SetValue()),
the default value of the field is returned instead (see IntReport.SetDefaultValue()).
This method is intended to be used with integer fields only.
int IntReport.GetValueAsInteger(string tableName, string fieldName,
int position, int& value)
A RGUMENTS
tableName
The name of the table.
fieldName
The name of the field.
position The position (row).
value (out)
The value at the given position (row) of the specified field in the specified table.
734
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
An error code. Possible values are
S EE ALSO
GetValueAsObject
Determines the object at the given position (row) of the specified field in the specified table.
If the object at the given position of the specified field was not previously set (see IntRe-
port.SetValue()), the null object is returned instead.
This method is intended to be used with object fields only.
int IntReport.GetValueAsObject(string tableName, string fieldName,
int position, object& value)
A RGUMENTS
tableName
The name of the table.
fieldName
The name of the field.
position The position (row).
value (out)
The object at the given position (row) of the specified field in the specified table.
R ETURNS
An error code. Possible values are
S EE ALSO
735
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetValueAsString
Determines the string value at the given position (row) of the specified field in the specified table.
If the value at the given position of the specified field was not previously set (see IntReport.SetValue()),
the default value of the field is returned instead (see IntReport.SetDefaultValue()).
This method is intended to be used with string fields only.
int IntReport.GetValueAsString(string tableName, string fieldName,
int position, string& value)
A RGUMENTS
tableName
The name of the table.
fieldName
The name of the field.
position The position (row).
value (out)
The value at the given position (row) of the specified field in the specified table.
R ETURNS
An error code. Possible values are
S EE ALSO
Reset
Removes all objects and tables added by the extension script.
When an extension script is executed outside of the regular Report Generation mechanism (e.g.
by pressing the ’Execute’ button of the script), all added objects and tables remain in the memory
of the corresponding Report Template (IntReport) object even after the script was executed. By
calling this method at the beginning of the extension script, i.e. before any objects or tables
are added, users can make sure that no added objects or tables from a previous, manual script
execution are left.
When running the regular Report Generation command, this method is automatically called
before the extension script is executed.
void IntReport.Reset()
736
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetDefaultValue
Stores the given value as default value for the specified field of the specified table. The specified
table and field must have been previously created using IntReport.CreateTable() and IntRe-
port.CreateField(), respectively.
If the default value of a field is not explicitly set, its default value is either an empty string (for
string fields), zero (for integer and double fields) or null (for object fields).
Please note that the default value of object fields cannot be changed.
int IntReport.SetDefaultValue(string tableName, string fieldName,
int|double|string value)
A RGUMENTS
tableName
The name of the table.
fieldName
the name of the field.
value The value that should be used as default value.
R ETURNS
An error code. Possible values are
0 No error has occurred, the default value has been successfully set.
1 No table with the given name has been found.
2 No field with the given name has been found in the given table.
3 The data type of the given value does not match the data type of the given field.
4 The data type of the given value is not supported by this method.
S EE ALSO
IntReport.SetValue(), IntReport.GetValue()
SetValue
Stores the given value at the position in the specified field of the specified table. The specified
table and field must have been previously created using IntReport.CreateTable() and IntRe-
port.CreateField(), respectively.
If the given field is a string field, numeric values are implicitly converted into strings and if
the given field is an integer field, double values are implicitly converted into integers (and vice
versa). Trying to store a string value to a numeric (i.e. integer or double) will result in an error
(see return value). Furthermore, objects can only be stored in object fields and object fields
only accept objects.
In order to use this method effectively, it is important to understand how fields work. Each
field maps positions (non-negative integers) to values of its data type, e.g. a string field maps
positions to strings. When a field is created (see IntReport.CreateField()), it does not map any
position to a value. By calling this method (for each desired field and position), users specify
what value is stored at which position. The highest position, for which at least one field in a table
has a value set, determines the row count of the table (see IntReport.GetRowCount()).
This means that users can conveniently set the value of a field at any desired position in any
order, but need to be aware that the row count of the whole table will be the highest position
they set a value for. If a valid position of a field (i.e. a non-negative integer that is smaller than
the current row count of the table) has not been assigned a value, the field will return its default
737
3.6. OTHERS CHAPTER 3. OBJECT METHODS
value whenever the value at the position is to be determined (see IntReport.GetValue()). The
default value of a field can be changed by calling the method IntReport.SetDefaultValue().
int IntReport.SetValue(string tableName,
string fieldName,
int position,
int|double|string|object value)
A RGUMENTS
tableName
The name of the table.
fieldName
The name of the field.
position The position (a non-negative integer; negative positions are treated as zero and
should not be used).
value The value that should be set in the given table, field and position.
R ETURNS
An error code. Possible values are
S EE ALSO
3.6.35 IntRunarrange
Overview
GetSwitchStatus*
GetSwitchStatus*
Determines the status of the given switch in the running arrangement, without assigning or
applying the running arrangement.
int IntRunarrange.GetSwitchStatus(object switch)
A RGUMENTS
switch ElmCoup or StaSwitch from which to get the status stored in running arrange-
ment
R ETURNS
Status of the switch in the running arrangement. Possible values are
738
3.6. OTHERS CHAPTER 3. OBJECT METHODS
1 Switch is closed
E XAMPLE
set substations, switches;
object substation, runarrange, switch;
int status;
substations = GetCalcRelevantObjects('ElmSubstat');
if(runarrange){
switches = substation.GetChildren(0, '*.ElmCoup');
for(switch = switches.First(); switch; switch = switches.Next()){
status = runarrange.GetSwitchStatus(switch);
printf('Status for %o in RA %o in substation %o. %d', switch, runarrange, substation,
}
}
}
3.6.36 IntScenario
Overview
Activate
Apply
ApplySelective
Deactivate
DiscardChanges
GetObjects*
GetOperationValue*
ReleaseMemory
Save
SetOperationValue
Activate
Activates a scenario. If there is currently another scenario active that one will be deactivated
automatically.
int IntScenario.Activate()
R ETURNS
0 successfully activated
1 error, e.g. already activate, no project and study case active
739
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Apply
Copies the values stored in a scenario to the corresponding network elements. The value
transfer is identical to scenario activation, however, the scenario will not be activated. In case of
having an active variation or another scenario, the values will be recorded there.
int IntScenario.Apply([int requestUserConfirmation])
int IntScenario.Apply(int requestUserConfirmation,
[object parentfilter]
)
A RGUMENTS
requestUserConfirmation(optional)
0 silent, just apply the data without further confirmation requests
1 request a user confirmation first (default)
parentfilter (optional)
If given, scenario data is only applied for given object and all of its children (hier-
archical filter)
R ETURNS
0 on success
ApplySelective
Similar to function Apply() but copies only the set of attributes listed in the given apply configu-
ration. An apply configuration is a folder consisting of variable selection objects (IntMon), one
per class. For each class the attributes to be copied can be selected.
int IntScenario.ApplySelective(object applyConfiguration)
int IntScenario.ApplySelective(int requestUserConfirmation,
object applyConfiguration
)
A RGUMENTS
applyConfiguration
folder containing variable selection objects
requestUserConfirmation(optional)
0 silent, just apply the data without further confirmation requests
1 request a user confirmation first (default)
R ETURNS
0 on succes
Deactivate
Deactivates the currently active scenario.
int IntScenario.Deactivate([int saveOrUndo])
740
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
saveOrUndo(optional)
Determines whether changes in active scenario will be saved or discarded before
the scenario is deactivated. If this argument is omitted, the user will be asked.
0 discard changes
1 save changes
R ETURNS
0 on success
DiscardChanges
Discards all unsaved changes made to a scenario.
int IntScenario.DiscardChanges([int resetCalculation])
A RGUMENTS
resetCalculation(optional)
Determines whether calculation results should be reset afterwards.
0 no reset, retain results
1 default, reset results
R ETURNS
0 on success
1 error, scenario was not modified or not active
GetObjects*
Returns a set of all objects for which operational data are stored in scenario.
set IntScenario.GetObjects()
R ETURNS
Set of all objects for which operational data are stored in scenario
GetOperationValue*
This function offers read access to the operation data values stored in the scenario.
int IntScenario.GetOperationValue(int&|double&|string&|object& value,
object obj,
string attribute,
[int fromObject])
A RGUMENTS
value (out)
variable that holds the value after call
obj object for which the operation to be retrieved
741
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 on success
ReleaseMemory
Releases the memory used by a scenario. Any further access to the scenario will reload the
data from database. The function can be called on inactive scenarios only. Use this function
with care!
int IntScenario.ReleaseMemory()
R ETURNS
0 on success
1 error, scenario is active
Save
Saves the current active value of all operational attributes for all active network elements to
database.
int IntScenario.Save()
R ETURNS
0 successfully saved
1 error, scenario was not modified or not active
SetOperationValue
Offers write access to operational data stored in a scenario.
int IntScenario.SetOperationValue(int|double|string|object newvalue,
object obj,
string attribute,
[int toObject = 1]
)
A RGUMENTS
newvalue New value to store in the scenario.
obj Object for which the operation data to store.
attribute Name of the operation data attribute.
toObject Only if current scenario is active:
0 Value is only stored to scenario on db.
1 As 0 but value is also updated on object in memory. (default)
742
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 on success, otherwise 1.
3.6.37 IntScensched
Overview
Activate
Deactivate
DeleteRow
GetScenario*
GetStartEndTime*
SearchScenario*
Activate
Activates a scenario scheduler.
int IntScensched.Activate()
R ETURNS
0 successfully activated
1 error, e.g. already activate, no project and study case active
Deactivate
Deactivates a scenario scheduler.
int IntScensched.Deactivate()
R ETURNS
0 successfully deactivated
1 error, e.g. already deactivates, no project and study case active
DeleteRow
Delete row(s) of the scenario scheduler.
void IntScensched.DeleteRow(int row, [int numberOfRows])
A RGUMENTS
row row number (begin with 0)
numberOfRows (optional)
number of rows to delete (default = 1)
GetScenario*
Get the scenario for corresponding time 'iTime'.
object IntScenario.GetScenario(int iTime)
743
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
iTime Time (UCTE) to get the corresponding scenario.
R ETURNS
NULL No scenario at time 'iTime'defined
IntScenario Scenario will be activated at time 'iTime'
GetStartEndTime*
Get start and end time of the corresponding scenario.
int IntScenario.GetStartEndTime(object scenario,
int& startTime,
int& endTime)
A RGUMENTS
scenario A scenario (IntScenario).
startTime (out)
Start time (time when the scenario is activated)).
endTime (out)
End time (time until the scenario is still activated).
R ETURNS
−1 Scenario not found (not part of scenario scheduler)
≥0 Vector index (index of scenario)
SearchScenario*
Search at which table index (row) the corresponding scenario is defined in the scheduler.
int IntScensched.SearchScenario(object scenarioObject)
A RGUMENTS
scenarioObject
scenario object
R ETURNS
−1 Scenario not found (not part of scenario scheduler).
≥0 Vector index (row, index of scenario).
744
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.38 IntScheme
Overview
Activate
Consolidate
Deactivate
GetActiveScheduler*
NewStage
Activate
Activates a variation and inserts a variation reference in a 'Variation Configuration Folder'stored
in the study case.
int IntScheme.Activate()
R ETURNS
0 successfully activated
1 error, e.g. already activate, no project and study case active
Consolidate
Changes that are recorded in this variation will be permanently applied to the original location.
Note: Modified scenarios are not saved.
Works only:
• for non network variation e.g. used for Mvar Limit Curves, Thermal Ratings ...
int IntScheme.Consolidate()
R ETURNS
0 On success.
1 If an error has occured.
Deactivate
Deactivates a variation and removes the variation reference in the 'Variation Configuration
Folder'stored in the study case.
int IntScheme.Deactivate()
R ETURNS
0 successfully deactivated
1 error, e.g. already deactivated, no project and study case active
745
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetActiveScheduler*
Returns the corresponding active variation scheduler or NULL if no scheduler is active for this
variation (IntScheme).
object IntScheme.GetActiveScheduler()
NewStage
Adds a new expansion stage into the variation (name = sname).
int IntScheme.NewStage(string name,
int activationTime,
int activate
)
A RGUMENTS
name Name of the new expansion stage.
activationTime
Activation time of the new expansion stage in seconds since 01.01.1970 00:00:00.
activate
1 The actual study time is changed to the parameter iUTCtime and the
varation will be activated. If the variation is a network variation, the
new created expansion stage is used as 'recording 'expansion stage.
If the variation (this) is not active, the variation will be automatically
activated.
0 Expansion stage and/or variation will not be activated.
3.6.39 IntSscheduler
Overview
Activate
Deactivate
Update
Activate
Activates a variation scheduler. An already activated scheduler for same variation will be
deactivated automatically.
int IntSscheduler.Activate()
R ETURNS
=0 On success
6= 0 If an error has occurred
746
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Deactivate
Deactivates a variation scheduler.
int IntSscheduler.Deactivate()
R ETURNS
=0 on success
6= 0 If an error has occurred especially if scheduler was not active (to be consistent
with scenario scheduler deactivate()).
Update
Update variation scheduler (updates internal reference stages).
int IntSscheduler.Update()
R ETURNS
=0 On success
6= 0 If an error has occurred
3.6.40 IntSstage
Overview
Activate
CreateStageObject
EnableDiffMode
GetVariation*
IsExcluded*
PrintModifications*
ReadValue*
WriteValue
Activate
Activates the expansion stage and sets the 'recording' expansion stage. The study time will be
automatically set to the correponsing time of the stage.
int IntSstage.Activate([int iQueryOption])
A RGUMENTS
iQueryOption
0 (default) The user must confirm the query.
1 The “Yes” button is automatically applied.
2 The “No” button is automatically applied.
R ETURNS
0 Successfully activated.
1 Error, e.g. scheme is not active.
747
3.6. OTHERS CHAPTER 3. OBJECT METHODS
CreateStageObject
Creates a stage object (delta or delete object) inside corresponding IntSstage.
object IntSstage.CreateStageObject(int type,
object rootObject
)
A RGUMENTS
type Kind of object to create
1 Delete object
2 Delta object
rootObject
(Original) object for which the stage object should be created.
R ETURNS
Stage object on success.
E XAMPLE
!for a given IntSstage 'stage' and a IntThrating 'rating'
EnableDiffMode
Enables the comparison mode for the variation management system. If the mode is enabled a
DELTA object is only created when the object is different.
void IntSstage.EnableDiffMode(int enable)
A RGUMENTS
enable
0 disables the difference/comparison mode
1 enables the difference/comparison mode
748
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetVariation*
Returns variation of expansion stage.
object IntSstage.GetVariation()
R ETURNS
Variation object corresponding to stage.
D EPRECATED N AMES
GetScheme
E XAMPLE
!for a given IntSstage 'oStage'
object variation;
variation = oStage.GetVariation();
if (variation) {
printf('The Variation corresponding to %o is %o.',oStage, variation);
}
IsExcluded*
Returns if expansion stage flag 'Exclude from Activation' is switched on (return value = 1) or not
(return value = 0). The function checks also if the stage is excluded regarding the restricted
validity period of the corresponding variation and considers also the settings of an variation
scheduler when defined.
double IntSstage.IsExcluded()
R ETURNS
1 if stage is excluded
0 if stage is considered
E XAMPLE
!for a given IntStage 'oStage'
int iStageStatus;
iStageStatus = oStage.IsExcluded();
if (iStageStatus=0) {
printf('The object %o is considered for activation.',oStage);
}
else {
printf('The object %o is not considered for activation.',oStage);
PrintModifications*
Reports in the the output window the modification of the corresponding expansion stage. Works
only if the expansion stage is the active 'recording 'expansion stage.
int IntSstage.PrintModifications([int onlyNetworkData,]
[string ignoredParameter]
)
749
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
onlyNetworkData (optional)
1 (default) Show only network data modifications. Graphical modifica-
tions are not report when the diagrams folder are recored.
0 Show all modifications
ignoredParameter (optional)
Comma separated list of parameters which are ignored for reporting.
R ETURNS
0 on success
1 if the actual expansion stage is not the 'recording 'expansion stage.
ReadValue*
Get the value for an attribute of an ADD or DELTA object which modifies “rootObj” (root object).
int IntSstage.ReadValue(double&|string&|object& value,
object rootObj,
string attributeName)
R ETURNS
=0 On success.
6= 0 Error e.g. wrong data type.
WriteValue
Writes a value for an attribute to an ADD or DELTA object which modifies rootObj (root object).
int IntSstage.WriteValue(double|string|object value,
object rootObj,
string attributeName)
R ETURNS
=0 On success.
6= 0 Error e.g. wrong data type.
3.6.41 IntSubset
Overview
Apply
ApplySelective
Clear
GetConfiguration*
GetObjects*
750
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Apply
Copies the values stored in a scenario to the corresponding network elements. The value
transfer is identical to scenario activation, however, the scenario will not be activated. In case of
having an active variation or another scenario, the values will be recorded there.
int IntSubset.Apply([int requestUserConfirmation])
A RGUMENTS
requestUserConfirmation(optional)
0 silent, just apply the data without further confirmation requests
1 request a user confirmation first (default)
R ETURNS
0 on success
ApplySelective
Similar to function Apply() but copies only the set of attributes listed in the given apply configu-
ration. An apply configuration is a folder consisting of variable selection objects (IntMon), one
per class. For each class the attributes to be copied can be selected.
int IntSubset.ApplySelective(object applyConfiguration)
int IntSubset.ApplySelective(int requestUserConfirmation,
object applyConfiguration)
A RGUMENTS
applyConfiguration
folder containing variable selection objects
requestUserConfirmation(optional)
0 silent, just apply the data without further confirmation requests
1 request a user confirmation first (default)
R ETURNS
0 on succes
Clear
Clears all values stored in the subset.
Please note that this function can only be called on subsets of currently in-active scenarios.
int IntSubset.Clear()
R ETURNS
0 On success.
1 On error, e.g. subset belongs to a currently active scenario.
751
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetConfiguration*
Returns class and attribute configuration for the subset.
string IntSubset.GetConfiguration(string subset)
A RGUMENTS
subset
R ETURNS
Returns a list of classes and attributes for which operational data are stored in subset.
GetObjects*
Returns a set of all objects for which operational data are stored in the subset.
set IntSubset.GetObjects()
R ETURNS
Set of all objects for which operational data are stored in the subset
3.6.42 IntThrating
Overview
GetCriticalTimePhase*
GetRating*
Resize
GetCriticalTimePhase*
This function returns the smallest duration (time-phase) for which the power flow is beyond the
rating.
double IntThrating.GetCriticalTimePhase(double Flow,
double Loading
)
A RGUMENTS
Flow Power from the load flow calculation, in MVA.
Loading Element loading, in %.
R ETURNS
>0 Smallest time-phase for which the flow is beyond the rating.
-1 In case that no rating is violated.
E XAMPLE
! External object with the rating characteristic: objTrf2W
double Time, Flow, Loading
object thermRating;
thermRating = objTrf2W:pRating;
if (thermRating) {
752
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Flow = 800;
Loading = 95;
Time = thermRating.GetCriticalTimePhase(Flow, Loading);
printf('The critical time-phase for which the power
%10.3f beyond the loading (%10.3f) is %10.3f', Flow, Loading, Time);
}
GetRating*
This function returns the rating in MVA according to the thermal rating table, considering element
overloading and its duration (time-phase).
double IntThrating.GetRating(double Loading,
double Duration
)
A RGUMENTS
Loading Element loading, in %.
Duration Duration or time phase for which the loading is considered, in minutes
R ETURNS
Rating in MVA or 0 if not found.
E XAMPLE
! External object with the rating characteristic: objTrf2W
double Rating, Loading, TimePhase;
object thermRating;
thermRating = objTrf2W:pRating;
if (thermRating) {
Loading = 84;
TimePhase = 10; ! for 10 Minutes
Rating = thermRating.GetRating(Loading, TimePhase);
printf('The Rating at Time-Phase %10.3f min when the loading
is %10.3f %: %10.3f MVA', TimePhase, Loading, Rating);
}
Resize
Resizes the configuration vectors like configTa,condigWind,configSolar,preload or duration
void IntThrating.Resize(int size, string name)
A RGUMENTS
size size of the referenced vector
R ETURNS
If the resize is unsuccessful the error message shall be issued.
753
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.43 IntUrl
Overview
View
View
Requests the operating system to open given URL for viewing. The performed action depends
on the default action configured in the system. For example, by default 'http://www.google.com'
would be opened in standard browser.
Please note, the action is only executed if access to given URL is enabled in the 'External
Access' configuration of PowerFactory (IntExtaccess).
int IntUrl.View()
R ETURNS
The returned value reports the success of the operation:
3.6.44 IntUser
Overview
Purge
SetPassword
TerminateSession
Purge
Purges project storage and updates storage statistics for all projects of the user.
Requires write access to the project; the functions does nothing when the project is locked by
another user.
void IntUser.Purge()
SetPassword
Sets the password for the user the function is called on.
Note: Only the administrator user is allowed to use this function. He can (re-)set the password
for every user.
int IntUser.SetPassword(string newpassword)
A RGUMENTS
newpassword
Case sensitive user password to set
R ETURNS
Returns whether or not the password has successfully been set. Possible values are:
754
3.6. OTHERS CHAPTER 3. OBJECT METHODS
0 error
1 password set successfully
TerminateSession
Allows the Administrator to log out another user. Prints an error if the current user is not the
Administrator.
void IntUser.TerminateSession()
3.6.45 IntUserman
Overview
CreateGroup
CreateUser
GetGroups*
GetUsers*
UpdateGroups
CreateGroup
Creates a new user group of given name. If a group with given name already exists the existing
one is returned instead.
Note: Only Administrator user is allowed to call this function.
object IntUserman.CreateGroup(string name)
A RGUMENTS
name Given name of the user group
R ETURNS
Created user group (IntGroup)
CreateUser
Creates a new user with given name. If the user already exists the existing one is returned
instead.
Note: Only Administrator user is allowed to call this function.
object IntUserman.CreateUser(string name)
A RGUMENTS
name Given name of the user
R ETURNS
Created user (IntUser)
755
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetGroups*
Returns a container with all user groups.
Note: Only the administrator user is allowed to call this function.
set IntUserman.GetGroups()
R ETURNS
Set of all available users
GetUsers*
Returns a container with all users as they are currently visible in the Data Manager tree.
Note: Only the administrator user is allowed to call this function.
set IntUserman.GetUsers()
R ETURNS
Set of all available users
UpdateGroups
Updates the Everybody group so it contains all currently existing users and cleans it of removed
users.
void IntUserman.UpdateGroups()
3.6.46 IntVec
Overview
Get*
Init*
Max*
Mean*
Min*
Resize*
Save*
Set*
Size*
Sort*
756
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Get*
Get the value in row index. Index is one based, therefore the index of the first entry is 1.
double IntVec.Get(int index)
A RGUMENTS
index Index in vector, one based.
S EE ALSO
IntVec.Set()
E XAMPLE
See example of IntVec.Sort().
Init*
Initializes the vector. Resizes the vector and initializes all values to 0.
This operation is performed in memory only. Use IntVec.Save() to save the modified vector to
database.
void IntVec.Init(int size)
A RGUMENTS
size The new size of the vector.
E XAMPLE
See example of IntVec.Sort().
Max*
Gets the maximum value stored in the vector.
double IntVec.Max()
R ETURNS
The maximum value stored in the vector. Empty vectors return 0 as maximum value.
Mean*
Calculates the average value of the vector.
double IntVec.Mean()
R ETURNS
The average value of the vector. A value of 0. is returned for empty vectors.
Min*
Gets the minimum value stored in the vector.
double IntVec.Min()
757
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
The minimum value stored in the vector. Empty vectors return 0 as minimum value.
Resize*
Resizes the vector. Inserted values are initialized to 0.
This operation is performed in memory only. Use IntVec.Save() to save the modified vector to
database.
void IntVec.Resize(int size)
A RGUMENTS
size The new size.
E XAMPLE
The following example resize a vector to size 4 and writes a avlue of 10 to the first entry.
object vectorObj;
int size,
row;
double value;
vectorObj = GetFromStudyCase('IntVec');
vectorObj.Resize(0);
vectorObj.Resize(4);
vectorObj.Set(1,10);
size = vectorObj.Size(); ! should be 4
for (row=1; row<=size; row+=1) {
value = vectorObj.Get(row);
printf('%d: %f',row,value);
}
Save*
Saves the current state of this vector to database.
If the matrix is calculation relevant, an optional parameter allows to control whether available
calculation results shall be reset afterwards or not.
Note: In QDSL, the calculation results are never reset and the parameter ”resetCalculation” is
ignored.
void IntVec.Save()
void IntVec.Save(int resetCalculation)
A RGUMENTS
resetCalculation (optional)
1 reset calculation results (default)
0 keep calculation results
758
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Set*
Set the value in row index. Index is one based, therefore the index of the first entry is 1.
The vector is resized automatically to size index in case that the index exceeds the current
vector size. Values inserted are automatically initialized to a value of 0.
This operation is performed in memory only. Use IntVec.Save() to save the modified vector to
database.
void IntVec.Set(int index,
double value)
A RGUMENTS
index Index in vector.
value Value to assign in row index.
S EE ALSO
IntVec.Get()
E XAMPLE
See example of IntVec.Sort().
Size*
Returns the size of the vector.
int IntVec.Size()
R ETURNS
The size of the vector.
E XAMPLE
See example of IntVec.Sort().
Sort*
Sorts the vector.
This operation is performed in memory only. Use IntVec.Save() to save the modified vector to
database.
void IntVec.Sort([int ascending = 0])
A RGUMENTS
ascending
Sort order:
0 Highest value first (descending, default).
1 Smallest value first (ascending).
E XAMPLE
The following script fills a vector and reports the initial values, the values after sorting in
increasing order and finally in decreasing order.
759
3.6. OTHERS CHAPTER 3. OBJECT METHODS
object vectorObj;
int size,
row;
double value;
vectorObj = GetFromStudyCase('IntVec');
! resize to 4 rows, all containing 0
vectorObj.Init(4);
vectorObj.Set(1,1);
vectorObj.Set(2,3);
vectorObj.Set(3,2);
!vectorObj.Set(4,5); 4. row unchanged -> remains 0
size = vectorObj.Size();
Info('Initial Vector');
for (row=1; row<=size; row+=1) {
value = vectorObj.Get(row);
printf('%d: %f',row,value);
}
Info('Increasing');
vectorObj.Sort(1); ! sort increasing
for (row=1; row<=size; row+=1) {
value = vectorObj.Get(row);
printf('%d: %f',row,value);
}
Info('Decreasing');
vectorObj.Sort(0); ! sort decreasing
for (row=1; row<=size; row+=1) {
value = vectorObj.Get(row);
printf('%d: %f',row,value);
}
3.6.47 IntVecobj
Overview
Get*
Resize*
Save*
Search*
Set*
Size*
Get*
Get the object in row index. Index is one based, therefore the index of the first entry is 1.
object IntVecobj.Get(int index)
A RGUMENTS
index Index in vector, one based.
S EE ALSO
IntVecobj.Set()
760
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Resize*
Resizes the vector. Inserted new entries are initialized to NULL.
This operation is performed in memory only. Use IntVecobj.Save() to save the modified vector
to database.
void IntVecobj.Resize(int size)
A RGUMENTS
size The new size.
Save*
Saves the current state of this vector to database.
If the vector is calculation relevant, an optional parameter allows to control whether available
calculation results shall be reset afterwards or not.
Note: In QDSL, the calculation results are never reset and the parameter ”resetCalculation” is
ignored.
void IntVecobj.Save()
void IntVecobj.Save(int resetCalculation)
A RGUMENTS
resetCalculation (optional)
1 reset calculation results (default)
0 keep calculation results
Search*
Search if the object (obj) is part of the vecor and returns the corresponding index of the vector
(one based).
int IntVecobj.Search(object obj)
R ETURNS
1 ... size object found, located at index
0 object not part of vector
Set*
Set the object (obj) in row index. Index is one based, therefore the index of the first entry is 1.
The vector is resized automatically to size index in case that the index exceeds the current
vector size. Object inserted are automatically initialized to a value of NULL.
This operation is performed in memory only. Use IntVecobj.Save() to save the modified vector
to database.
void IntVecobj.Set(int index,
object obj)
761
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
index Index in vector.
obj Object to assign in row index.
S EE ALSO
IntVecobj.Get()
Size*
Returns the size of the vector.
int IntVecobj.Size()
R ETURNS
The size of the vector.
3.6.48 IntVersion
Overview
CreateDerivedProject
GetDerivedProjects
GetHistoricalProject
Rollback
CreateDerivedProject
Creates a derived project from the version.
object IntVersion.CreateDerivedProject(string name,
[object parent]
)
A RGUMENTS
name The name of the project which will be created.
parent(optional)
The parent of the project which will be created. Default is the current user.
R ETURNS
Returns the created project.
E XAMPLE
object project, version, derivedProject ;
project = GetActiveProject();
if (.not. project) {
Error('no active project found');
exit();
}
762
3.6. OTHERS CHAPTER 3. OBJECT METHODS
derivedProject = version.CreateDerivedProject('DerivedProject');
GetDerivedProjects
list of projects derived from this version
set IntVersion.GetDerivedProjects()
R ETURNS
list of derived projects
E XAMPLE
object project, version, derivedProject;
set versions, projects, derivedProjects;
project = GetActiveProject();
versions = project.GetVersions();
for (version=versions.First(); version; version=versions.Next()) {
Info('Derived projects of version %o', version);
derivedProjects = version.GetDerivedProjects();
for (derivedProject=derivedProjects.First(); derivedProject; derivedProject=derivedProject
Info(' %o', derivedProject);
}
}
GetHistoricalProject
Returns historic project within version
object IntVersion.GetHistoricalProject()
R ETURNS
Returns the historic project object
E XAMPLE
object project, version, historicProject ;
project = GetActiveProject();
version = project.GetLatestVersion(0); !consider all versions
historicProject = version.GetHistoricalProject();
Rollback
Roll backs the project to this version. No project have to be active. Furthermore no script from
the project of the version have to be running.
int IntVersion.Rollback()
763
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 on success
1 otherwise
E XAMPLE
object project, version;
project = GetActiveProject();
3.6.49 IntViewbookmark
Overview
JumpTo
UpdateFromCurrentView
JumpTo
Opens the referenced diagram (if not already open) and sets the viewing area.
void IntViewbookmark.JumpTo()
UpdateFromCurrentView
Updates the bookmark’s diagram and view area from the current drawing window.
void IntViewbookmark.UpdateFromCurrentView()
3.6.50 PltAxis
Overview
DoAutoScale
SetFont
DoAutoScale
Adapts the axis range such that it includes the entire data range. Note: Only works if the plot
this axis belongs to is currently shown.
void PltAxis.DoAutoScale()
764
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetFont
Sets the font for this axis
void PltAxis.SetFont(string fontName,
int fontSize,
int fontStyle)
A RGUMENTS
fontName
Font name
fontSize Font size
3.6.51 PltComplexdata
Overview
AddVector
ChangeColourPalette
ClearVectors
AddVector
Appends a vector to the plot.
void PltComplexdata.AddVector(object element,
string complexVariable)
A RGUMENTS
element Element to display
complexVariable
Complex variable to display, e.g.: ’m:ur:bus1 + j * m:ui:bus1’
ChangeColourPalette
Colours the vectors according to the colour palette identified by the given name. Additionally,
the colour palette is set as the object’s default palette.
void PltComplexdata.ChangeColourPalette(string paletteName)
A RGUMENTS
paletteName
Name of the colour palette to apply
765
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 on success
1 on error
ClearVectors
Removes all vectors from the plot.
void PltComplexdata.ClearVectors()
3.6.52 PltDataseries
Overview
AddCurve
AddXYCurve
ChangeColourPalette
ClearCurves
GetDataSource
GetIntCalcres
AddCurve
Appends a curve to the plot.
void PltDataseries.AddCurve(object element,
string varname,
[object datasource]
)
A RGUMENTS
element Element to display
varname Name of the element variable to display
datasource (optional)
Data source to assign to the curve (ElmRes or IntComtrade). If not specified, the
plot’s default result file will be used for the curve.
E XAMPLE
The following example finds a plot and adds a curve to it. The element line is assumed to
be passed to the script:
object page;
object graphicsBoard;
object plot;
object dataseries;
graphicsBoard = GetGraphicsBoard();
if (graphicsBoard) {
page = graphicsBoard.GetPage('Voltage');
if (page) {
plot = page.GetPlot('RST');
if (plot) {
dataseries = plot.GetDataSeries();
if (dataseries) {
766
3.6. OTHERS CHAPTER 3. OBJECT METHODS
dataseries.AddCurve(line, 'c:loading');
}
}
}
}
AddXYCurve
Appends a curve to a XY plot.
void PltDataseries.AddXYCurve(object elementX,
string varnameX,
object elementY,
string varnameY,
[object datasource]
)
A RGUMENTS
elementX Element to display on x-axis
varnameX
Name of the element variable to display on x-axis
elementY Element to display on y-axis
varnameY
Name of the element variable to display on y-axis
datasource (optional)
Data source to assign to the curve (ElmRes or IntComtrade). If not specified, the
plot’s default result file will be used for the curve.
ChangeColourPalette
Colours the curves according to the colour palette identified by the given name. Additionally,
the colour palette is set as the dataseries’ default palette.
void PltDataseries.ChangeColourPalette(string paletteName)
A RGUMENTS
paletteName
Name of the colour palette to apply
R ETURNS
0 on success
1 on error
ClearCurves
Removes all curves from the plot.
void PltDataseries.ClearCurves()
767
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetDataSource
Returns the data source that is used for the curve with given index.
object PltDataseries.GetDataSource(int curveIndex)
A RGUMENTS
int curveIndex
curve index in table, must be ≥ 0
R ETURNS
object Data source
NULL No data source found
GetIntCalcres
Gets all user Calculated Result objects (IntCalcres) stored inside the data series.
set PltDataseries.GetIntCalcres()
R ETURNS
All Calculated Result objects (IntCalcres) stored inside the data series.
3.6.53 PltLegend
Overview
SetFont
SetFont
Sets the font for this axis
void PltAxis.SetFont(string fontName,
int fontSize,
int fontStyle)
A RGUMENTS
fontName
Font name
fontSize Font size
fontStyle Font style
1 Bold
2 Italic
3 Bold and italic
4 Underline
768
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.54 PltLinebarplot
Overview
ChangeStyle
DoAutoScale
DoAutoScaleX
DoAutoScaleY
GetAxisX
GetAxisY
GetDataSeries
GetLegend
GetTitleObject
SetAutoScaleModeX
SetAutoScaleModeY
SetAxisSharingLevelX
SetAxisSharingLevelY
SetScaleTypeX
SetScaleTypeY
SetScaleX
SetScaleY
ChangeStyle
Applies the plot style identified by the given name to this plot.
void PltLinebarplot.ChangeStyle(string styleName)
A RGUMENTS
styleName
Name of the style template to apply
R ETURNS
0 on success
1 on error
DoAutoScale
Adapts the plot’s axes ranges such that they show the entire data range.
void PltLinebarplot.DoAutoScale([int axisDimension])
A RGUMENTS
axisDimension (optional)
Limits auto-scaling to one dimension. Possible values:
0 scale only x-axes
1 scale only y-axes
769
3.6. OTHERS CHAPTER 3. OBJECT METHODS
DoAutoScaleX
Adapts the plot’s x-axes ranges such that they show the entire data range.
void PltLinebarplot.DoAutoScaleX()
DoAutoScaleY
Adapts the plot’s y-axes ranges such that they show the entire data range.
void PltLinebarplot.DoAutoScaleY()
GetAxisX
Returns one of the plot’s x-axes.
object PltLinebarplot.GetAxisX([int axisIndex])
A RGUMENTS
axisIndex=0 (optional)
Determines which x-axis should be returned:
0 main x-axis
1 second x-axis (will be created if not yet present)
R ETURNS
PltAxis object
GetAxisY
Returns one of the plot’s y-axes.
object PltLinebarplot.GetAxisY([int axisIndex])
A RGUMENTS
axisIndex=0 (optional)
Determines which y-axis should be returned:
0 main y-axis
1 second y-axis (will be created if not yet present)
R ETURNS
PltAxis object
GetDataSeries
Returns the plot’s data series object (PltDataseries).
object PltLinebarplot.GetDataSeries()
R ETURNS
Data series object (PltDataseries)
770
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example creates a curve plot named 'RST' on the plot page named 'Voltage',
and retrieves its data series.
object graphicsBoard;
object page;
object plot;
object dataseries;
graphicsBoard = GetGraphicsBoard(); ! Look for open desktop
if (graphicsBoard) {
page = graphicsBoard.GetPage('Voltage',1);
if (page) {
plot = page.GetOrInsertCurvePlot('RST');
if (plot) {
dataseries = plot.GetDataSeries();
}
}
}
GetLegend
Returns the plot’s legend object (PltLegend).
object PltLinebarplot.GetLegend()
R ETURNS
Legend object (PltLegend)
GetTitleObject
Returns the plot’s title object (PltTitle).
object PltLinebarplot.GetTitleObject()
R ETURNS
Title object (PltTitle)
SetAutoScaleModeX
Defines whether the plot should automatically adapt its main x-axis range on data changes.
void PltLinebarplot.SetAutoScaleModeX(int mode)
A RGUMENTS
mode Possible values:
0 off (do not react to data changes)
1 adapt scale after calculation has finished
2 adapt scale during live plotting
771
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetAutoScaleModeY
Defines whether the plot should automatically adapt its main y-axis range on data changes.
void PltLinebarplot.SetAutoScaleModeY(int mode)
A RGUMENTS
mode Possible values:
0 off (do not react to data changes)
1 adapt scale after calculation has finished
2 adapt scale during live plotting
SetAxisSharingLevelX
Defines whether the plot has its own x-axis or should share its x-axis across the page or the
entire graphics board.
void PltLinebarplot.SetAxisSharingLevelX(int level)
A RGUMENTS
level Possible values:
0 local (do not share x-axis)
1 use x-axis from page
2 use x-axis from graphics board
SetAxisSharingLevelY
Defines whether the plot has its own y-axis or should share its y-axis across the page or the
entire graphics board.
void PltLinebarplot.SetAxisSharingLevelY(int level)
A RGUMENTS
level Possible values:
0 local (do not share y-axis)
1 use y-axis from page
2 use y-axis from graphics board
SetScaleTypeX
Sets the scale type of the plot’s main x-axis.
void PltLinebarplot.SetScaleTypeX(int scaleType)
772
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
scaleType
Possible values:
0 linear
1 logarithmic
SetScaleTypeY
Set the scale type of the plot’s main y-axis.
void PltLinebarplot.SetScaleTypeY(int scaleType)
A RGUMENTS
scaleType
Possible values:
0 linear
1 logarithmic
2 dB
SetScaleX
Sets the scale of the plot’s main x-axis.
void PltLinebarplot.SetScaleX(double min,
double max
)
A RGUMENTS
min Minimum of x-scale.
max Maximum of x-scale.
SetScaleY
Sets the scale of the plot’s main y-axis.
void PltLinebarplot.SetScaleY(double min,
double max
)
A RGUMENTS
min Minimum of y-scale.
773
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.55 PltTitle
Overview
SetFont
SetFont
Sets the font for this axis
void PltAxis.SetFont(string fontName,
int fontSize,
int fontStyle)
A RGUMENTS
fontName
Font name
fontSize Font size
fontStyle Font style
1 Bold
2 Italic
3 Bold and italic
4 Underline
3.6.56 PltVectorplot
Overview
ChangeStyle
DoAutoScale
GetAxisX
GetAxisY
GetComplexData
GetLegend
GetTitleObject
SetAutoScaleModeX
SetAutoScaleModeY
SetScaleX
SetScaleY
774
3.6. OTHERS CHAPTER 3. OBJECT METHODS
ChangeStyle
Applies the plot style identified by the given name to this plot.
void PltVectorplot.ChangeStyle(string styleName)
A RGUMENTS
styleName
Name of the style template to apply
R ETURNS
0 on success
1 on error
DoAutoScale
Adapts the plot’s axes ranges such that they show the entire data range.
void PltVectorplot.DoAutoScale()
GetAxisX
Returns the plot’s x-axis.
object PltVectorplot.GetAxisX()
R ETURNS
PltAxis object
GetAxisY
Returns the plot’s y-aies.
object PltVectorplot.GetAxisY()
R ETURNS
PltAxis object
GetComplexData
Returns the plot’s complex data definition object (PltComplexdata).
object PltVectorplot.GetComplexData()
R ETURNS
Complex data definition object (PltComplexdata)
GetLegend
Returns the plot’s legend object (PltLegend).
object PltVectorplot.GetLegend()
775
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
Legend object (PltLegend)
GetTitleObject
Returns the plot’s title object (PltTitle).
object PltVectorplot.GetTitleObject()
R ETURNS
Title object (PltTitle)
SetAutoScaleModeX
Defines whether the plot should automatically adapt its main x-axis range on data changes.
void PltVectorplot.SetAutoScaleModeX(int mode)
A RGUMENTS
mode Possible values:
0 off (do not react to data changes)
1 adapt scale after calculation has finished
SetAutoScaleModeY
Defines whether the plot should automatically adapt its main y-axis range on data changes.
void PltVectorplot.SetAutoScaleModeY(int mode)
A RGUMENTS
mode Possible values:
0 off (do not react to data changes)
1 adapt scale after calculation has finished
SetScaleX
Sets the scale of the plot’s x-axis.
void PltVectorplot.SetScaleX(double min,
double max
)
A RGUMENTS
min Minimum of x-scale.
max Maximum of x-scale.
776
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetScaleY
Sets the scale of the plot’s y-axis.
void PltVectorplot.SetScaleY(double min,
double max
)
A RGUMENTS
min Minimum of y-scale.
max Maximum of y-scale.
3.6.57 RelChar
Overview
SetCurve
SetCurve
Assign a tripping curve by name. The curve must be defined in the associated type object.
int RelChar.SetCurve(string name)
A RGUMENTS
name Name of the curve to assign (may contain wildcards).
R ETURNS
0 The curve was found and assigned.
1 No curve with the given name is defined or multiple curves matched the name.
3.6.58 RelToc
Overview
SetCurve
SetCurve
Assign a tripping curve by name. The curve must be defined in the associated type object.
int RelToc.SetCurve(string name)
A RGUMENTS
name Name of the curve to assign (may contain wildcards).
R ETURNS
0 The curve was found and assigned.
1 No curve with the given name is defined or multiple curves matched the name.
777
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.59 RelZpol
Overview
AssumeCompensationFactor
AssumeReRl
AssumeXeXl
AssumeCompensationFactor
Triggers a calculation of the complex compensation factor and stores the result.
int RelZpol.AssumeCompensationFactor()
R ETURNS
0 The compensation factor was successfully calculated.
1 An error occurred (e.g. conencted branch was not found).
AssumeReRl
Triggers a calculation of the real part of the decoupled compensation factor and stores the
result.
int RelZpol.AssumeReRl()
R ETURNS
0 The compensation factor was successfully calculated.
1 An error occurred (e.g. conencted branch was not found).
AssumeXeXl
Triggers a calculation of the imaginary part of the decoupled compensation factor and stores
the result.
int RelZpol.AssumeXeXl()
R ETURNS
0 The compensation factor was successfully calculated.
1 An error occurred (e.g. conencted branch was not found).
3.6.60 ScnFreq
Overview
GetLimit*
GetNumberOfViolations*
GetValue*
GetVariable*
GetViolatedElement*
GetViolationTime*
778
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetLimit*
Returns the limit value (in p.u.) of the ith violation, given by vIdx.
double ScnFreq.GetLimit(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The limit value (in p.u.) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetNumberOfViolations*
Returns the number of violations.
int ScnFreq.GetNumberOfViolations()
R ETURNS
The number of violations.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetValue*
Returns the ith value (in p.u.), given by vIdx, which causes the violation.
double ScnFreq.GetValue(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The ith value (in p.u.), given by vIdx, which causes the violation. If vIdx is negative, zero or
greater than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetVariable*
Returns the name of the variable of the ith violation, given by vIdx.
string ScnFreq.GetVariable(int vIdx)
A RGUMENTS
vIdx vIdx > 0
779
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
The name of the variable of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ”NoVariable”.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolatedElement*
Returns the element of the ith violation, given by vIdx.
object ScnFreq.GetViolatedElement(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The element of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns NULL.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolationTime*
Returns the time (in seconds) of the ith violation, given by vIdx.
double ScnFreq.GetViolationTime(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The time (in seconds) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
The following example gets the scan modules which have violations. For every violation of
each scan module, all relevant information is shown.
object oSim,oRef;
set sScanTrigger;
int violation, nbviolation;
oSim = GetCaseObject('ComSim');
sScanTrigger=oSim.GetViolatedScanModules();
780
3.6. OTHERS CHAPTER 3. OBJECT METHODS
printf('%o',oRef.GetViolatedElement(violation));
printf('%s',oRef.GetVariable(violation));
printf('%f',oRef.GetValue(violation));
printf('%f',oRef.GetLimit(violation));
}
}
3.6.61 ScnFrt
Overview
GetLimit*
GetNumberOfViolations*
GetValue*
GetVariable*
GetViolatedElement*
GetViolationTime*
GetLimit*
Returns the limit value of the ith violation, given by vIdx.
double ScnFrt.GetLimit(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The limit value of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetNumberOfViolations*
Returns the number of violations.
int ScnFrt.GetNumberOfViolations()
R ETURNS
The number of violations.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetValue*
Returns the ith value, given by vIdx, which causes the violation.
double ScnFrt.GetValue(int vIdx)
781
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The ith value, given by vIdx, which causes the violation. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example of ScnFreq.GetViolationTime().
GetVariable*
Returns the name of the variable of the ith violation, given by vIdx.
string ScnFrt.GetVariable(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The name of the variable of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ”NoVariable”.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolatedElement*
Returns the element of the ith violation, given by vIdx.
object ScnFrt.GetViolatedElement(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The element of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns NULL.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolationTime*
Returns the time (in seconds) of the ith violation, given by vIdx.
double ScnFrt.GetViolationTime(int vIdx)
A RGUMENTS
vIdx vIdx > 0
782
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
The time (in seconds) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
3.6.62 ScnSpeed
Overview
GetLimit*
GetNumberOfViolations*
GetValue*
GetVariable*
GetViolatedElement*
GetViolationTime*
GetLimit*
Returns the limit value (in p.u.) of the ith violation, given by vIdx.
double ScnSpeed.GetLimit(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The limit value (in p.u.) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetNumberOfViolations*
Returns the number of violations.
int ScnSpeed.GetNumberOfViolations()
R ETURNS
The number of violations.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetValue*
Returns the ith value (in p.u.), given by vIdx, which causes the violation.
double ScnSpeed.GetValue(int vIdx)
783
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The ith value (in p.u.), given by vIdx, which causes the violation. If vIdx is negative, zero or
greater than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetVariable*
Returns the name of the variable of the ith violation, given by vIdx.
string ScnSpeed.GetVariable(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The name of the variable of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ”NoVariable”.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolatedElement*
Returns the element of the ith violation, given by vIdx.
object ScnSpeed.GetViolatedElement(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The element of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns NULL.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolationTime*
Returns the time (in seconds) of the ith violation, given by vIdx.
double ScnSpeed.GetViolationTime(int vIdx)
A RGUMENTS
vIdx vIdx > 0
784
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
The time (in seconds) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
3.6.63 ScnSync
Overview
GetLimit*
GetNumberOfViolations*
GetValue*
GetVariable*
GetViolatedElement*
GetViolationTime*
GetLimit*
Returns the limit value of the ith violation, given by vIdx.
double ScnSync.GetLimit(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The limit value of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetNumberOfViolations*
Returns the number of violations.
int ScnSync.GetNumberOfViolations()
R ETURNS
The number of violations.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetValue*
Returns the ith value, given by vIdx, which causes the violation.
double ScnSync.GetValue(int vIdx)
785
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The ith value, given by vIdx, which causes the violation. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetVariable*
Returns the name of the variable of the ith violation, given by vIdx.
string ScnSync.GetVariable(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The name of the variable of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ”NoVariable”.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolatedElement*
Returns the element of the ith violation, given by vIdx.
object ScnSync.GetViolatedElement(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The element of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns NULL.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolationTime*
Returns the time (in seconds) of the ith violation, given by vIdx.
double ScnSync.GetViolationTime(int vIdx)
A RGUMENTS
vIdx vIdx > 0
786
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
The time (in seconds) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
3.6.64 ScnVar
Overview
GetLimit*
GetNumberOfViolations*
GetValue*
GetVariable*
GetViolatedElement*
GetViolationTime*
GetLimit*
Returns the limit value of the ith violation, given by vIdx.
double ScnVar.GetLimit(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The limit value of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetNumberOfViolations*
Returns the number of violations.
int ScnVar.GetNumberOfViolations()
R ETURNS
The number of violations.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetValue*
Returns the ith value, given by vIdx, which causes the violation.
double ScnVar.GetValue(int vIdx)
787
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The ith value, given by vIdx, which causes the violation. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetVariable*
Returns the name of the variable of the ith violation, given by vIdx.
string ScnVar.GetVariable(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The name of the variable of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ”NoVariable”.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolatedElement*
Returns the element of the ith violation, given by vIdx.
object ScnVar.GetViolatedElement(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The element of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns NULL.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolationTime*
Returns the time (in seconds) of the ith violation, given by vIdx.
double ScnVar.GetViolationTime(int vIdx)
A RGUMENTS
vIdx vIdx > 0
788
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
The time (in seconds) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
3.6.65 ScnVolt
Overview
GetLimit*
GetNumberOfViolations*
GetValue*
GetVariable*
GetViolatedElement*
GetViolationTime*
GetLimit*
Returns the limit value (in p.u.) of the ith violation, given by vIdx.
double ScnVolt.GetLimit(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The limit value (in p.u.) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetNumberOfViolations*
Returns the number of violations.
int ScnVolt.GetNumberOfViolations()
R ETURNS
The number of violations.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetValue*
Returns the ith value (in p.u.), given by vIdx, which causes the violation.
double ScnVolt.GetValue(int vIdx)
789
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The ith value (in p.u.), given by vIdx, which causes the violation. If vIdx is negative, zero or
greater than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetVariable*
Returns the name of the variable of the ith violation, given by vIdx.
string ScnVolt.GetVariable(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The name of the variable of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ”NoVariable”.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolatedElement*
Returns the element of the ith violation, given by vIdx.
object ScnVolt.GetViolatedElement(int vIdx)
A RGUMENTS
vIdx vIdx > 0
R ETURNS
The element of the ith violation, given by vIdx. If vIdx is negative, zero or greater than the
number of violations, then the function returns NULL.
E XAMPLE
See example ScnFreq.GetViolationTime().
GetViolationTime*
Returns the time (in seconds) of the ith violation, given by vIdx.
double ScnVolt.GetViolationTime(int vIdx)
A RGUMENTS
vIdx vIdx > 0
790
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
The time (in seconds) of the ith violation, given by vIdx. If vIdx is negative, zero or greater
than the number of violations, then the function returns ’nan’.
E XAMPLE
See example ScnFreq.GetViolationTime().
3.6.66 StoMaint
Overview
SetElms
SetElms
Sets the maintenance elements.
void StoMaint.SetElms(object singleElement)
void StoMaint.SetElms(set multipleElements)
A RGUMENTS
singleElement
single Element for Maintenance
multipleElements
multiple Elements for Maintenance
3.6.67 TypAsmo
Overview
CalcElParams
CalcElParams
Calculates the electrical parameters from the input data. Behaves as the calculate button on
the basic data page was pressed and the parameter estimation is executed. Shall be applied
only if the Input mode is set to ’Slip-Torque/Current Characteristic’ or ’Measurement curves’.
int TypAsm.CalcElParams([double acceptSqError = 1.e-03],
[int solverType = 0],
[int useLinConst = 1],
[int considerEff = 1],
[double kx = 0.5],
[double kr = 1.])
A RGUMENTS
acceptSqError (optional)
If calculated squared error is bolow this value, calculation is successfull.
solverType (optional)
Solver used in the parameter estimation. Possible values are:
0 LBFGS (default).
791
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Calculation successfully (squared error less than acceptSqError).
1 Error.
3.6.68 TypCtcore
Overview
AddRatio
RemoveRatio
RemoveRatioByIndex
AddRatio
Adds the given ratio to the core. The ratio is added so that the sorting remains in ascending
order. The accuracy parameters will be copied from the previous row. If the new ratio is to be
the first ratio, the accuracy parameters will be copied from the next row instead.
int TypCtcore.AddRatio(double ratio)
A RGUMENTS
ratio New ratio to add.
R ETURNS
0 New ratio was added.
1 An error occurred.
RemoveRatio
Removes the given ratio from the core. The last remaining ratio can never be removed.
int TypCtcore.RemoveRatio(double ratio)
A RGUMENTS
ratio Ratio to remove.
792
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Ratio was removed.
1 An error occurred.
RemoveRatioByIndex
Removes the ratio with the given index from the core. The index is zero based. The last
remaining ratio can never be removed.
int TypCtcore.RemoveRatio(int index)
A RGUMENTS
index Index to remove.
R ETURNS
0 Index was removed.
1 An error occurred.
3.6.69 TypLne
Overview
IsCable*
IsCable*
Checks if the line type is a cable type.
int TypLne.IsCable()
R ETURNS
1 Type is a cable
0 Type is not a cable
E XAMPLE
The following example reports all cable types.
set cables;
object type;
int i;
cables = GetCalcRelevantObjects();
type = cables.Firstmatch('TypLne');
while (type) {
i = type.IsCable();
if (i) type.ShowFullName();
type = cables.Nextmatch();
}
793
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.70 TypMdl
Overview
Check
Compile
Pack
Check
Checks the model for errors e.g during parsing of interpreted model, during loading of compiled
model.
int TypMdl.Check()
R ETURNS
0 TypMdl is OK.
1 Error during parsing of interpreted model.
2 Error during loading of compiled model.
Compile
Compile the model.
int TypMdl.Compile([const char* modelPath], [int overrideModel])
A RGUMENTS
modelPath (optional)
Full path to a location where the model should be stored. Leave empty to use
default.
overrideModel (optional)
The model will be overrided if already present at the selected location and if the
value is set to 1. (default = 0)
R ETURNS
0 Compilation is Ok.
1 Compilation failled
Pack
Copies all used Modelica model types (i.e. referenced TypMdl) to a child folder ”Externals”.
int TypMdl.Pack()
R ETURNS
0 On success.
1 On error.
794
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.71 TypQdsl
Overview
Encrypt
IsEncrypted*
ResetThirdPartyModule
SetThirdPartyModule
Encrypt
Encrypts a type. An encrypted type can be used without password but decrypted only with
password. If no password is given a ’Choose Password’ dialog appears.
int TypQdsl.Encrypt([string password = ''],
[int removeObjectHistory = 1],
[int masterCode = 0])
A RGUMENTS
password (optional)
Password for decryption. If no password is given a ’Choose Password’ dialog
appears.
removeObjectHistory (optional)
Handling of unencrypted object history in database, e.g. used by project versions
or by undo:
0 Do not remove.
1 Do remove (default).
2 Show dialog and ask.
masterCode (optional)
Used for re-selling types. Third party licence codes already set in the type will be
overwritten by this value (default = 0).
R ETURNS
0 On success.
1 On error.
S EE ALSO
TypQdsl.IsEncrypted()
IsEncrypted*
Returns the encryption state of the type.
int TypQdsl.IsEncrypted()
R ETURNS
1 Type is encrypted.
0 Type is not encrypted.
795
3.6. OTHERS CHAPTER 3. OBJECT METHODS
S EE ALSO
TypQdsl.Encrypt()
ResetThirdPartyModule
Resets the third party licence. Only possible for non-encrypted models. Requires masterkey
licence for third party module currently set.
int TypQdsl.ResetThirdPartyModule()
R ETURNS
0 On success.
1 On error.
SetThirdPartyModule
Sets the third party licence to a specific value. Only possible for non-encrypted models with no
third party licence set so far. Requires masterkey licence for third party module to be set.
int TypQdsl.SetThirdPartyModule(string companyCode,
string moduleCode
)
A RGUMENTS
companyCode
D isplay name or numeric value of company code.
moduleCode
D isplay name or numeric value of third party module.
R ETURNS
0 On success.
1 On error.
3.6.72 TypTr2
Overview
GetZeroSequenceHVLVT*
GetZeroSequenceHVLVT*
Returns the calculated star equivalent of the zero sequence impedances.
int TypTr2.GetZeroSequenceHVLVT(double& hvReal,
double& hvImag,
double& lvReal,
double& lvImag,
double& tReal ,
double& tImag
)
796
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
hvReal (out)
Real part of the HV impedance in %.
hvImag (out)
Imaginary part of the HV impedance in %.
lvReal (out)
Real part of the LV impedance in %.
lvImag (out)
Imaginary part of the LV impedance in %.
tReal (out)
Real part of the tertiary (delta) impedance in %.
tImag (out)
Imaginary part of the tertiary (delta) impedance in %.
R ETURNS
0 No error occurred.
1 An error occurred; the values are invalid.
3.6.73 VisBdia
Overview
AddObjs
AddResObjs
Clear
SetScaleY
SetXVariable
SetYVariable
AddObjs
Adds objects to elements column in table 'Bars'.
void VisBdia.AddObjs(set elements)
A RGUMENTS
elements Elements to add in table.
E XAMPLE
The following example gets a distortion analysis diagram and adds all elements of the selec-
tion
object page;
object graphBoard;
object plot;
set elements;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Distortion',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisBdia',1); ! get distortion analysis plot
797
3.6. OTHERS CHAPTER 3. OBJECT METHODS
if (plot) {
elements = SEL.All();
plot.AddObjs(elements);
}
}
}
AddResObjs
Adds objects to elements column in table 'Bars' (similar to AddObjs). Additionally a result file is
assigned to all rows added in the 'Result File' column.
void VisBdia.AddResObjs(object resultFileObj,
set elements
)
A RGUMENTS
resultFileObj
The result file to assign. Must be an object of class ElmRes.
E XAMPLE
The following example gets a distortion analysis diagram and adds all elements of the selec-
tion with result file taken from study case.
object page;
object graphBoard;
object plot;
object resFile;
set elements;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Distortion',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisBdia',1); ! get distortion analysis plot
if (plot) {
resFile = GetFromStudyCase('ElmRes');
elements = SEL.All();
plot.AddResObjs(elements);
}
}
}
Clear
Removes all elements from plot by erasing all rows from the table named 'Bars'.
void VisBdia.Clear()
E XAMPLE
The following example gets the distortion analysis diagram and removes all elements.
798
3.6. OTHERS CHAPTER 3. OBJECT METHODS
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Distortion',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisBdia',1); ! get distortion analysis plot
if (plot) {
plot.Clear();
}
}
}
SetScaleY
Sets y-axis scale limits.
void VisBdia.SetScaleY(double min,
double max,
[int log]
)
A RGUMENTS
min (optional)
Minimum of y-scale.
max (optional)
Maximum of y-scale.
log (optional)
Possible values:
0 linear
1 logarithmic
E XAMPLE
The following example gets a distortion analysis diagram and sets the y-axis scale to a
logarithmic scale in the range of [1,1000]
object page;
object graphBoard;
object plot;
object scale;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Distortion',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisBdia',1); ! get distortion analysis plot
if (plot) {
plot.SetScaleY(1.,1000.,1);
}
}
}
799
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetXVariable
Set the x-axis Variable of the Distortion Analysis Diagram
int VisBdia.SetXVariable(string variable)
A RGUMENTS
variable x-axis variable to set.Length of variable must not exceed 37 characters.
R ETURNS
0 if ok, 1 if variable length exceeds 37 characters,
E XAMPLE
The following example gets a distortion analysis diagram and sets the x-axis variable to
’order’.
object page;
object graphBoard;
object plot;
object scale;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Distortion',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisBdia',1); ! get distortion analysis plot
if (plot) {
plot.SetXVariable('order');
}
}
}
SetYVariable
Set the y-axis variable of the Distortion Analysis Diagram
int VisBdia.SetYVariable(string variable)
A RGUMENTS
variable y-axis variable to set.Length of variable must not exceed 37 characters.
R ETURNS
0 if ok, 1 if variable length exceeds 37 characters,
E XAMPLE
The following example gets a distortion analysis diagram and sets the y-axis variable to
’m:u:bu1’.
object page;
object graphBoard;
object plot;
object scale;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Distortion',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisBdia',1); ! get distortion analysis plot
800
3.6. OTHERS CHAPTER 3. OBJECT METHODS
if (plot) {
plot.SetYVariable('m:u:bu1');
}
}
}
3.6.74 VisDraw
Overview
AddRelay
AddRelays
CentreOrigin
Clear
DoAutoScaleOnAll
DoAutoScaleOnCharacteristics
DoAutoScaleOnImpedances
DoAutoScaleX
DoAutoScaleY
AddRelay
Adds a relay to the plot and optionally sets the drawing style.
void VisDraw.AddRelay(object relay,
[double colour,]
[double style,]
[double width])
A RGUMENTS
relay The protection device to be added.
colour (optional)
The colour to be used.
style (optional)
The line style to be used.
width (optional)
The line width to be used.
AddRelays
Adds relays to the plot.
void VisDraw.AddRelays(set relays)
A RGUMENTS
relays The protection devices (ElmRelay or RelFuse) to be added.
801
3.6. OTHERS CHAPTER 3. OBJECT METHODS
CentreOrigin
Centre the origin of the plot
void VisDraw.CentreOrigin()
Clear
Removes all protection devices from the plot.
void VisDraw.Clear()
DoAutoScaleOnAll
Scales the plot automatically under consideration of relay characteristics, simulation curves and
short circuit arrows. The function works for local scales only.
int VisDraw.DoAutoScaleOnAll()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
DoAutoScaleOnCharacteristics
Scales the plot automatically under consideration of relay characteristics. Same as button
named Characteristics. The function works for local scales only.
int VisDraw.DoAutoScaleOnCharacteristics()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
DoAutoScaleOnImpedances
Scales the plot automatically under consideration of branch impedances. Same as button
named Impedances. The function works for local scales only.
int VisDraw.DoAutoScaleOnImpedances()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
DoAutoScaleX
Scales the x-axis of the plot automatically. The function works for local x-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisDraw.DoAutoScaleX()
802
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
DoAutoScaleY
Scales the y-axis of the plot automatically. The function works for local y-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisDraw.DoAutoScaleY()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
3.6.75 VisHrm
Overview
Clear
DoAutoScaleX
DoAutoScaleY
GetDataSource
GetScaleObjX
GetScaleObjY
SetAutoScaleX
SetAutoScaleY
SetCrvDesc
SetDefScaleX
SetDefScaleY
Clear
Removes all curves by clearing table named 'Curves'.
void VisHrm.Clear()
E XAMPLE
The following example gets the waveform plot and removes all curves.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Distortion',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
plot.Clear();
}
}
}
803
3.6. OTHERS CHAPTER 3. OBJECT METHODS
DoAutoScaleX
Scales x-axis automatically.
int VisHrm.DoAutoScaleX()
R ETURNS
0 Ok, call to DoAutoScaleX() was successfull
1 Failed, because the x-scale is not local
E XAMPLE
The following example gets the waveform plot and scales the x-axis automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Waveform',1); ! get panel named 'Waveform'
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
plot.DoAutoScaleX();
}
}
}
DoAutoScaleY
Scales y-axis automatically.
int VisHrm.DoAutoScaleY()
R ETURNS
0 Ok, call to DoAutoScaleY() was successfull
1 Failed, because the y-scale is not local
E XAMPLE
The following example gets the waveform plot and scales the y-axis automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Waveform',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
plot.DoAutoScaleY();
}
}
}
804
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetDataSource
Get data source for curve with index
object VisHrm.GetDataSource(int curveIndex)
A RGUMENTS
int curveIndex
Possible values:
<0 invalid
≥0 curve index in table
R ETURNS
object Data source
NULL No data source found
E XAMPLE
The following example looks for a plot and gets the data source for the first curve.
object dataSource;
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisHrm',1); ! get plot
if (plot) {
dataSource = plot.GetDataSource(0);
}
}
}
GetScaleObjX
Gets the object used for scaling the x-axis.
object VisHrm.GetScaleObjX()
R ETURNS
this object In case that 'Use local Axis' is set to 'Local'.
the virtual instrument panel In case that 'Use local axis' is set to 'Current Page'.
the graphics board In case that 'Use local axis' is set to 'Graphics Board'.
E XAMPLE
The following example gets the object specifying the x-scale of the waveform plot.
object page;
object graphBoard;
object plot;
object scaleObjX;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
805
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetScaleObjY
Gets the object used for scaling the y-axis.
object VisHrm.GetScaleObjY()
R ETURNS
this object In case that 'Use local Axis' is enabled.
the plot type In case that 'Use local axis' is disabled.
E XAMPLE
The following example gets the object specifying the y-scale of the waveform plot.
object page;
object graphBoard;
object plot;
object scaleObjY;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Waveform',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
scaleObjY = plot.GetScaleObjY();
scaleObjY.ShowFullName();
}
}
}
SetAutoScaleX
Sets Auto Scale setting of the x-scale. The scale is automatic set to local, in case that the
waveform plot is using the scale of the graphics board or the virtual instrument panel.
void VisHrm.SetAutoScaleX(int mode)
A RGUMENTS
mode Possible values:
0 never
1 after simulation
806
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example gets the waveform plot and sets the Auto Scale option of the x-axis to
On.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Waveform',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
plot.SetAutoScaleX(1);
}
}
}
SetAutoScaleY
Sets Auto Scale setting of the y-scale. The scale is automatic set to local, in case that the
waveform plot is using the scale of the plot type.
void VisHrm.SetAutoScaleY(int mode)
A RGUMENTS
mode Possible values:
0 never
1 after simulation
E XAMPLE
The following example gets the waveform plot and sets the Auto Scale option of the y-axis to
On.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Waveform',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
plot.SetAutoScaleY(1);
}
}
}
SetCrvDesc
Sets the user defined description of a curve.
void VisHrm.SetCrvDesc(int curveIndex, string curveDescription)
807
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
curveIndex
Curve index; first curve in table is index 1.
curveDescription
Description to set
E XAMPLE
The following example gets the waveform plot and sets the description of the first variable to
example.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Waveform',1); ! get panel named Waveform
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
plot.SetCrvDesc(1,'example');
}
}
}
SetDefScaleX
Sets the x-scale to be used to the graphics board.
void VisHrm.SetDefScaleX()
E XAMPLE
The following example gets the waveform plot and sets the x-scale to the graphics board.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Waveform',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
plot.SetDefScaleX();
}
}
}
SetDefScaleY
Sets the y-scale to be used to the plot type.
void VisHrm.SetDefScaleY()
808
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example gets the waveform plot and sets the y-scale to the plot type.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Waveform',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisHrm',1); ! get waveform plot
if (plot) {
plot.SetDefScaleY();
}
}
}
3.6.76 VisMagndiffplt
Overview
AddRelay
AddRelays
Clear
DoAutoScaleX
DoAutoScaleY
Refresh
AddRelay
Adds a relay to the plot and optionally sets the drawing style.
void VisMagndiffplt.AddRelay(object relay,
[double colour,]
[double style,]
[double width])
A RGUMENTS
relay The protection device to be added.
colour (optional)
The colour to be used.
style (optional)
The line style to be used.
width (optional)
The line width to be used.
AddRelays
Adds relays to the plot.
void VisMagndiffplt.AddRelays(set relays)
809
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
relays The protection devices (ElmRelay or RelFuse) to be added.
Clear
Removes all protection devices from the plot.
void VisMagndiffplt.Clear()
DoAutoScaleX
Scales the x-axis of the plot automatically. The function works for local x-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisMagndiffplt.DoAutoScaleX()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
DoAutoScaleY
Scales the y-axis of the plot automatically. The function works for local y-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisMagndiffplt.DoAutoScaleY()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
Refresh
Refreshes the plot by attempting to automatically scale both axes.
void VisMagndiffplt.Refresh()
3.6.77 VisOcplot
Overview
AddRelay
AddRelays
Clear
DoAutoScaleX
DoAutoScaleY
Refresh
810
3.6. OTHERS CHAPTER 3. OBJECT METHODS
AddRelay
Adds a relay to the plot and optionally sets the drawing style.
void VisOcplot.AddRelay(object relay,
[double colour,]
[double style,]
[double width])
A RGUMENTS
relay The protection device to be added.
colour (optional)
The colour to be used.
style (optional)
The line style to be used.
width (optional)
The line width to be used.
AddRelays
Adds relays to the plot.
void VisOcplot.AddRelays(set relays)
A RGUMENTS
relays The protection devices (ElmRelay or RelFuse) to be added.
Clear
Removes all protection devices from the plot.
void VisOcplot.Clear()
DoAutoScaleX
Scales the x-axis of the plot automatically. The function works for local x-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisOcplot.DoAutoScaleX()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
DoAutoScaleY
Scales the y-axis of the plot automatically. The function works for local y-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisOcplot.DoAutoScaleY()
811
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
Refresh
Refreshes the plot by attempting to automatically scale both axes.
void VisOcplot.Refresh()
3.6.78 VisPath
Overview
Clear
DoAutoScaleX
DoAutoScaleY
SetAdaptX
SetAdaptY
SetScaleX
SetScaleY
Clear
Removes all curves by clearing table named 'Variables' on page 'Curves'.
void VisPath.Clear()
E XAMPLE
The following example gets the plot and removes all curves.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('Analysis','VisPath',1); ! get plot
if (plot) {
plot.Clear();
}
}
}
DoAutoScaleX
Scales x-axis automatically.
int VisPath.DoAutoScaleX()
R ETURNS
Always 0
812
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example gets the plot and scales the x-axis automatically
object page;
object plot;
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('Analysis','VisPath',1); ! get plot
if (plot) {
plot.DoAutoScaleX();
}
}
}
DoAutoScaleY
Scales y-axis automatically.
int VisPath.DoAutoScaleY()
R ETURNS
Always 0
E XAMPLE
The following example gets the plot and scales the x-axis automatically
object page;
object graphBoard;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('Analysis','VisPath',1); ! get plot
if (plot) {
plot.DoAutoScaleY();
}
}
}
SetAdaptX
Sets the Adapt Scale option of the x-scale.
void VisPath.SetAdaptX(int mode)
A RGUMENTS
mode Possible values:
0 off
1 on
813
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example gets the plot and sets Adapt Scale of the x-axis to On
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('Analysis','VisPath',1); ! get plot
if (plot) {
plot.SetAdaptX(1);
}
}
}
SetAdaptY
Sets the Adapt Scale option of the x-scale.
void VisPath.SetAdaptY(int mode)
A RGUMENTS
mode Possible values:
0 off
1 on
E XAMPLE
The following example gets the plot and sets Adapt Scale of the y-axis to On
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('Analysis','VisPath',1); ! get plot
if (plot) {
plot.SetAdaptY(1);
}
}
}
SetScaleX
Sets x-axis scale.
void VisPath.SetScaleX(double min,
double max
)
814
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
min Minimum of x-scale.
max Maximum of x-scale.
E XAMPLE
The following example sets the minimum to 1 and maximum to 10.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('Analysis','VisPath',1); ! get plot
if (plot) {
plot.SetScaleX(1,10);
}
}
}
SetScaleY
Sets y-axis scale limits.
void VisPath.SetScaleY (double min,
double max,
[int log]
)
A RGUMENTS
min Minimum of y-scale.
max Maximum of y-scale.
log (optional)
Possible values:
0 linear
1 logarithmic
E XAMPLE
The following example gets the plot and sets the y-axis scale to a logarithmic scale in the
range of [1,1000]
object page;
object graphBoard;
object plot;
object scale;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Distortion
if (page) {
plot=page.GetVI('Analysis','VisPath',1); ! get distortion analysis plot
if (plot) {
815
3.6. OTHERS CHAPTER 3. OBJECT METHODS
plot.SetScaleY(1.,1000.,1);
}
}
}
3.6.79 VisPcompdiffplt
Overview
AddRelay
AddRelays
CentreOrigin
Clear
DoAutoScaleX
DoAutoScaleY
AddRelay
Adds a relay to the plot and optionally sets the drawing style.
void VisPcompdiffplt.AddRelay(object relay,
[double colour,]
[double style,]
[double width])
A RGUMENTS
relay The protection device to be added.
colour (optional)
The colour to be used.
style (optional)
The line style to be used.
width (optional)
The line width to be used.
AddRelays
Adds relays to the plot.
void VisPcompdiffplt.AddRelays(set relays)
A RGUMENTS
relays The protection devices (ElmRelay or RelFuse) to be added.
CentreOrigin
Centre the origin of the plot
void VisPcompdiffplt.CentreOrigin()
816
3.6. OTHERS CHAPTER 3. OBJECT METHODS
Clear
Removes all protection devices from the plot.
void VisPcompdiffplt.Clear()
DoAutoScaleX
Scales the x-axis of the plot automatically. The function works for local x-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisPcompdiffplt.DoAutoScaleX()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
DoAutoScaleY
Scales the y-axis of the plot automatically. The function works for local y-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisPcompdiffplt.DoAutoScaleY()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
3.6.80 VisPlot
Overview
AddResVars
AddVars
Clear
DoAutoScaleX
DoAutoScaleY
GetDataSource
GetIntCalcres
GetScaleObjX
GetScaleObjY
SetAdaptX
SetAdaptY
SetAutoScaleX
SetAutoScaleY
SetCrvDesc
SetDefScaleX
SetDefScaleY
SetScaleX
SetScaleY
SetXVar
817
3.6. OTHERS CHAPTER 3. OBJECT METHODS
AddResVars
Appends variables to the plot. Variables which are already in the plot are not added.
void VisPlot.AddResVars(object elmRes,
object element,
string varname
)
A RGUMENTS
elmRes Result object, classname ElmRes.
elememt Element to add.
varname Variable name.
E XAMPLE
The following examples looks for a plot and adds a variable.
object graphBoard;
object page;
object plot;
object resObj;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
resObj = GetFromStudyCase('*.ElmRes');
plot.AddResVars(resObj, line,'c:loading');
}
}
}
AddVars
Appends variables to the plot. Variables which are already in the plot are not added.
void VisPlot.AddVars(object element,
string varname
)
A RGUMENTS
elememt Element to add.
varname Variable name.
E XAMPLE
The following examples looks for a plot and adds a variable.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'voltage'
818
3.6. OTHERS CHAPTER 3. OBJECT METHODS
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.AddVars(line,'c:loading');
}
}
}
Clear
Removes all curves from plot.
void VisPlot.Clear()
E XAMPLE
The following example gets the plot and removes all curves.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.Clear();
}
}
}
DoAutoScaleX
Scales x-axis automatically.
int VisPlot.DoAutoScaleX()
R ETURNS
0 Ok, call to DoAutoScaleX() was successfull
1 Failed, because the x-scale is not local
E XAMPLE
The following example gets the plot and scales the x-axis automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('U','VisPlot',1); ! get plot
if (plot) {
plot.DoAutoScaleX();
819
3.6. OTHERS CHAPTER 3. OBJECT METHODS
}
}
}
DoAutoScaleY
Scales y-axis automatically.
int VisPlot.DoAutoScaleY()
R ETURNS
0 Ok, call to DoAutoScaleY() was successfull
1 Failed, because the y-scale is not local
E XAMPLE
The following example gets the plot and scales the y-axis automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('U','VisPlot',1); ! get plot
if (plot) {
plot.DoAutoScaleY();
}
}
}
GetDataSource
Get data source for curve with index
object VisPlot.GetDataSource(int curveIndex)
A RGUMENTS
int curveIndex
Possible values:
<0 invalid
≥0 curve index in table
R ETURNS
object Data source
NULL No data source found
E XAMPLE
The following example looks for a plot and gets the data source for the first curve.
820
3.6. OTHERS CHAPTER 3. OBJECT METHODS
object dataSource;
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
dataSource = plot.GetDataSource(0);
}
}
}
GetIntCalcres
Gets all user Calculated Result objects (IntCalcres) stored inside plot
set VisPlot.GetIntCalcres()
R ETURNS
All Calculated Result objects (IntCalcres) stored inside plot.
GetScaleObjX
Gets the object used for scaling the x-axis.
object VisPlot.GetScaleObjX()
R ETURNS
this object In case that 'Use local Axis' is set to 'Local'.
the virtual instrument panel In case that 'Use local axis' is set to 'Current Page'.
the graphics board In case that 'Use local axis' is set to 'Graphics Board'.
E XAMPLE
The following example gets the object specifying the x-scale of plot.
object page;
object graphBoard;
object plot;
object scaleObjX;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
scaleObjX = plot.GetScaleObjX();
scaleObjX.ShowFullName();
}
}
}
821
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetScaleObjY
Gets the object used for scaling the y-axis.
object VisPlot.GetScaleObjY()
R ETURNS
this object In case that 'Use local Axis' is enabled.
the plot type In case that 'Use local axis' is disabled.
E XAMPLE
The following example gets the object specifying the y-scale of the plot.
object page;
object graphBoard;
object plot;
object scaleObjY;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
scaleObjY = plot.GetScaleObjY();
scaleObjY.ShowFullName();
}
}
}
SetAdaptX
Sets the Adapt Scale option of the local x-scale.
void VisPlot.SetAdaptX(int mode,
[double trigger]
)
A RGUMENTS
mode Possible values:
0 off
1 on
trigger (optional)
Trigger value, unused if mode is off or empty
E XAMPLE
The following example looks for a plot and sets its adapt scale option.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
822
3.6. OTHERS CHAPTER 3. OBJECT METHODS
if (plot) {
plot.SetAdaptX(1,3); ! Turn on adapt scale, use a trigger value of 3
plot.SetAdaptX(0,3); ! Turn off adapt scale
plot.SetAdaptX(1); ! Turn on adapt scale again, do not change the trigger value
}
}
}
SetAdaptY
Sets the Adapt Scale option of the local y-scale.
void VisPlot.SetAdaptY(int mode,
[double offset]
)
A RGUMENTS
mode Possible values:
0 off
1 on
offset (optional)
Offset value, unused if mode is off or empty
E XAMPLE
The following example looks for a plot and sets its adapt scale option.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetAdaptY(1,3); ! Turn on adapt scale, use an offset value of 3
plot.SetAdaptY(0,3); ! Turn off adapt scale
plot.SetAdaptY(1); ! Turn on adapt scale again, do not change the offset value
}
}
}
SetAutoScaleX
Sets Auto Scale setting of the x-scale. The scale is automatic set to local, in case that the plot
is using the scale of the graphics board or the virtual instrument panel.
void VisPlot.SetAutoScaleX(int mode)
823
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
mode Possible values:
0 never
1 after simulation
2 during simulation
E XAMPLE
The following example gets the plot and sets the Auto Scale option of the x-axis to On.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetAutoScaleX(1);
}
}
}
SetAutoScaleY
Sets Auto Scale setting of the y-scale. The scale is automatic set to local, in case that the plot
is using the scale of the plot type.
void VisPlot.SetAutoScaleY(int mode)
A RGUMENTS
mode Possible values:
0 never
1 after simulation
2 during simulation
E XAMPLE
The following example gets the plot and sets the Auto Scale option of the y-axis to On.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetAutoScaleY(1);
}
}
}
824
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetCrvDesc
Sets the user defined description of a curve.
void VisPlot.SetCrvDesc(int curveIndex,
string curveDescription
)
A RGUMENTS
curveIndex
Curve index; first curve in table is index 1.
curveDescription
Description to set.
E XAMPLE
The following example gets a plot and sets the description of the first variable to example.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('Plot','VisPlot',1); ! get plot
if (plot) {
plot.SetCrvDesc(1,'example');
}
}
}
SetDefScaleX
Sets the x-scale to be used to the graphics board.
void VisPlot.SetDefScaleX()
E XAMPLE
The following example gets the plot and sets the x-scale to the graphics board.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetDefScaleX();
}
}
}
825
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetDefScaleY
Sets the y-scale to be used to the plot type.
void VisPlot.SetDefScaleY()
E XAMPLE
The following example gets the plot and sets the y-scale to the plot type.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetDefScaleY();
}
}
}
SetScaleX
Sets the local x-axis scale. A function call without arguments sets the Auto Scale setting to On
without changing the scale itself.
void VisPlot.SetScaleX()
void VisPlot.SetScaleX(double min,
double max,
[int log]
)
A RGUMENTS
min (optional)
Minimum of x-scale.
max (optional)
Maximum of x-scale.
log (optional)
Possible values:
0 linear
1 logarithmic
E XAMPLE
The following examples look for a Subplot named 'RST' and set its x-scale. There are three
different examples. 1. Example: Set x-axis to local and change 'Auto Scale' of x axis to 'On'.
2. Example: Set minimum to 0 and maximum to 20. 3. Example: Set minimum to 1 and
maximum to 1000. Changes to a logarithmic scale.
! Set Auto Scale to On
object graphBoard;
object page;
object plot;
826
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetScaleY
Sets the local y-axis scale. A function call without arguments sets the Auto Scale setting to On
without changing the scale itself.
void VisPlot.SetScaleY()
void VisPlot.SetScaleY(double min,
double max,
[int log]
)
A RGUMENTS
min (optional)
Minimum of y-scale.
827
3.6. OTHERS CHAPTER 3. OBJECT METHODS
max (optional)
Maximum of y-scale.
log (optional)
Possible values:
0 linear
1 logarithmic
E XAMPLE
The following examples look for a Subplot named 'RST' and set its y-scale. There are three
different examples. 1. Example: Set y-axis to local and change 'Auto Scale' of y axis to 'On'.
2. Example: Set minimum to 0 and maximum to 20. 3. Example: Set minimum to 1 and
maximum to 1000. Changes to a logarithmic scale.
! Set Auto Scale to On
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot named RST
if (plot) {
plot.SetScaleY(); ! set auto scale mode to On
}
}
}
828
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetXVar
Sets the local x-axis variable. If The default x-axis variable (time) is set if no argument is
passed.
void VisPlot.SetXVar()
void VisPlot.SetXVar(object obj,
string varname
)
A RGUMENTS
obj (optional)
x-axis object
varname (optional)
variable of obj
E XAMPLE
The following examples look for a subplot named RST and set its x-axis variable. The first
example sets an user defined x-axis variable of the plot. The second one sets the default
x-axis variable (time).
! set x-axis variable 'm:U1:bus1' of object line
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetXVar(line,'m:U1:bus1'); ! Set x-scale variable
}
}
}
! set default x-axis variable
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetXVar(); ! Set default x-scale variable (time)
}
}
}
829
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.81 VisPlot2
Overview
AddResVars
AddVars
Clear
DoAutoScaleX
DoAutoScaleY2
DoAutoScaleY
GetDataSource
GetScaleObjX
GetScaleObjY
SetAdaptX
SetAdaptY
SetAutoScaleX
SetAutoScaleY
SetCrvDesc
SetDefScaleX
SetDefScaleY
SetScaleX
SetScaleY
SetXVar
ShowY2
AddResVars
Appends variables to the plot. Variables which are already in the plot are not added.
void VisPlot2.AddResVars(object elmRes,
object element,
string varname,
[int y2 = 1]
)
A RGUMENTS
elmRes Result object, classanme ElmRes
elememt Element to add
varname Variable name
y2 (optional)
Possible values:
1 y1-axis, default value
2 y2 axis
E XAMPLE
The following examples looks for a plot and adds a variable to the second y axis
object graphBoard;
object page;
object plot;
object resObj;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'voltage'
830
3.6. OTHERS CHAPTER 3. OBJECT METHODS
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
resObj = GetFromStudyCase('*.ElmRes');
plot.AddResVars(resObj, line,'c:loading',2);
}
}
}
AddVars
Appends variables to the plot. Variables which are already in the plot are not added.
void VisPlot2.AddVars(object element,
string varname,
[int y2 = 1]
)
A RGUMENTS
elememt Element to add
varname Variable name
y2 (optional)
Possible values:
E XAMPLE
The following examples looks for a plot and adds a variable to the second y axis
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.AddVars(line,'c:loading',2);
}
}
}
Clear
Removes variables from plot
void VisPlot2.Clear([int y2])
831
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
y2 (optional)
Possible values:
1 y1-axis, default value
2 y2 axis
E XAMPLE
The following example looks for a plot and removes all variables of y2 from plot
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.Clear(2);
}
}
}
DoAutoScaleX
Scales x-axis automatically.
int VisPlot2.DoAutoScaleX()
R ETURNS
0 Ok, call to DoAutoScaleX() was successfull
1 Failed, because the x-scale is not local
E XAMPLE
The following example gets the plot and scales the x-axis automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('U','VisPlot2',1); ! get plot
if (plot) {
plot.DoAutoScaleX();
}
}
}
832
3.6. OTHERS CHAPTER 3. OBJECT METHODS
DoAutoScaleY2
Scales y2-axis automatically.
int VisPlot2.DoAutoScaleY2()
R ETURNS
0 Ok, call to DoAutoScaleY() was successfull
1 Failed, because the y-scale is not local
E XAMPLE
The following example gets the plot and scales the y1-axis automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.DoAutoScaleY2();
}
}
}
DoAutoScaleY
Scales y1-axis automatically.
int VisPlot2.DoAutoScaleY()
R ETURNS
0 Ok, call to DoAutoScaleY() was successfull
1 Failed, because the y-scale is not local
E XAMPLE
The following example gets the plot and scales the y1-axis automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.DoAutoScaleY();
}
}
}
833
3.6. OTHERS CHAPTER 3. OBJECT METHODS
GetDataSource
Get data source for curve with index
object VisPlot.GetDataSource(int curveIndex, int yaxis)
A RGUMENTS
int curveIndex
Possible values:
<0 invalid
≥0 curve index in table
int yaxis Possible values:
1 y1 axis
2 y2 axis
R ETURNS
object Data source
NULL No data source found
E XAMPLE
The following example looks for a plot and gets the data source for the first curve of y2 axis.
object dataSource;
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
dataSource = plot.GetDataSource(0,2);
}
}
}
GetScaleObjX
Gets the object used for scaling the x-axis.
object VisPlot2.GetScaleObjX()
R ETURNS
this object In case that 'Use local Axis' is set to 'Local'.
the virtual instrument panel In case that 'Use local axis' is set to 'Current Page'.
the graphics board In case that 'Use local axis' is set to 'Graphics Board'.
834
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example gets the object specifying the x-scale of plot.
object page;
object graphBoard;
object plot;
object scaleObjX;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
scaleObjX = plot.GetScaleObjX();
scaleObjX.ShowFullName();
}
}
}
GetScaleObjY
Returns used object defining y-scale. The returned object is either the plot itself or the plot type
(IntPlot).
object VisPlot2.GetScaleObjY ([int y2])
R ETURNS
this object In case that 'Use local Axis' is enabled.
the plot type In case that 'Use local axis' is disabled.
E XAMPLE
The following examples look for a Subplot named ’RST’and get the used y2-scale object.
object page;
object graphBoard;
object plot;
object scale;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
scale=plot.GetScaleObjY(2);
scale.ShowFullName();
}
}
}
835
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetAdaptX
Sets the Adapt Scale option of the local x-scale.
void VisPlot2.SetAdaptX(int mode,
[double trigger]
)
A RGUMENTS
mode Possible values:
0 off
1 on
trigger (optional)
Trigger value, unused if mode is off or empty
E XAMPLE
The following example looks for a plot and sets its adapt scale option.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.SetAdaptX(1,3); ! Turn on adapt scale, use a trigger value of 3
plot.SetAdaptX(0,3); ! Turn off adapt scale
plot.SetAdaptX(1); ! Turn on adapt scale again, do not change the trigger value
}
}
}
SetAdaptY
Sets the Adapt Scale option of the local y-scale.
void VisPlot2.SetAdaptY(int mode,
[double offset,]
[int y2]
)
A RGUMENTS
mode Possible values:
0 off
1 on
offset (optional)
Offset value, unused if mode is off or empty
y2 (optional)
Possible values:
1 y1-axis, default value
2 y2 axis
836
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example looks for a plot and sets the adapt scale option of y2 to 1, trigger value
is 4
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.SetAdaptY(1,4,2);
}
}
}
SetAutoScaleX
Sets Auto Scale setting of the x-scale. The scale is automatic set to local, in case that the plot
is using the scale of the graphics board or the virtual instrument panel.
void VisPlot2.SetAutoScaleX(int mode)
A RGUMENTS
mode Possible values:
0 never
1 after simulation
2 during simulation
E XAMPLE
The following example gets the plot and sets the Auto Scale option of the x-axis to On.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetAutoScaleX(1);
}
}
}
837
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetAutoScaleY
Sets automatic scaling mode of the y-scale. The axis given in the second argument is automat-
ically set to local.
void VisPlot2.SetAutoScaleY (int mode,
[int y2]
)
A RGUMENTS
mode Possible values:
0 never
1 after simulation
2 during simulation
y2 (optional)
Possible values:
1 y1-axis, default value
2 y2 axis
E XAMPLE
The following example looks for a and change its auto scale mode to Online
object graphBoard;
object page;
object plot;
! Look for opened graphics board.
graphBoard=GetGraphicsBoard();
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.SetAutoScaleY(2); ! Turn off automatic scaling of y-scale
}
}
}
SetCrvDesc
Sets the user defined description of a curve.
void VisPlot2.SetCrvDesc(int curveIndex, string curveDescription)
A RGUMENTS
curveIndex
Curve index; first curve in table is index 1.
curveDescription
Description to set
838
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example gets a plot and sets the description of the first variable to example.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('Plot','VisPlot2',1); ! get plot
if (plot) {
plot.SetCrvDesc(1,'example');
}
}
}
SetDefScaleX
Sets the x-scale to be used to the graphics board.
void VisPlot2.SetDefScaleX()
E XAMPLE
The following example gets the plot and sets the x-scale to the graphics board.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.SetDefScaleX();
}
}
}
SetDefScaleY
Sets the y-scale to be used to the plot type.
void VisPlot2.SetDefScaleY([int y2])
A RGUMENTS
y2 (optional)
Possible values:
839
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example gets the plot and sets the y-scale to the plot type.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.SetDefScaleY(1);
}
}
}
SetScaleX
Sets the local x-axis scale. A function call without arguments sets the Auto Scale setting to On
without changing the scale itself.
void VisPlot.SetScaleX()
void VisPlot.SetScaleX(double min,
double max,
[int log]
)
A RGUMENTS
min (optional)
Minimum of x-scale.
max (optional)
Maximum of x-scale.
log (optional)
Possible values:
0 linear
1 logarithmic
E XAMPLE
The following examples look for a and sets its x-scale. There are three different examples.
1. Example: Set x-axis to local and change 'Auto Scale' of x axis to 'On'. 2. Example: Set
minimum to 0 and maximum to 20. 3. Example: Set minimum to 1 and maximum to 1000.
Changes to a logarithmic scale.
! Set Auto Scale to On
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot named RST
if (plot) {
840
3.6. OTHERS CHAPTER 3. OBJECT METHODS
SetScaleY
Sets scale of y-axis. Calling the function without any argument sets the Auto Scale option for
the y axis (both share the same setting) to On.
void VisPlot2.SetScaleY()
void VisPlot2.SetScaleY(double min,
double max,
[int log,]
[int Y2]
)
A RGUMENTS
min (optional)
Minimum of y-scale.
max (optional)
Maximum of y-scale.
log (optional)
Possible values:
841
3.6. OTHERS CHAPTER 3. OBJECT METHODS
0 linear
1 logarithmic
y2 (optional)
Possible values:
1 y1-axis, default value
2 y2 axis
E XAMPLE
The following examples looks for a plotand sets its y1 scale to [1,1000] and log.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot',1); ! get plot
if (plot) {
plot.SetScaleY(1,1000,1,1);
}
}
}
SetXVar
Sets the local x-axis variable. If The default x-axis variable (time) is set if no argument is
passed.
void VisPlot2.SetXVar()
void VisPlot2.SetXVar(object obj,
string varname
)
A RGUMENTS
obj (optional)
x-axis object
varname (optional)
variable of obj
E XAMPLE
The following examples look for a plot and set its x-axis variable. The first example sets
an user defined x-axis variable of the plot. The second one sets the default x-axis variable
(time).
! set x-axis variable 'm:U1:bus1' of object line
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
842
3.6. OTHERS CHAPTER 3. OBJECT METHODS
ShowY2
Enables or disables the y2 axis.
void VisPlot2.ShowY2([int show])
A RGUMENTS
show (optional)
Possible values:
0 hide y2 axis
1 show y2 axis (default)
E XAMPLE
The following example looks for a plot and hides the y2 axis.
object graphBoard;
object page;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open desktop.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! Get panel named 'Voltage'
if (page) {
plot=page.GetVI('RST','VisPlot2',1); ! get plot
if (plot) {
plot.ShowY2(0);
}
}
}
843
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.82 VisPlottz
Overview
AddRelay
AddRelays
Clear
DoAutoScaleX
DoAutoScaleY
AddRelay
Adds a relay to the plot and optionally sets the drawing style.
void VisPlottz.AddRelay(object relay,
[double colour,]
[double style,]
[double width])
A RGUMENTS
relay The protection device to be added.
colour (optional)
The colour to be used.
style (optional)
The line style to be used.
width (optional)
The line width to be used.
AddRelays
Adds relays to the plot.
void VisPlottz.AddRelays(set relays)
A RGUMENTS
relays The protection devices (ElmRelay or RelFuse) to be added.
Clear
Removes all protection devices from the plot.
void VisPlottz.Clear()
DoAutoScaleX
Scales the x-axis of the plot automatically. The function works for local x-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisPlottz.DoAutoScaleX()
844
3.6. OTHERS CHAPTER 3. OBJECT METHODS
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
DoAutoScaleY
Scales the y-axis of the plot automatically. The function works for local y-scales only. If the
x-scale is not local a warning is shown in the output window and 1 is returned by the function.
int VisPlottz.DoAutoScaleY()
R ETURNS
0 Automatic scaling was executed.
1 An Error occurred.
3.6.83 VisVec
Overview
CentreOrigin
CentreOrigin
Centre the origin of the plot
void VisVec.CentreOrigin()
3.6.84 VisVecres
Overview
CentreOrigin
CentreOrigin
Centre the origin of the plot
void VisVecres.CentreOrigin()
845
3.6. OTHERS CHAPTER 3. OBJECT METHODS
3.6.85 VisXyplot
Overview
Clear
DoAutoScaleX
DoAutoScaleY
GetDataSource
SetCrvDescX
SetCrvDescY
Clear
Removes all curves from plot.
void VisXyplot.Clear()
E XAMPLE
The following example gets the plot and removes all curves.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Current',1); ! get panel
if (page) {
plot=page.GetVI('RST','VisXyplot',1); ! get plot
if (plot) {
plot.Clear();
}
}
}
DoAutoScaleX
Scales all used x-axes automatically.
int VisXyplot.DoAutoScaleX()
R ETURNS
0 Ok, call to DoAutoScaleX() was successfull
1 Failed, because the x-scales are not local
E XAMPLE
The following example gets the plot and scales the x-axes automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('U','VisXyplot',1); ! get plot
846
3.6. OTHERS CHAPTER 3. OBJECT METHODS
if (plot) {
plot.DoAutoScaleX();
}
}
}
DoAutoScaleY
Scales all used y-axes automatically.
int VisXyplot.DoAutoScaleY()
R ETURNS
0 Ok, call to DoAutoScaleX() was successfull
1 Failed, because the x-scales are not local
E XAMPLE
The following example gets the plot and scales the y-axes automatically
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named 'Voltage'
if (page) {
plot=page.GetVI('U','VisXyplot',1); ! get plot
if (plot) {
plot.DoAutoScaleY();
}
}
}
GetDataSource
Get data source for curve with index
object VisXyplot.GetDataSource(int curveIndex)
A RGUMENTS
int curveIndex
Possible values:
<0 invalid
≥0 curve index in table
R ETURNS
object Data source
NULL No data source found
847
3.6. OTHERS CHAPTER 3. OBJECT METHODS
E XAMPLE
The following example looks for a plot and gets the data source for the first curve.
object dataSource;
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Voltage',1); ! get panel named Voltage
if (page) {
plot=page.GetVI('RST','VisXyplot',1); ! get plot
if (plot) {
dataSource = plot.GetDataSource(0);
}
}
}
SetCrvDescX
Sets the user defined description of a curve for the x-variable.
void VisXyplot.SetCrvDescX(int curveIndex, string curveDescription)
A RGUMENTS
curveIndex
Curve index; first curve in table is index 1.
curveDescription
Description to set
E XAMPLE
The following example gets a plot and sets the description of the first variable to example.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Current',1); ! get panel
if (page) {
plot=page.GetVI('Plot','VisXyplot',1); ! get plot
if (plot) {
plot.SetCrvDescX(1,'xvalue');
}
}
}
SetCrvDescY
Sets the user defined description of a curve for the y-variable.
void VisXyplot.SetCrvDescY(int curveIndex, string curveDescription)
848
3.6. OTHERS CHAPTER 3. OBJECT METHODS
A RGUMENTS
curveIndex
Curve index; first curve in table is index 1.
curveDescription
Description to set
E XAMPLE
The following example gets a plot and sets the description of the first variable to example.
object page;
object graphBoard;
object plot;
graphBoard=GetGraphicsBoard(); ! Look for open graphics board.
if (graphBoard) {
page=graphBoard.GetPage('Current',1); ! get panel
if (page) {
plot=page.GetVI('Plot','VisXyplot',1); ! get plot
if (plot) {
plot.SetCrvDescY(1,'yvalue');
}
}
}
849
CHAPTER 4. SET ROUTINES
4 Set Routines
Overview
Add*
Clear*
Count*
First*
FirstFilt*
IsIn*
MarkInGraphics
Next*
NextFilt*
Obj*
OutputFlexibleData*
Remove*
ShowModalBrowser
ShowModalSelectBrowser
ShowModelessBrowser
SortToClass*
SortToName*
SortToVar*
Add*
Adds an object or all objects from a set to the set.
An object is only added if not already contained.
int set.Add(object obj)
int set.Add(set objects)
A RGUMENTS
obj Object to add.
objects Set of objects to add.
R ETURNS
0 On success.
6= 0 On error, e.g. object is already contained in the set.
S EE ALSO
set.IsIn(), set.Remove()
E XAMPLE
The following example collects all not selected lines.
850
CHAPTER 4. SET ROUTINES
Clear*
Removes all objects from the set.
void set.Clear()
S EE ALSO
set.Remove()
Count*
Returns the number of objects in the set.
int set.Count()
R ETURNS
The number (≥ 0) of objects in the set.
E XAMPLE
The following example outputs the number of calculation relevant lines (in an active project).
int n;
set lines;
lines = GetCalcRelevantObjects('ElmLne');
n = lines.Count();
printf('There are %d calculation relevant line elements inside active project', n);
First*
Returns the first object in the set.
object set.First()
R ETURNS
6= NULL First object in set.
NULL Set is empty.
851
CHAPTER 4. SET ROUTINES
S EE ALSO
E XAMPLE
The following example writes the full names of all lines in the general selection to the output
window.
set lines;
object line;
lines = SEL.AllLines();
line = lines.First();
while (line) {
line.ShowFullName();
line = lines.Next();
}
FirstFilt*
Returns the first object from the set which name matches the filter.
The filter describes an object name (case-sensitive, optionally including a class name) and can
contain the following wildcards:
A RGUMENTS
filter Object name filter, possibly containing wildcards.
R ETURNS
6= NULL The first object matching the filter.
NULL No object matches the filter.
S EE ALSO
E XAMPLE
The following example writes all two and three winding transformers (class name ElmTr2 and
ElmTr3) whose names start with a 'T' to the output window.
852
CHAPTER 4. SET ROUTINES
set transformers;
object transformer;
transformers = GetCalcRelevantObjects();
transformer = transformers.FirstFilt('T*.ElmTr?');
while (transformer) {
transformer.ShowFullName();
transformer = transformers.NextFilt();
}
IsIn*
Checks if the set contains given object.
int set.IsIn(object obj)
A RGUMENTS
obj Object to check.
R ETURNS
0 Object is not contained.
1 Object is contained.
For NULL, the result is always 0.
S EE ALSO
set.Add(), set.Remove()
E XAMPLE
See set.Add().
MarkInGraphics
This function is deprecated. Please use MarkInGraphics() instead.
void set.MarkInGraphics([int searchAllDiagramsAndSelect])
Next*
Returns the next object in the set.
object set.Next()
R ETURNS
6= NULL Next object in set.
NULL Last object has been reached.
S EE ALSO
set.First()
853
CHAPTER 4. SET ROUTINES
E XAMPLE
See set.First().
NextFilt*
Returns the next object from the set which name matches the filter given in set.FirstFilt().
int set.NextFilt()
R ETURNS
6= NULL Next object matching the filter.
NULL No next object matches the filter.
S EE ALSO
E XAMPLE
See set.FirstFilt().
Obj*
Returns the object at the given index in the set.
int set.Obj(int index)
A RGUMENTS
index the index of the object.
R ETURNS
The object at the given index in the set, when 'index'is in range, NULLotherwise.
OutputFlexibleData*
This function is deprecated. Please use OutputFlexibleData() instead.
void set.OutputFlexibleData([string flexibleDataPage = ''])
Remove*
Removes an object from the set.
int set.Remove(object obj)
A RGUMENTS
obj Object to remove.
R ETURNS
0 On success.
1 On error.
854
CHAPTER 4. SET ROUTINES
S EE ALSO
set.Add(), set.IsIn()
E XAMPLE
The following example removes all lines shorter than 1km from a set.
set lines;
object line;
double length;
lines = SEL.AllLines();
line = lines.First();
while (line) {
length = line:dline;
if (line < 1) {
lines.Remove(line);
}
line = lines.Next();
}
ShowModalBrowser
This function is deprecated. Please use ShowModalBrowser() instead.
void set.ShowModalBrowser([int detailMode = 0,]
[string title = '',]
[string page = ''])
ShowModalSelectBrowser
This function is deprecated. Please use ShowModalSelectBrowser() instead.
set set.ShowModalSelectBrowser([string title,]
[string classFilter,])
ShowModelessBrowser
This function is deprecated. Please use ShowModelessBrowser() instead.
void set.ShowModelessBrowser([int detailMode = 0,]
[string title = '',]
[string page = ''])
SortToClass*
Sorts the objects in the set according their class names.
void set.SortToClass(int descending)
A RGUMENTS
descending
0 Sorts ascending A. . . Z.
1 Sorts descending Z. . . A.
855
CHAPTER 4. SET ROUTINES
E XAMPLE
The following example writes all lines and terminals to the output window, ascending sorted
according their class names.
set objects;
object obj;
objects = GetCalcRelevantObjects('*.ElmLne, *.ElmTerm');
objects.SortToClass(0);
obj = objects.First();
while (obj) {
obj.ShowFullName();
obj = objects.Next();
}
SortToName*
Sorts the objects in the set according their names ('loc name').
int set.SortToName(int descending)
A RGUMENTS
descending
0 Sorts ascending A. . . Z.
1 Sorts descending Z. . . A.
E XAMPLE
The following example writes all lines and terminals to the output window, ascending sorted
according their names.
set objects;
object obj;
objects = GetCalcRelevantObjects('*.ElmLne, *.ElmTerm');
objects.SortToName(0);
obj = objects.First();
while (obj) {
obj.ShowFullName();
obj = objects.Next();
}
SortToVar*
Sorts the objects in the set according the values of the given variable names.
The frist variable name defines the principle sorting. Each further variable name defines a
sub-sorting.
void set.SortToVar(int descending,
string variable1,
[...,]
[string variable5]
)
856
CHAPTER 4. SET ROUTINES
A RGUMENTS
descending
0 Sorts ascending.
1 Sorts descending.
variable1 Variable name of principle sorting.
E XAMPLE
The following example writes all lines to the output window, sorted by derating factor and
length.
set lines;
object line;
lines = GetCalcRelevantObjects('*.ElmLne');
lines.SortToVar(0, 'fline', 'dline');
line = lines.First();
while (line) {
printf('%10s %f %f', line:loc_name, line:fline, line:dline);
line = lines.Next();
}
857
Index
abs AddCurve
Mathematical Functions, 71 ComTablereport, 503
acos PltDataseries, 766
Mathematical Functions, 71 AddDouble
Activate IntAddonvars, 641
ElmNet, 224 AddDoubleMatrix
IntCase, 646 IntAddonvars, 641
IntLibrary, 693 AddDoubleVector
IntPrj, 711 IntAddonvars, 642
IntScenario, 739 AddEvent
IntScensched, 743 IntRas, 726
IntScheme, 745 AddHeader
IntSscheduler, 746 ComTablereport, 503
IntSstage, 747 AddInteger
ActivateProject IntAddonvars, 643
Global Functions, 4 AddIntegerVector
ActiveCase IntAddonvars, 643
Global Functions, 12 AddInvisibleFilter
ActiveProject ComTablereport, 504
Global Functions, 10 AddListFilter
AdaptWidth ComTablereport, 504
IntGrflayer, 684 AddListFilterEntries
SetLevelvis, 587 ComTablereport, 505
Add AddMultiListFilter
Set Routines, 850 ComTablereport, 505
AddBreaker AddObject
StaCubic, 311 IntAddonvars, 644
AddButton IntReport, 727
ComTablereport, 501 AddObjects
AddCalcRelevantCoincidenceDefinitions IntReport, 728
SetLvscale, 590 AddObjectVector
AddCellAction IntAddonvars, 644
ComTablereport, 501 AddObjs
AddCntcy VisBdia, 797
ComSimoutage, 492 AddPage
AddColumn SetDesktop, 578
ComTablereport, 502 AddPlot
AddConfiguration ComTablereport, 506
SetDataext, 575 AddProjectToCombined
AddContingencies IntPrj, 711
ComSimoutage, 493 AddProjectToRemoteDatabase
AddCopy IntPrj, 711
General Object Methods, 141 AddRas
AddCubicle ComSimoutage, 493
ElmBoundary, 192 AddRatio
858
INDEX INDEX
859
INDEX INDEX
asin CalcElParams
Mathematical Functions, 71 TypAsmo, 791
AssignCimRdfIds CalcEstimatedPaybackPeriod
ComGridtocim, 446 ComTececocmp, 554
AssumeCompensationFactor CalcInternalRateOfReturn
RelZpol, 778 ComTececocmp, 554
AssumeReRl CalcMaxHostedPower
RelZpol, 778 ComHostcap, 449
AssumeXeXl CalcShiftedReversedBoundary
RelZpol, 778 ElmBoundary, 192
atan2 CalculateCheckSum
Mathematical Functions, 72 BlkDef, 615
atan CalculateInterchangeTo
Mathematical Functions, 72 ElmArea, 177
ElmNet, 225
BeginDataExtensionModification ElmZone, 306
IntPrj, 712 CalculateMaxFaultCurrents
BinaryAnd ElmRelay, 231
Mathematical Functions, 72 CalculateVoltageLevel
BinaryOr ElmArea, 177
Mathematical Functions, 73 ElmNet, 225
BlkDef, 614 ElmZone, 307
CalculateCheckSum, 615 CalculateVoltInterVolt
Check, 614 ElmArea, 177
Compile, 615 ElmNet, 226
Encrypt, 615 ElmZone, 307
GetCheckSum, 615 CalcWeibullPar
Pack, 615 Mathematical Functions, 73
PackAsMacro, 616 CanAddProjectToRemoteDatabase
ResetThirdPartyModule, 616 IntPrj, 712
SetThirdPartyModule, 616 CanSubscribeProjectReadOnly
BlkSig, 617 IntPrj, 712
GetFromSigName, 617 CanSubscribeProjectReadWrite
GetToSigName, 617 IntPrj, 712
BlockSwitch ceil
ComShctrace, 487 Mathematical Functions, 74
BuildExportStructure CentreOrigin
ComUcteexp, 557 VisDraw, 802
BuildNodeNames VisPcompdiffplt, 816
ComUcteexp, 557 VisVec, 845
VisVecres, 845
CalcAggrVarsInRadFeed ChangeColourPalette
ElmFeeder, 201 PltComplexdata, 765
CalcCluster PltDataseries, 767
SetCluster, 565 ChangeFont
SetDistrstate, 586 IntGrflayer, 684
CalcContributions SetLevelvis, 588
ComRelpost, 480 ChangeFrameAndWidth
CalcDiscountedEstimatedPaybackPeriod SetLevelvis, 588
ComTececocmp, 554 ChangeLayer
CalcEfficiency IntGrflayer, 685
ElmAsm, 181 SetLevelvis, 588
ElmGenstat, 207 ChangeRefPoints
ElmPvsys, 227 IntGrflayer, 686
ElmSym, 269 SetLevelvis, 588
ElmXnet, 304 ChangeStyle
860
INDEX INDEX
861
INDEX INDEX
862
INDEX INDEX
863
INDEX INDEX
864
INDEX INDEX
865
INDEX INDEX
866
INDEX INDEX
867
INDEX INDEX
868
INDEX INDEX
869
INDEX INDEX
870
INDEX INDEX
871
INDEX INDEX
872
INDEX INDEX
873
INDEX INDEX
GetAllUsers GetCellAccessObject
Global Functions, 12 ComTablereport, 513
GetAnalogueDescriptions GetCellAlignment
IntComtrade, 651 ComTablereport, 514
IntComtradeset, 660 GetCellBackgroundColor
GetAttributeEnumerationType ComTablereport, 514
CimModel, 619 GetCellColor
CimObject, 625 ComTablereport, 515
GetAvailableButtons GetCellEditObjects
SetTboxconfig, 603 ComTablereport, 515
GetAvailableGenPower GetCellFontStyle
ElmAsm, 181 ComTablereport, 516
ElmAsmsc, 184 GetCellFormat
ElmGenstat, 208 ComTablereport, 516
ElmPvsys, 229 GetCellHelpText
ElmSym, 270 ComTablereport, 517
GetAxisX GetCellValueType
PltLinebarplot, 770 ComTablereport, 517
PltVectorplot, 775 GetCheckboxCellValue
GetAxisY ComTablereport, 518
PltLinebarplot, 770 GetCheckSum
PltVectorplot, 775 BlkDef, 615
GetBbOrder GetChildren
ElmBbone, 187 General Object Methods, 144
GetBlockedSwitches GetClass
ComShctrace, 488 General Object Methods, 145
GetBorderCubicles GetClassDescription
Global Functions, 12 Global Functions, 14
GetBranch GetClassName
StaCubic, 312 General Object Methods, 145
GetBranches GetClassType
ElmArea, 179 ComCimvalidate, 407
ElmFeeder, 202 GetColouringMode
ElmZone, 308 SetColscheme, 569
SetPath, 593 GetColumnFilter
GetBrowserSelection ComTablereport, 518
Global Functions, 13 GetColumnHeader
GetBuses ComTablereport, 518
ElmArea, 179 GetColumnId
ElmFeeder, 203 ComTablereport, 519
ElmZone, 309 GetColumnLabel
SetPath, 593 IntMat, 695
GetBusType GetColumnLabelIndex
ElmTerm, 274 IntMat, 695
GetCalcRelevantCubicles GetColumnValues
ElmTerm, 274 ElmRes, 244
GetCalcRelevantObjects IntComtrade, 651
Global Functions, 13 IntComtradeset, 660
GetCalcRX GetCombinedProjectSource
ElmRelay, 232 General Object Methods, 145
GetCanvasSize GetCommandsForStudyCase
SetDesktop, 579 ComTasks, 543
GetCaseCommand GetCompleteBbPath
Global Functions, 18 ElmBbone, 188
GetCaseObject GetComplexData
Global Functions, 18 PltVectorplot, 775
874
INDEX INDEX
875
INDEX INDEX
876
INDEX INDEX
877
INDEX INDEX
GetNumberOfRows GetOperationValue
ComTablereport, 521 IntScenario, 741
ElmRes, 249 GetOperator
IntComtrade, 653 General Object Methods, 151
IntComtradeset, 662 GetOrderCode
IntMat, 696 ComUcteexp, 561
GetNumberOfSelectedCells GetOrInsertCurvePlot
ComTablereport, 521 GrpPage, 635
GetNumberOfStudyCases GetOrInsertDiscreteBarPlot
ComTasks, 544 GrpPage, 636
GetNumberOfSwitchEventsForTimeStep GetOrInsertModalAnalysisPlot
ComContingency, 416 GrpPage, 636
GetNumberOfTimeSteps GetOrInsertPlot
ComContingency, 417 SetVipage, 608
GetNumberOfValidationMessages GetOrInsertVectorPlot
ComCimvalidate, 409 GrpPage, 637
GetNumberOfViolations GetOrInsertXYPlot
ScnFreq, 779 GrpPage, 637
ScnFrt, 781 GetOverLoadedBranches
ScnSpeed, 783 ComShc, 485
ScnSync, 785 GetOverLoadedBuses
ScnVar, 787 ComShc, 486
ScnVolt, 789 GetOwner
GetNumProcesses General Object Methods, 151
SetUser, 606 GetPage
GetNumSlave SetDesktop, 580
SetParalman, 590 GetPageLen
GetObj Global Functions, 21
ComContingency, 417 GetParameterCount
ElmRes, 249 CimModel, 619
GetObject CimObject, 627
ComCimvalidate, 410 GetParameterNamespace
ComOutage, 468 CimModel, 620
ElmRes, 250 CimObject, 627
GetObjectCellValue GetParameterValue
ComTablereport, 522 CimModel, 620
GetObjectId CimObject, 628
ComCimvalidate, 410 GetParameterValueAsDouble
GetObjects IntReport, 731
IntReport, 731 GetParameterValueAsInteger
IntScenario, 741 IntReport, 731
IntSubset, 752 GetParameterValueAsString
GetObjectsReferencingThis IntReport, 732
CimObject, 626 GetParent
GetObjectsWithSameId General Object Methods, 151
CimObject, 626 GetPathFolder
GetObjectValue SetPath, 593
ElmRes, 250 GetPathToNearestBusbar
IntComtrade, 653 StaCubic, 315
IntComtradeset, 662 GetPfObjects
GetObjs CimObject, 628
ElmArea, 180 GetPFVersion
ElmFeeder, 204 Global Functions, 21
ElmZone, 309 GetPlot
GetOMR GrpPage, 637
ComOmr, 465 GetProfile
878
INDEX INDEX
879
INDEX INDEX
880
INDEX INDEX
881
INDEX INDEX
ActiveProject, 10 GetResVar, 23
AllRelevant, 13 GetSettings, 23
ClearCommands, 4 GetSummaryGrid, 24
ClearRecycleBin, 4 GetTouchedObjects, 24
CommitTransaction, 4 GetTouchingExpansionStages, 25
CommitTx , 4 GetTouchingStageObjects, 25
ConvertGeometryStringToMDL, 4 GetTouchingVariations, 25
CreateFaultCase, 5 GetUserManager, 26
CreateProject, 5 GetUserSettings, 26
DecodeColour, 6 HttpGet, 26
Delete, 7 ImportDz, 27
DeleteUntouchedObjects, 7 ImportSnapshot, 28
EncodeColour, 8 IsLdfValid, 28
Exe, 8 IsNAN, 28
ExecuteCmd, 8 IsRmsValid, 29
exit, 9 IsScenarioAttribute, 29
GetActiveCalculationStr, 9 IsShcValid, 30
GetActiveNetworkVariations, 10 IsSimValid, 30
GetActiveProject, 10 LicenceHasModule, 31
GetActiveScenario, 11 LoadProfile, 32
GetActiveScenarioScheduler, 11 LoadResData, 33
GetActiveStages, 11 MarkInGraphics, 33
GetActiveStudyCase, 12 OutputFlexibleData, 33
GetAllUsers, 12 PostCommand, 34
GetBorderCubicles, 12 PrepForUntouchedDelete, 34
GetBrowserSelection, 13 Rebuild, 34
GetCalcRelevantObjects, 13 ReleaseResData, 35
GetCaseCommand, 18 ReloadProfile, 35
GetCaseObject, 18 ResetCalculation, 35
GetClassDescription, 14 ResFirstValidObject, 35
GetCurrentDiagram, 14 ResFirstValidObjectVar, 36
GetCurrentSelection, 14 ResFirstValidVar, 36
GetCurrentUser, 15 ResGetMax, 36
GetCurrentZoomScaleLevel, 15 ResGetMin, 36
GetDataFolder, 16 ResIndex, 36
GetDescription, 16 ResNextValidObject, 37
GetDiagramSelection, 17 ResNextValidObjectVar, 37
GetFlowOrientation, 17 ResNextValidVar, 37
GetFromStudyCase, 18 ResNval, 37
GetGlobalLib, 18 ResNvars, 37
GetGlobalLibrary, 18 ResSortToVar, 37
GetGraphBoard, 19 SaveAsScenario, 38
GetGraphicsBoard, 19 SaveScenarioAs, 38
GetLanguage, 19 SearchObjectByForeignKey, 38
GetLastCmd, 20 SelectToolbox, 39
GetLocalLib, 20 SetShowAllUsers, 39
GetLocalLibrary, 20 Sleep, 39
GetMem, 20 SplitLine, 40
GetPageLen, 21 StatFileGetXrange, 40
GetPFVersion, 21 StatFileResetXrange, 40
GetProjectFolder, 21 StatFileSetXrange, 41
GetRecordingStage, 22 SummaryGrid, 24
GetResData, 22 validLDF, 28
GetResDesc, 22 validRMS, 29
GetResObj, 23 validSHC, 30
GetResUnit, 23 validSIM, 30
882
INDEX INDEX
883
INDEX INDEX
InsertPlot GetNumberOfAnalogueSignalDescriptions,
SetVipage, 608 661
IntAddonvars, 641 GetNumberOfColumns, 662
AddDouble, 641 GetNumberOfDigitalSignalDescriptions, 662
AddDoubleMatrix, 641 GetNumberOfRows, 662
AddDoubleVector, 642 GetObjectValue, 662
AddInteger, 643 GetSignalHeader, 663
AddIntegerVector, 643 GetUnit, 663
AddObject, 644 GetValue, 663
AddObjectVector, 644 GetVariable, 664
AddString, 644 Load, 665
RemoveParameter, 645 NCol, 662
SetConstraint, 645 NRow, 662
IntCase, 646 Release, 665
Activate, 646 SizeX, 662
ApplyNetworkState, 646 SizeY, 662
ApplyStudyTime, 647 SortAccordingToColumn, 666
Consolidate, 647 IntDataset, 667
Deactivate, 647 AddRef, 667
SetStudyTime, 647 All, 667
IntComtrade, 648 Clear, 667
ConvertToASCIIFormat, 648 GetAll, 667
ConvertToBinaryFormat, 648 IntDocument, 668
FindColumn, 649 Export, 668
FindMaxInColumn, 649 Import, 668
FindMinInColumn, 650 Reset, 669
GetAnalogueDescriptions, 651 View, 669
GetColumnValues, 651 IntDplmap, 669
GetDescription, 651 Clear, 669
GetDigitalDescriptions, 652 Contains, 669
GetNumberOfAnalogueSignalDescriptions, First, 670
652 GetValue, 671
GetNumberOfColumns, 652 Insert, 674
GetNumberOfDigitalSignalDescriptions, 652 Next, 674
GetNumberOfRows, 653 Remove, 675
GetObjectValue, 653 Size, 675
GetSignalHeader, 653 Update, 675
GetUnit, 654 IntDplvec, 676
GetValue, 654 Clear, 676
GetVariable, 655 Get, 676
Load, 655 IndexOf, 678
NCol, 652 Insert, 678
NRow, 653 Remove, 678
Release, 656 Size, 679
SizeX, 653 Sort, 679
SizeY, 652 IntEvt, 679
SortAccordingToColumn, 656 CreateCBEvents, 680
IntComtradeset, 658 RemoveSwitchEvents, 680
FindColumn, 658 IntExtaccess, 680
FindMaxInColumn, 659 CheckUrl, 680
FindMinInColumn, 660 IntGate, 681
GetAnalogueDescriptions, 660 AddTrigger, 681
GetColumnValues, 660 IntGrf, 681
GetDescription, 661 MoveToLayer, 681
GetDigitalDescriptions, 661 IntGrfgroup, 682
ClearData, 682
884
INDEX INDEX
885
INDEX INDEX
886
INDEX INDEX
887
INDEX INDEX
IsPQ IsStudyCaseIgnored
ElmAsm, 184 ComTasks, 545
IsProjectFolderType IsValid
IntPrjfolder, 724 IntRas, 726
IsQuadBooster
ElmTr2, 286 JumpTo
ElmTr3, 291 IntViewbookmark, 764
ElmTr4, 295 JumpToLastStep
IsReducible ComContingency, 418
General Object Methods, 166
LdfEquivalentVerification
IsRelevant
ComRed, 476
General Object Methods, 159
LicenceHasModule
IsRmsValid
Global Functions, 31
Global Functions, 29
ln
IsRowVisible
Mathematical Functions, 80
ComTablereport, 526
lnm
IsScenarioAttribute
General Object Methods, 167
Global Functions, 29
Load
IsShcValid
ElmRes, 255
Global Functions, 30
IntComtrade, 655
IsShortCircuited
IntComtradeset, 665
General Object Methods, 166
LoadData
IsSimValid
IntPrj, 717
Global Functions, 30
LoadFile
IsSplitting
ElmFile, 205
ElmBoundary, 193
LoadMicroSCADAFile
IsStarted
ComLink, 454
ElmRelay, 233
LoadProfile
IsStatusBitSet
Global Functions, 32
StaExtbrkmea, 319
LoadResData
StaExtcmdmea, 324
Global Functions, 33
StaExtdatmea, 330
LoadSimulationState
StaExtfmea, 334
ComSim, 491
StaExtfuelmea, 339
LoadSnapshot
StaExtimea, 344
ComSim, 491
StaExtpfmea, 349
log
StaExtpmea, 354
Mathematical Functions, 80
StaExtqmea, 359
LossCostAtBusTech
StaExtsmea, 364
ComCapo, 401
StaExttapmea, 369
StaExtv3mea, 374 Mark
StaExtvmea, 379 IntGrflayer, 688
IsStatusBitSetTmp SetLevelvis, 589
StaExtbrkmea, 319 MarkInGraphics
StaExtcmdmea, 325 General Object Methods, 167
StaExtdatmea, 330 Global Functions, 33
StaExtfmea, 335 Set Routines, 853
StaExtfuelmea, 340 MarkRegions
StaExtimea, 345 ComSimoutage, 496
StaExtpfmea, 350 Mathematical Functions, 70
StaExtpmea, 355 abs, 71
StaExtqmea, 360 acos, 71
StaExtsmea, 364 asin, 71
StaExttapmea, 369 atan, 72
StaExtv3mea, 374 atan2, 72
StaExtvmea, 379 BinaryAnd, 72
888
INDEX INDEX
889
INDEX INDEX
890
INDEX INDEX
891
INDEX INDEX
892
INDEX INDEX
ResetReductionInMemory ResNextValidVar
ComRed, 477 Global Functions, 37
ResetStatusBit ResNval
StaExtbrkmea, 320 Global Functions, 37
StaExtcmdmea, 325 ResNvars
StaExtdatmea, 330 Global Functions, 37
StaExtfmea, 335 ResSortToVar
StaExtfuelmea, 340 Global Functions, 37
StaExtimea, 345 Restore
StaExtpfmea, 350 IntPrj, 719
StaExtpmea, 355 ResultForDirectionalBackupVariable
StaExtqmea, 360 ComCoordreport, 423
StaExtsmea, 364 ResultForFuseVariable
StaExttapmea, 370 ComCoordreport, 424
StaExtv3mea, 375 ResultForInstantaneousVariable
StaExtvmea, 380 ComCoordreport, 424
ResetStatusBitTmp ResultForMaxCurrent
StaExtbrkmea, 320 ComCoordreport, 425
StaExtcmdmea, 325 ResultForNonDirectionalBackupVariable
StaExtdatmea, 330 ComCoordreport, 425
StaExtfmea, 335 ResultForOverloadVariable
StaExtfuelmea, 340 ComCoordreport, 426
StaExtimea, 345 ResultForOverreachVariable
StaExtpfmea, 350 ComCoordreport, 427
StaExtpmea, 355 ResultForShortCircuitVariable
StaExtqmea, 360 ComCoordreport, 427
StaExtsmea, 365 ResultForZoneVariable
StaExttapmea, 370 ComCoordreport, 428
StaExtv3mea, 375 RndExp
StaExtvmea, 380 Mathematical Functions, 81
ResetThirdPartyModule RndGetMethod
BlkDef, 616 Mathematical Functions, 82
ComDpl, 441 RndGetSeed
TypQdsl, 796 Mathematical Functions, 82
ResFirstValidObject RndNormal
Global Functions, 35 Mathematical Functions, 82
ResFirstValidObjectVar RndSetup
Global Functions, 36 Mathematical Functions, 83
ResFirstValidVar RndUnifInt
Global Functions, 36 Mathematical Functions, 85
ResGetMax RndUnifReal
Global Functions, 36 Mathematical Functions, 85
ResGetMin RndWeibull
Global Functions, 36 Mathematical Functions, 86
ResIndex Rollback
Global Functions, 36 IntVersion, 763
Resize round
ElmBoundary, 194 Mathematical Functions, 86
IntMat, 698 RowLbl
IntThrating, 753 IntMat, 696, 699
IntVec, 758
IntVecobj, 761 Save
ResNextValidObject IntMat, 699
Global Functions, 37 IntScenario, 742
ResNextValidObjectVar IntVec, 758
Global Functions, 37 IntVecobj, 761
893
INDEX INDEX
SaveAsRA SearchObject
ElmSubstat, 267 General Object Methods, 170
SaveAsScenario SearchObjectByForeignKey
Global Functions, 38 Global Functions, 38
SaveFile SearchScenario
ElmFile, 205 IntScensched, 744
SaveScenarioAs SelectToolbox
Global Functions, 38 Global Functions, 39
SaveSimulationState SendData
ComSim, 492 ComLink, 455
SaveSnapshot ComOpc, 467
ComSim, 492 SentDataStatus
ScnFreq, 778 ComLink, 455
GetLimit, 779 Set Routines, 850
GetNumberOfViolations, 779 Add, 850
GetValue, 779 Clear, 851
GetVariable, 779 Count, 851
GetViolatedElement, 780 First, 851
GetViolationTime, 780 FirstFilt, 852
ScnFrt, 781 IsIn, 853
GetLimit, 781 MarkInGraphics, 853
GetNumberOfViolations, 781 Next, 853
GetValue, 781 NextFilt, 854
GetVariable, 782 Obj, 854
GetViolatedElement, 782 OutputFlexibleData, 854
GetViolationTime, 782 Remove, 854
ScnSpeed, 783 ShowModalBrowser, 855
GetLimit, 783 ShowModalSelectBrowser, 855
GetNumberOfViolations, 783 ShowModelessBrowser, 855
GetValue, 783 SortToClass, 855
GetVariable, 784 SortToName, 856
GetViolatedElement, 784 SortToVar, 856
GetViolationTime, 784 Set
ScnSync, 785 IntMat, 699
GetLimit, 785 IntVec, 759
GetNumberOfViolations, 785 IntVecobj, 761
GetValue, 785 SetActiveModule
GetVariable, 786 ComAddon, 397
GetViolatedElement, 786 SetAdaptX
GetViolationTime, 786 SetDesktop, 581
ScnVar, 787 SetVipage, 609
GetLimit, 787 VisPath, 813
GetNumberOfViolations, 787 VisPlot, 822
GetValue, 787 VisPlot2, 836
GetVariable, 788 SetAdaptY
GetViolatedElement, 788 IntPlot, 708
GetViolationTime, 788 VisPath, 814
ScnVolt, 789 VisPlot, 823
GetLimit, 789 VisPlot2, 836
GetNumberOfViolations, 789 SetAdditionalResultsFlagForCommand
GetValue, 789 ComTasks, 548
GetVariable, 790 SetAsDefault
GetViolatedElement, 790 ElmRes, 256
GetViolationTime, 790 SetAssociationValue
Search CimModel, 622
IntVecobj, 761 CimObject, 630
894
INDEX INDEX
895
INDEX INDEX
896
INDEX INDEX
897
INDEX INDEX
898
INDEX INDEX
899
INDEX INDEX
900
INDEX INDEX
901
INDEX INDEX
902
INDEX INDEX
903
INDEX INDEX
904
INDEX INDEX
905
INDEX INDEX
xlSetFontSize
MS Excel Functions, 109
xlSetHorizontalAlignment
MS Excel Functions, 110
xlSetNumberFormat
MS Excel Functions, 111
xlSetPrintTitleRows
MS Excel Functions, 111
xlSetRowHeight
MS Excel Functions, 112
xlSetTextColor
MS Excel Functions, 112
xlSetTextStyle
MS Excel Functions, 113
xlSetValue
MS Excel Functions, 114
xlSetValues
MS Excel Functions, 114
xlSetVerticalAlignment
MS Excel Functions, 115
xlSetVisible
MS Excel Functions, 116
xlSetWorksheetName
MS Excel Functions, 116
xlSetWrapText
MS Excel Functions, 117
xlStart
MS Excel Functions, 117
xlTerminate
MS Excel Functions, 120
ZeroDerivative
ComInc, 451
ZoomAll
SetDesktop, 586
906