This page describes all AURORA Commands to use in Aurora Scripting. These commands must be prefixed with AURORACommand. or AC. in the script.
NOTE: As a general rule, AURORA Commands (AC.) are used to accomplish specific commands when using scripting. AURORA Datasets (ADS.) are used to change values directly in the project datasets.
NOTE: If the Simulation Options window is open and a change is made to a project setting through Scripting, the Simulation Options window may become “suspended.” As a result, changes made directly within the Simulation Options window may be ignored. As such, scripts that make any changes to project settings should be run with the Simulation Options window closed. If Aurora detects this problem, a warning appears in the Status window.
Click on a topic below to learn more about the specific command:
ActivateChangeSetActivateChangeSet
This will activate a change set in the current project. It is given the name of the change set to activate. If the change set does not exist, all change sets will be deactivated.
AC.ActivateChangeSet (changeSet As String)
Example:
AC.ActivateChangeSet ("FuelPriceChanged")
AURORARunToStudyStartAURORARunToStudyStart
Runs Aurora to the beginning of the next study. The main use for this command is to control multiple run studies easily through scripting. It is mostly used when running multiple Change Sets or multiple risk iteration studies. It is also helpful to use when modifying the input dataset during a risk run.
The command, AC.RunToStudyStart(), is identical to this function.
AC.AURORARunToStudyStart()
Use to step through an Aurora simulation by advancing the current loaded project through the next model hour. Unlike using the Step button on the Home ribbon, this will not automatically pause at the study hour, it will continue executing the script. Note that users must include this command to use the AC.VarSim commands during a simulation.
AC.StepOneHour() is identical to this command.
AC.AuroraStep()
Example:
'This function will get the current risk iteration and write it to the Status screen and message log
AC.LoadProjectWaitForDBRead("C:\AURORAxmp\RiskProject.apz")
Dim isRunning As Boolean = True
Dim currentRiskIteration As Integer = AC.VarSimT.RiskIteration
While (isRunning = True)
AC.AuroraStep()
currentRiskIteration = AC.VarSimT.RiskIteration
AC.SendToAURORAXMP ("Risk Iteration: " & CStr(currentRiskIteration))
isRunning = AC.VarAURORAStatus.SimulationRunning
End While
AURORAStepToDispatchHourStartAURORAStepToDispatchHourStart
Use to step through Aurora. This command pauses the model just before processing input data for the dispatch hour. This is useful for users who wish to modify input data conditional upon the current status of the model run.
The command, AC.StepToDispatchHourStart(), is identical to this function.
AC.AURORAStepToDispatchHourStart()
CalcPenFacsForShortRunsCalcPenFacsForShortRuns
Limits the penalty factor calculation for nodal studies to use the median load hour within the run period instead of the calendar year. AC.CalcPenFacsForShortRuns(True) turns the switch on. It will remain true/on for the duration of that Aurora instance unless it is turned off with AC.CalcPenFacsForShortRuns(False).
AC.CalcPenFacsForShortRuns(setValue As Boolean)
Example:
AC.CalcPenFacsForShortRuns(True)
ChangeInputDataBaseChangeInputDataBase
Used to change the input database in the current project. It is given the full file path for the new input database. However, this will only change, not load, the new input database. To change and load a new input database, use AC.LoadInputDataBase().
AC.ChangeInputDataBase(FileName As String)
Example:
AC.ChangeInputDatabase("C:\AURORAxmp\US_Canada _DB_2018_v3.xdb")
ChangeInputDatabasePasswordChangeInputDatabasePassword
Use this function to change the password in the input database. The password in the project file will also be updated. If the call was successful a value of True will be returned from the function.
When this command is used, the project file and input database in use will get the new password. If another project file that references the same input database is subsequently opened, it WILL NOT have a record of the changed password and will no longer have access to the input database. Aurora will generate the following warning: “Project file and database have conflicting DB passwords. The password in the project file will need to be changed to match the password in the database.
AC.ChangeInputDatabasePassword (newPassword As String) As Boolean
Example:
Dim result As Boolean = AC.ChangeInputDatabasePassword ("newpassword")
If(result = True) Then
AC.SendToAURORAXMP("Input DB password changed successfully")
End If
ChangeOutputDatabaseNameChangeOutputDatabaseName
Used to change the output database in the current project. It is given the full file path for the new output database. It will change and load the new database if the new database exists and is valid.
AC.ChangeOuputDataBaseName(fileName As String)
Example:
AC.ChangeOutputDataBaseName("C:\AURORAxmp\Nodal_10bus_Output.xdb")
ChangeOutputDataBaseTypeChangeOutputDataBaseType
Used to change the type of database format for Output. The options are xmpSQL, SQL Server, Zipped XML, XML, and MySQL.
AC.ChangeOuputDataBaseType(outputDBType As Options.OutputDatabaseType)
Example:
AC.ChangeOutputDataBaseType(OutputDatabaseType.xmpSQL)
ChangeProjectPasswordChangeProjectPassword
This is an obsolete function that is kept around for legacy purposes. Do not use this.
AC.ChangeProjectPassword(newPassword As String) As Boolean
Converts all of the columns in a specified CDS table to user data columns.
AC.ConvToUserData(myTableName As String)
Example:
Dim myTableName As String = "CDS Table Name"
AC.ConvToUserData(myTableName)
This will create an archive of the current project. It has three parameters, the first is the full file path of the archive to be created. The second is a boolean that is passed by reference, if it is True, the archive was successful. There is a final optional parameter as a Boolean, if it is True, it will include all of the input tables in the input database in the archive. If it is False or not specified, it will only include input tables selected as “In Study”.
AC.CreateArchive (myArchiveFilename As String, ByRef goodResult As Boolean, Optional allTables As Boolean)
Examples:
'This will create an archive with all the input database tables in it
Dim result As Boolean = False
AC.CreateArchive ("C:\AURORAxmp\NewArchive_AllTables.zip", result, True)
If (result = False) Then
AC.SendToAURORAXMP("Error creating archive with all input tables.")
End If
'This will create an archive with only the selected input database tables in it
AC.CreateArchive ("C:\AURORAxmp\NewArchive.zip", result)
If (result = False) Then
AC.SendToAURORAXMP("Error creating archive with only selected input tables.")
End If
This returns the Run ID of the simulation currently being run. It will return String.Empty if no simulation is running.
AC.CurrentRunID() As String
Example:
Dim currentRunID As String = AC.CurrentRunID
DeactivateChangeSetDeactivateChangeSet
This will deactivate a change set in the currently loaded project. It is given the name of the change set to deactivate.
AC.DeactivateChangeSet (changeSet As String)
Example:
AC.DeactivateChangeSet ("FuelPriceChanged")
This delays the execution of the script. It will pause the script at that line for a specified number of seconds.
AC.Delay(seconds As Integer)
Example:
AC.Delay(5)
ForceInputDataBaseLoadForceInputDataBaseLoad
This will force the input database associated with the current project to load. This command has the same functionality as the Force Database Load button on the Data Assumptions Toolbar.
AC.ForceInputDataBaseLoad()
ForceInputTableLoadForceInputTableLoad
This function forces the load of an individual table in Input. It takes in the Input table name as a parameter.
AC.ForceInputTableLoad (myTableName As String)
Example:
'This will update the Areas table in the Nodal_10Bus project
AC.ForceInputTableLoad ("Areas 10Bus")
GetAURORAxmpVersionGetAURORAxmpVersion
This returns the version of Aurora being run, such as “13.2.1001”. It returns the model version number as a string.
AC.GetAURORAxmpVersion() As String
Example:
Dim version As String = AC.GetAURORAxmpVersion()
AC.SendToAURORAXMP("The current version of Aurora is " & version)
This returns a string array containing the change sets associated with the current project.
AC.GetChangeSets() As String
Example:
'This will print out all of the change sets in the project to the status screen and message log.
Dim changeSetNames() As String
changeSetNames = AC.GetChangeSets()
For Each csName As String In changeSetNames
AC.SendToAURORAXMP("Change Set: " & csName)
Next
GetCurrentProjectNameGetCurrentProjectName
This will return the current Aurora project’s file name without the file extension. If there was an error retrieving the file name, it will return “Not Available”.
AC.GetCurrentProjectName() As String
Example:
'This will send “Nodal_10Bus_Example is the current project” to the Status window and message log.
AC.LoadProject("C:\AURORAxmp\Nodal_10Bus_Example.apz")
AC.SendToAURORAXMP (AC.GetCurrentProjectName() & " is the current project")
GetCurrentProjectPathGetCurrentProjectPath
This will return the current Aurora project’s full file path and name, with the extension. If there was any error retrieving the file path, it will return “Not Available”
AC.GetCurrentProjectPath() As String
Example:
'This will send “C:\AURORAxmp\Nodal_10Bus_Example.apz is the current project” to the Status window and message log.
AC.LoadProject("C:\AURORAxmp\Nodal_10Bus_Example.apz")
AC.SendToAURORAXMP (AC.GetCurrentProjectPath() & " is the current project")
This returns the number of days in a specified month. It takes in the month as an integer value between 1 and 12. It also takes in the year, which is used to see if it is a leap year. There is a default function in VB which has the same functionality, DateTime.DaysInMonth().
AC.GetDaysInMonth(iMonth As Integer, iYear As Integer) As Integer
Example:
'This will return the number of days In February 2018, which is 28
Dim numDays As Integer = AC.GetDaysInMonth(2, 2018)
GetHourlyFtpUrlGetHourlyFtpUrl
This command will search through an FTP directory to find filenames that match the base url parameter given to the function. It will return the URL of the file with the most recent date, or if it cannot find any matching URL, it will return an empty string. This function is useful when a file is known to exist in an FTP directory, but the file has a variable suffix, such as when a file is generated with a date or time stamp as part of that filename.
You can also specify your username and password for the given FTP site by including these in your base URL in standard ftp URL format.
AC.GetHourlyFtpUrl (urlBase As String) As String
Example:
'If you are looking for a file named OUTAGES_yyyymmddhh, but don’t know what the most recent date would be, this will return it. The url returned would be “ftp://somecompany.com/files/OUTAGES_2018120108”
Dim url As String = AC.GetHourlyFtpUrl("ftp://somecompany.com/files/OUTAGES_")
'This returns the same url, but uses a username and password if access is restricted
Dim url As String = AC.GetHourlyFtpUrl ("ftp://myusername:mypassword@ftp.somecompany.com/files/OUTAGES_")
GetReportSetNamesGetReportSetNames
This will return the names of all report sets in the project as an array of strings.
ADS.GetReportSetNames() As String()
GetShiftFactorBinFilePathGetShiftFactorBinFilePath
Returns an array of strings that lists all of the current Shift Factor file paths, along with their corresponding array index, associated with the current project.
AC.GetShiftFactorBinFilePath() As String()
Example:
Dim shiftFactorNames() As StringshiftFactorNames =
AC.GetShiftFactorBinFilePath()For Each sfName As String In
shiftFactorNames
AC.SendToAURORAXMP("Shift Factor: " & sfName)Next
GetStatusScreenMessagesGetStatusScreenMessages
This returns the full contents of the Status window.
AC.GetStatusScreenMessages() As String
Example:
Dim allStatusMessages = AC.GetStatusScreenMessages()
Returns the UNC path to a given local path.
AC.GetUncPath(localPath As String) As String
Example:
'The uncPath will be \\host-name\C\AURORAxmp\Nodal_10Bus_Example.apz
Dim uncPath As String = AC.GetUncPath("C:\AURORAxmp\Nodal_10Bus_Example.apz")
Use this command to retrieve today’s date formatted for use in a URL (YYYYMMDD). All single digit months and days are padded with leading zeros.
AC.GetUrlDate() As String
Example:
'If today’s date is January 9th, 2018, the function will return “20180109”
Dim todaysDate As String = AC.GetUrlDate()
GetZonalPricePreforecastGetZonalPricePreforecast
This is used to extract the internal preforecast of prices which is used by the commitment logic. Aurora must be “stepped” into an hour to use this function. The preforecast is an array of doubles passed by reference to the function, it will have the internal preforecast price when the function has ended. The size of this array should be 168 to look a full week ahead.
The first parameter passed to the function is the short name of the zone. The second and third parameters are the start date and start hour of the internal preforecast. The fourth parameter is a message passed by reference that contains the status of the operation, it will hold an error message if there was a problem in the function or be an empty string if the function was successful. The last parameter is the array of doubles that will hold the preforecast.
There is also the option to GetZonalPricePreforecastSingleHour for a single hour.
AC.GetZonalPricePreforecast(myShortZoneName As String, ByRef myPFStartDate As Date, ByRef myPFStartHour As Long, ByRef myMessage As String, ByRef myPreForecast() As Double)
Example:
'This will show the preforecast for zone “West” for the week ahead of the first hour of the runAC.LoadProject("C:\AURORAxmp\Nodal_10Bus_Example.apz")AC.AURORAStep()Dim startDate As DateDim StartHour As LongDim myMsg As StringDim myPreforecast(168) As DoubleAC.GetZonalPricePreforecast("West", startDate, StartHour, myMsg, myPreforecast)If (myMsg <> "") Then AC.SendToAURORAXMP("Error with preforecast: " & myMsg)ElseFor Each price As Double In myPreforecast AC.SendToAURORAXMP("Price: " & price)NextEnd If
InitializeAURORAxmpInitializeAURORAxmp
This command is only used when running a script outside of the Aurora scripting environment (e.g., from an Excel or Access macro). It should be used before loading a project file.
AC.InitializeAURORAXMP()
KillAuroraProcessKillAuroraProcess
This function will exit out of the script and close the Aurora instance from which the script is running.
In Aurora 13.5, you could use Dim myProcess = Process.GetCurrentProcess() to get the Aurora process in the script and call myProcess.Kill() to stop the script and close Aurora. Starting in Aurora 14.0, this will no longer work and AC.KillAuroraProcess() must be used instead.
AC.KillAuroraProcess()
ListUnusedTSReferencesListUnusedTSReferences
This function will return a list of current references/IDs of all the time series vectors in a given Time Series table, such as year or monthly, that are not referenced in the current configuration. It is given the Time Series table name as a parameter and will return a list of strings.
Activate Time Series Vector Reference must be selected in Options for this command to work.
AC.ListUnusedTSReferences (ByRef tableName As String) As System.Collections.Generic.List(Of String)
Example:
'This will print out a list of unused time series in the Time Series Monthly table
Dim unusedTimeSeries As New System.Collections.Generic.List(Of String)
unusedTimeSeries = AC.ListUnusedTSReferences ("Time Series Monthly")
For Each tsReference As String In unusedTimeSeries
AC.SendToAURORAXMP("Unused Time Series Monthly: " & tsReference)
Next
LoadArchiveAndSaveLoadArchiveAndSave
Loads an archived Aurora project and then saves the project. It is equivalent to using “Unarchive Project” in the Project Menu. It needs the archive file path as the first parameter. The second parameter holds the resulting message of the unarchiving, such as the error if it encounters a problem. The third parameter is a Boolean passed by reference of the results of the unarchiving, True if it was successful, otherwise it will be False.
The fourth parameter is the myProjectFilePath. This used to be an optional parameter but has changed to be a required parameter. The directory of myProjectFilePath will also be the directory where the other files in the project, such as Input database, Change Set files, etc, will be created and saved.
The last parameter is optional, a way to change the name of the Input database when unarchiving. You do not need a full file path for this parameter, just the new name.
NOTE: For archived projects in the old archive format, you can change the specific project file name if you have the .apz file name changed in myProjectFilePath, ie if the project’s name was “Nodal_10Bus_Example.apz” when the project was archived, you can change the name to “Nodal_10Bus_UnarchivedProject.apz”.
However, in the new archive format starting in Aurora 14.0, the project will be unarchived with whatever name it was archived with. In the example above, the unarchived project will always be named “Nodal_10Bus_Example.apz”. But, it is still important to put the myProjectFilePath as a parameter because the directory of myProjectFilePath will still be used as the directory to unarchive all the files in the archive.
You will also not be able to change the name of the Input database with the new format archives. The input database will be unarchived with the name it was archived with.
AC.LoadArchiveAndSave(myArchiveFilename As String, ByRef resultMsg As String, ByRef goodResult As Boolean, myProjectFilePath As String, Optional myInputDBFileName As String)
Example:
' This will unarchive the project and all files in the archive to the folder “C:\AURORAxmp\UnarchivedProject”.
Dim resultMsg As String = ""
Dim goodResult As Boolean = False
AC. LoadArchiveAndSave("C:\AURORAxmp\NewArchive.zip", resultMsg, goodResult,
"C:\AURORAxmp\UnarchivedProject\ProjectName.apz", "NewInputDBName.xdb”)
If (goodResult = False) Then
AC.SendToAURORAXMP("Error unarchiving: " & resultMsg)
End If
LoadInputDataBaseLoadInputDataBase
Changes and loads the specified input database to the current project. It is given the full file path for the new input database.
AC.LoadInputDataBase(fileName As String)
Example:
AC.LoadInputDataBase("C:\AURORAxmp\US_Canada _DB_2018_v3.xdb")
This loads a specified Aurora project. The first parameter for this project is the project name as a string. This string must be the full file path and end in “.apz”. The second parameter is an optional integer that returns whether the function was successful or not. The third parameter is also optional, it is a boolean that allows the function to skip reading the input database, this defaults to False if nothing is set to it.
AC.LoadProject(projectName As String, Optional ByRef openStatus As Integer, Optional skipInputDbRead As Boolean)
Example:
AC.LoadProject("C:\AURORAxmp\WECC Default.apz", OpenStatus)
LoadProjectwithOpenStatusLoadProjectwithOpenStatus
Use this command to load a specified Aurora project file (the project name must be a string ending with ".apz"). This "OpenStatus" can also be used to report the status of the attempted project load. This is particularly useful if accessing Aurora from a macro based in Excel or another application, since Aurora is generally not visible.
Here are all valid examples that will open “C:\AURORAxmp\WECC Default.apz":
'Will open the project and read the input database
AC.LoadProject("C:\AURORAxmp\WECC Default.apz")
'Will open the project, return if the load was successful, and read the input database if there was no error.
Dim OpenStatus As Integer
AC.LoadProject("C:\AURORAxmp\WECC Default.apz", OpenStatus)
If (OpenStatus = 1) Then
AC.SendToAURORAXMP("Project successfully loaded.")
End If
'Will open the project, but not read the input database
AC.LoadProject("C:\AURORAxmp\WECC Default.apz", True)
'Will open the project, return if the load was successful, and read the input database if there was no error.
Dim OpenStatus As Integer
AC.LoadProject("C:\AURORAxmp\WECC Default.apz", OpenStatus, False)
Open Status return values:
1 = Open OK
2 = Open Error
3 = Open With Missing DB
4 = Project file is empty
5 = Project file does not exist
6 = Project file read was not ok
LoadProjectWaitForDBReadLoadProjectWaitForDBRead
This loads a project file and doesn’t return until the database has completed loading. This is identical to LoadProject, except that the script will wait until the Input Database has been completely read before continuing. The user gives this function the full path of the Aurora project file and an optional integer that returns whether the function was successful or not.
AC.LoadProjectWaitForDBRead(projectName As String, Optional openStatus As Integer)
Examples:
'This will open WECC Default project
AC.LoadProjectWaitForDBRead("C:\AURORAxmp\WECC Default.apz")
'This will open WECC Default, but check if it loaded successfully
Dim OpenStatus As Integer
AC.LoadProjectWaitForDBRead("C:\AURORAxmp\WECC Default.apz", OpenStatus)
If (OpenStatus <> 1) Then
AC.SendToAURORAXMP("Error opening project.")
End If
Open Status return values:
1 = Open OK
2 = Open Error
3 = Open With Missing DB
4 = Project file is empty
5 = Project file does not exist
6 = Project file read was not ok
This will change and load a new, Quick View file in the current project. It is given the full path for the new Quick View file.
AC.LoadTemplate(fileName As String)
Example:
AC.LoadTemplate("C:\AURORAxmp\Nodal_10Bus_QuickViews_20180223.atz")
The full path and file name used to log messages during simulations. Can be used to get or set the log file path.
AC.LogFilePath As String
Example:
Dim logFilePath As String = AC.LogFilePath()
AC.LogFilePath = "C:\ProgramData\Energy Exemplar\Aurora\Logs\NewMessageLog.log"
LongTermCheckVarLongTermCheckVar
This is used to the turn on or off the Long Term study logic, or get the current value of it. The command AC.LongTermCheckVar = True is the same as selecting the Long Term Capacity Expansion as the Study Type in Project Setup.
AC.LongTermCheckVar() As Boolean
Example:
'This will return whether or not the study is a Long Term Capacity Expansion Study
Dim isLongTerm As Boolean = AC.LongTermCheckVar
'This will set the study to be Long Term Capacity Expansion
AC.LongTermCheckVar = True
MergeChangeSetsMergeChangeSets
This function will merge multiple Change Sets into one Change Set. The changeSetNames array will contain a list of all the Change Sets you would like to be merged. The Change Set merge order will be based on the Change Set’s position in the changeSetNames array. So the first Change Set in the array will be merged first and so on. The mergedChangeSetName is the new name of the merged Change Set. When this function is used, the Change Set will be in the “Applied” state. To save the new merged Change Set to the project, the project must be saved.
AC.MergeChangeSets(changeSetNames() as String, mergedChangeSetName As String)
Example:
'This will merge "New Change Set 1" and "New Change Set 2" into one Change Set called "Merged Change Set"
Dim changeSetNames() As String = {"New Change Set 1", "New Change Set 2"}
AC.MergeChangeSets(changeSetNames, "Merged Change Set")
MultipleRunOutputFlagMultipleRunOutputFlag
This will get or set the variable to write output for multiple runs to the database. This is the same as the Write Multiple Simulations to the Database checkbox on the Reporting form of Simulation Options or in the Project Setup.
AC.MultipleRunOutputFlag() As Boolean
Example:
'Sets the "Write Multiple Simulations to the Database" to be True
AC.MultipleRunOutputFlag = True
'Gets whether "Write Multiple Simulations to the Database" is set to True or False
Dim result As Boolean = AC.MultipleRunOutputFlag
NewChangeSetFromActiveEditsNewChangeSetFromActiveEdits
This function will create a new Change Set, consisting of any edits that are currently on the Input Database. The new Change Set will be activated and in the “Applied” state after calling this function. To save the new Change Set permanently, the project must be saved. A Change Set History will automatically be generated when this new Change Set is created.
This function will create a new Change Set that consists of any edits that are currently on the Input Database. So, you can modify the Input database through scripting and then call this function to create a new Change Set consisting of the scripting edits. You are also able to activate a Change Set, then modify the Input database through scripting, then call this function and the new Change Set will consist of the activated Change Set’s edits and the scripting edits.
NOTE: If the parameter “newChangeSetName” is the same as an existing Change Set, it will remove the existing Change Set and add the newly created Change Set to the project. This means you will lose any Change Set History for the existing Change Set, since it will be overwritten by the automatically generated Change Set History for the new Change Set.
AC.NewChangeSetFromActiveEdits(newChangeSetName As String)
Example:
'Set ADS.DataSetType to Input for the SetDataItemRow function to modify the Input db
ADS.DataSetType = ComDataSet.DataType.Input
'Create a new Change Set from script edits
Dim coalRowIndex = ADS.FindRow("Fuels", "Fuel Name", "Coal")
ADS.SetDataItemRow("Fuels", coalRowIndex, "Price", 1.50)
AC.NewChangeSetFromActiveEdits("CoalPriceChange")
'Create a new Change Set from an active Change Set and script edits
AC.ActivateChangeSet("HenryHubPrice")
coalRowIndex = ADS.FindRow("Fuels", "Fuel Name", "Coal")
ADS.SetDataItemRow("Fuels", coalRowIndex, "Price", 1.50)
AC.NewChangeSetFromActiveEdits("HenryHubAndCoalPriceChange")
This create a new report set in the project and select it to be the active report set. This new report set will default to having the same reporting settings of the previously selected report set. If newReportSetName is blank, it will default to naming the new report set “New Report Set”.
ADS.NewReportSet(newReportSetName As String) As Boolean
Pauses an Aurora simulation if it is currently running.
AC.Pause()
This reads a CDS file into the current project, it is equivalent to “Open Dataset” or “Reload Dataset” in the CDS ribbon. It takes an optional parameter that is the full file path of the CDS file to read. If no parameter is given, it reloads the current CDS file into the project. If a file path is given, it will open the new CDS table. It will return True if the operation was successful, otherwise it will return False.
AC.ReadCDS (Optional myCDSName As String) As Boolean
Example:
'Reload current CDS file
AC.ReadCDS()
'Will open CDS Examples as the CDS file in the project.
Dim result As Boolean = AC.ReadCDS("C:\AURORAxmp\CDS Examples.cds")
ReadLinkedTableReadLinkedTable
Use to read a linked table in scripting. This capability allows data in an input table linked to an Excel sheet to be changed at will, making it unnecessary to reload the entire input database. It requires the sheet and file name of the Excel workbook, and the Input table name (which should be an existing table) to place the data into. The “Loaded” parameter is a boolean that returns whether or not the sheet was loaded into the data table.
This capability should be used only with an existing Excel linked table, in the following manner:
1. Make sure the table is in the database.
2. Make sure the table has been read (database loaded and table used in the study).
3. Execute the command.
4. Run or Process as needed.
5. Repeat 3 & 4 as needed.
6. Importantly, the SheetName and BookFileName can be changed with each execution of the command.
NOTE: This capability should only be used with zip and SQL input databases.
AC.ReadLinkedTable(SheetName As String, BookFileName As String, InputTableName As String, ByRef Loaded As Boolean)
Example:
'This will read the linked Areas table to be reloaded into the input database if it was changed in Excel
AC.LoadProject("C:\AURORAxmp\WECC Default.apz")
Dim loaded As Boolean = False
AC.ReadLinkedTable("Excel Sheet Name", "C:\AURORAxmp\Excel File Name.xlsx", "Areas", loaded)
If (loaded = True) Then
AC.SendToAURORAXMP ("Success at reading linked Input table")
End If
Runs the currently loaded project. This method will not return until the simulation completes or encounters an error.
AC.Run()
Starts an Aurora run of the currently loaded project. Unlike Run(), before the simulation ends, it immediately returns to the next line in the script.
This is useful when running Aurora from another application or when using a ‘while’ loop to return specific information while running a simulation.
AC.RunandReturn() As String
This can be used to get or set the Run_ID for Output.
AC.RunID() As String
Example:
'Sets the new RunID for Output
AC.RunID = "New Run ID"
'Gets the current Run ID for the project
Dim currentRunID As String = AC.RunID
RunReturnTrueOnErrorRunReturnTrueOnError
This function runs the current project and returns True if it encounters an error or stopped prematurely, otherwise it returns False if the run completed successfully. This function has a parameter passed by reference that contains the error message if an error occurred.
AC.RunReturnTrueOnError(ByRef message As String)As Boolean
Examples:
'This will run Nodal_10bus_Example and write an error message to the Status screen and message log if there was an error during the simulation
AC.LoadProject("C:\AURORAxmp\Nodal_10bus_Example.apz")
Dim errorMsg As String = ""
Dim result As Boolean = AC.RunReturnTrueOnError(errorMsg)
If (result = True) Then
AC.SendScriptErrorToAURORAXMP (errorMsg)
End If
RunToStudyStartRunToStudyStart
Duplicate of AURORARunToStudyStart. See AURORARunToStudyStart on this page for more information.
AC.RunToStudyStart()
This saves the current project. There is an optional parameter that allows you to specify a filename to save the project as.
AC.SaveProject(Optional projectName As String)
Example:
'Will save the current project
AC.SaveProject()
'Will save the current project as a new project with the given name
AC.SaveProject("C:\AURORAxmp\New WECC Default.apz")
This saves the project with a new name. AC.SaveProject() has the same functionality as AC.SaveProjectAs(), if a filename is passed as a parameter.
AC.SaveProjectAs(projectName As String)
Example:
AC.SaveProjectAs("C:\AURORAxmp\New WECC Default.apz")
SaveProjectWithUncPathsSaveProjectWithUncPaths
Performs a save of the current project file to a new filename using UNC paths. By default, Aurora uses the local paths for all file paths in the project file. However, projects shared between multiple machines may want to share the same copy of the files rather (e.g. input databases) than creating multiples of the same file. By enabling UNC paths, the project file will point to the same resource file no matter the client.
AC.SaveProjectWithUncPath(filename As String)
Example:
AC.SaveProjectWithUncPath("\\host-name\share-name\file_path")
ScriptingStopFlagScriptingStopFlag
Used to stop a script if the model encounters an error. If this function is never called, Aurora defaults to stopping the model if it encounters an error. If the optional parameter, myScriptStopFlag, is True, the script will stop if there are any errors running a simulation. If myScriptStopFlag is False or the function is called without a parameter given, it will continue to execute even if the model runs into errors. This function returns the value of the stop flag, which should be the same value as the given parameter if the function was successful.
The command AC.StopScriptOnError() has the same functionality as AC.ScriptingStopFlag(), except that it does not return a value.
AC.ScriptingStopFlag(Optional myScriptStopFlag As Boolean) As Boolean
Example:
'The run will not stop if it encounters an error
Dim result As Boolean = AC.ScriptingStopFlag()
'The run will stop if it encounters an error
AC.ScriptingStopFlag(True)
SelectReportSetSelectReportSet
Use this command, just like clicking the dropdown selector in the UI, to select a Report Set as active for the study. This will change what report set is selected as the active report set in the project.
ADS.SelectReportSet(reportSetName As String) As Boolean
SendToAURORAxmpSendToAURORAxmp
Sends a message to the Status window and to the Aurora messages.log file. The location of your messages.log file will a message on the Status screen when Aurora is first opened.
The command, AC.WriteLog(myMessage As String), is identical to this function.
AC.SendToAURORAXMP(myMessage As String)
Examples:
AC.SendToAURORAXMP("This is a message.")
SendScriptErrorToAURORAXMPSendScriptErrorToAURORAXMP
This will send a scripting error message to the Status window and bring focus to the Status window. It will also send a message to Aurora’s messages.log file. This will not stop the script from continuing execution.
The command AC.WriteError(message As String) has the same functionality as this command.
AC.SendScriptErrorToAURORAXMP(message As String)
Examples:
'Tries to write tables to Excel, if it fails, it will send a script error to the status window and message log.
AC.LoadProjectWaitForDBRead("C:\AURORAxmp\Nodal_10bus_Example.apz")
Dim DataTables() As String = {"Fuels"}
Dim ExcelFilePath As String = "C:\AURORAxmp\FuelInputTable.xlsx"
Dim result As Boolean = AC.WriteTablesToExcel(True, DataTables, ExcelFilePath)
If (result = False) Then
AC.SendScriptErrorToAURORAXMP("Error exporting tables to Excel")
End If
SetInstanceIDinMessagesSetInstanceIDinMessages
This is used to identify individual instances of AURORA in the message.log file when running multiple instances of AURORA simultaneously. It is given the ID as a parameter.
AC.SetInstanceIDinMessages (lcInstanceIDinMessages As String)
Example:
AC.LoadProject("C:\AURORAxmp\Nodal_10Bus_Example.apz")
AC.SetInstanceIDinMessages("Nodal10Bus Project")
SetShiftFactrBinFilePathSetShiftFactrBinFilePath
Sets a Shift Factor file bin path. It takes in the index of the Shift Factor file to update and the new path of the Shift Factor file. It returns True if the update was successful, otherwise returns false.
AC.SetShiftFactorBinFilePath(index As Integer, newPath As String) As Boolean
Example:
'Tries to set a new shift factor file for the project. There is only one shift factor file in Nodal_10bus_Example, so the index is 0.
Dim result As Boolean = AC.SetShiftFactorBinFilePath(0, "C:\AURORAxmp\New_10Bus_SFF.bin")
If (result = False) Then
AC.SendToAURORAXMP("Error setting new Shift Factor file.")
End If
SkipEndOfRunChangeSetReactivationSkipEndOfRunChangeSetReactivation
When called before the run this will inform the run not to reactivate the current active change set.
AC.SkipEndOfRunChangeSetReactivation(skipReactivation As Boolean)
Example:
Dim result As Boolean = AC.SkipEndOfRunChangeSetReactivation(True)
Duplicate of AURORAStep. See AURORAStep on this page for more information.
AC.StepOneHour()
StepToDispatchHourStartStepToDispatchHourStart
Duplicate of AURORAStepToDispatchHourStart. See AURORAStepToDispatchHourStart for more information.
AC.StepToDispatchHourStart()
This command stops an Aurora simulation in progress.
AC.StopRun()
SwitchChangeSetFileSwitchChangeSetFile
This function will change what Change Set file the project is using. When this function is used, if Change Sets are set to be saved in the project file, they will now be saved in a separate Change Set file. The newChangeSetFile parameter takes in a file path to the new Change Set file. If overwriteNewChangeSetFile is set to False (which is the default), the Change Sets in the newChangeSetFile will be loaded into the project. If overwriteNewChangeSetFile is set to True, the current Change Sets in the project will be marked as “Applied” and when the project is saved, it will overwrite any Change Sets in the newChangeSetFile with the current Change Sets in the project.
This function can also move Change Sets from a Change Set file to the project file. Use the full project file path as the parameter for the newChangeSetFile parameter to move Change Set’s location to the project file. The Change Sets will be marked as “Applied” until the project is saved. The parameter overwriteNewChangeSetFile will be ignored if the Change Sets are moving to the project file.
AC.SwitchChangeSetFile(newChangeSetFile As String, Optional overwriteNewChangeSetFile as Boolean = False)
Examples:
'This will open and load the change sets in the FuelChangeSets.csf file
AC.SwitchChangeSetFile("C:\\AURORAxmp\\FuelChangeSets.csf")
'This will switch the change set file to ResourceChangeSets.csf and the current Change Sets will
'be in the "Applied" state until the project is saved. Once the project is saved, any Change Sets
'in the ResourceChangeSets.csf file will be overwritten by the current Change Sets.
AC.SwitchChangeSetFile("C:\\AURORAxmp\\ResourceChangeSets.csf", True)
'This will move change sets from a change set file to the project file
AC.SwitchChangeSetFile("C:\\AURORAxmp\\Nodal_10Bus_Example.apz")
This will update a single CDS table. It is equivalent of using “Update Data” in a CDS Table’s ribbon. It will update the data referenced by the CDS table regardless of the settings for Refresh on Table Load or Input Refresh Frequency. It will return True if the update was successful, otherwise it will return False.
AC.UpdateCDSTable(myTableName As String) As Boolean
Example:
Dim result As Boolean = AC.UpdateCDSTable("My CDS Table")
UpdateOneWebTableUpdateOneWebTable
Updates a single CDS table that has a web scraper source. This function has many optional parameters to make it customizable to different websites used for scraping. The function will return True if the CDS table was updated and False if it was not. The first, and only required parameter, is myTableName, which is the name of the CDS table to update.
The optional parameter urlUpdate, is the URL to update the CDS table from. The optional urlPreList parameter is a comma separated list of URLs to visit before scraping the data. This is used when a page requires authentication before accessing the resource, so the urlPreList will navigate through the required pages such as logging in. The optional urlPostList is a comma separated list of URLs to visit after scraping the data, such as logging out. The optional doCopy parameter is a Boolean that is true if the user wants to copy the resultant update to a new table and copyTableName is the name of the table the data should be copied to if doCopy is True.
AC.UpdateOneWebTable(myTableName As String, Optional urlUpdate As String, Optional urlPreList As String, Optional urlPostList As String, Optional doCopy As Boolean, Optional copyTableName As String) As Boolean
Example:
'This will try to update "My CDS Table" from the given website using web scraping
Dim tableName As String = "My CDS Table"
Dim urlUpdate As String = "https://www.website.com/tableinformation"
Dim urlPreList As String = "https://www.website.com, https://www.website.com/login"
Dim urlPostList As String = "https://www.website.com/logout"
Dim doCopy As Boolean = True
Dim newCopiedTable As String = "My CDS Table Copy"
Dim result As Boolean = AC.UpdateOneWebTable (tableName, urlUpdate, urlPreList, urlPostList, doCopy, newCopiedTable)
UpdateWebTablesInCdsUpdateWebTablesInCds
Performs an update to the CDS tables configured via the WebScraper.
AC.UpdateWebTablesInCds()
UseChangeCaseListUseChangeCaseList
This command can either return the current setting for the "Use Study Case List" option (in the Change Sets folder of Simulation Options) in the open project file or set this option. To set this option in the currently loaded project, set the property to True or False. To get the current setting, use it as boolean variable or set another boolean variable to AC.UseChangeCaseList.
AC.UseChangeCaseList() As Boolean
Example:
'This will set "Run Using Study Case List" to True in Project Setup
AC.UseChangeCaseList = True
'Gets if "Run Using Study Case List" is selected in Project Setup
Dim result As Boolean = AC.UseChangeCaseList
Use this to determine the number of items in a particular dataset while running Aurora in step mode. This command is useful for making changes to inputs during an Aurora run subject to this evaluation. See VarSimCount for more information.
AC.VarSimCount
Example:
AC.AURORAStep()
Dim numberOfResources As Integer = AC.VarSimCount.ResourcesExisting
Use this to determine attributes for a long term run while running Aurora in step mode. This command is useful for making changes to inputs during an Aurora run subject to this evaluation. See VarSimLT for more information.
AC.VarSimLT
Example:
AC.AURORAStep()
Dim StudyPrecision As Double = AC.VarSimLT.StudyPrecision
Use to determine time related attributes while running Aurora in step mode. This command is useful for making changes to inputs during an Aurora run subject to this evaluation. See VarSimT for more information.
AC.VarSimT
Example:
AC.AURORAStep()
Dim percentComplete As Double = AC.VarSimT.PercentStudyCompleted
Use this to determine the upper bound for certain variables while running Aurora in step mode. This command is useful for making changes to inputs during an Aurora run subject to this evaluation. See VarSimUB for more information.
AC.VarSimUB
Example:
AC.AURORAStep()
Dim fuelUpperBound As Integer = AC.VarSimUB.Fuels
This causes the script to pause execution until the current input database finishes loading.
Using AC.LoadProject() and then AC.WaitForDBLoad() is the same as using AC.LoadProjectWaitForDBRead().
AC.WaitForDBLoad()
Example:
AC.LoadProject("C:\AURORAxmp\WECC Default.apz")
AC.WaitForDBLoad()
Duplicate of SendScriptErrorToAURORAXMP. See SendScriptErrorToAURORAXMP on this page for more information and examples.
AC.WriteError(message As String)
Duplicate of SendToAURORAXMP. See SendToAURORAXMP for more information and examples.
AC.WriteLog(message As String)
WriteOutputDataBaseWriteOutputDataBase
This writes output in the current project to a specified database.
AC.WriteOutputDataBase(fileName As String)
Example:
AC.WriteOutputDataBase("C:\AURORAxmp\NewOutputDB.xdb")
WriteQuickViewsToExcelWriteQuickViewsToExcel
This function will export any Input or Output Quick Views to Excel. There are four parameters for this function. The first parameter is whether the Quick Views are for Input or Output tables, represented by the QuickViewType enum. The second parameter is a string array containing the names of the Quick Views to be exported. The third parameter is the file path for the Excel file to be created. The final parameter (which is a “True” or a “False”) determines whether to open the Excel file or not. The Excel file is created either way; if the parameter = True, the Excel file automatically opens after the script runs, and if the parameter = False, the Excel file will not automatically open. This function returns a Boolean, True if the export is successful and False if it is not.
AC.WriteQuickViewsToExcel(quickViewType As Parameters.QuickViewType, QuickViewNames() As String, ExcelFilename As String, Optional OpenInExcel As Boolean = True)
Examples:
'This will export the Input quick view named "Henry Hub NG Fuel" to Excel and Automatically open the Excel File.
Dim inputQuickViews() As String = {"Henry Hub NG Fuel"}
Dim inputQVExcelFilePath As String =
"C:\AURORAxmp\InputQuickViewsToExcel.xlsx"
Dim inputResult As Boolean = AC.WriteQuickViewsToExcel(QuickViewType.Input, inputQuickViews, inputQVExcelFilePath, True)
'This will export the Output quick view named "Nodal Hub Off-Peak" and "Nodal Hub Month On-Peak" to Excel and automatically open the Excel File.
Dim outputQuickViews() As String = {"Nodal Hub Month Off-Peak", "Nodal Hub Month On-Peak"}
Dim outputQVExcelFilePath As String =
"C:\AURORAxmp\OutputQuickViewsToExcel.xlsx"
Dim outputResult As Boolean = AC.WriteQuickViewsToExcel(QuickViewType.Output, outputQuickViews, outputQVExcelFilePath, True)
WriteTablesToExcelWriteTablesToExcel
This will export one or more input or output tables from Aurora into Excel, similar to the ToExcel button found in the input and output data tables. There are five parameters for this function. The first is isInput, which if set to True, means that the tables being exported are all input tables. If isInput is set to False, all the tables being exported are output tables. The second parameter is an array of strings with the table names being exported. If only exporting one table, the array will only have one string in it. The third parameter is the ExcelPath, which is the file path where the new Excel worksheet will be created. If multiple tables are set to be written, they will appear as sheets in one Excel workbook. There is also a fourth optional parameter, whether or not to open Excel with the new file, which defaults to True. The fifth parameter is whether or not to export the table in the User Default format for that table, which defaults to False. It returns a Boolean, True if the export was successful, False otherwise.
NOTE: If a table already exists in the path specified, it will be overwritten.
NOTE: If exporting output tables to Excel, be sure to use ADS.AssureOutputTableRead(TableName) prior to using this function.
AC.WriteTablesToExcel(isInput As Boolean, ArrayName As String(), ExcelPath As String, Optional OpenInExcel As Boolean, Optional exportUserDefaultTemplate As Boolean = False) As Boolean
Examples:
'This will export one input data table into Excel, and not automatically open it in Excel. It will not be exported in the User Default format.
AC.LoadProjectWaitForDBRead("C:\AURORAxmp\Nodal_10bus_Example.apz")
Dim DataTables() As String = {“Fuels”}
Dim ExcelFilePath As String = “C:\AURORAxmp\FuelInputTable.xlsx”
AC.WriteTablesToExcel(True, DataTables, ExcelFilePath, False, False)
'This will export multiple output tables into Excel and automatically open the Excel file. The table will be exported in the User Default format.
Dim DataTables() As String = {"FuelHour","FuelDay", "ResourceMonth"}
Dim ProjectPath As String = "C:\Aurora\Nodal_10bus_Example.apz"
AC.LoadProjectWaitForDBRead(ProjectPath)
For Each currentTable As String In DataTables
ADS.AssureOutputTableRead(currentTable)
Next
AC.WriteTablesToExcel(False, DataTables,
"C:\Aurora\FuelOutput_v2.xlsx", True, True)
xmpStopWatchMinutesxmpStopWatchMinutes
An integer that show the elapsed time since the beginning of a run in minutes. Must be used with xmpStopWatchSeconds to get the total time.
AC.XMPStopWatchMinutes() As Integer
Example:
Dim numMinutes As Integer = AC.XMPStopWatchMinutes
AC.SendToAURORAXMP("Number of minutes passed: " & CStr(numMinutes))
xmpStopWatchSecondsxmpStopWatchSeconds
An integer that show the elapsed time since the beginning of a run in seconds. Must be used with xmpStopWatchMinutes to get the total time.
AC.XMPStopWatchSeconds() As Integer
Example:
Dim numSeconds As Integer = AC.XMPStopWatchSeconds
AC.SendToAURORAXMP("Number of seconds passed: " & CStr(numSeconds))
AURORA Commands
For further assistance, please contact Aurora Support.
Copyright© 1997-2022 Energy Exemplar LLC. All rights reserved.