-
Notifications
You must be signed in to change notification settings - Fork 208
/
Copy pathForwardTranslator.cpp
4749 lines (4393 loc) · 224 KB
/
ForwardTranslator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***********************************************************************************************************************
* OpenStudio(R), Copyright (c) 2008-2022, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
*
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
* derived from this software without specific prior written permission from the respective party.
*
* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
* written permission from Alliance for Sustainable Energy, LLC.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/
#include "EnergyPlusAPI.hpp"
#include <src/energyplus/embedded_files.hxx>
#include "ForwardTranslator.hpp"
#include "../model/Model.hpp"
#include "../model/Model_Impl.hpp"
#include "../model/Surface.hpp"
#include "../model/Surface_Impl.hpp"
#include "../model/Construction.hpp"
#include "../model/Construction_Impl.hpp"
#include "../model/ConstructionWithInternalSource.hpp"
#include "../model/ConstructionWithInternalSource_Impl.hpp"
#include "../model/WaterUseEquipment.hpp"
#include "../model/WaterUseEquipment_Impl.hpp"
#include "../model/RunPeriod.hpp"
#include "../model/RunPeriod_Impl.hpp"
#include "../model/RunPeriodControlSpecialDays.hpp"
#include "../model/RunPeriodControlSpecialDays_Impl.hpp"
#include "../model/SimulationControl.hpp"
#include "../model/SimulationControl_Impl.hpp"
#include "../model/Building.hpp"
#include "../model/Building_Impl.hpp"
#include "../model/UtilityBill.hpp"
#include "../model/UtilityBill_Impl.hpp"
#include "../model/ElectricLoadCenterDistribution.hpp"
#include "../model/ElectricLoadCenterDistribution_Impl.hpp"
#include "../model/ShadingControl.hpp"
#include "../model/ShadingControl_Impl.hpp"
#include "../model/AdditionalProperties.hpp"
#include "../model/ConcreteModelObjects.hpp"
#include "../model/SpaceLoad.hpp"
#include "../model/SpaceLoad_Impl.hpp"
#include "../model/SpaceType.hpp"
#include "../model/SpaceInfiltrationDesignFlowRate.hpp"
#include "../model/SpaceInfiltrationDesignFlowRate_Impl.hpp"
#include "../model/SpaceInfiltrationEffectiveLeakageArea.hpp"
#include "../model/SpaceInfiltrationEffectiveLeakageArea_Impl.hpp"
#include "../model/SpaceInfiltrationFlowCoefficient.hpp"
#include "../model/SpaceInfiltrationFlowCoefficient_Impl.hpp"
#include "../model/ElectricEquipmentITEAirCooled.hpp"
#include "../model/ElectricEquipmentITEAirCooled_Impl.hpp"
#include "../model/OutputControlTableStyle.hpp"
#include "../model/OutputControlTableStyle_Impl.hpp"
#include "../model/OutputSQLite.hpp"
#include "../model/OutputSQLite_Impl.hpp"
#include "../utilities/idf/Workspace.hpp"
#include "../utilities/idf/IdfExtensibleGroup.hpp"
#include "../utilities/idf/IdfFile.hpp"
#include "../utilities/idf/WorkspaceObjectOrder.hpp"
#include "../utilities/core/Logger.hpp"
#include "../utilities/core/Assert.hpp"
#include "../utilities/core/FilesystemHelpers.hpp"
#include "../utilities/geometry/BoundingBox.hpp"
#include "../utilities/time/Time.hpp"
#include "../utilities/plot/ProgressBar.hpp"
#include <utilities/idd/IddEnums.hxx>
#include <utilities/idd/IddFactory.hxx>
#include <utilities/idd/FluidProperties_Name_FieldEnums.hxx>
#include <utilities/idd/FluidProperties_GlycolConcentration_FieldEnums.hxx>
#include <utilities/idd/GlobalGeometryRules_FieldEnums.hxx>
#include <utilities/idd/Output_Table_SummaryReports_FieldEnums.hxx>
#include <utilities/idd/OutputControl_Table_Style_FieldEnums.hxx>
#include <utilities/idd/Output_VariableDictionary_FieldEnums.hxx>
#include <utilities/idd/Output_SQLite_FieldEnums.hxx>
#include <utilities/idd/LifeCycleCost_NonrecurringCost_FieldEnums.hxx>
#include <utilities/idd/SetpointManager_MixedAir_FieldEnums.hxx>
#include "../utilities/idd/IddEnums.hpp"
#include "../utilities/core/Deprecated.hpp"
#include <algorithm>
#include <sstream>
#include <thread>
using namespace openstudio::model;
using namespace std;
namespace openstudio {
namespace energyplus {
ForwardTranslator::ForwardTranslator() {
m_logSink.setLogLevel(Warn);
m_logSink.setChannelRegex(boost::regex("openstudio\\.energyplus\\.ForwardTranslator"));
m_logSink.setThreadId(std::this_thread::get_id());
createFluidPropertiesMap();
m_keepRunControlSpecialDays = true; // At 3.1.0 this was changed to true.
m_ipTabularOutput = false;
m_excludeLCCObjects = false;
m_excludeSQliteOutputReport = false;
m_excludeHTMLOutputReport = false;
m_excludeVariableDictionary = false;
m_excludeSpaceTranslation = false; // At 3.4.1, this was changed to false.
}
Workspace ForwardTranslator::translateModel(const Model& model, ProgressBar* progressBar) {
// When m_excludeSpaceTranslation is false, could we skip the (expensive) clone since we aren't combining spaces?
// No, we are still doing stuff like removing orphan loads, spaces not part of a thermal zone, etc
Model modelCopy = model.clone(true).cast<Model>();
m_progressBar = progressBar;
if (m_progressBar) {
m_progressBar->setMinimum(0);
m_progressBar->setMaximum(model.numObjects());
}
return translateModelPrivate(modelCopy, true);
}
Workspace ForwardTranslator::translateModelObject(ModelObject& modelObject) {
Model modelCopy;
modelObject.clone(modelCopy);
m_progressBar = nullptr;
return translateModelPrivate(modelCopy, false);
}
std::vector<LogMessage> ForwardTranslator::warnings() const {
std::vector<LogMessage> result;
for (LogMessage logMessage : m_logSink.logMessages()) {
if (logMessage.logLevel() == Warn) {
result.push_back(logMessage);
}
}
return result;
}
std::vector<LogMessage> ForwardTranslator::errors() const {
std::vector<LogMessage> result;
for (LogMessage logMessage : m_logSink.logMessages()) {
if (logMessage.logLevel() > Warn) {
result.push_back(logMessage);
}
}
return result;
}
void ForwardTranslator::setKeepRunControlSpecialDays(bool keepRunControlSpecialDays) {
m_keepRunControlSpecialDays = keepRunControlSpecialDays;
}
void ForwardTranslator::setIPTabularOutput(bool isIP) {
m_ipTabularOutput = isIP;
}
void ForwardTranslator::setExcludeLCCObjects(bool excludeLCCObjects) {
m_excludeLCCObjects = excludeLCCObjects;
}
void ForwardTranslator::setExcludeSQliteOutputReport(bool excludeSQliteOutputReport) {
m_excludeSQliteOutputReport = excludeSQliteOutputReport;
}
void ForwardTranslator::setExcludeHTMLOutputReport(bool excludeHTMLOutputReport) {
m_excludeHTMLOutputReport = excludeHTMLOutputReport;
}
void ForwardTranslator::setExcludeVariableDictionary(bool excludeVariableDictionary) {
m_excludeVariableDictionary = excludeVariableDictionary;
}
void ForwardTranslator::setExcludeSpaceTranslation(bool excludeSpaceTranslation) {
m_excludeSpaceTranslation = excludeSpaceTranslation;
}
std::vector<ForwardTranslatorOptionKeyMethod> ForwardTranslator::forwardTranslatorOptionKeyMethods() {
return std::vector<ForwardTranslatorOptionKeyMethod>{{{"runcontrolspecialdays", "setKeepRunControlSpecialDays"},
{"ip_tabular_output", "setIPTabularOutput"},
{"no_lifecyclecosts", "setExcludeLCCObjects"},
{"no_sqlite_output", "setExcludeSQliteOutputReport"},
{"no_html_output", "setExcludeHTMLOutputReport"},
{"no_variable_dictionary", "setExcludeVariableDictionary"},
{"no_space_translation", "setExcludeSpaceTranslation"}}};
}
std::ostream& operator<<(std::ostream& out, const openstudio::energyplus::ForwardTranslatorOptionKeyMethod& opt) {
out << "(" << opt.json_name << ", " << opt.ft_method_name << ")";
return out;
}
// Figure out which object
// * If the load is assigned to a space,
// * m_excludeSpaceTranslation = true: translate and return the IdfObject for the Zone
// * m_excludeSpaceTranslation = false: translate and return the IdfObject for Space
// * If the load is assigned to a spaceType:
// * translateAndMapModelObjec(spaceType) (which will return a ZoneList if m_excludeSpaceTranslation is true, SpaceList otherwise)
IdfObject ForwardTranslator::getSpaceLoadParent(const model::SpaceLoad& sp, bool allowSpaceType) {
OptionalIdfObject relatedIdfObject;
if (boost::optional<Space> space_ = sp.space()) {
if (m_excludeSpaceTranslation) {
if (auto thermalZone_ = space_->thermalZone()) {
relatedIdfObject = translateAndMapModelObject(thermalZone_.get());
} else {
OS_ASSERT(false); // This shouldn't happen, since we removed all orphaned spaces earlier in the FT
}
} else {
relatedIdfObject = translateAndMapModelObject(space_.get());
}
} else if (boost::optional<SpaceType> spaceType_ = sp.spaceType()) {
if (allowSpaceType) {
relatedIdfObject = translateAndMapModelObject(spaceType_.get());
} else {
OS_ASSERT(false);
}
}
OS_ASSERT(relatedIdfObject);
return relatedIdfObject.get();
};
Workspace ForwardTranslator::translateModelPrivate(model::Model& model, bool fullModelTranslation) {
reset();
// translate Version first
model::Version version = model.getUniqueModelObject<model::Version>();
translateAndMapModelObject(version);
// translate Timestep second (this initializes it if need be)
model::Timestep timestep = model.getUniqueModelObject<model::Timestep>();
translateAndMapModelObject(timestep);
// resolve surface marching conflicts before combining thermal zones or removing spaces
// as those operations may change search distances
resolveMatchedSurfaceConstructionConflicts(model);
resolveMatchedSubSurfaceConstructionConflicts(model);
// remove subsurfaces from air walls
for (Surface surface : model.getConcreteModelObjects<Surface>()) {
if (surface.isAirWall()) {
for (auto& subSurface : surface.subSurfaces()) {
LOG(Warn, "Removing SubSurface '" << subSurface.nameString() << "' from air wall Surface '" << surface.nameString() << "'.");
subSurface.remove();
}
}
}
// check for spaces not in a thermal zone
for (Space space : model.getConcreteModelObjects<Space>()) {
if (!space.thermalZone()) {
LOG(Warn, "Space " << space.name().get() << " is not associated with a ThermalZone, it will not be translated.");
space.remove();
}
}
// remove orphan surfaces
for (PlanarSurface planarSurface : model.getModelObjects<PlanarSurface>()) {
if (!planarSurface.planarSurfaceGroup()) {
// a sub surface may have already been removed if the parent surface was removed
if (!planarSurface.handle().isNull()) {
LOG(Warn, planarSurface.briefDescription() << " is not associated with a PlanarSurfaceGroup, it will not be translated.");
planarSurface.remove();
}
}
}
// remove orphan loads
for (SpaceLoad spaceLoad : model.getModelObjects<SpaceLoad>()) {
if (spaceLoad.optionalCast<model::WaterUseEquipment>()) {
// WaterUseEquipment is not required to be attached to a space
continue;
}
if ((!spaceLoad.space()) && (!spaceLoad.spaceType())) {
LOG(Warn, spaceLoad.briefDescription() << " is not associated with a Space or SpaceType, it will not be translated.");
spaceLoad.remove();
}
}
if (m_excludeSpaceTranslation) {
// next thing to do is combine all spaces in each thermal zone
// after this each zone will have 0 or 1 spaces and each space will have 0 or 1 zone
for (ThermalZone thermalZone : model.getConcreteModelObjects<ThermalZone>()) {
thermalZone.combineSpaces();
}
} else {
// The SpaceInfiltration:EffectiveLeakageAreas and FlowCoefficients (unlike the SpaceInfiltration:DesignFlowRate),
// and the ElectricEquipment:ITE:AirCooled only accept a Zone or a Space, not a ZoneList nor a SpaceList
// So we need to put them on the spaces to avoid problems. But we do not need to hardSize() them (they end up going on a Space).
// then remove the spacetype ones to be safe (make 100% sure they won't get translated)
for (auto& sp : model.getConcreteModelObjects<SpaceType>()) {
// auto spi = sp.spaceInfiltrationDesignFlowRates();
auto spiel = sp.spaceInfiltrationEffectiveLeakageAreas();
auto spifc = sp.spaceInfiltrationFlowCoefficients();
auto ites = sp.electricEquipmentITEAirCooled();
std::vector<SpaceLoad> loads;
loads.reserve(spiel.size() + spifc.size() + ites.size());
loads.insert(loads.end(), spiel.begin(), spiel.end());
loads.insert(loads.end(), spifc.begin(), spifc.end());
loads.insert(loads.end(), ites.begin(), ites.end());
for (auto& infil : loads) {
if (infil.spaceType()) {
for (auto& space : sp.spaces()) {
auto infilClone = infil.clone(model).cast<SpaceLoad>();
infilClone.setParent(space);
}
infil.remove();
}
}
}
}
// remove unused space types
std::vector<SpaceType> spaceTypes = model.getConcreteModelObjects<SpaceType>();
for (SpaceType spaceType : spaceTypes) {
std::vector<Space> spaces = spaceType.spaces();
if (spaces.empty()) {
LOG(Info, "SpaceType " << spaceType.name().get() << " is not referenced by any space, it will not be translated.");
spaceType.remove();
} else if (spaces.size() == 1) {
//LOG(Info, "SpaceType " << spaceType.name().get() << " is referenced by one space, loads will be transfered to the space and the space type removed.");
// hard apply space type adds a dummy space type to prevent inheriting building space type
//spaces[0].hardApplySpaceType(false);
//spaceType.remove();
}
}
//Fix for Bug 717 - Take any OtherEquipment objects that still point to a spacetype and make
//a new instance of them for every space that that spacetype points to then delete the one
//that pointed to a spacetype
//
// TODO JM 2021-10-14: combineSpaces already does that. The only reason this code block is here is because:
// 1. ThermalZone::combineSpaces doesn't touch the initial Space Types, it's just that they are unused
// 2. This object is part of iddObjectToTranslate() which is a mistake to begin with: spaces/spaceTypes should be responsible for translating
// their loads!
// 3. Removing the unused space types right above should have taken care of the problem
std::vector<OtherEquipment> otherEquipments = model.getConcreteModelObjects<OtherEquipment>();
for (OtherEquipment otherEquipment : otherEquipments) {
boost::optional<SpaceType> spaceTypeOfOtherEquipment = otherEquipment.spaceType();
if (spaceTypeOfOtherEquipment) {
//loop through the spaces in this space type and make a new instance for each one
std::vector<Space> spaces = spaceTypeOfOtherEquipment.get().spaces();
for (Space space : spaces) {
OtherEquipment otherEquipmentForSpace = otherEquipment.clone().cast<OtherEquipment>();
otherEquipmentForSpace.setSpace(space);
//make a nice name for the thing
//std::string otherEquipmentForSpaceName = otherEquipment.name()
//otherEquipment.setName("newName")
}
//now, delete the one that points to a spacetype
otherEquipment.remove();
}
}
// Energyplus only allows single zone input for ITE object. If space type is assigned in OS,
// will translate to multiple ITE objects assigned to each zone under the same space type.
// then delete the one that pointed to a spacetype.
// By doing this, we can solve the potential problem that if this load is applied to a space type,
// the load gets copied to each space of the space type, which may cause conflict of supply air node.
//
// TODO JM 2021-10-14: combineSpaces already does that. The only reason this code block is here is because:
// 1. ThermalZone::combineSpaces doesn't touch the initial Space Types, it's just that they are unused
// 2. This object is part of iddObjectToTranslate() which is a mistake to begin with: spaces/spaceTypes should be responsible for translating
// their loads!
// 3. Removing the unused space types right above should have taken care of the problem
std::vector<ElectricEquipmentITEAirCooled> iTEAirCooledEquipments = model.getConcreteModelObjects<ElectricEquipmentITEAirCooled>();
for (ElectricEquipmentITEAirCooled iTequipment : iTEAirCooledEquipments) {
boost::optional<SpaceType> spaceTypeOfITEquipment = iTequipment.spaceType();
if (spaceTypeOfITEquipment) {
//loop through the spaces in this space type and make a new instance for each one
std::vector<Space> spaces = spaceTypeOfITEquipment.get().spaces();
for (Space space : spaces) {
ElectricEquipmentITEAirCooled iTEquipmentForSpace = iTequipment.clone().cast<ElectricEquipmentITEAirCooled>();
iTEquipmentForSpace.setSpace(space);
}
//now, delete the one that points to a spacetype
iTequipment.remove();
}
}
// Temporary workaround for EnergyPlusTeam #4451
// requested by http://code.google.com/p/cbecc/issues/detail?id=736
// do this after combining spaces to avoid suprises about relative coordinate changes
for (const auto& thermalZone : model.getConcreteModelObjects<ThermalZone>()) {
boost::optional<DaylightingControl> dc = thermalZone.secondaryDaylightingControl();
if (dc) {
double z = dc->positionZCoordinate();
if (z < 0) {
// find lowest point in thermalZone and move space origin down to that point
// lowest point will have z = 0 in relative coordinates
std::vector<Space> spaces = thermalZone.spaces();
OS_ASSERT(spaces.size() == 1);
double minZ = z;
BoundingBox bb = spaces[0].boundingBox();
if (bb.minZ()) {
minZ = std::min(minZ, bb.minZ().get());
}
OS_ASSERT(minZ < 0);
Transformation currentT = spaces[0].transformation();
Transformation newT = Transformation::translation(Vector3d(0, 0, minZ)) * currentT;
bool test = spaces[0].changeTransformation(newT);
OS_ASSERT(test);
}
}
}
// TODO: Is this still needed?
// ensure shading controls only reference windows in a single zone and determine control sequence number
// DLM: ideally E+ would not need to know the zone, shading controls could work across zones
std::vector<ShadingControl> shadingControls = model.getConcreteModelObjects<ShadingControl>();
std::sort(shadingControls.begin(), shadingControls.end(), WorkspaceObjectNameLess());
std::map<Handle, ShadingControlVector> zoneHandleToShadingControlVectorMap;
for (auto& shadingControl : shadingControls) {
std::set<Handle> thisZoneHandleSet;
for (auto& subSurface : shadingControl.subSurfaces()) {
boost::optional<Space> space = subSurface.space();
if (space) {
boost::optional<ThermalZone> thermalZone = space->thermalZone();
if (thermalZone) {
Handle zoneHandle = thermalZone->handle();
if (thisZoneHandleSet.empty()) {
// first thermal zone, no clone
thisZoneHandleSet.insert(zoneHandle);
auto it = zoneHandleToShadingControlVectorMap.find(zoneHandle);
if (it == zoneHandleToShadingControlVectorMap.end()) {
zoneHandleToShadingControlVectorMap.insert(std::make_pair(zoneHandle, std::vector<ShadingControl>()));
}
it = zoneHandleToShadingControlVectorMap.find(zoneHandle);
OS_ASSERT(it != zoneHandleToShadingControlVectorMap.end());
it->second.push_back(shadingControl);
shadingControl.additionalProperties().setFeature("Shading Control Sequence Number", (int)it->second.size());
} else if (thisZoneHandleSet.find(zoneHandle) != thisZoneHandleSet.end()) {
// already in here, good to go
} else {
// additional thermal zone, must clone
thisZoneHandleSet.insert(zoneHandle);
ShadingControl clone = shadingControl.clone(model).cast<ShadingControl>();
// assign clone to control subSurface
clone.addSubSurface(subSurface);
auto it = zoneHandleToShadingControlVectorMap.find(zoneHandle);
if (it == zoneHandleToShadingControlVectorMap.end()) {
zoneHandleToShadingControlVectorMap.insert(std::make_pair(zoneHandle, std::vector<ShadingControl>()));
}
it = zoneHandleToShadingControlVectorMap.find(zoneHandle);
OS_ASSERT(it != zoneHandleToShadingControlVectorMap.end());
it->second.push_back(clone);
clone.additionalProperties().setFeature("Shading Control Sequence Number", (int)it->second.size());
}
} else {
LOG(Warn, "Cannot find ThermalZone for " << subSurface.briefDescription() << " referencing " << shadingControl.briefDescription());
}
} else {
LOG(Warn, "Cannot find Space for " << subSurface.briefDescription() << " referencing " << shadingControl.briefDescription());
}
}
}
if (!m_keepRunControlSpecialDays) {
LOG(Warn, "You have manually choosen to not translate the RunPeriodControlSpecialDays, ignoring them.");
for (model::RunPeriodControlSpecialDays holiday : model.getConcreteModelObjects<model::RunPeriodControlSpecialDays>()) {
holiday.remove();
}
}
if (fullModelTranslation) {
// translate life cycle cost parameters
if (!m_excludeLCCObjects) {
boost::optional<LifeCycleCostParameters> lifeCycleCostParameters = model.lifeCycleCostParameters();
if (!lifeCycleCostParameters) {
// only warn if costs are present
if (!model.getConcreteModelObjects<LifeCycleCost>().empty()) {
LOG(Warn, "No LifeCycleCostParameters but LifeCycleCosts are present, adding default LifeCycleCostParameters.");
}
// always add this object so E+ results section exists
lifeCycleCostParameters = model.getUniqueModelObject<LifeCycleCostParameters>();
}
translateAndMapModelObject(*lifeCycleCostParameters);
}
// ensure that building exists
boost::optional<model::Building> building = model.building();
if (!building) {
building = model.getUniqueModelObject<model::Building>();
}
translateAndMapModelObject(*building);
// ensure that simulation control exists
boost::optional<model::SimulationControl> simulationControl = model.getOptionalUniqueModelObject<model::SimulationControl>();
if (!simulationControl) {
simulationControl = model.getUniqueModelObject<model::SimulationControl>();
}
translateAndMapModelObject(*simulationControl);
// ensure that sizing parameters control exists
boost::optional<model::SizingParameters> sizingParameters = model.getOptionalUniqueModelObject<model::SizingParameters>();
if (!sizingParameters) {
sizingParameters = model.getUniqueModelObject<model::SizingParameters>();
}
translateAndMapModelObject(*sizingParameters);
// ensure that run period exists
// DLM: should this only be done if there is a WeatherFile object?
boost::optional<model::RunPeriod> runPeriod = model.runPeriod();
if (!runPeriod) {
runPeriod = model.getUniqueModelObject<model::RunPeriod>();
}
translateAndMapModelObject(*runPeriod);
// ensure that output table summary reports exists
// If the user manually added an OutputTableSummaryReports, but he also opted-in to exclude it on the FT, which decision do we keep?
// Given that it's a much harder to set the option on the FT, I'll respect that one
if (!m_excludeHTMLOutputReport) {
auto optOutputTableSummaryReports = model.getOptionalUniqueModelObject<model::OutputTableSummaryReports>();
// Add default one if none explicitly specified
if (!optOutputTableSummaryReports) {
auto outputTableSummaryReports = model.getUniqueModelObject<model::OutputTableSummaryReports>();
outputTableSummaryReports.addSummaryReport("AllSummary");
translateAndMapModelObject(outputTableSummaryReports);
}
}
// add a global geometry rules object
auto& globalGeometryRules = m_idfObjects.emplace_back(openstudio::IddObjectType::GlobalGeometryRules);
globalGeometryRules.setString(openstudio::GlobalGeometryRulesFields::StartingVertexPosition, "UpperLeftCorner");
globalGeometryRules.setString(openstudio::GlobalGeometryRulesFields::VertexEntryDirection, "Counterclockwise");
globalGeometryRules.setString(openstudio::GlobalGeometryRulesFields::CoordinateSystem, "Relative");
globalGeometryRules.setString(openstudio::GlobalGeometryRulesFields::DaylightingReferencePointCoordinateSystem, "Relative");
globalGeometryRules.setString(openstudio::GlobalGeometryRulesFields::RectangularSurfaceCoordinateSystem, "Relative");
// create meters for utility bill objects
std::vector<UtilityBill> utilityBills = model.getConcreteModelObjects<UtilityBill>();
for (UtilityBill utilityBill : utilityBills) {
// these meters and variables will be translated later
OutputMeter consumptionMeter = utilityBill.consumptionMeter();
boost::optional<OutputMeter> peakDemandMeter = utilityBill.peakDemandMeter();
}
}
translateConstructions(model);
translateSchedules(model);
// Translate the Outdoor Air Node
{
auto node = model.outdoorAirNode();
// Create a new IddObjectType::OutdoorAir_Node
IdfObject idfObject(IddObjectType::OutdoorAir_Node);
m_idfObjects.push_back(idfObject);
idfObject.setName(node.name().get());
}
// get AirLoopHVACDedicatedOutdoorAirSystem in sorted order
std::vector<AirLoopHVACDedicatedOutdoorAirSystem> doass = model.getConcreteModelObjects<AirLoopHVACDedicatedOutdoorAirSystem>();
std::sort(doass.begin(), doass.end(), WorkspaceObjectNameLess());
for (AirLoopHVACDedicatedOutdoorAirSystem doas : doass) {
translateAndMapModelObject(doas);
}
// get air loops in sorted order
std::vector<AirLoopHVAC> airLoops = model.getConcreteModelObjects<AirLoopHVAC>();
std::sort(airLoops.begin(), airLoops.end(), WorkspaceObjectNameLess());
for (AirLoopHVAC airLoop : airLoops) {
translateAndMapModelObject(airLoop);
}
// get AirConditionerVariableRefrigerantFlow objects in sorted order
std::vector<AirConditionerVariableRefrigerantFlow> vrfs = model.getConcreteModelObjects<AirConditionerVariableRefrigerantFlow>();
std::sort(vrfs.begin(), vrfs.end(), WorkspaceObjectNameLess());
for (AirConditionerVariableRefrigerantFlow vrf : vrfs) {
translateAndMapModelObject(vrf);
}
// get plant loops in sorted order
std::vector<PlantLoop> plantLoops = model.getConcreteModelObjects<PlantLoop>();
std::sort(plantLoops.begin(), plantLoops.end(), WorkspaceObjectNameLess());
for (PlantLoop plantLoop : plantLoops) {
translateAndMapModelObject(plantLoop);
}
// translate AFN
translateAirflowNetwork(model);
// now loop over all objects
for (const IddObjectType& iddObjectType : iddObjectsToTranslate()) {
// get objects by type in sorted order
std::vector<WorkspaceObject> objects = model.getObjectsByType(iddObjectType);
std::sort(objects.begin(), objects.end(), WorkspaceObjectNameLess());
for (const WorkspaceObject& workspaceObject : objects) {
model::ModelObject modelObject = workspaceObject.cast<ModelObject>();
translateAndMapModelObject(modelObject);
}
}
if (fullModelTranslation) {
// add output requests
this->createStandardOutputRequests(model);
}
Workspace workspace(StrictnessLevel::Minimal, IddFileType::EnergyPlus);
OptionalWorkspaceObject vo = workspace.versionObject();
OS_ASSERT(vo);
workspace.removeObject(vo->handle());
workspace.setFastNaming(true);
workspace.addObjects(m_idfObjects);
workspace.setFastNaming(false);
OS_ASSERT(workspace.getObjectsByType(IddObjectType::Version).size() == 1u);
return workspace;
}
// struct for sorting children in forward translator
struct ChildSorter
{
ChildSorter(std::vector<IddObjectType>& iddObjectTypes) : m_iddObjectTypes(iddObjectTypes) {}
// sort first by position in iddObjectTypes and then by name
bool operator()(const model::ModelObject& a, const model::ModelObject& b) const {
auto ita = std::find(m_iddObjectTypes.begin(), m_iddObjectTypes.end(), a.iddObject().type());
auto itb = std::find(m_iddObjectTypes.begin(), m_iddObjectTypes.end(), b.iddObject().type());
if (ita < itb) {
return true;
} else if (ita > itb) {
return false;
}
std::string aname;
boost::optional<std::string> oaname = a.name();
if (oaname) {
aname = *oaname;
}
std::string bname;
boost::optional<std::string> obname = b.name();
if (obname) {
bname = *obname;
}
return istringLess(aname, bname);
}
std::vector<IddObjectType> m_iddObjectTypes;
};
boost::optional<IdfObject> ForwardTranslator::translateAndMapModelObject(ModelObject& modelObject) {
boost::optional<IdfObject> retVal;
// if already translated then exit
ModelObjectMap::const_iterator objInMap = m_map.find(modelObject.handle());
if (objInMap != m_map.end()) {
return boost::optional<IdfObject>(objInMap->second);
}
LOG(Trace, "Translating " << modelObject.briefDescription() << ".");
switch (modelObject.iddObject().type().value()) {
case openstudio::IddObjectType::OS_AdditionalProperties: {
// no op
break;
}
case openstudio::IddObjectType::OS_AirConditioner_VariableRefrigerantFlow: {
model::AirConditionerVariableRefrigerantFlow vrf = modelObject.cast<AirConditionerVariableRefrigerantFlow>();
retVal = translateAirConditionerVariableRefrigerantFlow(vrf);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC: {
model::AirLoopHVAC airLoopHVAC = modelObject.cast<AirLoopHVAC>();
retVal = translateAirLoopHVAC(airLoopHVAC);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_ReturnPlenum: {
model::AirLoopHVACReturnPlenum airLoopHVACReturnPlenum = modelObject.cast<AirLoopHVACReturnPlenum>();
retVal = translateAirLoopHVACReturnPlenum(airLoopHVACReturnPlenum);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_SupplyPlenum: {
model::AirLoopHVACSupplyPlenum airLoopHVACSupplyPlenum = modelObject.cast<AirLoopHVACSupplyPlenum>();
retVal = translateAirLoopHVACSupplyPlenum(airLoopHVACSupplyPlenum);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_DualDuct_ConstantVolume: {
auto mo = modelObject.cast<AirTerminalDualDuctConstantVolume>();
retVal = translateAirTerminalDualDuctConstantVolume(mo);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_DualDuct_VAV: {
auto mo = modelObject.cast<AirTerminalDualDuctVAV>();
retVal = translateAirTerminalDualDuctVAV(mo);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_DualDuct_VAV_OutdoorAir: {
auto mo = modelObject.cast<AirTerminalDualDuctVAVOutdoorAir>();
retVal = translateAirTerminalDualDuctVAVOutdoorAir(mo);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_FourPipeInduction: {
model::AirTerminalSingleDuctConstantVolumeFourPipeInduction airTerminal =
modelObject.cast<AirTerminalSingleDuctConstantVolumeFourPipeInduction>();
retVal = translateAirTerminalSingleDuctConstantVolumeFourPipeInduction(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_Reheat: {
model::AirTerminalSingleDuctConstantVolumeReheat airTerminal = modelObject.cast<AirTerminalSingleDuctConstantVolumeReheat>();
retVal = translateAirTerminalSingleDuctConstantVolumeReheat(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_CooledBeam: {
model::AirTerminalSingleDuctConstantVolumeCooledBeam airTerminal = modelObject.cast<AirTerminalSingleDuctConstantVolumeCooledBeam>();
retVal = translateAirTerminalSingleDuctConstantVolumeCooledBeam(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_FourPipeBeam: {
model::AirTerminalSingleDuctConstantVolumeFourPipeBeam airTerminal = modelObject.cast<AirTerminalSingleDuctConstantVolumeFourPipeBeam>();
retVal = translateAirTerminalSingleDuctConstantVolumeFourPipeBeam(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_ParallelPIU_Reheat: {
model::AirTerminalSingleDuctParallelPIUReheat airTerminal = modelObject.cast<AirTerminalSingleDuctParallelPIUReheat>();
retVal = translateAirTerminalSingleDuctParallelPIUReheat(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_SeriesPIU_Reheat: {
model::AirTerminalSingleDuctSeriesPIUReheat airTerminal = modelObject.cast<AirTerminalSingleDuctSeriesPIUReheat>();
retVal = translateAirTerminalSingleDuctSeriesPIUReheat(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_NoReheat: {
model::AirTerminalSingleDuctConstantVolumeNoReheat airTerminal = modelObject.cast<AirTerminalSingleDuctConstantVolumeNoReheat>();
retVal = translateAirTerminalSingleDuctConstantVolumeNoReheat(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_VAV_NoReheat: {
model::AirTerminalSingleDuctVAVNoReheat airTerminal = modelObject.cast<AirTerminalSingleDuctVAVNoReheat>();
retVal = translateAirTerminalSingleDuctVAVNoReheat(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_VAV_Reheat: {
model::AirTerminalSingleDuctVAVReheat airTerminal = modelObject.cast<AirTerminalSingleDuctVAVReheat>();
retVal = translateAirTerminalSingleDuctVAVReheat(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_InletSideMixer: {
model::AirTerminalSingleDuctInletSideMixer airTerminal = modelObject.cast<AirTerminalSingleDuctInletSideMixer>();
retVal = translateAirTerminalSingleDuctInletSideMixer(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheat: {
model::AirTerminalSingleDuctVAVHeatAndCoolNoReheat airTerminal = modelObject.cast<AirTerminalSingleDuctVAVHeatAndCoolNoReheat>();
retVal = translateAirTerminalSingleDuctVAVHeatAndCoolNoReheat(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirTerminal_SingleDuct_VAV_HeatAndCool_Reheat: {
model::AirTerminalSingleDuctVAVHeatAndCoolReheat airTerminal = modelObject.cast<AirTerminalSingleDuctVAVHeatAndCoolReheat>();
retVal = translateAirTerminalSingleDuctVAVHeatAndCoolReheat(airTerminal);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_ZoneSplitter: {
model::AirLoopHVACZoneSplitter splitter = modelObject.cast<AirLoopHVACZoneSplitter>();
retVal = translateAirLoopHVACZoneSplitter(splitter);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_ZoneMixer: {
model::AirLoopHVACZoneMixer mixer = modelObject.cast<AirLoopHVACZoneMixer>();
retVal = translateAirLoopHVACZoneMixer(mixer);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_OutdoorAirSystem: {
model::AirLoopHVACOutdoorAirSystem oaSystem = modelObject.cast<AirLoopHVACOutdoorAirSystem>();
retVal = translateAirLoopHVACOutdoorAirSystem(oaSystem);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_DedicatedOutdoorAirSystem: {
model::AirLoopHVACDedicatedOutdoorAirSystem doaSystem = modelObject.cast<AirLoopHVACDedicatedOutdoorAirSystem>();
retVal = translateAirLoopHVACDedicatedOutdoorAirSystem(doaSystem);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_UnitaryHeatPump_AirToAir: {
model::AirLoopHVACUnitaryHeatPumpAirToAir unitary = modelObject.cast<AirLoopHVACUnitaryHeatPumpAirToAir>();
retVal = translateAirLoopHVACUnitaryHeatPumpAirToAir(unitary);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_UnitaryHeatCool_VAVChangeoverBypass: {
model::AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass unitary = modelObject.cast<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass>();
retVal = translateAirLoopHVACUnitaryHeatCoolVAVChangeoverBypass(unitary);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_UnitaryHeatPump_AirToAir_MultiSpeed: {
model::AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed unitary = modelObject.cast<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed>();
retVal = translateAirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed(unitary);
break;
}
case openstudio::IddObjectType::OS_AirLoopHVAC_UnitarySystem: {
model::AirLoopHVACUnitarySystem unitary = modelObject.cast<AirLoopHVACUnitarySystem>();
retVal = translateAirLoopHVACUnitarySystem(unitary);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManagerAssignmentList: {
auto mo = modelObject.cast<AvailabilityManagerAssignmentList>();
retVal = translateAvailabilityManagerAssignmentList(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_Scheduled: {
auto mo = modelObject.cast<AvailabilityManagerScheduled>();
retVal = translateAvailabilityManagerScheduled(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_ScheduledOn: {
auto mo = modelObject.cast<AvailabilityManagerScheduledOn>();
retVal = translateAvailabilityManagerScheduledOn(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_ScheduledOff: {
auto mo = modelObject.cast<AvailabilityManagerScheduledOff>();
retVal = translateAvailabilityManagerScheduledOff(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_HybridVentilation: {
auto mo = modelObject.cast<AvailabilityManagerHybridVentilation>();
retVal = translateAvailabilityManagerHybridVentilation(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_OptimumStart: {
auto mo = modelObject.cast<AvailabilityManagerOptimumStart>();
retVal = translateAvailabilityManagerOptimumStart(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_DifferentialThermostat: {
auto mo = modelObject.cast<AvailabilityManagerDifferentialThermostat>();
retVal = translateAvailabilityManagerDifferentialThermostat(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_NightVentilation: {
auto mo = modelObject.cast<AvailabilityManagerNightVentilation>();
retVal = translateAvailabilityManagerNightVentilation(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_NightCycle: {
auto mo = modelObject.cast<AvailabilityManagerNightCycle>();
retVal = translateAvailabilityManagerNightCycle(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_HighTemperatureTurnOn: {
auto mo = modelObject.cast<AvailabilityManagerHighTemperatureTurnOn>();
retVal = translateAvailabilityManagerHighTemperatureTurnOn(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_HighTemperatureTurnOff: {
auto mo = modelObject.cast<AvailabilityManagerHighTemperatureTurnOff>();
retVal = translateAvailabilityManagerHighTemperatureTurnOff(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_LowTemperatureTurnOn: {
auto mo = modelObject.cast<AvailabilityManagerLowTemperatureTurnOn>();
retVal = translateAvailabilityManagerLowTemperatureTurnOn(mo);
break;
}
case openstudio::IddObjectType::OS_AvailabilityManager_LowTemperatureTurnOff: {
auto mo = modelObject.cast<AvailabilityManagerLowTemperatureTurnOff>();
retVal = translateAvailabilityManagerLowTemperatureTurnOff(mo);
break;
}
case openstudio::IddObjectType::OS_Boiler_HotWater: {
model::BoilerHotWater boiler = modelObject.cast<BoilerHotWater>();
retVal = translateBoilerHotWater(boiler);
break;
}
case openstudio::IddObjectType::OS_Boiler_Steam: {
model::BoilerSteam boiler = modelObject.cast<BoilerSteam>();
retVal = translateBoilerSteam(boiler);
break;
}
case openstudio::IddObjectType::OS_Building: {
model::Building building = modelObject.cast<Building>();
retVal = translateBuilding(building);
break;
}
case openstudio::IddObjectType::OS_BuildingStory: {
// no-op
return retVal;
}
case openstudio::IddObjectType::OS_CentralHeatPumpSystem: {
model::CentralHeatPumpSystem mo = modelObject.cast<CentralHeatPumpSystem>();
retVal = translateCentralHeatPumpSystem(mo);
break;
}
case openstudio::IddObjectType::OS_CentralHeatPumpSystem_Module: {
// no-op
return retVal;
}
case openstudio::IddObjectType::OS_Chiller_Absorption: {
auto mo = modelObject.cast<ChillerAbsorption>();
retVal = translateChillerAbsorption(mo);
break;
}
case openstudio::IddObjectType::OS_Chiller_Absorption_Indirect: {
auto mo = modelObject.cast<ChillerAbsorptionIndirect>();
retVal = translateChillerAbsorptionIndirect(mo);
break;
}
case openstudio::IddObjectType::OS_Chiller_Electric_ASHRAE205: {
auto mo = modelObject.cast<ChillerElectricASHRAE205>();
retVal = translateChillerElectricASHRAE205(mo);
break;
}
case openstudio::IddObjectType::OS_Chiller_Electric_EIR: {
model::ChillerElectricEIR chiller = modelObject.cast<ChillerElectricEIR>();
retVal = translateChillerElectricEIR(chiller);
break;
}
case openstudio::IddObjectType::OS_Chiller_Electric_ReformulatedEIR: {
model::ChillerElectricReformulatedEIR chiller = modelObject.cast<ChillerElectricReformulatedEIR>();
retVal = translateChillerElectricReformulatedEIR(chiller);
break;
}
case openstudio::IddObjectType::OS_ChillerHeaterPerformance_Electric_EIR: {
model::ChillerHeaterPerformanceElectricEIR mo = modelObject.cast<ChillerHeaterPerformanceElectricEIR>();
retVal = translateChillerHeaterPerformanceElectricEIR(mo);
break;
}
case openstudio::IddObjectType::OS_ClimateZones: {
// no-op
return retVal;
}
case openstudio::IddObjectType::OS_Construction_CfactorUndergroundWall: {
model::CFactorUndergroundWallConstruction construction = modelObject.cast<CFactorUndergroundWallConstruction>();
retVal = translateCFactorUndergroundWallConstruction(construction);
break;
}
case openstudio::IddObjectType::OS_ConvergenceLimits: {
model::ConvergenceLimits limits = modelObject.cast<ConvergenceLimits>();
retVal = translateConvergenceLimits(limits);
break;
}
case openstudio::IddObjectType::OS_Coil_Cooling_CooledBeam: {
// This is handled directly in ATU:SingleDuct:ConstantVolume::CooledBeam
break;
}
case openstudio::IddObjectType::OS_Coil_Cooling_FourPipeBeam: {
// This is handled directly in ATU:SingleDuct:ConstantVolume::FourPipeBeam
break;
}
case openstudio::IddObjectType::OS_Coil_Heating_FourPipeBeam: {
// This is handled directly in ATU:SingleDuct:ConstantVolume::FourPipeBeam
break;
}
case openstudio::IddObjectType::OS_Coil_Cooling_DX: {
model::CoilCoolingDX coil = modelObject.cast<CoilCoolingDX>();
if (this->isHVACComponentWithinUnitary(coil)) {
retVal = translateCoilCoolingDXWithoutUnitary(coil);
} else {
retVal = translateCoilCoolingDX(coil);
}
break;
}
case openstudio::IddObjectType::OS_Coil_Cooling_DX_CurveFit_Performance: {
model::CoilCoolingDXCurveFitPerformance performance = modelObject.cast<CoilCoolingDXCurveFitPerformance>();
retVal = translateCoilCoolingDXCurveFitPerformance(performance);
break;
}
case openstudio::IddObjectType::OS_Coil_Cooling_DX_CurveFit_OperatingMode: {