NOTE: As a general rule, AURORA Datasets (ADS.) are used to change values directly in the project datasets, and AURORA Commands (AC.) are used to accomplish specific commands when using Scripting.
The following list contains the AURORA Dataset syntax available for use in Aurora Scripting.
These datasets must be prefixed with AURORADataset. or ADS. in the script.
Click on a topic below to learn more about the specific dataset options:
AcceptInputDSChangesAcceptInputDSChanges
If any changes have been made to an Input data table using scripting, use this command to save these changes to memory. This must be called before the model runs for the simulation to use the updated Input data table. However, AcceptInputDSChanges will not permanently save these changes to the Input database. If you make changes to the Input data tables using scripting and want to remove those changes, calling ADS.RejectInputDSChanges() will set the Input database back to its original state.
ADS.AcceptInputDSChanges() As Boolean
Example:
'The coal price in Fuels will be changed to "yr_newPrices"
ADS.DataSetType = DataType.Input
ADS.SetDataItemSearch("Fuels" , "yr_coalprices", "Price", "yr_newPrices")
Dim result = ADS.AcceptInputDSChanges()
If(result = True) Then
Dim coalPrice As String= ADS.GetDataItem("Fuels",
ADS.FindRow("Fuels" , "Fuel ID", "Coal"), "Price")
AC.SendToAURORAXMP("The price of coal is "& coalPrice)
End If
AddChangeSetToStudyCaseAddChangeSetToStudyCase
Adds the specified change set to the first study case it encounters with this run id.
ADS.AddChangeSetToStudyCase(runID As String, changeSetName As String) As Boolean
Example:
Dim result As Boolean= ADS.AddChangeSetToStudyCase("New Case 1" ,"New Change Set 1")
AddNewStudyCaseAddNewStudyCase
This function will create and add a Study Case. The only mandatory parameter is the Run ID. Unless specified otherwise, the defaults for the optional parameters will be used. To skip defining a parameter, just use ‘, ,’ in the parameters, i.e., ADS.AddNewStudyCase(“New Case”, , True) will set New Case to be the Base Case. The default for runCase will be used, which is True. The user only needs to specially skip over parameters if they are before the one they want to change from the default. If they are after, a closing parenthesis can be used and those parameters will still use the default. The default for RunOrder is 0, so it will appear at the top of the Study Case List unless otherwise specified. To make sure the new Study Case appears at the bottom of the run order, set the value to the count of the study cases, or a large number like 1000. The function will return True if the Study Case was added successfully or False otherwise.
ADS.AddNewStudyCase(runId As String , runCase As Boolean = True , baseCase As Boolean = False, runOrder As Integer=0, rmtName As String = "", parameterSetName As String = "", changeSet As String = "") As Boolean
Example:
'These are four valid examples to create a new study case
Dim result As Boolean = ADS .AddNewStudyCase("New Study Case")
Dim result = ADS.AddNewStudyCase(“New Study Case”, False, False, 10, "New RMT Name", "Parameter Set 2", "New Change Set 1, New Change Set 2")
Dim result = ADS.AddNewStudyCase(“New Study Case”, , , , "New RMT Name")
Dim result = ADS.AddNewStudyCase(“New Study Case”, , , , , , "New Change Set 1, New Change Set 2")
AddRowsInInputTableAddRowsInInputTable
This command will add rows to an Input Table. The table name must be specified, along with the number of rows to add. There is an optional parameter that allows the user to define what the primary key of the starting row will be, all subsequent rows will follow that key. If the parameter is not specified, the first new row will start with one more than the largest existing primary key in the table. The function will return a Boolean, True if the command was successful, False otherwise.
ADS.AddRowsInInputTable(myTableName As String, numRows As Integer, Optional firstPrimaryKey As Integer) As Boolean
Example:
'This will add 5 rows to the resources table, starting with the primary key of 1300.
ADS.DataSetType = DataType.Input
Dim result As Boolean = ADS .AddRowsInInputTable("Resources 10bus", 5, 1300)
AssureOutputTableReadAssureOutputTableRead
Use this command when retrieving data from Output tables. This will make sure the table in in the Output database has been read into Aurora. It will return true if the read was successful, false otherwise.
ADS.AssureOutputTableRead(outputTableName As String) As Boolean
Example:
'This will check to make sure ResourceHour exists in Output before trying to retrieve data from the table.
ADS.DataSetType = DataType.Output
Dim result As Boolean = ADS.AssureOutputTableRead("ResourceHour")
If (result = True) Then
Dim firstRow As String = ADS.GetDataItemArray("ResourceHour", 0)
AC.SendToAURORAXMP(firstRow)
End If
ChangeInputTableChangeInputTable
Use this command to change which table is selected as In Study (in the Input data grid) in the database. For example, suppose there are two Areas type tables in the database: Areas Table1 and Areas Table2. If Areas Table1 is currently selected in study, then the command ADS.ChangeInputTable("Areas Table2", "Areas") will check Areas Table2 in study. This command returns a string that will hold an error message if the function was not successful. If it was successful, the returned string will be empty.
ADS.ChangeInputTable(myTableName As String, myTableType As String) As String
Example:
'Sets the selected Areas table to "Areas Table1"
ADS.ChangeInputTable("Areas Table1" , "Areas")
'Sets the selected Areas table to “Areas Table2” and checks to see if the function was successful. If the message variable is not an empty string, there was a problem setting the new table.
Dim message As String = ADS.ChangeInputTable("Areas Table2", "Areas")
If (message <> "") Then
AC.SendToAURORAXMP("Error changing table: "& message)
End If
CopyInputDataBaseTableCopyInputDataBaseTable
Use this command to copy an input database table. This copy will automatically be saved to the input database. This is analogous to copying an Input Table while in the Input Tables Window view. To see the change on the Input page after running the script command, Reload Grid must be used to show the new copied table. If “newTableName” already exists in the Input database, “overwrite” must be set to True to successfully copy the originalTableName table to the newTableName. Otherwise this function will not be successful and it will return False.
ADS.CopyInputDataBaseTable(originalTableName As String, newTableName As String, Optional overwrite As Boolean) As Boolean
Example:
'If "CopyOfCondidtions" does not exist before this script is run, result1 should be successful. Then because overwriting CopyOfConditions if it exists is set to True, result2 should be successful as well.
ADS.DataSetType = DataType.Input
Dim result1 As Boolean = ADS .CopyInputDataBaseTable ("Conditions" , "CopyOfConditions")
Dim result2 As Boolean = ADS .CopyInputDataBaseTable ("Conditions" , "CopyOfConditions", True)
CopyInputDSTableCopyInputDSTable
Use this command to copy an input dataset table. Note that the table will only be copied to the input dataset in memory and will not show in the input database. This function will return True if the copy is successful, False otherwise.
ADS.CopyInputDSTable(originalTableName As String, newTableName As String) As Boolean
Example:
'This will make a copy of the Fuel input table in memory only
ADS.DataSetType = DataType.Input
Dim result As Boolean = ADS.CopyInputDSTable("Fuels", "CopyOfFuels")
This allows the script to reference the correct dataset. If a change will be made to a data table or a project file variable, the corresponding dataset must be selected before the changing command is executed. Use this command before using any of the other AURORA Dataset commands. See DataSetType for more information.
ADS.DataSetType As DataType
Example:
'Set the DataSetType
ADS.DataSetType = DataType.Input
'Get current DataSetType
Dim currentDataSetType = ADS.DataSetType
AC.SendToAURORAXMP("The current DataSetType is " & currentDataSetType.ToString())
DeleteRowsInInputTableDeleteRowsInInputTable
This command will delete specified rows in an input table. The input table name must be read into the input database for this function to work. An array of integers that hold the row indexes to be deleted will be passed to the function. The function will return the number of rows that were successfully deleted.
ADS.DeleteRowsInInputTable(myTableName As String, rowIndices() As Integer) As Integer
Example:
'This will find all the rows in the resources table where Fuel is coal and then delete them.
ADS.DataSetType = DataType.Input
Dim rowIndexes As Integer() = ADS.FindRows("Resources 10bus", "Fuel", "Coal")
Dim rowsDeleted As Integer = ADS .DeleteRowsInInputTable("Resources 10bus" , rowIndexes)
If (rowsDeleted <> rowIndexes.Length) Then
AC.SendToAURORAXMP("Not all rows were successfully deleted")
End If
DeleteStudyCaseDeleteStudyCase
Will delete the first study case it encounters with this run id.See Delete a Study Case in the UpdateStudyCase topic for more details.
ADS.DeleteStudyCase(runID As String) As Boolean
Example:
Dim result As Boolean = ADS.DeleteStudyCase("New Case 1")
DisableCustomColumnReportingDisableCustomColumnReporting
This will turn off custom column reporting for the active report set in the project. If there is an error changing this setting, it will return False, otherwise this function will return True.
ADS.DisableCustomColumnReporting() As Boolean
This command is used to search for the row index in a table part of the current dataset, ADS.DataSetType. This will be given a table name, a column name, and the value of the column’s cell. The function will return the row number for the first row with an entry of the column value in the specified column. A value of -1 is returned if no row is found. Note that the row index is zero-based, so all tables start with the row index as zero rather than row index as one.
This command is usually used before ADS.GetDataItem as a row index is needed to retrieve a value.
To search for a row based on entries in multiple columns, use the command ADS.FindRowInTable().
ADS.FindRow(myTableName As String, myColName As String, myColValue As String) As Integer
Example:
'This will help retrieve the price of solar fuel in the Input Fuels table.
ADS.DataSetType = DataType.Input
Dim rowIndex As Integer = ADS.FindRow("Fuels", "Fuel Name" , "Solar")
Dim solarPrice As String = ADS.GetDataItem("Fuels", rowIndex, "Price")
AC.SendToAURORAXMP("The price of the Solar in the Fuels table is " & solarPrice)
This function is almost identical to ADS.FindRow(), except that instead of being given one column with one matching value, the function is given an array of strings of column names with an array of corresponding column values as strings. See FindRowInTable to learn more.
If looking for multiple rows, not just the first row, that will match the column criteria, use ADS.FindRowsinTable.
ADS.FindRowInTable(myTableName As String, myColNames() As String, myColValues() As String) As Integer
Example:
'This will get the row index in the output table ZoneMonth where the Name of the zone is ERCOT-Houston and the Report Month is 3.
ADS.DataSetType = DataType.Output
Dim colNames(1) As String
Dim colValues(1) As String
colNames(0) = "Name"
colNames(1) = "Report_Month"
colValues(0) = "ERCOT-Houston"
colValues(1) = "3"
Dim rowIndex As Integer = ADS.FindRowInTable("ZoneMonth" , colNames, colValues)
This command is used to search for multiple row indexes in a table. That table must be a part of the dataset, ADS.DataSetType. The function will return an array of row indexes for all the rows that have a column value matching the specified column name. A value of -1 is returned if no row is found.
To search for multiple rows based on entries in multiple columns, use the command ADS.FindRowsInTable().
This command is usually used before ADS.GetDataItem as a row index is needed to retrieve a value.
ADS.FindRows(myTableName As String, myColName As String, myColValue As String) As Integer()
Example:
'This will go through and find all of the rows where Condition is "Average" in the ZoneYear output table and it will write the prices for each zone to the Status window and message log.
ADS.DataSetType = DataType.Output
Dim rowIndexes As Integer() = ADS.FindRows("ZoneYear", "Condition", "Average")
For Each rowIndex As Integer In rowIndexes
Dim zoneName As String = ADS.GetDataItem("ZoneYear", rowIndex, "Name")
Dim zonePrice As String = ADS.GetDataItem("ZoneYear", rowIndex, "Price")
AC.SendToAURORAXMP("The average price for "& zoneName & " is "& zonePrice)
Next
FindRowsInTableFindRowsInTable
This command is almost identical to ADS.FindRows(), except that instead of being given one column with one matching value, the function is given an array of column names with an array of corresponding column values as strings.
ADS.FindRowsInTable(myTableName As String, myColNames() As String, myColValues() As String) As Integer()
Example:
'This will find all the rows in ZoneYear in Output where the Condition is "EPA On-Peak" and the year is 2018 and then using those row indexes, the price of each zone can be found.
ADS.DataSetType = DataType.Output
Dim colNames(1) As String
Dim colValues(1) As String
colNames(0) = "Condition"
colNames(1) = "Time_Period"
colValues(0) = "EPA On-Peak"
colValues(1) = "2018"
Dim rowIndexes As Integer() = ADS.FindRowsInTable("ZoneYear", colNames, colValues)
For Each rowIndex As Integer In rowIndexes
Dim zoneName As String = ADS.GetDataItem("ZoneYear", rowIndex, "Name")
Dim zonePrice As String = ADS.GetDataItem("ZoneYear", rowIndex, "Price")
AC.SendToAURORAXMP("The on peak price in 2018 for "& zoneName &" is " & zonePrice)
Next
FindRowsInTableContainingMultipleValuesFindRowsInTableContainingMultipleValues
This function is almost identical to ADS.FindRowsInTableContainingValue, however this function allows you to search multiple columns for the matching criteria. Unlike the function FindRows() or FindRowsInTable, this function allows you to get rows that have cells containing the “myColValue”, it does not have to equal it. Unlike FindRowsInTableContainingValue, you can search for rows that have values in multiple columns.
This command is used to search for the row index in a table part of the current dataset, ADS.DataSetType. This function needs the table name to search in, which must be a part of the ADS.DataSetType dataset. Then give the function an array of column names and an array containing the value of the corresponding column’s cell it should contain.
ADS.FindRowsInTableContainingMultipleValues(myTableName As String, myColNames()As String, myColValues() As String) As Integer()
Example:
'This function will look in the Resources table and return the row indices that
match rows where Name contains "A B Brown" and where Fuel contains "CoalUS"
ADS.DataSetType = ComDataSet.DataType.Input
Dim colNames(1) AsString
Dim colValues(1) As String
colNames(0) = "Name"
colValues(0) ="A B Brown"
colNames(1) = "Fuel"
colValues(1) = "CoalUS"
Dim rowIndexes As Integer() = ADS.FindRowsInTableContainingMultipleValues
("Resources Disaggregated", colNames, colValues)
FindRowInTableContainingValueFindRowInTableContainingValue
This function is similar to ADS.FindRows() or ADS.FindRowsInTable(), however, this function allows you to get rows that have cells containing the value specified in “myColValue”, it does not have to equal it.
This command is used to search for the rows containing “myColValue” in the specified column and will return the row indices in an array. The function needs the table name, which must be a part of the dataset specified in ADS.DataSetType. You must also give the function what column you want to search for and the value the cell should contain.
ADS.FindRowsInTableContainingValue(myTableName As String, myColName As String, myColValue As String) As Integer()
Example:
'Get a list of all the resources in the Resources table where the value under “Name” contains “Redfield”. ‘So it would return rows where the resource’s name is “Redfield (1)”, “Redfield (2)”, and “Redfield (3)”.
ADS.DataSetType = AURORAServer.ComDataSet.DataType.Input
Dim resourceName As String = "Redfield"
Dim resourceRowIndices As Integer() = ADS.FindRowsInTableContainingValue
(“Resources Disaggregated”, "Name", resourceName)
FirstColumnInTableFirstColumnInTable
Returns the first column name for a specified table. The table must be a part of the current dataset, ADS.DataSetType.
ADS.FirstColumnInTable(myTableName As String) As String
Example:
'The first column name for the Capacity Price table in Input is "Capacity Price Area"
ADS.DataSetType = DataType.Input
String colName = ADS.FirstColumnInTable("Capacity Price_RMT_ERCOT_20181005")
FirstTableInDataSetFirstTableInDataSet
This will return the name of the first table in the specified dataset, ADS.DataSetType. Note that the order of the tables in these datasets do not match the order they appear in the UI. For example, using this when DataSetType is set to Input will not show the Input tables in their alphabetical order as they appear on the Input Tables page.
ADS.FirstTableInDataSet() As String
Example:
'This will write "The first table of the Memory dataset is Hour Fuel" to the Status screen and message log.
ADS.DataSetType = DataType.Memory
AC.SendToAURORAXMP("The first table of the Memory dataset is " &
ADS.FirstTableInDataSet())
Use this to retrieve a data item from a specified table given the row index and column name. The specified table must be a part of ADS.DataSetType. This will return the value as a string. Note that the row indexes are zero-based, so all tables start with row number zero rather than row number one.
Use FindRow/s to find the row index given specific column criteria.
ADS.GetDataItem(myTableName As String, myRow AsInteger, myColName As String) As String
Example:
'This will get the price for every time period for every row whose "Name" was "Henry Hub NaturalGas" in the FuelMonth output table
ADS.DataSetType = DataType.Output
Dim rowIndexes As Integer() = ADS.FindRows("FuelMonth", "Name", "Henry Hub NaturalGas")
For Each row As Integer In rowIndexes
Dim timePeriod As String = ADS.GetDataItem("FuelMonth" , row,"Time_Period")
Dim fuelPrice As String = ADS.GetDataItem("FuelMonth", row, "Price")
AC.SendToAURORAXMP("The price of Henry Hub NaturalGas during " & timePeriod & " was " & fuelPrice)
Next
GetDataItemArray GetDataItemArray
Retrieves an entire row’s data as one long string for a specified table and row index. The data for each column is separated by a “|” character. The string only holds the values for each column, not the column name as well. If the value of the column is empty, nothing will be printed between the separating “|” characters. The table must be a part of the specified dataset, ADS.DataSetType. ADS.FindRow() can be used to find what the row indexes matches specific column criteria.
Note that the row indexes are zero-based, so all tables start with row index zero rather than row index one.
ADS.GetDataItemArray(myTableName As String, myRow As Integer) As String
Example:
'This will return the first row of the Demand Collection table, so entireRow will equal "FlatLoadID|17.20|ERCOT_FlatLoad||956|"'ID = FlatLoadID'Percent = 17.20'Demand Set ID = ERCOT_FlatLoad'Hourly Demand Vector = blank cell'Primary Key = 956
ADS.DataSetType = DataType.Input
Dim entireRow As String = ADS .GetDataItemArray("ERCOT Demand Collection", 0)
AC.SendToAURORAXMP(entireRow)
This function will return the data table with the specified table name. The data table must be a part of the dataset defined by ADS.DataSetType.
ADS.GetDataTable(StringtableName) As DataTable
Example:
ADS.DataSetType = AURORAServer.ComDataSet.DataType.Input
Dim resourcesDataTable As DataTable = ADS.GetDataTable(“Resources
Disaggregated”)
GetProjectParameterGetProjectParameter
Takes in a project parameter and returns the value from the project. It will return the value as an Object, that can be cast to its specified type.
ADS.GetProjectParameter(VariableName As SimOptions) As Object
Example:
Dim studyTypeObj As Object= ADS .GetProjectParameter(SimOptions.ActiveStudyType)
Dim studyType As ActiveStudyType = CType (studyTypeObj, Integer)
'This will send “Nodal” To the Status window
AC.SendToAURORAXMP(studyType.ToString())
GetProjectParametersGetProjectParameters
Takes in an array of project parameters and returns an array of Objects for the values. This will be faster than calling the singular function multiple times.
ADS.GetProjectParameters(VariableName As SimOptions) As Object
Example:
Dim parameterNames (4) As SimOptions
parameterNames(0) = SimOptions.RunUsingStudyCaseList
parameterNames(1) = SimOptions.StartDateMonth
parameterNames(2) = SimOptions.EndDateMonth
parameterNames( 3) = SimOptions.UseThreadingInLogic
Dim results() As Object = ADS.GetProjectParameters(parameterNames)
GetStudyCaseRunIdsGetStudyCaseRunIds
This will return the Run IDs of all the Study Cases in the project. It will return the Run IDs in a string array.
ADS.GetStudyCaseRunIds() As String()
Example:
Dim runIDs() As String = ADS.GetStudyCaseRunIds()
GetStudyCaseValueGetStudyCaseValue
GetStudyCaseValue returns the value of the attribute of the Study Case with the specified Run ID. If there are multiple Study Cases with that Run ID, the function will use the first one it encounters, the one with the lowest Run Order. If the Run ID does not exist or there is an error retrieving the value, the function will return nothing.
ADS.GetStudyCaseValue(runId As String, Attribute As StudyCase)As Object
Example:
Dim changeSetsInStudyCase As String = ADS.GetStudyCaseValue("New Case", StudyCase.ChangeSets)
Dim isBaseCase As Boolean = ADS.GetStudyCaseValue("New Case 1", StudyCase.BaseCase)
GetStudyCaseValuesGetStudyCaseValues
To get multiple attributes for different Study Cases at once, use ADS.GetStudyCaseValues. This is faster than calling ADS.GetStudyCaseValue multiple times. This function takes in an array of Run IDs and an array of the Study Case attributes and returns the values as an Object array.
ADS.GetStudyCaseValues(runIds As String(), attributes As StudyCase()) As Object
Example:
Dim runIds(3) As String
Dim attributes(3) As StudyCase
runIds(0) = "New Case"
attributes(0) = StudyCase.ChangeSets
runIds(1) = "New Case 1"
attributes(1) = StudyCase.ChangeSets
runIds(2) = "New Case"
attributes(2) = StudyCase.RMTName
runIds(3) = "New Case 1"
attributes(3) = StudyCase.RunCase
Dim Results As Object() = ADS.GetStudyCaseValues(runIds, attributes)
NextColumnInTableNextColumnInTable
Use this when looping through columns in a table, it will return the name of the next column in the specified table. The table must be a part of the specified dataset, ADS.DataSetType. The index of the next column will not reset to zero, or the beginning of the column list, when the script ends, it will continue to hold it’s place while the Scripting tab is open. The index will be reset to zero when ADS.FirstColumnInTable()is used or when it reaches the end of the column list.
This function can be used with ADS.NextTableInDataset() to loop through all the tables and columns in a dataset.
ADS.NextColumnInTable(myTableName As String)As String
Example:
'This will print out "The next column in Heat Rate is ID" to the Status window and message log when the script is first run and then if the script is run again, it will print out "The next column in Heat Rate is Type"
ADS.DataSetType = DataType.Input
Dim colName As String = ADS.NextColumnInTable("ERCOT Heat Rate Definitions")
AC.SendToAURORAXMP("The next column in Heat Rate is "& colName)
NextTableInDataSetNextTableInDataSet
Returns the name of the next table in the specified dataset, ADS.DataSetType. The index of the next table will not reset to zero when the script is finished, it will continue while the Scripting tab is open. The index of this function will reset to zero, or the beginning of the list, when ADS.FirstTableInDataSet() is called or it reaches the last table in the dataset.
If looping through columns in the table, then use in conjunction with ADS.FirstColumnInTable(). ADS.FirstColumnInTable() will essentially reset the starting position to the left most column.
ADS.NextTableInDataSet() As String
Example:
'If just this code is run in a script twice, the Status message will first be "Next table in the Project dataset is SingleRow" and the second time the script is run, the Status message will be "Next table in the Project dataset is DispatchFlag"
ADS.DataSetType = DataType.Project
AC.SendToAURORAXMP("Next table in the Project dataset is " &
ADS.NextTableInDataSet())
NumberOfColumnsInTableNumberOfColumnsInTable
Returns the number of columns in a specified table. If there is an error retrieving the number of columns, a -1 will be returned. The table name given must be a part of the current ADS.DataSetType.
ADS.NumberOfColumnsInTable (myTableName As String) As Integer
Example:
'This will get the number of columns for the first table in the Input dataset. If there is not an error, the Status message will be "The number of columns in Conditions is 5”
ADS.DataSetType = DataType.Input
Dim firstTable As String = ADS .FirstTableInDataSet()
Dim numColumns As Integer = ADS.NumberOfColumnsInTable(firstTable)
If(numColumns = -1) Then
AC.SendToAURORAXMP("Error retrieving number of columns for " &firstTable)
Else
AC.SendToAURORAXMP("The number of columns for "& firstTable & " is "& numColumns)
End If
NumberOfRowsInTableNumberOfRowsInTable
Returns the number of rows in a specified table. If there is an error retrieving the row count, a -1 will be returned. The table name given must be a part of the current ADS.DataSetType.
ADS .NumberOfRowsInTable(myTableName As String)As Integer
Example:
'This will get the number of rows for the Conditions WECC table in the Input dataset.
ADS.DataSetType = DataType.Input
Dim numRows As Integer = ADS .NumberOfRowsInTable("Conditions WECC" )
If(numRows = -1) Then
AC.SendToAURORAXMP("Error retrieving number of rows for Conditions WECC")
Else
AC.SendToAURORAXMP("The number of rows for Conditions WECC is " &numRows)
End If
NumberOfTablesInDataSetNumberOfTablesInDataSet
This will return the number of tables in the specified dataset. If ADS.DataSetType has not been set yet, it will return -1.
ADS.NumberofTablesInDataSet() As Integer
Example:
'Retrieves the number of tables in the Project data set
ADS.DataSetType = DataType.Project Dim numTables As Integer =
ADS.NumberofTablesInDataSet()
ProjectTableNameProjectTableName
Use this to return the name of the project table being used. This works in conjunction with ProjectTableType. Each project table type refers to an actual table in the underlying data set. This returns the name of that underlying table.
ADS.ProjectTableName As String
Example:
'This will set the ProjectTableType to Dispatch and the actual name of that table is "DispatchFlag". So a message will be sent to the Status page with ”The current table name of the ProjectTableType is: DispatchFlag”
ADS.DataSetType = DataType.Project
ADS.ProjectTableType = ProjectDSTablesType.Dispatch
Dim tableName As String = ADS.ProjectTableName
AC.SendToAURORAXMP("The current table name of the ProjectTableType is:
"& tableName)
ProjectTableTypeProjectTableType
This is used when the DataSetType is set to DataType.Project. This specifies which type of project file settings to reference for any variable or table changes. However, most project settings changes can now be made through using ADS.UpdateProjectParameter(). See ProjectTableType to learn more.
ADS.ProjectTableType As ProjectDSTablesType
Example:
'This will set the ProjectTableType for changing project variables relating the Logic Settings in Simulation Options
ADS.DataSetType = DataType.ProjectADS.ProjectTableType = ProjectDSTablesType.Dispatch
RejectInputDSChangesRejectInputDSChanges
Use this to reject input dataset changes that were made in the script. This will reject all the changes made before the last database save, which is called in the script using ADS.AcceptInputDSChanges(). It will return True if it successfully rejects the changes, False if it encounters an error.
ADS.RejectInputDSChanges() As Boolean
Example:
'The coal price in Fuels will be changed to "yr_newPrices", then after calling RejectInputDSChanges, the coal price will be changed back to "yr_coalprices".
ADS.DataSetType = DataType.Input
ADS.SetDataItemSearch("Fuels", "yr_coalprices", "Price", "yr_newPrices")
Dim result = ADS.RejectInputDSChanges()
If (result = True) Then
Dim coalPrice As String = ADS.GetDataItem("Fuels",
ADS.FindRow("Fuels", "Fuel ID", "Coal"), "Price")
AC.SendToAURORAXMP("The price of coal is "& coalPrice)
End If
RemoveChangeSetFromStudyCaseRemoveChangeSetFromStudyCase
Will delete the specified change set from the first study case it encounters with this run id.
See Remove a Change Set to a Study Case in the UpdateStudyCase topic for more details.
ADS.RemoveChangeSetFromStudyCase(runId As String, changeSetName As String) As Boolean
Example:
Dim result As Boolean = ADS.RemoveChangeSetFromStudyCase("New Case 1", "New Change Set 1")
SaveViewAsTableSaveViewAsTable
This command will overwrite an existing table with the specified filter or sort. It can be used on any table, as long as it is a part of the current ADS.DataSetType. This command is given the table name to be overwritten, along with the filter and sort parameters. The table must already exist in the database and be read into the database. It will return a Boolean, True if the function was successful, false otherwise.
The create the filter string, it must start with the column name followed by the operator and the value to filter on. The value must always be in single quotation marks for strings and dates. For numeric values such as integers and doubles, no quotation marks should be used. For column names that have a space in them, square brackets should be put around them. For example, “Price < 1” or “[Report Area] = ‘True’”. To filter based on multiple conditions, use “AND”, “OR”, and “NOT” to link expressions together. For example, “[Heat Rate] > 10000 AND Capacity <= 250000 OR Fuel = ‘Coal’”. In this one expression meant for the Resources table, it will show all resources that have a heat rate greater than 10000 AND a capacity less than or equal to 250000, along with showing all the resources that use coal as fuel.
The sort for the data table must be based on one or more columns. The sort string will only have the names of the columns. If there are multiple columns to be used in the sort, they will be separated by a comma and sorted in the order they appear in the string. For example, “Name” will only sort the table by the Name column. “Name,Heat Rate” will sort the data table by name, then by heat rate.
The sort type allows the columns to be sorted based upon their specific column type. If using sorting, this parameter must be defined. The options are “String”, “Integer”, “Double”, “Boolean” and “Date”. If sorting on more than one column then this argument needs to be “Column1Type,Column2Type”. For example, if the sort string is “Name,Heat Rate”, the sort type string would be “String,Integer”.
ADS.SaveViewAsTable(myTableName As String, Optional myFilterString As String, Optional mySortString As String, Optional mySortType As String) As Boolean
Example:
'FilteredResources is a table already created by copying the resources table. This table will delete any resources that do not match the filter string, so it will only have resources that have a heat rate less than or equal to 10000 or have coal as their fuel. It will then sort these resources by name and then by their heat rate.
ADS.DataSetType = DataType.Input
Dim myFilter As String = "[Heat Rate] <= 10000 OR Fuel = 'Coal'"
Dim mySort As String = "Name,Heat Rate"
Dim mySortType As String = "String,Integer"
Dim newResult = ADS.SaveViewAsTable("FilteredResources", myFilter, mySort, mySortType)
If (newResult = False) Then
AC.SendToAURORAXMP("Error creating filtered and sorted resources table")
End If
SetDataItemInputPKSetDataItemInputPK
Use this to update data in a specified Input table. It will only work for Input tables, when ADS.DataSetType = DataType.Input. It is given the table name, column name of the value to be changed, the primary key of the row, and the new value of the cell as an object. This command will return a boolean, True if it was successful, False otherwise.
This command references the data item location by the primary key of the specified table instead of the row index so that inserting rows in the table will not necessitate a change in this command.
ADS.SetDataItemInputPK(myTableName As String, myKeyValue As String, myColName As String, myNewValue As Object) As Boolean
Example:
'This will change the generator Gen 6-1's (whose Primary Key is 5) Capacity from 250000 to 270000 in the Resources table for Nodal_10Bus_Example.apz
ADS.DataSetType = DataType.Input
Dim result As Boolean = ADS.SetDataItemInputPK("Resources 10bus", "5", "Capacity", 270000)
If (result = False) Then
AC.SendToAURORAXMP("Error changing capacity value")
End If
Use this to update data in a specified table (table name and column name as strings, row as long, and value as variant). This command is similar to ADS.SetDataItemInputPK() except that it references data items by row index and not primary key. This command will be affected if new rows are added or deleted in the data table as row indexes might changes.
It is recommended that ADS.UpdateProjectParameter is used for changing project settings.
NOTE: When using the row index, the current row in the data table may not reflect the actual row index in the data table below if a filter or sort was used. If manually inputting the row index for this function, make sure Clear Filter/Sort is used on the data table to see the order of the actual underlying table to find the correct row index.
ADS.SetDataItemRow(myTableName As String, myRow As Integer, myColName As String, myNewValue As Object) As Boolean
Example:
'This will find the row that defines coal in Fuels and changes the price of it to a new yearly time series.
ADS.DataSetType = DataType.Input
Dim rowIndex As Integer = ADS.FindRow("Fuels", "Fuel ID", "Coal")
Dim result As Boolean = ADS.SetDataItemRow("Fuels", rowIndex, "Price", "yr_newPrices")
If (result = False) Then
AC.SendToAURORAXMP("Error changing coal fuel price")
End If
SetDataItemRowsSetDataItemRows
This command is identical to ADS.SetDataItemRow(), except that it will set multiple new values at once in the same table. It will return a list of booleans, True if the value was able to be updated, False otherwise.
ADS.SetDataItemRows(myTableName As String, myRows() As Integer, myColNames() As String, myNewValues() As Object) As Boolean()
Example:
'This will change multiple rows and column values in the Fuels table
ADS.DataSetType = DataType.Input
Dim rowIndexes(2) As Integer
Dim colNames(2) As String
Dim newValues(2) As Object
rowIndexes(0) = ADS.FindRow("Fuels", "Fuel Name", "Coal")
rowIndexes(1) = ADS.FindRow("Fuels", "Fuel Name", "Solar")
rowIndexes(2) = ADS.FindRow("Fuels", "Fuel ID", "WAT")
colNames(0) = "Price"
colNames(1) = "Escalation"
colNames(2) = "Fixed O&M"
newValues(0) = "yr_newPrices"
newValues(1) = 0.75
newValues(2) = 350
Dim results(3) As Boolean
results = ADS.SetDataItemRows("Fuels", rowIndexes, colNames, newValues)
For Each result As Boolean In results
If (result = False) Then
AC.SendToAURORAXMP("Error changing value")
End If
Next
SetDataItemSearchSetDataItemSearch
This will update data in a specified table by referencing the original value in the column. The table must be in the current dataset, ADS.DataSetType. This takes in the specified table, the original value of the column, the column name, and then the new value of the column. The command will return a boolean, True if the update was successful, False otherwise.
The specified table could be in any dataset, so this command could be used to change project file settings, however ADS.UpdateProjectParameter is recommended to change most project settings.
ADS.SetDataItemSearch(myTableName As String, mySearchValue As String, myColName As String, myNewValue As Object) As Boolean
Example:
'This will search the Fuel table rows until it finds "yr_coalprices" in the Price column, then change that value to "yr_NEWcoalprices"
ADS.DataSetType = DataType.Input
Dim result As Boolean = ADS.SetDataItemSearch ("Fuels" , "yr_coalprices", "Price" , "yr_newPrices")
If (result = False) Then
AC.SendToAURORAXMP("Error changing coal price time series")
End If
SetupMemoryUpdateToFalseSetupMemoryUpdateToFalse
This disengages real time updating of a specific memory table during a model. This command must be executed before you begin the run or step Aurora. It will return True if the variable change was successful, false otherwise.
It needs to be executed only once for each table and will remain set (for the duration of the Aurora session) until changed.
ADS.SetupMemoryUpdateToFalse(tableName As String) As Boolean
Example:
'Sets the Hour Fuel Table to not update every dispatch hour. This will make the Aurora simulation run faster.
Dim result As Boolean = ADS.SetupMemoryUpdateToFalse("Hour Fuel" )
If (result = True) Then
AC.Run()
End If
SetupMemoryUpdateToTrueSetupMemoryUpdateToTrue
This allows a specific memory table to be updated during a model run (table name as string). So the selected memory table will be updated and show the results for every dispatch hour while Aurora is being stepped through or running. This command must be executed before you begin the run or step Aurora. It needs to be executed only once for each table and will remain set (for the duration of the AURORA session) until changed. It will return True if the variable change was successful, false otherwise.
Note that because it remains set until changed, if you stop your script and start doing other work with Aurora, any runs will be slowed as the data is populated in the memory dataset table. Hence you should set memory update to false at the end of the script.
ADS.SetupMemoryUpdateToTrue(tableName As String) As Boolean
Example:
'This will allow access to specific hourly data the Hour Fuel Memory table during a run
ADS.DataSetType = DataType.Memory
ADS.SetupMemoryUpdateToTrue("Hour Fuel" )
AC.AURORAStep()
Dim rowNumber As Integer = ADS.FindRow("Hour Fuel", "Fuel Name" , "Coal")
Dim coalUsed As String = ADS.GetDataItem("Hour Fuel", rowNumber, "Quantity Used")
AC.SendToAURORAXMP("The quantity used for coal in the first dispatch hour of the study is "& coalUsed)
UpdateProjectParameterUpdateProjectParameter
This function changes variables in Project Setup and Simulation Options. UpdateProjectParameter is an easier way to use the functionality provided by ADS.SetDataItemRow(). UpdateProjectParameter takes two variables: the name of the parameter to change and the new value.
The name of the parameter will be part of the SimOptions enumeration. This name as part of the SimOptions enumeration will almost always exactly match how you see the variable in user interface. For example, to change the Active Study Type in Project Setup, the variable you would use as the first parameter is SimOptions.ActiveStudyType. Some will have slight differences, such as Start Date in Study Period has both SimOptions.StartDateMonth and SimOptions.StartDateYear. When typing the function, it will auto-fill with suggestions for parameters that match.
The second parameter is the new value. It can take any object, such as a numeric, string, or boolean value. It can also take an enumeration value. So, for variables that have dropdown values in the user interface, type the variable name and then a period, and it will show you the value options for that variable.
ADS.UpdateProjectParameter (VariableName As SimOptions, NewValue As Object) As Boolean
Example:
'Set Active Study Type to be Long Term Capacity Expansion
'UpdateProjectParameter can return a boolean that shows
'whether or not the value was updated
Dim result As Boolean = ADS.UpdateProjectParameter(SimOptions.ActiveStudyType, ActiveStudyType.LongTermCapacityExpansion)
'Set the Start Date year to be 2016
ADS.UpdateProjectParameter(SimOptions.StartDateYear, 2016)
'Set the Methodology to MIP in Long Term
ADS.UpdateProjectParameter (SimOptions.Methodology, Methodology.MIP)
'Use Threading in Logic and Parallelize the Run in General
ADS.UpdateProjectParameter(SimOptions.UseThreadingInLogic, True)
UpdateProjectParametersUpdateProjectParameters
There is a plural option, ADS.UpdateProjectParameters, that will take in an array of SimOption variables and an array of objects to change multiple variables in a project at once. When changing multiple variables, this option is faster than using the singular UpdateProjectParameter. The function will return an array of Booleans, with each row representing whether the variable was successfully updated or not.
ADS.UpdateProjectParameters(VariableName() As SimOptions, NewValue() As Object) As Boolean()
Example:
'UpdateProjectParameters does the same thing as the singular one above, however it just takes in a list with all of the parameters. This is faster than the singular UpdateProjectParameter for changing multiple variables.
Dim VarNames (6) As SimOptions
Dim NewValues (6) As Object
VarNames(0) = SimOptions.ActiveStudyType
NewValues(0) = ActiveStudyType.LongTermCapacityExpansion
VarNames(1) = SimOptions.StartDateYear
NewValues(1) = 2016
VarNames(2) = SimOptions.EndDateYear
NewValues(2) = 2030
VarNames(3) = SimOptions.Methodology
NewValues(3) = Methodology.MIP
VarNames(4) = SimOptions.DispatchRepresentation
NewValues(4) = DispatchRepresentation.LDC
VarNames(5 ) = SimOptions.UseThreadingInLogic
NewValues( 5) = True
VarNames(6 ) = SimOptions.ParallelizeTheRunAcrossYears
NewValues( 6) = True
Dim Results = ADS.UpdateProjectParameters(VarNames, NewValues)
UpdateReportingParameterUpdateReportingParameter
This function will update the parameters in the Output Reporting table in Simulation Options. This will update the reporting selections for a single table type and period type. This will return a boolean to show whether the function was successful or not.
ADS.UpdateReportingParameter(tableType As Options.OutputTableType, periodType As Options.ReportingPeriod, reportValue As Options.ReportingType, periodAverage As Boolean , otherConditionsValue AsOptions.ReportingType) As Boolean
Example:
'This will update the reporting table so Fuel Month will report All fuels, the Period Average will be reported, and Selected is for Other Conditions
Dim result=ADS.UpdateReportingParameter(OutputTableType.Fuel, ReportingPeriod.Month, ReportingType.All, True, ReportingType.Selected)
UpdateReportingParametersUpdateReportingParameters
This has the same functionality of ADS.UpdateReportingParameter, however you can set multiple attributes for different output tables at once. Also, this is faster than calling ADS.UpdateReportingParameter multiple times because the changes will only be pushed to the UI once at the end, not after every update.
UpdateReportingParameters(tableTypes() As Options.OutputTableType, periodTypes() As Options.ReportingPeriod, reportValues() As Options.ReportingType, periodAverages() As Boolean , otherConditionsValues() As Options.ReportingType) As Boolean()
UpdateStudyCaseUpdateStudyCase
Updates an attribute for a single Study Case. It will update the specified attribute of the first Study Case it encounters (the one with the lowest Run Order value) with the specified Run ID.
ADS.UpdateStudyCase(runId As String, Attribute As StudyCase, newValue As Object) As Boolean
Possible attributes it can update are:
Options.StudyCase.RunId: newValue must be a String.
Options.StudyCase.RMTName: newValue must be a String.
Options.StudyCase.ParameterSet: newValue must be a String. Capitalization does matter and any leading or trailing spaces in Parameter Set Name will be trimmed. If the given Parameter Set Name does not exist, the parameter set name will change to be empty.
Options.StudyCase.ChangeSets: newValue must be a String. This will remove any Change Sets already in the Study Case and replace them with the Change Sets in the given comma delimited list. Capitalization does not matter and any leading or trailing spaces in the Change Set names will be trimmed. If one of the Change Set names given is not contained in Change Sets, none of the Change Set updates will go through. To delete all Change Sets from a Study Case, have the newValue be an empty String, “”.
Options.StudyCase.BaseCase: newValue must be a Boolean. Only one Study Case can be a base case. If a Study Case is set to be a base case, all other study cases will be set to not be the base case.
Options.StudyCase.RunCase: newValue must be a Boolean. Selects a Study Case to be run as part of a simulation.
Options.StudyCase.RunOrder: newValue must be an Integer. The run order of the Study Cases. If two Study Cases are given the same Run Case value, i.e., 0, then the order of the Study Cases will be based alphabetically.
Example
Dim result = ADS.UpdateStudyCase("New Case", StudyCase.RunCase, True)
Dim result = ADS.UpdateStudyCase("New Case 1", StudyCase.ChangeSets,
"New Change Set 1, New Change Set 3")
UpdateStudyCasesUpdateStudyCases
This has the same functionality of ADS.UpdateStudyCase, however you can set multiple attributes for different Study Cases at once. Also, this is faster than calling ADS.UpdateStudyCase multiple times because the changes will only be pushed to the UI once at the end, not after every update.
ADS.UpdateStudyCases(runId As String(), Attribute As StudyCase(), newValue As Object()) As Boolean()
Example:
'The function will return an array Of Booleans, True If the attribute was updated successfully Or False otherwise.
Dim RunIds(3) As String
Dim AttNames(3) As StudyCase
Dim NewValues(3) As Object
RunIds(0) = "New Case 2"
AttNames(0) = StudyCase.RunId
NewValues(0) = "New Case 1"
RunIds(1) = "New Case 1"
AttNames(1) = StudyCase.BaseCase
NewValues(1) = True
RunIds(2) = "New Case 6"
AttNames(2) = StudyCase.ParameterSet
NewValues(2) = "Parameter Set 1"
RunIds(3) = "New Case 5"
AttNames(3) = StudyCase.RunOrder
NewValues(3) = 2
Dim Results = ADS.UpdateStudyCases(RunIds, AttNames, NewValues)
ValidateResTimeSeriesValidateResTimeSeries
Use this command to generate a report with resolved time series values for a specific resource. For the given resId the model will find all input parameters related to the resource which have entries which are time series values. It will loop through the hours of the currently defined study period (or only the first hour of each day if dailyOnly = True) and locate hours when one or more of these parameters changes. Each hour with a change will produce a new line in the Status Window showing all values for that hour.
The report is formatted for easy copying to another application such as Microsoft Excel. To see a list of columns which do not have time series entries the optional parameter reportStaticValues should be set to True. To exclude certain columns from the report, these should be entered as a String in the last parameter of the function, using a comma delimited list if more than one column is to be excluded. Note that the report does not apply inflation to input financial values but reports them as entered.
If isPortfolioRes is False, the logic will find the ID in the Resources table and will look for time series entries in that table. It will also find relevant values in the Fuel, Emission Rate, Emission Price, and Heat Rate Definitions tables if those are referenced by the resource, but note that for the Fuel Price it will not include the value of reference fuels.
If isPortfolioRes is True, the model will look for the resource ID in the Portfolio Resource table and validate the time series entries in the percent owned columns. If isNewResource is True, the model will look for the resource ID in the New Resources table. It will also report the total percent owned for each resource. This function can only be called when the model is not currently running a simulation.
To exclude columns from the report, put these as a comma delimited list in the excludedCols parameter. To exclude columns that are not directly in the Resources table (e.g., Fuel Price in Fuels table), use the descriptor exactly as reported on the status screen. If doSetup = False, the logic will skip the time series logic setup and other pre-processing. This can be used when multiple calls to the ValidateResTimeSeries() command are used in a script. The first call to the command should have doSetup = True, and all subsequent calls can have doSetup = False to improve performance.
If the optional parameters are not used their default values are False for reportStaticValues, dailyOnly, isPortfolioRes, and isNewResouce. The default value of doSetup is True. The default value of excludedCols is an empty string.
ADS.ValidateResTimeSeries(resourceID As String, Optional reportStaticValues As Boolean, Optional dailyOnly As Boolean, Optional excludedCols As String, Optional isPortfolioRes As Boolean, Optional isNewResource As Boolean, Optional doSetup As Boolean) As Boolean
Example:
'This will print out a report to the Status window of all the time series relating to resource with the id of 5968.
ADS.DataSetType = DataType.InputADS .ValidateResTimeSeries("5968")
Scripting
AURORA Datasets
For further assistance, please contact Aurora Support.
Copyright© 1997-2024 Energy Exemplar LLC. All rights reserved.