The Autodesk.Revit.DB.Analysis namespace includes several classes to obtain and analyze the contents of a project's detailed energy analysis model.
The Export to gbXML and the Heating and Cooling Loads features produce an analytical thermal model from the physical model of a building. The analytical thermal model is composed of spaces, zones and planar surfaces that represent the actual volumetric elements of the building.
The classes related to the detailed energy analysis model are:
Use the static method EnergyAnalysisDetailModel.Create() to create and populate the energy analysis model. The EnergyAnaysisDetailModel is stored as an element in the Revit model, and thus the EnergyAnalysisDetailModel.Create() method requires there to be an open transaction. The generated model is always returned in world coordinates, but the method TransformModel() transforms all surfaces in the model according to ground plane, shared coordinates and true north.
If an energy analysis model is already created, the static method EnergyAnalysisDetailModel.GetMainEnergyAnalysisDetailModel() returns the main EnergyAnalysisDetailModel contained in the given document (or null if none has been created). The energy analysis detail model can be displayed in associated views.
Set the appropriate options using the EnergyAnalysisDetailModelOptions class.
The options available when creating the energy analysis detail model include:
The EnergyAnalysisDetailModelOptions.EnergyModelType property can be set to SpatialElement (where the energy model is based on rooms or spaces) or BuildingElement (where the energy model is based on analysis of building element volumes). However, note that the generated energy model is also affected by settings in EnergyDataSettings, including the EnergyDataSettings.AnalysisType property. If this property is set to AnalysisMode.ConceptualMassesAndBuildingElements, the EnergyAnalysisDetailModel will use the combination of conceptual masses and building elements.
The following example creates a new energy analysis detailed model from the physical model then displays the originating element for each surface of each space in the model.
Code Region: Energy Analysis Detail Model |
// Collect space and surface data from the building's analytical thermal model EnergyAnalysisDetailModelOptions options = new EnergyAnalysisDetailModelOptions(); options.Tier = EnergyAnalysisDetailModelTier.Final; // include constructions, schedules, and non-graphical data in the computation of the energy analysis model options.EnergyModelType = EnergyModelType.SpatialElement; // Energy model based on rooms or spaces EnergyAnalysisDetailModel eadm = EnergyAnalysisDetailModel.Create(doc, options); // Create a new energy analysis detailed model from the physical model IList<EnergyAnalysisSpace> spaces = eadm.GetAnalyticalSpaces(); StringBuilder builder = new StringBuilder(); builder.AppendLine("Spaces: " + spaces.Count); foreach (EnergyAnalysisSpace space in spaces) { SpatialElement spatialElement = doc.GetElement(space.CADObjectUniqueId) as SpatialElement; ElementId spatialElementId = spatialElement == null ? ElementId.InvalidElementId : spatialElement.Id; builder.AppendLine(" >>> " + space.SpaceName + " related to " + spatialElementId); IList<EnergyAnalysisSurface> surfaces = space.GetAnalyticalSurfaces(); builder.AppendLine(" has " + surfaces.Count + " surfaces."); foreach (EnergyAnalysisSurface surface in surfaces) { builder.AppendLine(" +++ Surface from " + surface.OriginatingElementDescription); } } TaskDialog.Show("EAM", builder.ToString()); |
After creating the EnergyAnalysisDetailModel, the spaces, openings and surfaces associated with it can be retrieved with the GetAnalyticalOpenings(), GetAnalyticalSpaces(), GetAnalyticalShadingSurfaces() and GetAnalyticalSurfaces() methods.
It is recommended that applications call Document.Delete() on the EnergyAnalysisDetailModel elements that they create when finished accessing the data, but any energy models created after the main energy model will be deleted automatically before document saving or synchronization.
From an EnergyAnalysisSpace you can retrieve the collection of EnergyAnalysisSurfaces which define an enclosed volume bounded by the center plane of walls and the top plane of roofs and floors. Alternatively, GetClosedShell() retrieves a collection of Polyloops, which are planar polygons, that define an enclosed volume measured by interior bounding surfaces. For two-dimensions, use GetBoundary() which returns a collection of Polyloops representing the 2D boundary of the space that defines an enclosed area measured by interior bounding surfaces.
The EnergyAnalysisSpace class also has a number of properties for accessing information about the analysis space, such as AnalyticalVolume, SpaceName and Area.
From an EnergyAnalysisSpace you can retrieve the primary analysis space associated with the surface as well as the secondary adjacent analytical space. The GetAnalyticalOpenings() method will retrieve a collection of all analytical openings in the surface. The GetPolyloop() method obtains the planar polygon describing the surface geometry as described in gbXML.
The EnergyAnalysisSurface class has numerous properties to provide more information about the analytical surface, such as Height, Width, Corner (lower-left coordinate for the analytical rectangular geometry viewed from outside), and an originating element description.
The surface type is available either as an EnergyAnalysisSurfaceType or as a gbXMLSurfaceType. The gbXML surface type attribute is determined by the source element and the number of space adjacencies. Possible types are:
Type |
Source element and space adjacencies |
Shade |
No associated source element and no space adjacencies |
Air |
No associated source element and at least one space adjacency |
ExteriorWall |
Source element is a Wall or a Curtain Wall there is one space adjacency |
InteriorWall |
Source element is a Wall or a Curtain Wall and: there are two space adjacencies or the type Function parameter is set to "Interior" or "CoreShaft" |
UndergroundWall |
Source element is a Wall or a Curtain Wall and there is one space adjacency and if it is below grade |
SlabOnGrade |
Source element is a Floor and there is one space adjacency |
RaisedFloor |
Source element is a Floor and there is one space adjacency and it is above grade |
UndergroundSlab |
Source element is a Floor and there is one space adjacency and it is below grade |
InteriorFloor |
Source element is a Floor and: there are two space adjacencies or the type Function parameter is set to "Interior |
Roof |
Source element is a Roof or a Ceiling and there is one space adjacency |
UndergroundCeiling |
Source element is a Roof or a Ceiling and there is one space adjacency and it is below grade |
Ceiling |
Source element is a Roof or a Ceiling and there are two space adjacencies |
From an EnergyAnalysisOpening you can retrieve the associated parent analytical surface element. The GetPolyloop() method returns the opening geometry as a planar polygon.
A number of properties are available to obtain information about the analytical opening, such as Height, Width, Corner and OpeningName. Similar as for analytical surfaces, the analytical opening type can be obtained as a simple EnergyAnalysisOpeningType enumeration or as a gbXMLOpeningType attribute. The type of the opening is based on the family category for the opening and in what element it is contained, as shown in the following table:
Type |
Family Category or containing element |
OperableWindow |
Window |
NonSlidingDoor |
Door |
FixedSkylight |
Opening contained in a Roof |
FixedWindow |
Opening contained in a Curtain Wall Panel |
Air |
Opening of the category Openings |