CEC Compliance Manager (Com) Software Docu v16
CEC Compliance Manager (Com) Software Docu v16
CEC Compliance Manager (Com) Software Docu v16
The purpose of this document is to provide information needed to develop software interfaces to the CEC
Compliance engine DLL(s). The primary library third party tools will interface with is BEMCmpMgr19c.dll for
2019 analysis. This DLL manages the compliance analysis processing, including:
The analysis engine DLLs are based solely on open source dependencies (primarily boost, Qt C++, OpenSSL and
OpenStudio libraries), whereas the CBECC-Com UI still requires Microsoft (Windows) libraries. All 2019 DLLs and
executables are compiled as 64-bit programs.
There are only a handful of exports needed to perform compliance analysis and retrieve analysis results/reports.
One initializes the DLLs, one performs the analysis (and potentially generates a report), another to generate a
draft report from an existing analysis results file, three more are designed to retrieve data (inputs and/or
results) from the building model following analysis, a couple more to retrieve error messages and the last is used
to clean-up following exit.
The overall analysis data model is broken into a few subsets, one of which is the “Input Data Model”. This is the
version of most interest to third party tools wishing to generate files that can be analyzed for compliance using
this tool. The Input Data Model is documented in a text file contained in each release of CBECC-Com, residing in
the “Data” directory of the install, at:
<CBECC-Com xxx Data>\Documents\RulesetSource\T24N_2019 - Input Data Model.txt
There is one variation associated with the input data model that is important to understand, and that has to do
with the ability to describe buildings using either “Detailed” or “Simplified” geometry. There are certain
limitations on building and analysis features when using the simplified approach, while any/all features and
analysis can be performed on detailed geometry projects. For more information on this topic, refer to the
CBECC-Com User’s Manual.
A new feature of the Input Data Model text file is the ability to specify whether or not certain building object
properties should or should not be included in detailed vs. simplified building model files submitted for analysis.
This is denoted in the highlighted excerpt from the Input Data Model text:
Spc Space #Props:109/340 MaxDefinable: 1000
Parent(s): Story
Children: IntLtgSys / DayltgCtrl / Ceiling / ExtFlr...
...
Area ... Float ... Units: ft2 ... (see next line) Error if not: Value >= 0.01
... ... ... Compulsory when Proj:GeometryInpType = 'Simplified', else NotInput
One data model variation that is NOT documented in the Input Data Model text file (described above) is the
inclusion of PolyLp (PolyLoop) objects in project files. Detailed geometry projects should include PolyLp children
for Spc (Space) objects and all types of surfaces, shading devices (Ceiling, ExtFlr, ExtWall, IntFlr, IntWall, Roof,
UndgrFlr, UndgrWall, Win, Skylt, Dr & ExtShdgObj) & photovoltaic array objects (PVArray, PVArrayGeom &
1
PVArrayShade). Simplified geometry projects should include NO PolyLp objects. If PolyLp objects are included in
simplified geometry projects, they will be removed and not considered during analysis.
Recommended sequence of events (assuming use of Visual Studio & C++) for a scenario where direct linking to
the compliance manager DLLs is not required:
1. Load the pertinent DLLs via LoadLibrary() -->> "libeay32.dll", "ssleay32.dll", "Qt5Core.dll", "Qt5Xml.dll",
"Qt5Gui.dll", "Qt5Network.dll", "Qt5WebKit.dll", "Qt5Widgets.dll", "BEMProc19c.dll" and
"BEMCmpMgr19c.dll"
This step MAY not be required if the third party application and these referenced DLLs are located in the
same directory.
2. Call GetProcAddress() to retrieve function pointers to each DLL function you plan to call.
5. Unload the loaded DLLS (in reverse order) via FreeLibrary() -->> "BEMCmpMgr19c.dll" and
"BEMProc19c.dll", then "Qt5Widgets.dll", "Qt5WebKit.dll", "Qt5Network.dll ", "Qt5Gui.dll",
"Qt5Xml.dll", "Qt5Core.dll", "ssleay32.dll", and "libeay32.dll"
This step not required if the third party DLLs are not explicitly loaded in step 1.
Function Reference
The following are names and documentation pertaining to the compliance manager routines referenced above
where:
pszBEMBasePathFile is a null terminated string containing the path and filename of the data model
definitions file. This should not be specified (pass in NULL) unless the run being performed uses a
different data model as the one previously used to initialize the DLLs or perform a simulation.
pszRulesetPathFile is a null terminated string containing the path and filename of the ruleset file used
to process the building model. This should be specified for each run when switching building models, as
it re-initializes both the building model and ruleset data. In the CBECC-Com installer, this would be:
‘<Data directory>\Rulesets\T24N_2019.bin’ for 2019 analysis.
If a simulation is to be performed on a building model already loaded into memory, then you can specify
NULL for this argument.
pszSimWeatherPath is a null terminated string containing path (including trailing ‘\’) of the directory
where the EnergyPlus CEC weather files reside. The default CBECC-Com installer location for these files
is: ‘<Data directory >\EPW\’.
pszCompMgrDLLPath is a null terminated string containing path (including trailing ‘\’) of the directory
where the CEC compliance manager DLLs reside. If NULL or a zero-length path is specified for this
argument, then the path to the executable file which loaded & called this analysis routine will be used.
The analysis mechanism assumes that other required executables are located as follows in relation to
the directory identified by this argument:
- EnergyPlus simulation executable & DLLs located in ‘EPlus\’ subdirectory, and
- CSE engine executable located in ‘CSE\’ subdirectory (used for photovoltaic panel, battery &
residential water heating).
pszDHWWeatherPath (no longer used)
pszProcessingPath is a null terminated string containing the path (including trailing ‘\’) of the directory
where the simulation inputs and outputs will be written.
pszModelPathFile is a null terminated string containing the path and filename of the building model
input (.cibd or .xml) file. The model input file identified by this argument may or may not be loaded into
memory during the analysis processing depending on a subsequent argument.
pszLogPathFile is a null terminated string containing the path and filename of a file to write processing
messages to. If specified as NULL (which it typically is), then the log file will be equivalent to the
pszModelPathFile specified in the previous argument, but with the file extension replaced with ‘.log’.
pszUIVersionString is a null terminated string containing the name and version/ID of the application
that is calling this function. This information is stored in the data model for later reporting in results
export and final compliance reports.
where the “Click here…” link opens the CBECC-Com HVAC FAQ page at the UMLH section in the
user’s default web browser.
o WriteUMLHViolationsToFile: boolean (0/1 – default 1): whether or not to write a text file with
details of any Proposed model unmet load hours (similar to the information provided in the
above dialog). If selected, this information is written to the file:
<Input file path>\<Input filename> - UMLH Zones.txt
o QuickAnalysis (-1/0/1 – default -1): whether to perform QuickAnalysis, processes much faster
but may vary from the results of a full annual analysis and therefore cannot be used to generate
final compliance documentation. There is no difference in the sizing simulations, but annual
simulations consist of 4 1-week run periods, one period simulated in each season of the year.
Values of 0/1 will override the QuickAnalysis setting defined in the model input data and the
default value of -1 will activate QuickAnalysis only if specified in the model.
o ParallelSimulations: boolean (0/1 – default 1): whether or not simulations should be grouped by
type (sizing vs. annual) and performed at the same time (in parallel). This feature has been
shown to reduce the overall analysis duration by 30-40% (depending on model details). This
feature can be toggled off by specifying a ‘0’ for this analysis option.
o LogWritingMode: integer (0-2 – default 2): the method used to write messages to project log
files.
0. log file flushed and closed following each write (slower, but ensures complete log file)
1. log file populated in memory and only flushed/refreshed periodically (faster writing)
2. causes use of method '1' if any detailed logging activated (when VerboseInputLogging,
LogRuleEvaluation, or DebugRuleEvalCSV are specified), otherwise '0'
o AnalysisThruStep: integer (0-100 – default 100): an indication of the last analysis step to be
executed before aborting the analysis. Steps of the analysis (and their corresponding integer
values) include:
1. Analysis initialization (DEFAULT/CHECKSIM/CHECKCODE rules)
2. Prepare Proposed & Baseline Sizing models (if applicable)
o SimulationStorage: integer (0-7 – default 1): determines which, if any, simulation input and/or
output files are to be retained following each building model simulation. Valid options include:
0. ALL simulation sub-directories and files deleted
1. Only the input (.idf) files are retained
2. (#1 above) + summary output (.htm) retained
3. (#2 above) + limited additional output (.csv|.eio|.err|.rdd) retained
4. (#3 above) + SQL output (.sql) retained
5. (#3 (not 4) above) + both SQL & other standard output files retained
6. (#4 & 5 above) +
7. ALL simulation input and output files retained
o AnalysisStorage: integer (0-3 – default 2): determines which, if any, (non-simulation) files
generated during analysis are to be retained following each round of analysis. Valid options
include:
0. ALL analysis files deleted
1. Only simulation SDD XML (.xml) files are retained
2. (#1 above) + OpenStudio model (.osm) files are retained
3. ALL files produced during analysis are retained
o ExportHourlyResults: a series of integer options that will cause the export of 1-2 hourly results
CSV files during analysis, one for each individual annual simulation.
ExportHourlyResults_ap = 1 - exports results of annual proposed simulation
ExportHourlyResults_ab = 1 - exports results of annual baseline simulation
ExportHourlyResults_All = 1 - exports results of all annual simulations
o ProxyServerAddress: character string: The address (i.e. “site.site:port”) of the proxy server to
be used in accessing the report generator (via the internet).
o ProxyServerCredentials: character string: Username and password credentials (i.e.
“username:password”) needed to access the internet via the proxy server (only needed for
report generation).
o ProxyServerType: character string: options include ‘Http’ (default), ‘Socks5’, ‘HttpCaching’ and
‘FtpCaching’.
o NetComLibrary: character string: network communications software library – options include
‘QT’ (new default in this version), and ‘CURL’ (only option in previous releases).
o ModelRpt_ALL (or specific model report options): boolean (0/1 – default 0): whether or not
certain CSV report files are to be written by the ruleset for each model generated during the
analysis. Such CSV files are used primarily for testing/debugging, but can be informative in
Multiple analysis options can be concatenated into the pszAnalysisOptionsCSV string, for instance, if
you wanted to perform a run with the Verbose & BypassOpenStudio_p flags activated (and all other
defaults used), then this function argument would include the string
“Verbose,1,BypassOpenStudio_p,1,”.
Searches for options in this string argument are case insensitive and if a single flag is repeated
multiple times, the value associated with its first occurrence will drive the analysis.
pszErrorMessage is a pointer to a character string that can be populated by this function to describe
error(s) encountered during the analysis. Pass in a value of 0/NULL if no return of error messaging is
desired.
iErrorMsgLength is an integer describing the number of characters present in the error message
character string (previous argument). Pass in a value of 0 if no return of error messaging is desired.
bDisplayProgress is a boolean indicating whether or not to display the analysis progress dialog as the
processing is executed.
hWnd is a HANDLE to a MS Windows application window. This argument is not currently used.
pszResultsSummary is a pointer to a character string of length (iResultsSummaryLen) that is to be
populated with a summary of the analysis performed. If no results summary string is desired, pass NULL
for this argument.
iResultsSummaryLen is the length of the character string (pszResultsSummary argument) to be
populated (2056 is recommended length), or 0 if no summary string desired.
Refer to information below for the CMX_PopulateResultsHeader_CECNonRes() function for information
about populating column titles for this data.
iSecurityKeyIndex is an integer value assigned to each certified software vendor that is used to identify
which of a predefined number of security keys integrated into the compliance ruleset should be used to
generate permit (secure) compliance reports immediately following the analysis.
Contact the CEC and/or compliance engine software contractor for this index prior to submitting
software to the CEC for certification.
pszSecurityKey is a null terminated string containing a subset of a private security key which is used by
the compliance engine to generate permit (secure) compliance reports immediately following the
analysis.
Contact the CEC and/or compliance engine software contractor for this character string prior to
submitting software to the CEC for certification.
Return value is 0 if simulation successful and > 0 if errors occurred (listed below).
All path/filename arguments can be either complete or relative to the path in which the calling executable
resides.
(return values in the range greater than 100 describe issues encountered during/by simulation)
101-110 describe issues not specific to any individual run:
101 : User aborted analysis
102 : Simulation processing path not valid
103 : Simulation executable path not valid
104 : Invalid number of concurrent simulations (max = 10)
105 : Invalid combination of unique model & quick simulations (max 2 models when performing quick runs)
111-310 describe issues with initializing simulation inputs (SimIdx = 0-9):
111 + (SimIdx*10) : SDD XML simulation input file not found
112 + (SimIdx*10) : Simulation weather file not found
113 + (SimIdx*10) : Simulation error output path/file not valid
114 + (SimIdx*10) : Invalid simulation input data
311-510 describe errors encountered in OpenStudio processing (SimIdx = 0-9):
311 + (SimIdx*10) : Error encountered in OpenStudio loading SDD XML file
312 + (SimIdx*10) : Error encountered in OpenStudio saving model to OSM file
313 + (SimIdx*10) : Unable to locate EnergyPlus simulation SQL output file
314 + (SimIdx*10) : OpenStudio Model not valid following simulation
315 + (SimIdx*10) : OpenStudio Facility not valid following simulation
316 + (SimIdx*10) : Error creating OpenStudio Model object
317 + (SimIdx*10) : Error encountered in OpenStudio saving (forward translated) IDF file
This is an alternative compliance analysis routine as the one listed above (CMX_PerformAnalysis_CECNonRes).
The function arguments are identical to the above routine with the exception of HWND* removed and a new
final argument which is a pointer to a callback function. The return value is also the same as above.
This callback function referenced by the final function argument is called each time the analysis progress is
checked/reported, enabling calling applications to monitor analysis progress and abort analysis prior to
completion without using the analysis progress dialog available in the compliance engine.
where:
(refer to the previous routine for information on all arguments prior to pAnalProgCallbackFunc)
pAnalProgCallbackFunc is a pointer to a callback function declared as:
long (CALLBACK* PAnalysisProgressCallbackFunc)( long lProgressID,
long lPercent )
where:
lProgressID encodes several settings describing the current stage of analysis (see below), and
lPercent which indicates the percent progress (0-100)
A return value of 0 from the callback function will cause analysis to continue and a return value > 0 will
cause the analysis to be aborted.
The following source code describes how the lProgressID argument can be decoded to describe the current
analysis stage.
// 2,147,483,647 - max long int
// ABB,CCC,CDD - compliance analysis
// A: analysis type
#define BCM_NRP_Type_Comp 0 // 0-compliance
#define BCM_NRP_Type_Batch 1 // 1-batch processing
#define BCM_NRP_Type( lNRP ) (long) (lNRP / BCM_NRP_AMult)
#define BCM_NRP_TypeIsComp( lNRP )
(long) (BCM_NRP_Type( lNRP ) == BCM_NRP_Type_Comp ? 1 : 0)
#define BCM_NRP_TypeIsBatch( lNRP )
(long) (BCM_NRP_Type( lNRP ) == BCM_NRP_Type_Batch ? 1 : 0)
Mid-simulation progress described below is a placeholder for future progress reporting. These settings are not
yet used in the compliance engine.
// D: simulation progress - valid range 0-99
#define BCM_NRP_Prog( lNRP ) (long) (lNRP % BCM_NRP_CMult)
#define BCM_NRP_Prog_None 0 // blank
#define BCM_NRP_Prog_Init 1 // Initialization
#define BCM_NRP_Prog_Warmup 2 // Warmup
#define BCM_NRP_Prog_Jan 3 // Jan
#define BCM_NRP_Prog_Feb 4 // Feb
#define BCM_NRP_Prog_Mar 5 // Mar
#define BCM_NRP_Prog_Apr 6 // Apr
#define BCM_NRP_Prog_May 7 // May
#define BCM_NRP_Prog_Jun 8 // Jun
#define BCM_NRP_Prog_Jul 9 // Jul
#define BCM_NRP_Prog_Aug 10 // Aug
#define BCM_NRP_Prog_Sep 11 // Sep
#define BCM_NRP_Prog_Oct 12 // Oct
#define BCM_NRP_Prog_Nov 13 // Nov
#define BCM_NRP_Prog_Dec 14 // Dec
#define BCM_NRP_Prog_Rpt 15 // Reporting
where:
pszHdr1, pszHdr2 & pszHdr3 are pointers to character string of length iHdr1/2/3Len that are to be
populated with column labels for analysis results summaries returned via the final two arguments of the
CMX_PerformAnalysis_CECNonRes() function.
iHdr1Len, iHdr2Len & iHdr3Len are the lengths of the character string arguments to be populated.
Current recommended label string lengths are 768, 1024 & 3072, respectively
Return value is 0 if all header strings are populated successfully and a value of 1-3 if population of one of the
three header strings is not successful.
Call this routine each time string data is to be retrieved from the building model.
Call this routine each time integer data is to be retrieved from the building model.
Call this routine each time float data is to be retrieved from the building model.
void CMX_ExitBEMProcAndCmpMgrDLLs();
Call this routine only once (following all simulations) immediately prior to unloading the DLLs.