ChangeParametersMultipleElementFlatInput Function
The ChangeParametersMultipleElementFlatInput function allows you to set parameters for multiple objects of the same type in a case loaded into the Simulator Automation Server. This function is very similar to the ChangeParametersMultipleElement, but uses a single dimensioned array of values as input instead of a multi-dimensioned array of arrays. The advantage of this function is that it is much faster to change multiple elements with a single function call than it is to repeatedly call ChangeParametersSingleElement multiple times. An additional advantage over ChangeParametersMultipleElement is that you can still take advantage of the speed improvement, even if the programming language you are using does not support multi-dimensioned arrays.
Unlike the script SetData and CreateData commands, SimAuto does not have any explicit functions to create elements. Instead this can be done using the ChangeParameters functions by making use of the CreateIfNotFound SimAuto property. Set CreateIfNotFound = True if objects that are updated through the ChangeParameters functions should be created if they do not already exist in the case. Objects that already exist will be updated. Set CreateIfNotFound = False to not create new objects and only update existing ones. The CreateIfNotFound property is global, once it is set to True this applies to all future ChangeParameters calls.
Function Prototype
ChangeParametersMultipleElementFlatInput(ObjectType, ParamList, NoOfObjects, ValueList)
Parameter Definitions
ObjectType : String The type of object for which parameters are being changed.
ParamList : Variant A variant array storing strings (COM Type BSTR). This array stores a list of PowerWorldâ object field variables, as defined in the section on PowerWorld Object Fields. The ParamList must contain the key field variables for the specific device, or the device cannot be identified.
NoOfObjects You must pass an integer number of devices that are passing values for. SimAuto will automatically check that the number of parameters for each device (counted from ParamList) and the number of objects integer correspond to the number of values in value list (counted from ValueList.)
ValueList : Variant A variant array storing a list of variants. Value list can be an array with many values, as it is a single dimensioned array of all values for all devices that are being changed. The structure of the ValueList array is such that all of the parameters for the first object are listed first, then all parameters for the second object, and so on. The parameters must be in the same order as given in ParamList. In other words, your array would look like:
ValueList = Array(Obj1Param1, Obj1Param2, Obj2Param1, Obj2Param2,Obj3Param1, …, ObjNParam1, ObjNParam2)
Output
ChangeParametersMultipleElementFlatInput only returns the first element in Output, the error string.
Notes
If the number of parameters given in ParamList multiplied by the number of objects passed does not equal the total number of values in ValueList, SimAuto will abort the function call.