GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 1 / 1 / 2
Functions: 100.0% 1 / 1 / 2
Branches: -% 0 / 1 / 1

src/model/Model_Impl.hpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #ifndef MODEL_MODEL_IMPL_HPP
7 #define MODEL_MODEL_IMPL_HPP
8
9 #include "ComponentWatcher.hpp"
10 #include "Building.hpp"
11 #include "FoundationKivaSettings.hpp"
12 #include "OutputControlFiles.hpp"
13 #include "OutputControlReportingTolerances.hpp"
14 #include "OutputControlResilienceSummaries.hpp"
15 #include "OutputControlTableStyle.hpp"
16 #include "OutputControlTimestamp.hpp"
17 #include "OutputDiagnostics.hpp"
18 #include "OutputDebuggingData.hpp"
19 #include "OutputJSON.hpp"
20 #include "OutputSQLite.hpp"
21 #include "OutputEnergyManagementSystem.hpp"
22 #include "OutputTableSummaryReports.hpp"
23 #include "OutputSchedules.hpp"
24 #include "OutputConstructions.hpp"
25 #include "PerformancePrecisionTradeoffs.hpp"
26 #include "LifeCycleCostParameters.hpp"
27 #include "SizingParameters.hpp"
28 #include "RadianceParameters.hpp"
29 #include "RunPeriod.hpp"
30 #include "RunPeriodControlDaylightSavingTime.hpp"
31 #include "YearDescription.hpp"
32 #include "Site.hpp"
33 #include "SiteGroundReflectance.hpp"
34 #include "SiteWaterMainsTemperature.hpp"
35 #include "SiteGroundTemperatureBuildingSurface.hpp"
36 #include "SiteGroundTemperatureFCfactorMethod.hpp"
37 #include "SiteGroundTemperatureDeep.hpp"
38 #include "SiteGroundTemperatureShallow.hpp"
39 #include "Facility.hpp"
40 #include "WeatherFile.hpp"
41 #include "Version.hpp"
42 #include "SimulationControl.hpp"
43 #include "LightingSimulationControl.hpp"
44 #include "AirflowNetworkSimulationControl.hpp"
45 #include "InsideSurfaceConvectionAlgorithm.hpp"
46 #include "OutsideSurfaceConvectionAlgorithm.hpp"
47 #include "HeatBalanceAlgorithm.hpp"
48 #include "ZoneAirContaminantBalance.hpp"
49 #include "ZoneAirHeatBalanceAlgorithm.hpp"
50 #include "ZoneAirMassFlowConservation.hpp"
51 #include "ZoneCapacitanceMultiplierResearchSpecial.hpp"
52 #include "ConvergenceLimits.hpp"
53 #include "ShadowCalculation.hpp"
54 #include "Timestep.hpp"
55 #include "ClimateZones.hpp"
56 #include "EnvironmentalImpactFactors.hpp"
57 #include "ExternalInterface.hpp"
58 #include "PythonPluginSearchPaths.hpp"
59
60 #include "../nano/nano_signal_slot.hpp" // Signal-Slot replacement
61
62 #include "../utilities/idf/Workspace.hpp"
63 #include "../utilities/idf/Workspace_Impl.hpp"
64 #include "../utilities/idf/WorkspaceObject.hpp"
65 #include "../utilities/idf/WorkspaceObject_Impl.hpp"
66 #include "../utilities/filetypes/WorkflowJSON.hpp"
67
68 #include <boost/optional.hpp>
69
70 #include <vector>
71
72 namespace openstudio {
73
74 class SqlFile;
75 class IdfFile;
76 class Workspace;
77 class ProgressBar;
78
79 namespace detail {
80 class WorkspaceObject_Impl;
81 }
82
83 namespace model {
84
85 // forward declaration
86 class Model;
87 class ModelObject;
88 class Component;
89 class ComponentData;
90 class Schedule;
91 class Node;
92 class SpaceType;
93
94 namespace detail {
95
96 class ModelObject_Impl;
97
98 /** Container for the OpenStudio Building Model hierarchy. */
99 class MODEL_API Model_Impl : public openstudio::detail::Workspace_Impl
100 {
101
102 public:
103 /** @name Constructors and Destructors */
104 //@{
105
106 // default constructor
107 Model_Impl();
108
109 // construct from IdfFile
110 Model_Impl(const IdfFile& idfFile);
111
112 // construct from Workspace
113 Model_Impl(const openstudio::detail::Workspace_Impl& workspace, bool keepHandles = false);
114
115 // copy constructor, used for clone
116 Model_Impl(const Model_Impl& other, bool keepHandles = false);
117
118 /** Subset copy constructor makes unconnected copy of all data, only keeping information about
119 * objects corresponding to handles. */
120 Model_Impl(const Model_Impl& other, const std::vector<Handle>& hs, bool keepHandles = false, StrictnessLevel level = StrictnessLevel::Draft);
121
122 /** Implementation of openstudio::detail::Workspace_Impl::clone for Model_Impl. The returned
123 * value may be cast to type Model. */
124 virtual Workspace clone(bool keepHandles = false) const override;
125
126 /** Implementation of openstudio::detail::Workspace_Impl::cloneSubset for Model_Impl. The
127 * returned value may be cast to type Model. */
128 virtual Workspace cloneSubset(const std::vector<Handle>& handles, bool keepHandles = false,
129 StrictnessLevel level = StrictnessLevel::Draft) const override;
130
131 /** Swaps underlying data between this workspace and other. */
132 virtual void swap(Workspace& other) override;
133
134 31061 virtual ~Model_Impl() override = default;
135
136 /** Creates ComponentWatchers for each ComponentData object. Should be called as part of
137 * construction from IdfFile or Workspace. */
138 void createComponentWatchers();
139
140 //@}
141 /** @name Type Casting */
142 //@{
143
144 Model model() const;
145
146 //@}
147 /** @name Getters */
148 //@{
149
150 /// Get the WorkflowJSON
151 WorkflowJSON workflowJSON() const;
152
153 /// Get the sql file
154 boost::optional<openstudio::SqlFile> sqlFile() const;
155
156 /** Get the Building object if there is one, this implementation uses a cached reference to the Building
157 * object which can be significantly faster than calling getOptionalUniqueModelObject<Building>(). */
158 boost::optional<Building> building() const;
159
160 /** Get the FoundationKivaSettings object if there is one, this implementation uses a cached reference to the FoundationKivaSettings
161 * object which can be significantly faster than calling getOptionalUniqueModelObject<FoundationKivaSettings>(). */
162 boost::optional<FoundationKivaSettings> foundationKivaSettings() const;
163
164 /** Get the OutputControlFiles object if there is one, this implementation uses a cached reference to the OutputControlFiles
165 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputControlFiles>(). */
166 boost::optional<OutputControlFiles> outputControlFiles() const;
167
168 /** Get the OutputControlReportingTolerances object if there is one, this implementation uses a cached reference to the OutputControlReportingTolerances
169 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputControlReportingTolerances>(). */
170 boost::optional<OutputControlReportingTolerances> outputControlReportingTolerances() const;
171
172 /** Get the OutputControlResilienceSummaries object if there is one, this implementation uses a cached reference to the OutputControlResilienceSummaries
173 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputControlResilienceSummaries>(). */
174 boost::optional<OutputControlResilienceSummaries> outputControlResilienceSummaries() const;
175
176 /** Get the OutputControlTableStyle object if there is one, this implementation uses a cached reference to the OutputControlTableStyle
177 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputControlTableStyle>(). */
178 boost::optional<OutputControlTableStyle> outputControlTableStyle() const;
179
180 /** Get the OutputControlTimestamp object if there is one, this implementation uses a cached reference to the OutputControlTimestamp
181 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputControlTimestamp>(). */
182 boost::optional<OutputControlTimestamp> outputControlTimestamp() const;
183
184 /** Get the OutputDiagnostics object if there is one, this implementation uses a cached reference to the OutputDiagnostics
185 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputDiagnostics>(). */
186 boost::optional<OutputDiagnostics> outputDiagnostics() const;
187
188 /** Get the OutputDebuggingData object if there is one, this implementation uses a cached reference to the OutputDebuggingData
189 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputDebuggingData>(). */
190 boost::optional<OutputDebuggingData> outputDebuggingData() const;
191
192 /** Get the OutputJSON object if there is one, this implementation uses a cached reference to the OutputJSON
193 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputJSON>(). */
194 boost::optional<OutputJSON> outputJSON() const;
195
196 /** Get the OutputSQLite object if there is one, this implementation uses a cached reference to the OutputSQLite
197 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputSQLite>(). */
198 boost::optional<OutputSQLite> outputSQLite() const;
199
200 /** Get the OutputEnergyManagementSystem object if there is one, this implementation uses a cached reference to the OutputEnergyManagementSystem
201 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputEnergyManagementSystem>(). */
202 boost::optional<OutputEnergyManagementSystem> outputEnergyManagementSystem() const;
203
204 /** Get the OutputTableSummaryReports object if there is one, this implementation uses a cached reference to the OutputTableSummaryReports
205 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputTableSummaryReports>(). */
206 boost::optional<OutputTableSummaryReports> outputTableSummaryReports() const;
207
208 /** Get the OutputSchedules object if there is one, this implementation uses a cached reference to the OutputSchedules
209 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputSchedules>(). */
210 boost::optional<OutputSchedules> outputSchedules() const;
211
212 /** Get the OutputConstructions object if there is one, this implementation uses a cached reference to the OutputConstructions
213 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutputConstructions>(). */
214 boost::optional<OutputConstructions> outputConstructions() const;
215
216 /** Get the PerformancePrecisionTradeoffs object if there is one, this implementation uses a cached reference to the PerformancePrecisionTradeoffs
217 * object which can be significantly faster than calling getOptionalUniqueModelObject<PerformancePrecisionTradeoffs>(). */
218 boost::optional<PerformancePrecisionTradeoffs> performancePrecisionTradeoffs() const;
219
220 /** Get the LifeCycleCostParameters object if there is one, this implementation uses a cached reference to the LifeCycleCostParameters
221 * object which can be significantly faster than calling getOptionalUniqueModelObject<LifeCycleCostParameters>(). */
222 boost::optional<LifeCycleCostParameters> lifeCycleCostParameters() const;
223
224 /** Get the SizingParameters object if there is one, this implementation uses a cached reference to the SizingParameters
225 * object which can be significantly faster than calling getOptionalUniqueModelObject<SizingParameters>(). */
226 boost::optional<SizingParameters> sizingParameters() const;
227
228 /** Get the RadianceParameters object if there is one, this implementation uses a cached reference to the RadianceParameters
229 * object which can be significantly faster than calling getOptionalUniqueModelObject<RadianceParameters>(). */
230 boost::optional<RadianceParameters> radianceParameters() const;
231
232 /** Get the RunPeriod object if there is one, this implementation uses a cached reference to the RunPeriod
233 * object which can be significantly faster than calling getOptionalUniqueModelObject<RunPeriod>(). */
234 boost::optional<RunPeriod> runPeriod() const;
235
236 /** Get the RunPeriodControlDaylightSavingTime object if there is one, this implementation uses a cached reference to the RunPeriodControlDaylightSavingTime
237 * object which can be significantly faster than calling getOptionalUniqueModelObject<RunPeriodControlDaylightSavingTime>(). */
238 boost::optional<RunPeriodControlDaylightSavingTime> runPeriodControlDaylightSavingTime() const;
239
240 /** Get the YearDescription object if there is one, this implementation uses a cached reference to the YearDescription
241 * object which can be significantly faster than calling getOptionalUniqueModelObject<YearDescription>(). */
242 boost::optional<YearDescription> yearDescription() const;
243
244 /** Get the Site object if there is one, this implementation uses a cached reference to the Site
245 * object which can be significantly faster than calling getOptionalUniqueModelObject<Site>(). */
246 boost::optional<Site> site() const;
247
248 /** Get the SiteGroundReflectance object if there is one, this implementation uses a cached reference to the SiteGroundReflectance
249 * object which can be significantly faster than calling getOptionalUniqueModelObject<SiteGroundReflectance>(). */
250 boost::optional<SiteGroundReflectance> siteGroundReflectance() const;
251
252 /** Get the SiteWaterMainsTemperature object if there is one, this implementation uses a cached reference to the SiteWaterMainsTemperature
253 * object which can be significantly faster than calling getOptionalUniqueModelObject<SiteWaterMainsTemperature>(). */
254 boost::optional<SiteWaterMainsTemperature> siteWaterMainsTemperature() const;
255
256 /** Get the SiteGroundTemperatureBuildingSurface object if there is one, this implementation uses a cached reference to the SiteGroundTemperatureBuildingSurface
257 * object which can be significantly faster than calling getOptionalUniqueModelObject<SiteGroundTemperatureBuildingSurface>(). */
258 boost::optional<SiteGroundTemperatureBuildingSurface> siteGroundTemperatureBuildingSurface() const;
259
260 /** Get the SiteGroundTemperatureFCfactorMethod object if there is one, this implementation uses a cached reference to the SiteGroundTemperatureFCfactorMethod
261 * object which can be significantly faster than calling getOptionalUniqueModelObject<SiteGroundTemperatureFCfactorMethod>(). */
262 boost::optional<SiteGroundTemperatureFCfactorMethod> siteGroundTemperatureFCfactorMethod() const;
263
264 /** Get the SiteGroundTemperatureDeep object if there is one, this implementation uses a cached reference to the SiteGroundTemperatureDeep
265 * object which can be significantly faster than calling getOptionalUniqueModelObject<SiteGroundTemperatureDeep>(). */
266 boost::optional<SiteGroundTemperatureDeep> siteGroundTemperatureDeep() const;
267
268 /** Get the SiteGroundTemperatureShallow object if there is one, this implementation uses a cached reference to the SiteGroundTemperatureShallow
269 * object which can be significantly faster than calling getOptionalUniqueModelObject<SiteGroundTemperatureShallow>(). */
270 boost::optional<SiteGroundTemperatureShallow> siteGroundTemperatureShallow() const;
271
272 /** Get the Facility object if there is one, this implementation uses a cached reference to the Facility
273 * object which can be significantly faster than calling getOptionalUniqueModelObject<Facility>(). */
274 boost::optional<Facility> facility() const;
275
276 /** Get the WeatherFile object if there is one, this implementation uses a cached reference to the WeatherFile
277 * object which can be significantly faster than calling getOptionalUniqueModelObject<WeatherFile>(). */
278 boost::optional<WeatherFile> weatherFile() const;
279
280 /** Get the SimulationControl object if there is one, this implementation uses a cached reference to the SimulationControl
281 * object which can be significantly faster than calling getOptionalUniqueModelObject<SimulationControl>(). */
282 boost::optional<SimulationControl> simulationControl() const;
283
284 /** Get the LightingSimulationControl object if there is one, this implementation uses a cached reference to the LightingSimulationControl
285 * object which can be significantly faster than calling getOptionalUniqueModelObject<LightingSimulationControl>(). */
286 boost::optional<LightingSimulationControl> lightingSimulationControl() const;
287
288 /** Get the AirflowNetworkSimulationControl object if there is one, this implementation uses a cached reference to the AirflowNetworkSimulationControl
289 * object which can be significantly faster than calling getOptionalUniqueModelObject<AirflowNetworkSimulationControl>(). */
290 boost::optional<AirflowNetworkSimulationControl> airflowNetworkSimulationControl() const;
291
292 /** Get the InsideSurfaceConvectionAlgorithm object if there is one, this implementation uses a cached reference to the InsideSurfaceConvectionAlgorithm
293 * object which can be significantly faster than calling getOptionalUniqueModelObject<InsideSurfaceConvectionAlgorithm>(). */
294 boost::optional<InsideSurfaceConvectionAlgorithm> insideSurfaceConvectionAlgorithm() const;
295
296 /** Get the OutsideSurfaceConvectionAlgorithm object if there is one, this implementation uses a cached reference to the OutsideSurfaceConvectionAlgorithm
297 * object which can be significantly faster than calling getOptionalUniqueModelObject<OutsideSurfaceConvectionAlgorithm>(). */
298 boost::optional<OutsideSurfaceConvectionAlgorithm> outsideSurfaceConvectionAlgorithm() const;
299
300 /** Get the HeatBalanceAlgorithm object if there is one, this implementation uses a cached reference to the HeatBalanceAlgorithm
301 * object which can be significantly faster than calling getOptionalUniqueModelObject<HeatBalanceAlgorithm>(). */
302 boost::optional<HeatBalanceAlgorithm> heatBalanceAlgorithm() const;
303
304 /** Get the ZoneAirContaminantBalance object if there is one, this implementation uses a cached reference to the ZoneAirContaminantBalance
305 * object which can be significantly faster than calling getOptionalUniqueModelObject<ZoneAirContaminantBalance>(). */
306 boost::optional<ZoneAirContaminantBalance> zoneAirContaminantBalance() const;
307
308 /** Get the ZoneAirHeatBalanceAlgorithm object if there is one, this implementation uses a cached reference to the ZoneAirHeatBalanceAlgorithm
309 * object which can be significantly faster than calling getOptionalUniqueModelObject<ZoneAirHeatBalanceAlgorithm>(). */
310 boost::optional<ZoneAirHeatBalanceAlgorithm> zoneAirHeatBalanceAlgorithm() const;
311
312 /** Get the ZoneAirMassFlowConservation object if there is one, this implementation uses a cached reference to the ZoneAirMassFlowConservation
313 * object which can be significantly faster than calling getOptionalUniqueModelObject<ZoneAirMassFlowConservation>(). */
314 boost::optional<ZoneAirMassFlowConservation> zoneAirMassFlowConservation() const;
315
316 /** Get the ZoneCapacitanceMultiplierResearchSpecial object if there is one, this implementation uses a cached reference to the ZoneCapacitanceMultiplierResearchSpecial
317 * object which can be significantly faster than calling getOptionalUniqueModelObject<ZoneCapacitanceMultiplierResearchSpecial>(). */
318 boost::optional<ZoneCapacitanceMultiplierResearchSpecial> zoneCapacitanceMultiplierResearchSpecial() const;
319
320 /** Get the ConvergenceLimits object if there is one, this implementation uses a cached reference to the ConvergenceLimits
321 * object which can be significantly faster than calling getOptionalUniqueModelObject<ConvergenceLimits>(). */
322 boost::optional<ConvergenceLimits> convergenceLimits() const;
323
324 /** Get the ShadowCalculation object if there is one, this implementation uses a cached reference to the ShadowCalculation
325 * object which can be significantly faster than calling getOptionalUniqueModelObject<ShadowCalculation>(). */
326 boost::optional<ShadowCalculation> shadowCalculation() const;
327
328 /** Get the Timestep object if there is one, this implementation uses a cached reference to the Timestep
329 * object which can be significantly faster than calling getOptionalUniqueModelObject<Timestep>(). */
330 boost::optional<Timestep> timestep() const;
331
332 /** Get the ClimateZones object if there is one, this implementation uses a cached reference to the ClimateZones
333 * object which can be significantly faster than calling getOptionalUniqueModelObject<ClimateZones>(). */
334 boost::optional<ClimateZones> climateZones() const;
335
336 /** Get the EnvironmentalImpactFactors object if there is one, this implementation uses a cached reference to the EnvironmentalImpactFactors
337 * object which can be significantly faster than calling getOptionalUniqueModelObject<EnvironmentalImpactFactors>(). */
338 boost::optional<EnvironmentalImpactFactors> environmentalImpactFactors() const;
339
340 /** Get the ExternalInterface object if there is one, this implementation uses a cached reference to the ExternalInterface
341 * object which can be significantly faster than calling getOptionalUniqueModelObject<ExternalInterface>(). */
342 boost::optional<ExternalInterface> externalInterface() const;
343
344 /** Get the PythonPluginSearchPaths object if there is one, this implementation uses a cached reference to the PythonPluginSearchPaths
345 * object which can be significantly faster than calling getOptionalUniqueModelObject<PythonPluginSearchPaths>(). */
346 boost::optional<PythonPluginSearchPaths> pythonPluginSearchPaths() const;
347
348 /** Get or create the YearDescription object if there is one, then call method from YearDescription. */
349 // DLM: this is due to issues exporting the model::YearDescription object because of name conflict with utilities::YearDescription.
350 boost::optional<int> calendarYear() const;
351 std::string dayofWeekforStartDay() const;
352 bool isDayofWeekforStartDayDefaulted() const;
353 bool isLeapYear() const;
354 bool isIsLeapYearDefaulted() const;
355 bool setCalendarYear(int calendarYear);
356 void resetCalendarYear();
357 bool setDayofWeekforStartDay(const std::string& dayofWeekforStartDay);
358 void resetDayofWeekforStartDay();
359 bool setIsLeapYear(bool isLeapYear);
360 void resetIsLeapYear();
361 int assumedYear();
362 openstudio::Date makeDate(openstudio::MonthOfYear monthOfYear, unsigned dayOfMonth);
363 openstudio::Date makeDate(unsigned monthOfYear, unsigned dayOfMonth);
364 openstudio::Date makeDate(openstudio::NthDayOfWeekInMonth n, openstudio::DayOfWeek dayOfWeek, openstudio::MonthOfYear monthOfYear);
365 openstudio::Date makeDate(unsigned dayOfYear);
366
367 Schedule alwaysOnDiscreteSchedule() const;
368
369 std::string alwaysOnDiscreteScheduleName() const;
370
371 Schedule alwaysOffDiscreteSchedule() const;
372
373 std::string alwaysOffDiscreteScheduleName() const;
374
375 Schedule alwaysOnContinuousSchedule() const;
376
377 std::string alwaysOnContinuousScheduleName() const;
378
379 Node outdoorAirNode() const;
380
381 SpaceType plenumSpaceType() const;
382
383 std::string plenumSpaceTypeName() const;
384
385 //@}
386 /** @name Setters */
387 //@{
388
389 /** Override to return false. IddFileType is always equal to IddFileType::OpenStudio. */
390 virtual bool setIddFile(IddFileType iddFileType);
391
392 // Overriding this from WorkspaceObject_Impl is how all objects in the model end up
393 // as model objects
394 virtual std::shared_ptr<openstudio::detail::WorkspaceObject_Impl> createObject(const IdfObject& object, bool keepHandle) override;
395
396 // Helper function to start the process of adding a cloned object to the workspace.
397 virtual std::shared_ptr<openstudio::detail::WorkspaceObject_Impl>
398 createObject(const std::shared_ptr<openstudio::detail::WorkspaceObject_Impl>& originalObjectImplPtr, bool keepHandle) override;
399
400 /// Set the WorkflowJSON
401 bool setWorkflowJSON(const WorkflowJSON& workflowJSON);
402
403 void resetWorkflowJSON();
404
405 /// set the sql file
406 virtual bool setSqlFile(const openstudio::SqlFile& sqlFile);
407
408 /// reset the sql file
409 bool resetSqlFile();
410
411 /// equality test
412 bool operator==(const Model& other) const;
413
414 /** Inserts Component into Model and returns the primary object, if possible. */
415 virtual boost::optional<ComponentData> insertComponent(const Component& component);
416
417 /** Removes all \link ResourceObject ResourceObjects\endlink with
418 * nonResourceObjectUseCount() == 0. All objects removed in the course of the purge
419 * are returned to support undos. Note that ResourceObjects may have children that
420 * are not ResourceObjects, and these may be removed as well. */
421 virtual std::vector<openstudio::IdfObject> purgeUnusedResourceObjects();
422
423 /** Removes all \link ResourceObject ResourceObjects\endlink of given IddObjectType with
424 * directUseCount() == 0. All objects removed in the course of the purge
425 * are returned to support undos. Note that ResourceObjects may have children that
426 * are not ResourceObjects, and these may be removed as well. */
427 virtual std::vector<openstudio::IdfObject> purgeUnusedResourceObjects(IddObjectType iddObjectType);
428
429 void connect(const Model& model, ModelObject sourceObject, unsigned sourcePort, ModelObject targetObject, unsigned targetPort);
430
431 void disconnect(ModelObject object, unsigned port);
432
433 //@}
434 /** @name Nano Signals */
435 //@{
436
437 Nano::Signal<void(openstudio::model::detail::ModelObject_Impl*, IddObjectType, openstudio::UUID)> initialModelObject;
438
439 Nano::Signal<void()> initialReportComplete;
440
441 //@}
442
443 // public slots :
444
445 virtual void obsoleteComponentWatcher(const ComponentWatcher& watcher);
446
447 virtual void reportInitialModelObjects();
448
449 void autosize();
450
451 void applySizingValues();
452
453 private:
454 // explicitly unimplemented copy constructor
455 // ETH@20120116 This causes a build error on Windows since there is already a copy constructor
456 // (with a defaulted second argument).
457 // Model_Impl(const Model_Impl &);
458
459 // explicitly unimplemented assignment operator
460 Model_Impl& operator=(const Model_Impl&);
461
462 − REGISTER_LOGGER("openstudio.model.Model");
463
464 // Make this a shared_ptr to avoid having to #include SqlFile.hpp in all Model objects
465 std::shared_ptr<openstudio::SqlFile> m_sqlFile;
466
467 std::vector<ComponentWatcher> m_componentWatchers;
468
469 void mf_createComponentWatcher(ComponentData& componentData);
470
471 WorkflowJSON m_workflowJSON;
472
473 private:
474 mutable boost::optional<Building> m_cachedBuilding;
475 mutable boost::optional<FoundationKivaSettings> m_cachedFoundationKivaSettings;
476 mutable boost::optional<OutputControlFiles> m_cachedOutputControlFiles;
477 mutable boost::optional<OutputControlReportingTolerances> m_cachedOutputControlReportingTolerances;
478 mutable boost::optional<OutputControlResilienceSummaries> m_cachedOutputControlResilienceSummaries;
479 mutable boost::optional<OutputControlTableStyle> m_cachedOutputControlTableStyle;
480 mutable boost::optional<OutputControlTimestamp> m_cachedOutputControlTimestamp;
481 mutable boost::optional<OutputDiagnostics> m_cachedOutputDiagnostics;
482 mutable boost::optional<OutputDebuggingData> m_cachedOutputDebuggingData;
483 mutable boost::optional<OutputJSON> m_cachedOutputJSON;
484 mutable boost::optional<OutputSQLite> m_cachedOutputSQLite;
485 mutable boost::optional<OutputEnergyManagementSystem> m_cachedOutputEnergyManagementSystem;
486 mutable boost::optional<OutputTableSummaryReports> m_cachedOutputTableSummaryReports;
487 mutable boost::optional<OutputSchedules> m_cachedOutputSchedules;
488 mutable boost::optional<OutputConstructions> m_cachedOutputConstructions;
489 mutable boost::optional<PerformancePrecisionTradeoffs> m_cachedPerformancePrecisionTradeoffs;
490 mutable boost::optional<LifeCycleCostParameters> m_cachedLifeCycleCostParameters;
491 mutable boost::optional<SizingParameters> m_cachedSizingParameters;
492 mutable boost::optional<RadianceParameters> m_cachedRadianceParameters;
493 mutable boost::optional<RunPeriod> m_cachedRunPeriod;
494 mutable boost::optional<RunPeriodControlDaylightSavingTime> m_cachedRunPeriodControlDaylightSavingTime;
495 mutable boost::optional<YearDescription> m_cachedYearDescription;
496 mutable boost::optional<Site> m_cachedSite;
497 mutable boost::optional<SiteGroundReflectance> m_cachedSiteGroundReflectance;
498 mutable boost::optional<SiteWaterMainsTemperature> m_cachedSiteWaterMainsTemperature;
499 mutable boost::optional<SiteGroundTemperatureBuildingSurface> m_cachedSiteGroundTemperatureBuildingSurface;
500 mutable boost::optional<SiteGroundTemperatureFCfactorMethod> m_cachedSiteGroundTemperatureFCfactorMethod;
501 mutable boost::optional<SiteGroundTemperatureDeep> m_cachedSiteGroundTemperatureDeep;
502 mutable boost::optional<SiteGroundTemperatureShallow> m_cachedSiteGroundTemperatureShallow;
503 mutable boost::optional<Facility> m_cachedFacility;
504 mutable boost::optional<WeatherFile> m_cachedWeatherFile;
505 mutable boost::optional<Version> m_cachedVersion;
506 mutable boost::optional<SimulationControl> m_cachedSimulationControl;
507 mutable boost::optional<LightingSimulationControl> m_cachedLightingSimulationControl;
508 mutable boost::optional<AirflowNetworkSimulationControl> m_cachedAirflowNetworkSimulationControl;
509 mutable boost::optional<InsideSurfaceConvectionAlgorithm> m_cachedInsideSurfaceConvectionAlgorithm;
510 mutable boost::optional<OutsideSurfaceConvectionAlgorithm> m_cachedOutsideSurfaceConvectionAlgorithm;
511 mutable boost::optional<HeatBalanceAlgorithm> m_cachedHeatBalanceAlgorithm;
512 mutable boost::optional<ZoneAirContaminantBalance> m_cachedZoneAirContaminantBalance;
513 mutable boost::optional<ZoneAirHeatBalanceAlgorithm> m_cachedZoneAirHeatBalanceAlgorithm;
514 mutable boost::optional<ZoneAirMassFlowConservation> m_cachedZoneAirMassFlowConservation;
515 mutable boost::optional<ZoneCapacitanceMultiplierResearchSpecial> m_cachedZoneCapacitanceMultiplierResearchSpecial;
516 mutable boost::optional<ConvergenceLimits> m_cachedConvergenceLimits;
517 mutable boost::optional<ShadowCalculation> m_cachedShadowCalculation;
518 mutable boost::optional<Timestep> m_cachedTimestep;
519 mutable boost::optional<ClimateZones> m_cachedClimateZones;
520 mutable boost::optional<EnvironmentalImpactFactors> m_cachedEnvironmentalImpactFactors;
521 mutable boost::optional<ExternalInterface> m_cachedExternalInterface;
522 mutable boost::optional<PythonPluginSearchPaths> m_cachedPythonPluginSearchPaths;
523
524 // private slots:
525 void clearCachedData();
526 void clearCachedBuilding(const Handle& handle);
527 void clearCachedFoundationKivaSettings(const Handle& handle);
528 void clearCachedOutputControlFiles(const Handle& handle);
529 void clearCachedOutputControlReportingTolerances(const Handle& handle);
530 void clearCachedOutputControlResilienceSummaries(const Handle& handle);
531 void clearCachedOutputControlTableStyle(const Handle& handle);
532 void clearCachedOutputControlTimestamp(const Handle& handle);
533 void clearCachedOutputDiagnostics(const Handle& handle);
534 void clearCachedOutputDebuggingData(const Handle& handle);
535 void clearCachedOutputJSON(const Handle& handle);
536 void clearCachedOutputSQLite(const Handle& handle);
537 void clearCachedOutputEnergyManagementSystem(const Handle& handle);
538 void clearCachedOutputTableSummaryReports(const Handle& handle);
539 void clearCachedOutputSchedules(const Handle& handle);
540 void clearCachedOutputConstructions(const Handle& handle);
541 void clearCachedPerformancePrecisionTradeoffs(const Handle& handle);
542 void clearCachedLifeCycleCostParameters(const Handle& handle);
543 void clearCachedSizingParameters(const Handle& handle);
544 void clearCachedRadianceParameters(const Handle& handle);
545 void clearCachedRunPeriod(const Handle& handle);
546 void clearCachedRunPeriodControlDaylightSavingTime(const Handle& handle);
547 void clearCachedYearDescription(const Handle& handle);
548 void clearCachedSite(const Handle& handle);
549 void clearCachedSiteGroundReflectance(const Handle& handle);
550 void clearCachedSiteWaterMainsTemperature(const Handle& handle);
551 void clearCachedSiteGroundTemperatureBuildingSurface(const Handle& handle);
552 void clearCachedSiteGroundTemperatureFCfactorMethod(const Handle& handle);
553 void clearCachedSiteGroundTemperatureDeep(const Handle& handle);
554 void clearCachedSiteGroundTemperatureShallow(const Handle& handle);
555 void clearCachedFacility(const Handle& handle);
556 void clearCachedWeatherFile(const Handle& handle);
557 void clearCachedSimulationControl(const Handle& handle);
558 void clearCachedLightingSimulationControl(const Handle& handle);
559 void clearCachedAirflowNetworkSimulationControl(const Handle& handle);
560 void clearCachedInsideSurfaceConvectionAlgorithm(const Handle& handle);
561 void clearCachedOutsideSurfaceConvectionAlgorithm(const Handle& handle);
562 void clearCachedHeatBalanceAlgorithm(const Handle& handle);
563 void clearCachedZoneAirContaminantBalance(const Handle& handle);
564 void clearCachedZoneAirHeatBalanceAlgorithm(const Handle& handle);
565 void clearCachedZoneAirMassFlowConservation(const Handle& handle);
566 void clearCachedZoneCapacitanceMultiplierResearchSpecial(const Handle& handle);
567 void clearCachedConvergenceLimits(const Handle& handle);
568 void clearCachedShadowCalculation(const Handle& handle);
569 void clearCachedTimestep(const Handle& handle);
570 void clearCachedClimateZones(const Handle& handle);
571 void clearCachedEnvironmentalImpactFactors(const Handle& handle);
572 void clearCachedExternalInterface(const Handle& handle);
573 void clearCachedPythonPluginSearchPaths(const Handle& handle);
574
575 using CopyConstructorFunction = std::function<std::shared_ptr<openstudio::detail::WorkspaceObject_Impl>(
576 Model_Impl*, const std::shared_ptr<openstudio::detail::WorkspaceObject_Impl>&, bool)>;
577 using CopyConstructorMap = std::map<IddObjectType, CopyConstructorFunction>;
578
579 using NewConstructorFunction = std::function<std::shared_ptr<openstudio::detail::WorkspaceObject_Impl>(Model_Impl*, const IdfObject&, bool)>;
580 using NewConstructorMap = std::map<IddObjectType, NewConstructorFunction>;
581
582 // TODO: do we really need a macro and a **static** ModelObjectCreator
583 // The purpose of ModelObjectCreator is to support static initialization of two large maps.
584 // One is a map from IddObjectType to a function that creates a new ModelObject instance,
585 // The other is a map from IddObjectType to a function that creates a copy of an existing
586 //
587 // See Model_Impl::createObject implementation to see applicaiton of this class.
588 struct ModelObjectCreator
589 {
590 explicit ModelObjectCreator();
591
592 std::shared_ptr<openstudio::detail::WorkspaceObject_Impl> getNew(Model_Impl* model, const IdfObject& obj, bool keepHandle) const;
593 std::shared_ptr<openstudio::detail::WorkspaceObject_Impl>
594 getCopy(Model_Impl* model, const std::shared_ptr<openstudio::detail::WorkspaceObject_Impl>& obj, bool keepHandle) const;
595
596 CopyConstructorMap m_copyMap;
597 NewConstructorMap m_newMap;
598 };
599
600 static const ModelObjectCreator modelObjectCreator;
601 };
602
603 } // namespace detail
604
605 } // namespace model
606 } // namespace openstudio
607
608 #endif // MODEL_MODEL_IMPL_HPP
609