WriteAuxFile Function (version 9)
The WriteAuxFile function can be used to write data from the case in the Simulator Automation Server to a PowerWorldâ Auxiliary file. The function is flexible in that you can specify the type of object data you want to export, an advanced filter name for a filter you want to use, and as many or as few field types as desired that are supported by the type of object. In addition, you can specify a new file name for each call to WriteAuxFile, or you can specify the same file name and append the data to the file. If an error occurs while trying to write the auxiliary file, an error message is returned through EString.
WriteAuxFile(fileName, filterName, tObjectType, EString, {tAppend}, {tFieldList})
Parameter Definitions
FileName : String The name of the PowerWorldâ Auxiliary file you wish to save. No default.
filterName : String The name of an advanced filter which was previously defined in the case before being loaded in the Simulator Automation Server. If no filter is desired, then simply pass an empty string. If a filter name is passed but the filter cannot be found in the loaded case, no filter is used. Default is an empty string.
tObjectType : String A string describing the type of object for which your are requesting data. No Default.
EString : Variant This parameter must be assigned a variable declared as a Variant. This parameter is for a return value only, and will assign the passed variable a string representing an error that may have occurred in the Simulator Automation Server. If no error occurred, the EString variable will return an empty string.
TAppend : Boolean This parameter is optional. If you have given a file name of an auxiliary file that already exists, then the file will either be appended to or overwritten according to the setting of this parameter. If the parameter is not passed, the Simulator Automation Server assumes false.
TFieldList : Variant This parameter is optional. A variant array of strings, where each string represents an object field variable, as defined in the section on PowerWorld Object Variables. If no array is passed, the Simulator Automation Server will use predefined default fields when exporting the data.
Example
WriteAuxFile("c:\my files\myauxfile.aux", "", "gen", EString, False, [pwBusNum, pwGenID, pwGenAGCAble])
This function call will send the values of the fields in tFieldList to a PowerWorld Auxiliary file for all the generators in the load flow case. If a filter name had been passed instead of an empty string, Simulator would have located and used a pre-defined advanced filter and applied it to the information if it was found. By specifying the fields in the optional parameter tFieldList, only the three field values for each generator will be returned. If the optional parameter tFieldList had been omitted, Simulator would have returned internally defined default information for the generators. Since the tFieldList optional parameter was included, the tAppend optional parameter also had to be included, even though it's default value is already False.