GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 97.6% 122 / 0 / 125
Functions: 100.0% 17 / 0 / 17
Branches: 92.6% 125 / 0 / 135

src/energyplus/ForwardTranslator/ForwardTranslateSpace.cpp
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 #include "../ForwardTranslator.hpp"
7
8 #include "../../model/Model.hpp"
9 #include "../../model/LifeCycleCost.hpp"
10 #include "../../model/Space.hpp"
11 #include "../../model/Space_Impl.hpp"
12 #include "../../model/ThermalZone.hpp"
13 #include "../../model/SpaceType.hpp"
14
15 // Loads
16 #include "../../model/InternalMass.hpp"
17 #include "../../model/People.hpp"
18 #include "../../model/Lights.hpp"
19 #include "../../model/Luminaire.hpp"
20 #include "../../model/ElectricEquipment.hpp"
21 #include "../../model/ElectricEquipmentITEAirCooled.hpp"
22 #include "../../model/GasEquipment.hpp"
23 #include "../../model/HotWaterEquipment.hpp"
24 #include "../../model/SteamEquipment.hpp"
25 #include "../../model/OtherEquipment.hpp"
26 #include "../../model/SpaceInfiltrationDesignFlowRate.hpp"
27 #include "../../model/SpaceInfiltrationEffectiveLeakageArea.hpp"
28 #include "../../model/SpaceInfiltrationFlowCoefficient.hpp"
29 // Geometry children
30 #include "../../model/ShadingSurfaceGroup.hpp"
31 #include "../../model/InteriorPartitionSurfaceGroup.hpp"
32 #include "../../model/Surface.hpp"
33 #include "../../model/DefaultConstructionSet.hpp"
34
35 #include <utilities/idd/OS_Space_FieldEnums.hxx>
36 #include <utilities/idd/Space_FieldEnums.hxx>
37
38 #include "../../utilities/idd/IddEnums.hpp"
39 #include <utilities/idd/IddFactory.hxx>
40
41 using namespace openstudio::model;
42
43 using namespace std;
44
45 namespace openstudio {
46
47 namespace energyplus {
48
49 794 boost::optional<IdfObject> ForwardTranslator::translateSpace(model::Space& modelObject) {
50
51
2/3
✓ Branch 1 taken 794 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 794 times.
794 for (LifeCycleCost& lifeCycleCost : modelObject.lifeCycleCosts()) {
52 ✗ translateAndMapModelObject(lifeCycleCost);
53 794 }
54
55
3/3
✓ Branch 1 taken 794 times.
✓ Branch 3 taken 223 times.
✓ Branch 4 taken 571 times.
794 if (m_forwardTranslatorOptions.excludeSpaceTranslation()) {
56 223 return boost::none;
57 }
58
59 // Space
60
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Space, modelObject);
61
62 // ZoneName
63
2/3
✓ Branch 1 taken 571 times.
✓ Branch 3 taken 571 times.
✗ Branch 4 not taken.
1142 if (boost::optional<ThermalZone> thermalZone = modelObject.thermalZone()) {
64
4/4
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
✓ Branch 7 taken 571 times.
✓ Branch 10 taken 571 times.
571 idfObject.setString(SpaceFields::ZoneName, thermalZone->name().get());
65 571 }
66
67 // for CeilingHeight, Volume, FloorArea: only FT if hard set (same logic as for ThermalZone)
68
69 // CeilingHeight
70
2/3
✓ Branch 1 taken 571 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 571 times.
571 if (!modelObject.isCeilingHeightDefaulted()) {
71 ✗ idfObject.setDouble(SpaceFields::CeilingHeight, modelObject.ceilingHeight());
72 }
73
74 // Volume
75
3/3
✓ Branch 1 taken 571 times.
✓ Branch 3 taken 51 times.
✓ Branch 4 taken 520 times.
571 if (!modelObject.isVolumeDefaulted()) {
76
2/2
✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
51 idfObject.setDouble(SpaceFields::Volume, modelObject.volume());
77 }
78
79 // FloorArea
80
3/3
✓ Branch 1 taken 571 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 565 times.
571 if (!modelObject.isFloorAreaDefaulted()) {
81
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setDouble(SpaceFields::FloorArea, modelObject.floorArea());
82 }
83
84 // SpaceType
85
3/3
✓ Branch 1 taken 571 times.
✓ Branch 3 taken 309 times.
✓ Branch 4 taken 262 times.
1142 if (boost::optional<SpaceType> spaceType_ = modelObject.spaceType()) {
86
3/4
✓ Branch 1 taken 309 times.
✓ Branch 4 taken 309 times.
✓ Branch 6 taken 309 times.
✗ Branch 7 not taken.
618 if (auto idf_spaceType_ = translateAndMapModelObject(spaceType_.get())) {
87
3/3
✓ Branch 1 taken 309 times.
✓ Branch 4 taken 309 times.
✓ Branch 7 taken 309 times.
309 idfObject.setString(SpaceFields::SpaceType, idf_spaceType_->nameString());
88 309 }
89 571 }
90
91 // Construction Assignment Set Name
92
3/3
✓ Branch 1 taken 571 times.
✓ Branch 3 taken 567 times.
✓ Branch 4 taken 4 times.
571 if (!m_forwardTranslatorOptions.excludeConstructionAssignmentSets()) {
93 // NOTE: the DefaultConstructionSet of the Space is already merged with the DCS of its SpaceType and BuildingStory if needed (collapseToSpaceAndBuilding)
94
3/3
✓ Branch 1 taken 567 times.
✓ Branch 3 taken 54 times.
✓ Branch 4 taken 513 times.
1134 if (auto defaultConstructionSet_ = modelObject.defaultConstructionSet()) {
95
3/4
✓ Branch 1 taken 54 times.
✓ Branch 4 taken 54 times.
✓ Branch 6 taken 54 times.
✗ Branch 7 not taken.
108 if (auto wo_ = translateAndMapModelObject(*defaultConstructionSet_)) {
96
3/3
✓ Branch 1 taken 54 times.
✓ Branch 4 taken 54 times.
✓ Branch 7 taken 54 times.
54 idfObject.setString(SpaceFields::ConstructionAssignmentSetName, wo_->nameString());
97 54 }
98 567 }
99 }
100
101 // Translate all Space-specific loads (and geometry children)
102 9136 auto translateSpaceLoads = [this](auto loads) {
103 9136 std::sort(loads.begin(), loads.end(), WorkspaceObjectNameLess());
104
31/32
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::ElectricEquipment, std::allocator<openstudio::model::ElectricEquipment> > >(std::vector<openstudio::model::ElectricEquipment, std::allocator<openstudio::model::ElectricEquipment> >) const:
✓ Branch 4 taken 132 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::ElectricEquipmentITEAirCooled, std::allocator<openstudio::model::ElectricEquipmentITEAirCooled> > >(std::vector<openstudio::model::ElectricEquipmentITEAirCooled, std::allocator<openstudio::model::ElectricEquipmentITEAirCooled> >) const:
✓ Branch 4 taken 13 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::GasEquipment, std::allocator<openstudio::model::GasEquipment> > >(std::vector<openstudio::model::GasEquipment, std::allocator<openstudio::model::GasEquipment> >) const:
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::HotWaterEquipment, std::allocator<openstudio::model::HotWaterEquipment> > >(std::vector<openstudio::model::HotWaterEquipment, std::allocator<openstudio::model::HotWaterEquipment> >) const:
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::InteriorPartitionSurfaceGroup, std::allocator<openstudio::model::InteriorPartitionSurfaceGroup> > >(std::vector<openstudio::model::InteriorPartitionSurfaceGroup, std::allocator<openstudio::model::InteriorPartitionSurfaceGroup> >) const:
✓ Branch 4 taken 33 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::InternalMass, std::allocator<openstudio::model::InternalMass> > >(std::vector<openstudio::model::InternalMass, std::allocator<openstudio::model::InternalMass> >) const:
✓ Branch 4 taken 11 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::Lights, std::allocator<openstudio::model::Lights> > >(std::vector<openstudio::model::Lights, std::allocator<openstudio::model::Lights> >) const:
✓ Branch 4 taken 109 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::Luminaire, std::allocator<openstudio::model::Luminaire> > >(std::vector<openstudio::model::Luminaire, std::allocator<openstudio::model::Luminaire> >) const:
✗ Branch 4 not taken.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::OtherEquipment, std::allocator<openstudio::model::OtherEquipment> > >(std::vector<openstudio::model::OtherEquipment, std::allocator<openstudio::model::OtherEquipment> >) const:
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::People, std::allocator<openstudio::model::People> > >(std::vector<openstudio::model::People, std::allocator<openstudio::model::People> >) const:
✓ Branch 4 taken 45 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::ShadingSurfaceGroup, std::allocator<openstudio::model::ShadingSurfaceGroup> > >(std::vector<openstudio::model::ShadingSurfaceGroup, std::allocator<openstudio::model::ShadingSurfaceGroup> >) const:
✓ Branch 4 taken 75 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::SpaceInfiltrationDesignFlowRate, std::allocator<openstudio::model::SpaceInfiltrationDesignFlowRate> > >(std::vector<openstudio::model::SpaceInfiltrationDesignFlowRate, std::allocator<openstudio::model::SpaceInfiltrationDesignFlowRate> >) const:
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::SpaceInfiltrationEffectiveLeakageArea, std::allocator<openstudio::model::SpaceInfiltrationEffectiveLeakageArea> > >(std::vector<openstudio::model::SpaceInfiltrationEffectiveLeakageArea, std::allocator<openstudio::model::SpaceInfiltrationEffectiveLeakageArea> >) const:
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::SpaceInfiltrationFlowCoefficient, std::allocator<openstudio::model::SpaceInfiltrationFlowCoefficient> > >(std::vector<openstudio::model::SpaceInfiltrationFlowCoefficient, std::allocator<openstudio::model::SpaceInfiltrationFlowCoefficient> >) const:
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::SteamEquipment, std::allocator<openstudio::model::SteamEquipment> > >(std::vector<openstudio::model::SteamEquipment, std::allocator<openstudio::model::SteamEquipment> >) const:
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 571 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::Surface, std::allocator<openstudio::model::Surface> > >(std::vector<openstudio::model::Surface, std::allocator<openstudio::model::Surface> >) const:
✓ Branch 4 taken 2875 times.
✓ Branch 5 taken 571 times.
12472 for (auto& load : loads) {
105
15/16
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::ElectricEquipment, std::allocator<openstudio::model::ElectricEquipment> > >(std::vector<openstudio::model::ElectricEquipment, std::allocator<openstudio::model::ElectricEquipment> >) const:
✓ Branch 1 taken 132 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::ElectricEquipmentITEAirCooled, std::allocator<openstudio::model::ElectricEquipmentITEAirCooled> > >(std::vector<openstudio::model::ElectricEquipmentITEAirCooled, std::allocator<openstudio::model::ElectricEquipmentITEAirCooled> >) const:
✓ Branch 1 taken 13 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::GasEquipment, std::allocator<openstudio::model::GasEquipment> > >(std::vector<openstudio::model::GasEquipment, std::allocator<openstudio::model::GasEquipment> >) const:
✓ Branch 1 taken 5 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::HotWaterEquipment, std::allocator<openstudio::model::HotWaterEquipment> > >(std::vector<openstudio::model::HotWaterEquipment, std::allocator<openstudio::model::HotWaterEquipment> >) const:
✓ Branch 1 taken 4 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::InteriorPartitionSurfaceGroup, std::allocator<openstudio::model::InteriorPartitionSurfaceGroup> > >(std::vector<openstudio::model::InteriorPartitionSurfaceGroup, std::allocator<openstudio::model::InteriorPartitionSurfaceGroup> >) const:
✓ Branch 1 taken 33 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::InternalMass, std::allocator<openstudio::model::InternalMass> > >(std::vector<openstudio::model::InternalMass, std::allocator<openstudio::model::InternalMass> >) const:
✓ Branch 1 taken 11 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::Lights, std::allocator<openstudio::model::Lights> > >(std::vector<openstudio::model::Lights, std::allocator<openstudio::model::Lights> >) const:
✓ Branch 1 taken 109 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::Luminaire, std::allocator<openstudio::model::Luminaire> > >(std::vector<openstudio::model::Luminaire, std::allocator<openstudio::model::Luminaire> >) const:
✗ Branch 1 not taken.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::OtherEquipment, std::allocator<openstudio::model::OtherEquipment> > >(std::vector<openstudio::model::OtherEquipment, std::allocator<openstudio::model::OtherEquipment> >) const:
✓ Branch 1 taken 4 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::People, std::allocator<openstudio::model::People> > >(std::vector<openstudio::model::People, std::allocator<openstudio::model::People> >) const:
✓ Branch 1 taken 45 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::ShadingSurfaceGroup, std::allocator<openstudio::model::ShadingSurfaceGroup> > >(std::vector<openstudio::model::ShadingSurfaceGroup, std::allocator<openstudio::model::ShadingSurfaceGroup> >) const:
✓ Branch 1 taken 75 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::SpaceInfiltrationDesignFlowRate, std::allocator<openstudio::model::SpaceInfiltrationDesignFlowRate> > >(std::vector<openstudio::model::SpaceInfiltrationDesignFlowRate, std::allocator<openstudio::model::SpaceInfiltrationDesignFlowRate> >) const:
✓ Branch 1 taken 10 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::SpaceInfiltrationEffectiveLeakageArea, std::allocator<openstudio::model::SpaceInfiltrationEffectiveLeakageArea> > >(std::vector<openstudio::model::SpaceInfiltrationEffectiveLeakageArea, std::allocator<openstudio::model::SpaceInfiltrationEffectiveLeakageArea> >) const:
✓ Branch 1 taken 8 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::SpaceInfiltrationFlowCoefficient, std::allocator<openstudio::model::SpaceInfiltrationFlowCoefficient> > >(std::vector<openstudio::model::SpaceInfiltrationFlowCoefficient, std::allocator<openstudio::model::SpaceInfiltrationFlowCoefficient> >) const:
✓ Branch 1 taken 8 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::SteamEquipment, std::allocator<openstudio::model::SteamEquipment> > >(std::vector<openstudio::model::SteamEquipment, std::allocator<openstudio::model::SteamEquipment> >) const:
✓ Branch 1 taken 4 times.
auto openstudio::energyplus::ForwardTranslator::translateSpace(openstudio::model::Space&)::{lambda(auto:1)#1}::operator()<std::vector<openstudio::model::Surface, std::allocator<openstudio::model::Surface> > >(std::vector<openstudio::model::Surface, std::allocator<openstudio::model::Surface> >) const:
✓ Branch 1 taken 2875 times.
3336 translateAndMapModelObject(load);
106 }
107 9136 };
108
109
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.shadingSurfaceGroups());
110
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.interiorPartitionSurfaceGroups());
111
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.surfaces());
112
113
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.internalMass());
114
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.lights());
115
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.luminaires());
116
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.people());
117
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.electricEquipment());
118
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.electricEquipmentITEAirCooled());
119
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.gasEquipment());
120
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.hotWaterEquipment());
121
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.steamEquipment());
122
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.otherEquipment());
123
124 // TODO: Technically this stuff maps to a thermal zone, always (can't map to a Space/SpaceList)
125
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.spaceInfiltrationDesignFlowRates());
126
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.spaceInfiltrationEffectiveLeakageAreas());
127
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 translateSpaceLoads(modelObject.spaceInfiltrationFlowCoefficients());
128
129
1/1
✓ Branch 1 taken 571 times.
571 return idfObject;
130 571 } // translate function
131
132 } // namespace energyplus
133 } // namespace openstudio
134