GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 97.5% 116 / 0 / 119
Functions: 100.0% 17 / 0 / 17
Branches: 92.6% 113 / 0 / 122

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
34 #include <utilities/idd/OS_Space_FieldEnums.hxx>
35 #include <utilities/idd/Space_FieldEnums.hxx>
36
37 #include "../../utilities/idd/IddEnums.hpp"
38 #include <utilities/idd/IddFactory.hxx>
39
40 using namespace openstudio::model;
41
42 using namespace std;
43
44 namespace openstudio {
45
46 namespace energyplus {
47
48 774 boost::optional<IdfObject> ForwardTranslator::translateSpace(model::Space& modelObject) {
49
50
2/3
✓ Branch 1 taken 774 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 774 times.
774 for (LifeCycleCost& lifeCycleCost : modelObject.lifeCycleCosts()) {
51 ✗ translateAndMapModelObject(lifeCycleCost);
52 774 }
53
54
3/3
✓ Branch 1 taken 774 times.
✓ Branch 3 taken 214 times.
✓ Branch 4 taken 560 times.
774 if (m_forwardTranslatorOptions.excludeSpaceTranslation()) {
55 214 return boost::none;
56 }
57
58 // Space
59
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Space, modelObject);
60
61 // ZoneName
62
2/3
✓ Branch 1 taken 560 times.
✓ Branch 3 taken 560 times.
✗ Branch 4 not taken.
1120 if (boost::optional<ThermalZone> thermalZone = modelObject.thermalZone()) {
63
4/4
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
✓ Branch 7 taken 560 times.
✓ Branch 10 taken 560 times.
560 idfObject.setString(SpaceFields::ZoneName, thermalZone->name().get());
64 560 }
65
66 // for CeilingHeight, Volume, FloorArea: only FT if hard set (same logic as for ThermalZone)
67
68 // CeilingHeight
69
2/3
✓ Branch 1 taken 560 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 560 times.
560 if (!modelObject.isCeilingHeightDefaulted()) {
70 ✗ idfObject.setDouble(SpaceFields::CeilingHeight, modelObject.ceilingHeight());
71 }
72
73 // Volume
74
3/3
✓ Branch 1 taken 560 times.
✓ Branch 3 taken 51 times.
✓ Branch 4 taken 509 times.
560 if (!modelObject.isVolumeDefaulted()) {
75
2/2
✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
51 idfObject.setDouble(SpaceFields::Volume, modelObject.volume());
76 }
77
78 // FloorArea
79
3/3
✓ Branch 1 taken 560 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 554 times.
560 if (!modelObject.isFloorAreaDefaulted()) {
80
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setDouble(SpaceFields::FloorArea, modelObject.floorArea());
81 }
82
83 // SpaceType
84
3/3
✓ Branch 1 taken 560 times.
✓ Branch 3 taken 307 times.
✓ Branch 4 taken 253 times.
1120 if (boost::optional<SpaceType> spaceType_ = modelObject.spaceType()) {
85
3/4
✓ Branch 1 taken 307 times.
✓ Branch 4 taken 307 times.
✓ Branch 6 taken 307 times.
✗ Branch 7 not taken.
614 if (auto idf_spaceType_ = translateAndMapModelObject(spaceType_.get())) {
86
3/3
✓ Branch 1 taken 307 times.
✓ Branch 4 taken 307 times.
✓ Branch 7 taken 307 times.
307 idfObject.setString(SpaceFields::SpaceType, idf_spaceType_->nameString());
87 307 }
88 560 }
89
90 // Translate all Space-specific loads (and geometry children)
91 8960 auto translateSpaceLoads = [this](auto loads) {
92 8960 std::sort(loads.begin(), loads.end(), WorkspaceObjectNameLess());
93
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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 560 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 2854 times.
✓ Branch 5 taken 560 times.
12275 for (auto& load : loads) {
94
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 2854 times.
3315 translateAndMapModelObject(load);
95 }
96 8960 };
97
98
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.shadingSurfaceGroups());
99
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.interiorPartitionSurfaceGroups());
100
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.surfaces());
101
102
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.internalMass());
103
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.lights());
104
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.luminaires());
105
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.people());
106
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.electricEquipment());
107
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.electricEquipmentITEAirCooled());
108
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.gasEquipment());
109
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.hotWaterEquipment());
110
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.steamEquipment());
111
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.otherEquipment());
112
113 // TODO: Technically this stuff maps to a thermal zone, always (can't map to a Space/SpaceList)
114
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.spaceInfiltrationDesignFlowRates());
115
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.spaceInfiltrationEffectiveLeakageAreas());
116
2/2
✓ Branch 1 taken 560 times.
✓ Branch 4 taken 560 times.
560 translateSpaceLoads(modelObject.spaceInfiltrationFlowCoefficients());
117
118
1/1
✓ Branch 1 taken 560 times.
560 return idfObject;
119 560 } // translate function
120
121 } // namespace energyplus
122 } // namespace openstudio
123