OpenStudio:model
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Protected Member Functions | Related Functions | List of all members
openstudio::model::Component Class Reference

#include <Component.hpp>

+ Inheritance diagram for openstudio::model::Component:

Public Member Functions

Constructors and Destructors
 Component (const openstudio::IdfFile &idfFile)
 Construct from an IdfFile. More...
 
virtual ~Component ()
 
Getters
ComponentData componentData () const
 Returns the object that contains the contents list, unique identifiers, and timestamps for this Component. More...
 
ModelObject primaryObject () const
 Returns the primary ModelObject of this Component. More...
 
- Public Member Functions inherited from openstudio::model::Model
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...
 
boost::optional< ComponentDatainsertComponent (const Component &component)
 Inserts Component into Model and returns the primary object, if possible. More...
 
std::vector< ModelObjectmodelObjects (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...
 
 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 ()
 
WorkflowJSON workflowJSON () const
 Get the WorkflowJSON. More...
 
boost::optional< SqlFilesqlFile () const
 Returns the EnergyPlus output SqlFile if set. More...
 
boost::optional< Buildingbuilding () 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
< 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< RunPeriodrunPeriod () 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< YearDescriptionyearDescription () 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< intcalendarYear () 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
 
void 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< WeatherFileweatherFile () 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...
 
Schedule alwaysOffDiscreteSchedule () const
 Get an always off schedule with discrete type limits if there is one. More...
 
Schedule alwaysOnContinuousSchedule () const
 Get an always on schedule with continuous type limits if there is one. More...
 
SpaceType plenumSpaceType () const
 Get the space type used for plenums if there is one. More...
 
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<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 >
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
 
- Public Member Functions inherited from openstudio::Workspace
std::vector< WorkspaceObjectaddAndInsertObjects (const std::vector< IdfObject > &objectsToAdd, const std::vector< IdfObject > &objectsToInsert)
 
std::vector< WorkspaceObjectaddAndInsertObjects (const std::vector< WorkspaceObject > &objectsToAdd, const std::vector< WorkspaceObject > &objectsToInsert)
 
std::vector< WorkspaceObjectaddAndInsertObjects (const std::vector< WorkspaceObject > &objectsToAdd, const std::vector< std::vector< WorkspaceObject > > &objectsToInsert)
 
boost::optional< WorkspaceObjectaddObject (const IdfObject &idfObject)
 
std::vector< WorkspaceObjectaddObjects (const std::vector< IdfObject > &idfObjects)
 
std::vector< WorkspaceObjectaddObjects (const std::vector< WorkspaceObject > &objects)
 
bool canBeTarget (const Handle &handle, const std::set< std::string > &referenceListNames) const
 
cast () const
 
Workspace clone (bool keepHandles=false) const
 
Workspace cloneSubset (const std::vector< Handle > &handles, bool keepHandles=false, StrictnessLevel level=StrictnessLevel::Draft) const
 
bool connectProgressBar (openstudio::ProgressBar &progressBar)
 
bool disconnectProgressBar (openstudio::ProgressBar &progressBar)
 
bool fastNaming () const
 
boost::optional< IddObjectgetIddObject (const IddObjectType &type) const
 
boost::optional< WorkspaceObjectgetObject (Handle handle) const
 
boost::optional< WorkspaceObjectgetObjectByNameAndReference (std::string name, const std::vector< std::string > &referenceNames) const
 
boost::optional< WorkspaceObjectgetObjectByTypeAndName (IddObjectType objectType, const std::string &name) const
 
std::vector< WorkspaceObjectgetObjects (const std::vector< Handle > &handles) const
 
std::vector< WorkspaceObjectgetObjectsByName (const std::string &name, bool exactMatch=true) const
 
std::vector< WorkspaceObjectgetObjectsByReference (const std::string &referenceName) const
 
std::vector< WorkspaceObjectgetObjectsByReference (const std::vector< std::string > &referenceNames) const
 
std::vector< WorkspaceObjectgetObjectsByType (IddObjectType objectType) const
 
std::vector< WorkspaceObjectgetObjectsByType (const IddObject &objectType) const
 
std::vector< WorkspaceObjectgetObjectsByTypeAndName (IddObjectType objectType, const std::string &name) const
 
std::vector< Handle > handles (bool sorted=false) const
 
IddFile iddFile () const
 
IddFileType iddFileType () const
 
boost::optional< WorkspaceObjectinsertObject (const IdfObject &idfObject)
 
std::vector< WorkspaceObjectinsertObjects (const std::vector< IdfObject > &idfObjects)
 
std::vector< WorkspaceObjectinsertObjects (const std::vector< WorkspaceObject > &objects)
 
bool isInIddFile (IddObjectType type) const
 
bool isMember (const Handle &handle) const
 
bool isValid () const
 
bool isValid (StrictnessLevel level) const
 
std::vector< std::pair< QUrl,
openstudio::path > > 
locateUrls (const std::vector< URLSearchPath > &t_paths, bool t_create_relative_paths, const openstudio::path &t_infile)
 
boost::optional< std::string > name (const Handle &handle) const
 
std::string nextName (const std::string &name, bool fillIn) const
 
std::string nextName (const IddObjectType &iddObjectType, bool fillIn) const
 
unsigned numObjects () const
 
unsigned numObjectsOfType (IddObjectType type) const
 
unsigned numObjectsOfType (const IddObject &objectType) const
 
std::vector< WorkspaceObjectobjects (bool sorted=false) const
 
std::vector< WorkspaceObjectobjectsWithURLFields () const
 
bool operator!= (const Workspace &other) const
 
std::ostream & operator<< (std::ostream &os, const Workspace &workspace)
 
bool operator== (const Workspace &other) const
 
boost::optional< T > optionalCast () const
 
WorkspaceObjectOrder order ()
 
const WorkspaceObjectOrder order () const
 
bool removeObject (const Handle &handle)
 
bool removeObjects (const std::vector< Handle > &handles)
 
bool save (const openstudio::path &p, bool overwrite=false)
 
void setFastNaming (bool fastNaming)
 
bool setStrictnessLevel (StrictnessLevel level)
 
std::vector< Handle > sort (const std::vector< Handle > &handles) const
 
std::vector< WorkspaceObjectsort (const std::vector< WorkspaceObject > &objects) const
 
StrictnessLevel strictnessLevel () const
 
bool swap (WorkspaceObject &currentObject, IdfObject &newObject, bool keepTargets=false)
 
void swap (Workspace &other)
 
IdfFile toIdfFile () const
 
ValidityReport validityReport () const
 
ValidityReport validityReport (StrictnessLevel level) const
 
VersionString version () const
 
boost::optional< WorkspaceObjectversionObject () const
 
 Workspace (const Workspace &other)
 
 Workspace (StrictnessLevel level)
 
 Workspace ()
 
 Workspace (const IdfFile &idfFile, StrictnessLevel level=StrictnessLevel::None)
 
 Workspace (StrictnessLevel level, IddFileType iddFileType)
 
virtual ~Workspace ()
 

Protected Member Functions

 Component (const std::vector< ModelObject > &contents)
 Construct from a vector of ModelObjects, all in the same .model(). More...
 
- Protected Member Functions inherited from openstudio::Workspace
virtual void addVersionObject ()
 
std::vector< WorkspaceObjectallObjects () const
 
 Workspace (std::shared_ptr< detail::Workspace_Impl > impl)
 

Related Functions

(Note that these are not member functions.)

typedef std::vector< ComponentComponentVector
 
typedef boost::optional
< Component
OptionalComponent
 

Serialization

virtual bool save (const openstudio::path &p, bool overwrite=false)
 Save Component to path p. More...
 
static boost::optional< Componentload (const path &p)
 Load Component from path p, if possible. More...
 

Additional Inherited Members

- Public Types inherited from openstudio::Workspace
typedef boost::optional
< Workspace
OptionalWorkspace
 
typedef std::vector< WorkspaceWorkspaceVector
 
- Static Public Member Functions inherited from openstudio::model::Model
static boost::optional< Modelload (const path &osmPath)
 Load Model from file, attempts to load WorkflowJSON from standard path. More...
 
static boost::optional< Modelload (const path &osmPath, const path &workflowJSONPath)
 Load Model and WorkflowJSON from files, fails if either osm or workflowJSON cannot be loaded. More...
 
- Static Public Member Functions inherited from openstudio::Workspace
static boost::optional< Workspaceload (const openstudio::path &p)
 
static boost::optional< Workspaceload (const openstudio::path &p, const IddFile &iddFile)
 
static boost::optional< Workspaceload (const openstudio::path &p, const IddFileType &iddFileType)
 
- Protected Types inherited from openstudio::Workspace
typedef detail::Workspace_Impl ImplType
 

Detailed Description

Component is a Model that contains exactly one ComponentData object.

All objects other than the ComponentData object and the version object are the Component contents. There is a primary ModelObject that provides the Component's type. There are no public constructors, as Components are to be constructed through the ModelObject method createComponent. Similarly, Model-level object addition and removal, and SqlFile functionality, has been disabled.

Constructor & Destructor Documentation

openstudio::model::Component::Component ( const openstudio::IdfFile idfFile)
explicit

Construct from an IdfFile.

Must contain exactly one ComponentData object, and contents list in ComponentData must exactly match the contents of idfFile.

virtual openstudio::model::Component::~Component ( )
virtual
openstudio::model::Component::Component ( const std::vector< ModelObject > &  contents)
protected

Construct from a vector of ModelObjects, all in the same .model().

The primary object must be listed first. Throws if contents.empty() or if more than one .model() is found. StrictnessLevel is always set to Draft. Not for general use; used by ModelObject::createComponent.

Member Function Documentation

ComponentData openstudio::model::Component::componentData ( ) const

Returns the object that contains the contents list, unique identifiers, and timestamps for this Component.

static boost::optional<Component> openstudio::model::Component::load ( const path &  p)
static

Load Component from path p, if possible.

ModelObject openstudio::model::Component::primaryObject ( ) const

Returns the primary ModelObject of this Component.

Can be used to access the Component type by using .optionalCast or iddObjectType().

virtual bool openstudio::model::Component::save ( const openstudio::path &  p,
bool  overwrite = false 
)
virtual

Save Component to path p.

Will construct the parent folder if its parent folder exists. An existing file will only be overwritten if if overwrite==true. If no extension is provided, componentFileExtension() will be used.

Friends And Related Function Documentation

typedef std::vector<Component> ComponentVector
related
typedef boost::optional<Component> OptionalComponent
related