Knowledge Base

Using Special Variables with Scripts or SimAuto

Some Simulator functions cause special variables to be created for storing results. The multiple element TLR sensitivity is a common example. Special variables are used to hold the sensitivities of flows on those multiple elements with respect to injections at various points. The number of special variables in use depends on the number of branches and interfaces in the multiple element selection set. In the Simulator graphical user interface (GUI), the results case info displays inside the TLR Sensitivities/Generation Shift Factors dialog automatically display a column for each branch and interface in the selection set.

However, if you are using an auxiliary file script or SimAuto to calculate the sensitivities, you also likely need to know which branches or interfaces correspond to which sensitivity variables. The special sensitivity variables have the form MultBusTLRSens:x, where x is a location integer (between 0 and the number of multiple sensitivities in use minus 1.) The SaveObjectFields auxiliary script command can be used to save a list of all sensitivities and the branches or interfaces that each correspond to. The following example will calculate multiple element sensitivities for overloaded lines and transformers, save the results for injection groups in CSV format to the file MultBusTLRResults.csv, and save the injection group sensitivity fields in a separate file MultBusTLRFields.csv.

SCRIPT
{
CalculateTLRMultipleElement(BRANCH,OVERLOAD,BUYER,[Slack],DC);
SaveData(“MultBusTLRResults.csv”,CSV,InjectionGroup,[InjGrpName,ETLR,WTLR,MultBusTLRSens:ALL],[]);
SaveObjectFields(“MultBusTLRFields.csv”,InjectionGroup,[MultBusTLRSens:ALL]);
}

With SimAuto, you could use the RunScriptCommand function to save these files, but would then have to parse the files to identify the MultBusTLRSens variables. Alternately, you could use the GetParametersMultipleElement  function to retrieve the results and the GetSpecificFieldList function to identify the branches and interfaces corresponding to each MultBusTLRSens variable. Another SimAuto function, GetSpecificFieldMaxNum, may be used to identify the number of MultBusTLRSens variables in use.

Tags: ,,,

February 1, 2016