#include <Model.hpp>
Public Member Functions | |
void | applySizingValues () |
For each object in the model with autosizable fields, retrieves the autosized values from the sizing run and then sets these values in the object explicitly. More... | |
void | autosize () |
For each object in the model with autosizable fields, sets all autosizable fields to 'autosize'. More... | |
void | connect (ModelObject sourceObject, unsigned sourcePort, ModelObject targetObject, unsigned targetPort) const |
Connects the sourcePort on the source ModelObject to the targetPort on the target ModelObject. More... | |
void | disconnect (ModelObject object, unsigned port) |
Disconnects the port on the given ModelObject. More... | |
template<> | |
Building | getUniqueModelObject () |
template<> | |
FoundationKivaSettings | getUniqueModelObject () |
template<> | |
OutputControlFiles | getUniqueModelObject () |
template<> | |
OutputTableSummaryReports | getUniqueModelObject () |
template<> | |
LifeCycleCostParameters | getUniqueModelObject () |
template<> | |
PerformancePrecisionTradeoffs | getUniqueModelObject () |
template<> | |
RunPeriod | getUniqueModelObject () |
template<> | |
YearDescription | getUniqueModelObject () |
template<> | |
WeatherFile | getUniqueModelObject () |
boost::optional< ComponentData > | insertComponent (const Component &component) |
Inserts Component into Model and returns the primary object, if possible. More... | |
std::vector< ModelObject > | modelObjects (bool sorted=false) const |
Get all model objects. More... | |
bool | operator== (const Model &other) const |
Equality test, tests if this Model shares the same implementation object with other. More... | |
std::vector < openstudio::IdfObject > | purgeUnusedResourceObjects () |
Removes all ResourceObjects with nonResourceObjectUseCount() == 0. More... | |
std::vector < openstudio::IdfObject > | purgeUnusedResourceObjects (IddObjectType iddObjectType) |
Removes all ResourceObjects of given IddObjectType with directUseCount() == 0. More... | |
Constructors and Destructors | |
Model () | |
Creates a new, empty Model. More... | |
Model (const openstudio::IdfFile &idfFile) | |
Creates a new Model with one ModelObject for each IdfObject in the given IdfFile. More... | |
Model (const openstudio::Workspace &workspace) | |
Creates a new Model with one ModelObject for each WorkspaceObjects in the given Workspace. More... | |
virtual | ~Model () |
Getters | |
WorkflowJSON | workflowJSON () const |
Get the WorkflowJSON. More... | |
boost::optional< SqlFile > | sqlFile () const |
Returns the EnergyPlus output SqlFile if set. More... | |
boost::optional< Building > | building () const |
Get the Building object if there is one, this implementation uses a cached reference to the Building object which can be significantly faster than calling getOptionalUniqueModelObject<Building>(). More... | |
boost::optional < FoundationKivaSettings > | foundationKivaSettings () const |
Get the FoundationKivaSettings object if there is one, this implementation uses a cached reference to the FoundationKivaSettings object which can be significantly faster than calling getOptionalUniqueModelObject<FoundationKivaSettings>(). More... | |
boost::optional < OutputControlFiles > | outputControlFiles () const |
Get the OutputControlFiles object if there is one, this implementation uses a cached reference to the OutputControlFiles object which can be significantly faster than calling getOptionalUniqueModelObject<OutputControlFiles>(). More... | |
boost::optional < OutputTableSummaryReports > | outputTableSummaryReports () const |
Get the OutputTableSummaryReports object if there is one, this implementation uses a cached reference to the OutputTableSummaryReports object which can be significantly faster than calling getOptionalUniqueModelObject<OutputTableSummaryReports>(). More... | |
boost::optional < PerformancePrecisionTradeoffs > | performancePrecisionTradeoffs () const |
Get the PerformancePrecisionTradeoffs object if there is one, this implementation uses a cached reference to the PerformancePrecisionTradeoffs object which can be significantly faster than calling getOptionalUniqueModelObject<PerformancePrecisionTradeoffs>(). More... | |
boost::optional < LifeCycleCostParameters > | lifeCycleCostParameters () const |
Get the LifeCycleCostParameters object if there is one, this implementation uses a cached reference to the LifeCycleCostParameters object which can be significantly faster than calling getOptionalUniqueModelObject<LifeCycleCostParameters>(). More... | |
boost::optional< RunPeriod > | runPeriod () const |
Get the RunPeriod object if there is one, this implementation uses a cached reference to the RunPeriod object which can be significantly faster than calling getOptionalUniqueModelObject<RunPeriod>(). More... | |
boost::optional< YearDescription > | yearDescription () const |
Get the YearDescription object if there is one, this implementation uses a cached reference to the YearDescription object which can be significantly faster than calling getOptionalUniqueModelObject<YearDescription>(). More... | |
boost::optional< int > | calendarYear () const |
Get or create the YearDescription object if there is one, then call method from YearDescription. More... | |
std::string | dayofWeekforStartDay () const |
bool | isDayofWeekforStartDayDefaulted () const |
bool | isLeapYear () const |
bool | isIsLeapYearDefaulted () const |
bool | setCalendarYear (int calendarYear) |
void | resetCalendarYear () |
bool | setDayofWeekforStartDay (std::string dayofWeekforStartDay) |
void | resetDayofWeekforStartDay () |
bool | setIsLeapYear (bool isLeapYear) |
void | resetIsLeapYear () |
int | assumedYear () |
openstudio::Date | makeDate (openstudio::MonthOfYear monthOfYear, unsigned dayOfMonth) |
openstudio::Date | makeDate (unsigned monthOfYear, unsigned dayOfMonth) |
openstudio::Date | makeDate (openstudio::NthDayOfWeekInMonth n, openstudio::DayOfWeek dayOfWeek, openstudio::MonthOfYear monthOfYear) |
openstudio::Date | makeDate (unsigned dayOfYear) |
boost::optional< WeatherFile > | weatherFile () const |
Get the WeatherFile object if there is one, this implementation uses a cached reference to the WeatherFile object which can be significantly faster than calling getOptionalUniqueModelObject<WeatherFile>(). More... | |
Schedule | alwaysOnDiscreteSchedule () const |
Get an always on schedule with discrete type limits if there is one. More... | |
std::string | alwaysOnDiscreteScheduleName () const |
Get the always on schedule with discrete type limits name. More... | |
Schedule | alwaysOffDiscreteSchedule () const |
Get an always off schedule with discrete type limits if there is one. More... | |
std::string | alwaysOffDiscreteScheduleName () const |
Get the always off schedule with discrete type limits name. More... | |
Schedule | alwaysOnContinuousSchedule () const |
Get an always on schedule with continuous type limits if there is one. More... | |
std::string | alwaysOnContinuousScheduleName () const |
Get the always on schedule with continuous type limits name. More... | |
Node | outdoorAirNode () const |
Get a Node named 'Model Outdoor Air Node' (intended to be forward translated to an OutdoorAir:Node) and not connected to a PlantLoop or AirLoopHVAC. More... | |
SpaceType | plenumSpaceType () const |
Get the space type used for plenums if there is one. More... | |
std::string | plenumSpaceTypeName () const |
Get the space type name used for plenums. More... | |
Setters | |
bool | setWorkflowJSON (const WorkflowJSON &workflowJSON) |
Set the WorkflowJSON. More... | |
void | resetWorkflowJSON () |
Reset the WorkflowJSON. More... | |
bool | setSqlFile (const SqlFile &sqlFile) |
Sets the EnergyPlus output SqlFile. More... | |
bool | resetSqlFile () |
Resets the EnergyPlus output SqlFile. More... | |
Template Methods | |
template<typename T > | |
boost::optional< T > | getModelObject (const Handle &handle) const |
Returns the ModelObject referenced by handle if it is of type T. More... | |
template<typename T > | |
T | getUniqueModelObject () |
Returns the unique ModelObject of type T, creates a one if none are found. More... | |
template<typename T > | |
boost::optional< T > | getOptionalUniqueModelObject () const |
Returns the unique ModelObject of type T if it is found. More... | |
template<typename T > | |
std::vector< T > | getModelObjects (bool sorted=false) const |
Returns all ModelObjects of type T. More... | |
template<typename T > | |
std::vector< T > | getConcreteModelObjects () const |
Returns all ModelObjects of type T, using T::iddObjectType() to speed up the search. More... | |
template<typename T > | |
std::vector< T > | getModelObjects (const std::vector< openstudio::Handle > &handles) const |
Returns the subset of ModelObjects referenced by handles which are of type T. More... | |
template<typename T > | |
boost::optional< T > | getModelObjectByName (const std::string &name) const |
Returns the ModelObjects of type T with name (exactMatch). More... | |
template<typename T > | |
std::vector< T > | getModelObjectsByName (const std::string &name, bool exactMatch=true) const |
Returns all ModelObjects of type T with given name. More... | |
template<typename T > | |
boost::optional< T > | getConcreteModelObjectByName (const std::string &name) const |
template<typename T > | |
std::vector< T > | getConcreteModelObjectsByName (const std::string &name) const |
Static Public Member Functions | |
static boost::optional< Model > | load (const path &osmPath) |
Load Model from file, attempts to load WorkflowJSON from standard path. More... | |
static boost::optional< Model > | load (const path &osmPath, const path &workflowJSONPath) |
Load Model and WorkflowJSON from files, fails if either osm or workflowJSON cannot be loaded. More... | |
Related Functions | |
(Note that these are not member functions.) | |
bool | compareInputAndOutput (const ModelObject &object, const std::string &attributeName, double inputResult, double outputResult, double tol, LogLevel logLevel=LogLevel::Debug) |
Compare inputResult to outputResult. More... | |
typedef std::vector< Model > | ModelVector |
typedef boost::optional< Model > | OptionalModel |
Model derives from Workspace and is a container for ModelObjects as defined by the OpenStudio IDD.
The OpenStudio Model is primarily a container for ModelObjects which together define a complete or partial model of a building for energy simulation. A ModelObject cannot exist outside of a Model which ensures that each ModelObject can access the full Model to search for related ModelObjects. Model also accepts a connection to EnergyPlus simulation output through the SqlFile access to the SQLite output of EnergyPlus. Each ModelObject may then access simulation output in its own context. Connection to simulation data from other simulation engines is planned for the future.
The OpenStudio Model input data model is based on the schema defined by the OpenStudio IDD. Each concrete ModelObject wraps a particular data type in the OpenStudio IDD and Model enforces collection level constraints such as preventing multiple definitions of unique objects, updating reference fields that point from one ModelObject to another when the target's name changes, etc. Most of Model's capabilities for managing data according to an IDD schema are implemented in the Workspace base class. See the Workspace documentation in the utilities sub-project for more information about Workspace.
openstudio::model::Model::Model | ( | ) |
Creates a new, empty Model.
|
explicit |
Creates a new Model with one ModelObject for each IdfObject in the given IdfFile.
Any unwrapped IDD types will be wrapped with GenericModelObject.
|
explicit |
Creates a new Model with one ModelObject for each WorkspaceObjects in the given Workspace.
Any unwrapped IDD types will be wrapped with GenericModelObject.
|
inlinevirtual |
Schedule openstudio::model::Model::alwaysOffDiscreteSchedule | ( | ) | const |
Get an always off schedule with discrete type limits if there is one.
create a new schedule if necessary and add it to the model
std::string openstudio::model::Model::alwaysOffDiscreteScheduleName | ( | ) | const |
Get the always off schedule with discrete type limits name.
Schedule openstudio::model::Model::alwaysOnContinuousSchedule | ( | ) | const |
Get an always on schedule with continuous type limits if there is one.
create a new schedule if necessary and add it to the model
std::string openstudio::model::Model::alwaysOnContinuousScheduleName | ( | ) | const |
Get the always on schedule with continuous type limits name.
Schedule openstudio::model::Model::alwaysOnDiscreteSchedule | ( | ) | const |
Get an always on schedule with discrete type limits if there is one.
create a new schedule if necessary and add it to the model
std::string openstudio::model::Model::alwaysOnDiscreteScheduleName | ( | ) | const |
Get the always on schedule with discrete type limits name.
void openstudio::model::Model::applySizingValues | ( | ) |
For each object in the model with autosizable fields, retrieves the autosized values from the sizing run and then sets these values in the object explicitly.
Requires a sql file with sizing run results from a previous simulation. For example, if a ChillerElectricEIR's Reference Capacity was previously autosized to 120,000W by the sizing run, this method would find the 120,000W in the sql file and then set the Reference Capacity field to 120,000W explicitly. Next time a simulation is run, the chiller's capacity will be 120,000W, it will not be autosized during the sizing run.
int openstudio::model::Model::assumedYear | ( | ) |
void openstudio::model::Model::autosize | ( | ) |
For each object in the model with autosizable fields, sets all autosizable fields to 'autosize'.
Fields that previously contained hard-sized values will be overwritten by 'autosize.'
boost::optional<Building> openstudio::model::Model::building | ( | ) | const |
Get the Building object if there is one, this implementation uses a cached reference to the Building object which can be significantly faster than calling getOptionalUniqueModelObject<Building>().
boost::optional<int> openstudio::model::Model::calendarYear | ( | ) | const |
Get or create the YearDescription object if there is one, then call method from YearDescription.
void openstudio::model::Model::connect | ( | ModelObject | sourceObject, |
unsigned | sourcePort, | ||
ModelObject | targetObject, | ||
unsigned | targetPort | ||
) | const |
Connects the sourcePort on the source ModelObject to the targetPort on the target ModelObject.
std::string openstudio::model::Model::dayofWeekforStartDay | ( | ) | const |
void openstudio::model::Model::disconnect | ( | ModelObject | object, |
unsigned | port | ||
) |
Disconnects the port on the given ModelObject.
boost::optional<FoundationKivaSettings> openstudio::model::Model::foundationKivaSettings | ( | ) | const |
Get the FoundationKivaSettings object if there is one, this implementation uses a cached reference to the FoundationKivaSettings object which can be significantly faster than calling getOptionalUniqueModelObject<FoundationKivaSettings>().
|
inline |
|
inline |
Returns all ModelObjects of type T, using T::iddObjectType() to speed up the search.
This method will only work for concrete model objects (leaves in the ModelObject inheritance tree), hence the name.
|
inline |
|
inline |
Returns the ModelObject referenced by handle if it is of type T.
This method can be used with T as a concrete type (e.g. Zone) or as an abstract class (e.g. ParentObject).
|
inline |
Returns the ModelObjects of type T with name (exactMatch).
This method can be used with T as a concrete type (e.g. Zone) or as an abstract class (e.g. ParentObject), but please see getConcreteModelObjectByName if T is concrete.
|
inline |
Returns all ModelObjects of type T.
This method can be used with T as a concrete type (e.g. Zone) or as an abstract class (e.g. ParentObject).
|
inline |
Returns the subset of ModelObjects referenced by handles which are of type T.
This method can be used with T as a concrete type (e.g. Zone) or as an abstract class (e.g. ParentObject).
|
inline |
Returns all ModelObjects of type T with given name.
This method can be used with T as a concrete type (e.g. Zone) or as an abstract class (e.g. ParentObject).
|
inline |
Returns the unique ModelObject of type T if it is found.
|
inline |
Returns the unique ModelObject of type T, creates a one if none are found.
Note that template specilizations are provided below for objects were there is a performance gain to be had by caching the unique model object eg: getUniqueModelObject<YearDescription>()
Building openstudio::model::Model::getUniqueModelObject | ( | ) |
FoundationKivaSettings openstudio::model::Model::getUniqueModelObject | ( | ) |
OutputControlFiles openstudio::model::Model::getUniqueModelObject | ( | ) |
OutputTableSummaryReports openstudio::model::Model::getUniqueModelObject | ( | ) |
LifeCycleCostParameters openstudio::model::Model::getUniqueModelObject | ( | ) |
PerformancePrecisionTradeoffs openstudio::model::Model::getUniqueModelObject | ( | ) |
RunPeriod openstudio::model::Model::getUniqueModelObject | ( | ) |
YearDescription openstudio::model::Model::getUniqueModelObject | ( | ) |
WeatherFile openstudio::model::Model::getUniqueModelObject | ( | ) |
boost::optional<ComponentData> openstudio::model::Model::insertComponent | ( | const Component & | component | ) |
bool openstudio::model::Model::isDayofWeekforStartDayDefaulted | ( | ) | const |
bool openstudio::model::Model::isIsLeapYearDefaulted | ( | ) | const |
bool openstudio::model::Model::isLeapYear | ( | ) | const |
boost::optional<LifeCycleCostParameters> openstudio::model::Model::lifeCycleCostParameters | ( | ) | const |
Get the LifeCycleCostParameters object if there is one, this implementation uses a cached reference to the LifeCycleCostParameters object which can be significantly faster than calling getOptionalUniqueModelObject<LifeCycleCostParameters>().
|
static |
Load Model from file, attempts to load WorkflowJSON from standard path.
|
static |
Load Model and WorkflowJSON from files, fails if either osm or workflowJSON cannot be loaded.
openstudio::Date openstudio::model::Model::makeDate | ( | openstudio::MonthOfYear | monthOfYear, |
unsigned | dayOfMonth | ||
) |
openstudio::Date openstudio::model::Model::makeDate | ( | unsigned | monthOfYear, |
unsigned | dayOfMonth | ||
) |
openstudio::Date openstudio::model::Model::makeDate | ( | openstudio::NthDayOfWeekInMonth | n, |
openstudio::DayOfWeek | dayOfWeek, | ||
openstudio::MonthOfYear | monthOfYear | ||
) |
openstudio::Date openstudio::model::Model::makeDate | ( | unsigned | dayOfYear | ) |
std::vector<ModelObject> openstudio::model::Model::modelObjects | ( | bool | sorted = false | ) | const |
Get all model objects.
If sorted, then the objects are returned in the preferred order.
bool openstudio::model::Model::operator== | ( | const Model & | other | ) | const |
Equality test, tests if this Model shares the same implementation object with other.
Node openstudio::model::Model::outdoorAirNode | ( | ) | const |
boost::optional<OutputControlFiles> openstudio::model::Model::outputControlFiles | ( | ) | const |
Get the OutputControlFiles object if there is one, this implementation uses a cached reference to the OutputControlFiles object which can be significantly faster than calling getOptionalUniqueModelObject<OutputControlFiles>().
boost::optional<OutputTableSummaryReports> openstudio::model::Model::outputTableSummaryReports | ( | ) | const |
Get the OutputTableSummaryReports object if there is one, this implementation uses a cached reference to the OutputTableSummaryReports object which can be significantly faster than calling getOptionalUniqueModelObject<OutputTableSummaryReports>().
boost::optional<PerformancePrecisionTradeoffs> openstudio::model::Model::performancePrecisionTradeoffs | ( | ) | const |
Get the PerformancePrecisionTradeoffs object if there is one, this implementation uses a cached reference to the PerformancePrecisionTradeoffs object which can be significantly faster than calling getOptionalUniqueModelObject<PerformancePrecisionTradeoffs>().
SpaceType openstudio::model::Model::plenumSpaceType | ( | ) | const |
Get the space type used for plenums if there is one.
Create a new space type if necessary and add it to the model
std::string openstudio::model::Model::plenumSpaceTypeName | ( | ) | const |
Get the space type name used for plenums.
std::vector<openstudio::IdfObject> openstudio::model::Model::purgeUnusedResourceObjects | ( | ) |
Removes all ResourceObjects with nonResourceObjectUseCount() == 0.
All objects removed in the course of the purge are returned to support undos. Note that ResourceObjects may have children that are not ResourceObjects, and these may be removed as well.
std::vector<openstudio::IdfObject> openstudio::model::Model::purgeUnusedResourceObjects | ( | IddObjectType | iddObjectType | ) |
Removes all ResourceObjects of given IddObjectType with directUseCount() == 0.
All objects removed in the course of the purge are returned to support undos. Note that ResourceObjects may have children that are not ResourceObjects, and these may be removed as well.
void openstudio::model::Model::resetCalendarYear | ( | ) |
void openstudio::model::Model::resetDayofWeekforStartDay | ( | ) |
void openstudio::model::Model::resetIsLeapYear | ( | ) |
bool openstudio::model::Model::resetSqlFile | ( | ) |
Resets the EnergyPlus output SqlFile.
void openstudio::model::Model::resetWorkflowJSON | ( | ) |
Reset the WorkflowJSON.
boost::optional<RunPeriod> openstudio::model::Model::runPeriod | ( | ) | const |
Get the RunPeriod object if there is one, this implementation uses a cached reference to the RunPeriod object which can be significantly faster than calling getOptionalUniqueModelObject<RunPeriod>().
bool openstudio::model::Model::setCalendarYear | ( | int | calendarYear | ) |
bool openstudio::model::Model::setDayofWeekforStartDay | ( | std::string | dayofWeekforStartDay | ) |
bool openstudio::model::Model::setIsLeapYear | ( | bool | isLeapYear | ) |
bool openstudio::model::Model::setSqlFile | ( | const SqlFile & | sqlFile | ) |
Sets the EnergyPlus output SqlFile.
SqlFile must correspond to EnergyPlus simulation of this Model.
bool openstudio::model::Model::setWorkflowJSON | ( | const WorkflowJSON & | workflowJSON | ) |
Set the WorkflowJSON.
boost::optional<SqlFile> openstudio::model::Model::sqlFile | ( | ) | const |
Returns the EnergyPlus output SqlFile if set.
boost::optional<WeatherFile> openstudio::model::Model::weatherFile | ( | ) | const |
Get the WeatherFile object if there is one, this implementation uses a cached reference to the WeatherFile object which can be significantly faster than calling getOptionalUniqueModelObject<WeatherFile>().
WorkflowJSON openstudio::model::Model::workflowJSON | ( | ) | const |
Get the WorkflowJSON.
boost::optional<YearDescription> openstudio::model::Model::yearDescription | ( | ) | const |
Get the YearDescription object if there is one, this implementation uses a cached reference to the YearDescription object which can be significantly faster than calling getOptionalUniqueModelObject<YearDescription>().
|
related |
Compare inputResult to outputResult.
The intention is for inputResult to be the value of attributeName calculated using input data, and for outputResult to be the value of attributeName extracted from the Model::sqlFile(). Returns false and logs a message on the Model log channel at logLevel if the (relative) error is greater than tol.
|
related |
|
related |