RequestSystemsAnalysis Method


Requests a new systems analysis in the background.

Namespace: Autodesk.Revit.DB.Analysis
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2020.1

Syntax

C#
public void RequestSystemsAnalysis(
	SystemsAnalysisOptions options
)
Visual Basic
Public Sub RequestSystemsAnalysis ( _
	options As SystemsAnalysisOptions _
)
Visual C++
public:
void RequestSystemsAnalysis(
	SystemsAnalysisOptions^ options
)

Parameters

options
Type: Autodesk.Revit.DB.Analysis SystemsAnalysisOptions
The additional options to run systems analysis. If empty, use the default value in the view element. The request may download the weather file at current site location if not specified in the options.

Examples

Copy C#
// Create a new report and request systems analysis on the current energy model.
ViewSystemsAnalysisReport newReport = null;

SystemsAnalysisOptions theOptions = new SystemsAnalysisOptions();
string openStudioPath = Path.GetFullPath(Path.Combine(doc.Application.SystemsAnalysisWorkfilesRootPath, @"..\"));
// The following are the default values for systems analysis if not specified.
// If the weather file is not specified, the analysis will use the weather at the current site location.
theOptions.WorkflowFile = Path.Combine(openStudioPath, @"workflows\HVAC Systems Loads and Sizing.osw");
theOptions.OutputFolder = Path.GetTempPath();
using (Transaction transaction = new Transaction(doc))
{
   transaction.Start("Create Systems Analysis View");

   newReport = ViewSystemsAnalysisReport.Create(doc, "APITestView");
   // Create a new report of systems analysis. 
   if (newReport != null)
   {
      newReport.RequestSystemsAnalysis(theOptions);
      // Request the systems analysis in the background process. When the systems analysis is completed, 
      // the result is automatically updated in the report view and the analytical space elements.
      // You may check the status by calling newReport.IsAnalysisCompleted().
      transaction.Commit();
   }
   else
   {
      transaction.RollBack();
   }
}
Copy VB.NET
' Create a New report And request systems analysis on the current energy model.
Dim newReport As ViewSystemsAnalysisReport = Nothing

Dim theOptions As SystemsAnalysisOptions = New SystemsAnalysisOptions()
Dim openStudioPath As String = Path.GetFullPath(Path.Combine(doc.Application.SystemsAnalysisWorkfilesRootPath, "..\"))
' The following are the default values for systems analysis if not specified.
' If the weather file is not specified, the analysis will use the weather at the current site location.
theOptions.WorkflowFile = Path.Combine(openStudioPath, "workflows\HVAC Systems Loads and Sizing.osw")
theOptions.OutputFolder = Path.GetTempPath()
Using t As New Transaction(doc, "Create Systems Analysis View")
   t.Start()

   newReport = ViewSystemsAnalysisReport.Create(doc, "APITestView")
   ' Create a new report of systems analysis. 
   If newReport IsNot Nothing Then
      newReport.RequestSystemsAnalysis(theOptions)
      ' Request the systems analysis in the background process. When the systems analysis Is completed, 
      ' the result Is automatically updated in the report view And the analytical space elements.
      ' You may check the status by calling newReport.IsAnalysisCompleted().
      t.Commit()
   Else
      t.RollBack()
   End If
End Using

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions ArgumentsInconsistentException No weather station is within 500 nautical miles of this site location.
Autodesk.Revit.Exceptions FileNotFoundException Fail to download the weather file.
Autodesk.Revit.Exceptions InvalidOperationException A valid energy model is required for systems analysis. -or- Unable to access the weather service. Try again later.

See Also