src/model/Space.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 "Space.hpp" | ||
| 7 | #include "Space_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Model.hpp" | ||
| 10 | #include "Model_Impl.hpp" | ||
| 11 | #include "Building.hpp" | ||
| 12 | #include "Building_Impl.hpp" | ||
| 13 | #include "SpaceType.hpp" | ||
| 14 | #include "SpaceType_Impl.hpp" | ||
| 15 | #include "RenderingColor.hpp" | ||
| 16 | #include "RenderingColor_Impl.hpp" | ||
| 17 | #include "ConstructionBase.hpp" | ||
| 18 | #include "ConstructionBase_Impl.hpp" | ||
| 19 | #include "DefaultConstructionSet.hpp" | ||
| 20 | #include "DefaultConstructionSet_Impl.hpp" | ||
| 21 | #include "DefaultScheduleSet.hpp" | ||
| 22 | #include "DefaultScheduleSet_Impl.hpp" | ||
| 23 | #include "Schedule.hpp" | ||
| 24 | #include "Schedule_Impl.hpp" | ||
| 25 | #include "ThermalZone.hpp" | ||
| 26 | #include "ThermalZone_Impl.hpp" | ||
| 27 | #include "BuildingStory.hpp" | ||
| 28 | #include "BuildingStory_Impl.hpp" | ||
| 29 | #include "BuildingUnit.hpp" | ||
| 30 | #include "BuildingUnit_Impl.hpp" | ||
| 31 | #include "ShadingSurfaceGroup.hpp" | ||
| 32 | #include "ShadingSurfaceGroup_Impl.hpp" | ||
| 33 | #include "ShadingSurface.hpp" | ||
| 34 | #include "ShadingSurface_Impl.hpp" | ||
| 35 | #include "InteriorPartitionSurfaceGroup.hpp" | ||
| 36 | #include "InteriorPartitionSurfaceGroup_Impl.hpp" | ||
| 37 | #include "InteriorPartitionSurface.hpp" | ||
| 38 | #include "InteriorPartitionSurface_Impl.hpp" | ||
| 39 | #include "Surface.hpp" | ||
| 40 | #include "Surface_Impl.hpp" | ||
| 41 | #include "SubSurface.hpp" | ||
| 42 | #include "SubSurface_Impl.hpp" | ||
| 43 | #include "InternalMass.hpp" | ||
| 44 | #include "InternalMass_Impl.hpp" | ||
| 45 | #include "InternalMassDefinition.hpp" | ||
| 46 | #include "InternalMassDefinition_Impl.hpp" | ||
| 47 | #include "People.hpp" | ||
| 48 | #include "People_Impl.hpp" | ||
| 49 | #include "PeopleDefinition.hpp" | ||
| 50 | #include "PeopleDefinition_Impl.hpp" | ||
| 51 | #include "Lights.hpp" | ||
| 52 | #include "Lights_Impl.hpp" | ||
| 53 | #include "LightsDefinition.hpp" | ||
| 54 | #include "LightsDefinition_Impl.hpp" | ||
| 55 | #include "Luminaire.hpp" | ||
| 56 | #include "Luminaire_Impl.hpp" | ||
| 57 | #include "LuminaireDefinition.hpp" | ||
| 58 | #include "LuminaireDefinition_Impl.hpp" | ||
| 59 | #include "ElectricEquipment.hpp" | ||
| 60 | #include "ElectricEquipment_Impl.hpp" | ||
| 61 | #include "ElectricEquipmentDefinition.hpp" | ||
| 62 | #include "ElectricEquipmentDefinition_Impl.hpp" | ||
| 63 | #include "ElectricEquipmentITEAirCooled.hpp" | ||
| 64 | #include "ElectricEquipmentITEAirCooled_Impl.hpp" | ||
| 65 | #include "ElectricEquipmentITEAirCooledDefinition.hpp" | ||
| 66 | #include "ElectricEquipmentITEAirCooledDefinition_Impl.hpp" | ||
| 67 | #include "GasEquipment.hpp" | ||
| 68 | #include "GasEquipment_Impl.hpp" | ||
| 69 | #include "GasEquipmentDefinition.hpp" | ||
| 70 | #include "GasEquipmentDefinition_Impl.hpp" | ||
| 71 | #include "HotWaterEquipment.hpp" | ||
| 72 | #include "HotWaterEquipment_Impl.hpp" | ||
| 73 | #include "HotWaterEquipmentDefinition.hpp" | ||
| 74 | #include "HotWaterEquipmentDefinition_Impl.hpp" | ||
| 75 | #include "SteamEquipment.hpp" | ||
| 76 | #include "SteamEquipment_Impl.hpp" | ||
| 77 | #include "OtherEquipment.hpp" | ||
| 78 | #include "OtherEquipment_Impl.hpp" | ||
| 79 | #include "WaterUseEquipment.hpp" | ||
| 80 | #include "WaterUseEquipment_Impl.hpp" | ||
| 81 | #include "DaylightingControl.hpp" | ||
| 82 | #include "DaylightingControl_Impl.hpp" | ||
| 83 | #include "IlluminanceMap.hpp" | ||
| 84 | #include "IlluminanceMap_Impl.hpp" | ||
| 85 | #include "SpaceInfiltrationDesignFlowRate.hpp" | ||
| 86 | #include "SpaceInfiltrationDesignFlowRate_Impl.hpp" | ||
| 87 | #include "SpaceInfiltrationEffectiveLeakageArea.hpp" | ||
| 88 | #include "SpaceInfiltrationEffectiveLeakageArea_Impl.hpp" | ||
| 89 | #include "SpaceInfiltrationFlowCoefficient.hpp" | ||
| 90 | #include "SpaceInfiltrationFlowCoefficient_Impl.hpp" | ||
| 91 | #include "DesignSpecificationOutdoorAir.hpp" | ||
| 92 | #include "DesignSpecificationOutdoorAir_Impl.hpp" | ||
| 93 | #include "GlareSensor.hpp" | ||
| 94 | #include "GlareSensor_Impl.hpp" | ||
| 95 | #include "ZoneMixing.hpp" | ||
| 96 | #include "ZoneMixing_Impl.hpp" | ||
| 97 | |||
| 98 | #include <utilities/idd/OS_Space_FieldEnums.hxx> | ||
| 99 | #include <utilities/idd/OS_Surface_FieldEnums.hxx> | ||
| 100 | #include <utilities/idd/OS_SubSurface_FieldEnums.hxx> | ||
| 101 | #include <utilities/idd/IddEnums.hxx> | ||
| 102 | |||
| 103 | #include "../utilities/geometry/Geometry.hpp" | ||
| 104 | #include "../utilities/geometry/Transformation.hpp" | ||
| 105 | #include "../utilities/geometry/Point3d.hpp" | ||
| 106 | #include "../utilities/geometry/Vector3d.hpp" | ||
| 107 | #include "../utilities/geometry/EulerAngles.hpp" | ||
| 108 | #include "../utilities/geometry/BoundingBox.hpp" | ||
| 109 | #include "../utilities/geometry/Polygon3d.hpp" | ||
| 110 | #include "../utilities/geometry/Polyhedron.hpp" | ||
| 111 | |||
| 112 | #include "../utilities/core/ContainersMove.hpp" | ||
| 113 | |||
| 114 | #include "../utilities/core/Assert.hpp" | ||
| 115 | |||
| 116 | #undef BOOST_UBLAS_TYPE_CHECK | ||
| 117 | #if defined(_MSC_VER) | ||
| 118 | # pragma warning(push) | ||
| 119 | # pragma warning(disable : 4244) | ||
| 120 | #endif | ||
| 121 | #include <boost/geometry/geometry.hpp> | ||
| 122 | #include <boost/geometry/geometries/point_xy.hpp> | ||
| 123 | #include <boost/geometry/geometries/polygon.hpp> | ||
| 124 | #include <boost/geometry/geometries/ring.hpp> | ||
| 125 | #include <boost/geometry/geometries/multi_polygon.hpp> | ||
| 126 | #include <boost/geometry/geometries/adapted/boost_tuple.hpp> | ||
| 127 | #if defined(_MSC_VER) | ||
| 128 | # pragma warning(pop) | ||
| 129 | #endif | ||
| 130 | |||
| 131 | #include <algorithm> | ||
| 132 | #include <cmath> | ||
| 133 | #include <iterator> | ||
| 134 | #include <ranges> | ||
| 135 | |||
| 136 | #include <fmt/core.h> | ||
| 137 | |||
| 138 | namespace openstudio { | ||
| 139 | namespace model { | ||
| 140 | |||
| 141 | namespace detail { | ||
| 142 | |||
| 143 | 6907 | Space_Impl::Space_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : PlanarSurfaceGroup_Impl(idfObject, model, keepHandle) { | |
| 144 |
4/6✓ Branch 1 taken 6907 times.
✓ Branch 4 taken 6907 times.
✓ Branch 7 taken 6907 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 6907 times.
✗ Branch 13 not taken.
|
6907 | OS_ASSERT(idfObject.iddObject().type() == Space::iddObjectType()); |
| 145 | 6907 | } | |
| 146 | |||
| 147 | 2863 | Space_Impl::Space_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 148 | 2863 | : PlanarSurfaceGroup_Impl(other, model, keepHandle) { | |
| 149 |
4/6✓ Branch 1 taken 2863 times.
✓ Branch 4 taken 2863 times.
✓ Branch 7 taken 2863 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2863 times.
✗ Branch 13 not taken.
|
2863 | OS_ASSERT(other.iddObject().type() == Space::iddObjectType()); |
| 150 | 2863 | } | |
| 151 | |||
| 152 | 2042 | Space_Impl::Space_Impl(const Space_Impl& other, Model_Impl* model, bool keepHandle) : PlanarSurfaceGroup_Impl(other, model, keepHandle) {} | |
| 153 | |||
| 154 | 518 | boost::optional<ParentObject> Space_Impl::parent() const { | |
| 155 |
3/3✓ Branch 1 taken 518 times.
✓ Branch 4 taken 518 times.
✓ Branch 7 taken 518 times.
|
518 | return boost::optional<ParentObject>(this->model().building()); |
| 156 | } | ||
| 157 | |||
| 158 | ✗ | bool Space_Impl::setParent(ParentObject& newParent) { | |
| 159 | ✗ | bool result = false; | |
| 160 | ✗ | if (newParent.optionalCast<Building>()) { | |
| 161 | ✗ | result = (this->model() == newParent.model()); | |
| 162 | } | ||
| 163 | ✗ | return result; | |
| 164 | } | ||
| 165 | |||
| 166 | 1749 | std::vector<ModelObject> Space_Impl::children() const { | |
| 167 |
4/4✓ Branch 1 taken 1749 times.
✓ Branch 4 taken 1749 times.
✓ Branch 7 taken 1749 times.
✓ Branch 10 taken 1749 times.
|
3498 | return concat<ModelObject>(this->shadingSurfaceGroups(), this->interiorPartitionSurfaceGroups(), this->surfaces(), this->internalMass(), |
| 168 |
5/5✓ Branch 1 taken 1749 times.
✓ Branch 4 taken 1749 times.
✓ Branch 7 taken 1749 times.
✓ Branch 10 taken 1749 times.
✓ Branch 13 taken 1749 times.
|
3498 | this->lights(), this->luminaires(), this->people(), this->electricEquipment(), this->electricEquipmentITEAirCooled(), |
| 169 |
4/4✓ Branch 1 taken 1749 times.
✓ Branch 4 taken 1749 times.
✓ Branch 7 taken 1749 times.
✓ Branch 10 taken 1749 times.
|
3498 | this->gasEquipment(), this->hotWaterEquipment(), this->steamEquipment(), this->otherEquipment(), |
| 170 |
4/4✓ Branch 1 taken 1749 times.
✓ Branch 4 taken 1749 times.
✓ Branch 7 taken 1749 times.
✓ Branch 10 taken 1749 times.
|
3498 | this->waterUseEquipment(), this->daylightingControls(), this->illuminanceMaps(), this->glareSensors(), |
| 171 |
2/2✓ Branch 1 taken 1749 times.
✓ Branch 4 taken 1749 times.
|
3498 | this->spaceInfiltrationDesignFlowRates(), this->spaceInfiltrationEffectiveLeakageAreas(), |
| 172 |
3/3✓ Branch 1 taken 1749 times.
✓ Branch 4 taken 1749 times.
✓ Branch 7 taken 1749 times.
|
5247 | this->spaceInfiltrationFlowCoefficients(), this->supplyZoneMixing()); |
| 173 | } | ||
| 174 | |||
| 175 | ✗ | std::vector<IddObjectType> Space_Impl::allowableChildTypes() const { | |
| 176 | return { | ||
| 177 | IddObjectType::OS_ShadingSurfaceGroup, | ||
| 178 | IddObjectType::OS_InteriorPartitionSurfaceGroup, | ||
| 179 | IddObjectType::OS_Surface, | ||
| 180 | IddObjectType::OS_Lights, | ||
| 181 | IddObjectType::OS_Luminaire, | ||
| 182 | IddObjectType::OS_People, | ||
| 183 | IddObjectType::OS_ElectricEquipment, | ||
| 184 | IddObjectType::OS_ElectricEquipment_ITE_AirCooled, | ||
| 185 | IddObjectType::OS_GasEquipment, | ||
| 186 | IddObjectType::OS_HotWaterEquipment, | ||
| 187 | IddObjectType::OS_Daylighting_Control, | ||
| 188 | IddObjectType::OS_IlluminanceMap, | ||
| 189 | IddObjectType::OS_SpaceInfiltration_DesignFlowRate, | ||
| 190 | IddObjectType::OS_SpaceInfiltration_EffectiveLeakageArea, | ||
| 191 | IddObjectType::OS_SpaceInfiltration_FlowCoefficient, | ||
| 192 | ✗ | }; | |
| 193 | } | ||
| 194 | |||
| 195 | 4 | const std::vector<std::string>& Space_Impl::outputVariableNames() const { | |
| 196 |
3/4✓ Branch 0 taken 1 time.
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
4 | static const std::vector<std::string> result; |
| 197 | 4 | return result; | |
| 198 | } | ||
| 199 | |||
| 200 | 20 | IddObjectType Space_Impl::iddObjectType() const { | |
| 201 | 20 | return Space::iddObjectType(); | |
| 202 | } | ||
| 203 | |||
| 204 | 72535 | Transformation Space_Impl::buildingTransformation() const { | |
| 205 | 72535 | return this->transformation(); | |
| 206 | } | ||
| 207 | |||
| 208 | 680 | bool Space_Impl::changeTransformation(const openstudio::Transformation& transformation) { | |
| 209 |
1/1✓ Branch 1 taken 680 times.
|
680 | Transformation oldTransformation = this->transformation(); |
| 210 |
2/3✓ Branch 1 taken 680 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 680 times.
|
680 | if (!setTransformation(transformation)) { |
| 211 | ✗ | return false; | |
| 212 | } | ||
| 213 | |||
| 214 | // go through and update all child points and transformations so that: | ||
| 215 | // (Tnew^-1 * Told) * xold = childTransformation * xold = xnew | ||
| 216 | |||
| 217 |
2/2✓ Branch 1 taken 680 times.
✓ Branch 4 taken 680 times.
|
680 | Transformation childTransformation = transformation.inverse() * oldTransformation; |
| 218 | |||
| 219 |
3/3✓ Branch 1 taken 680 times.
✓ Branch 8 taken 3395 times.
✓ Branch 9 taken 680 times.
|
4075 | for (Surface& surface : this->surfaces()) { |
| 220 |
3/3✓ Branch 1 taken 3395 times.
✓ Branch 4 taken 3395 times.
✓ Branch 7 taken 3395 times.
|
3395 | bool test = surface.setVertices(childTransformation * surface.vertices()); |
| 221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3395 times.
|
3395 | if (!test) { |
| 222 | ✗ | LOG(Error, "Could not transform vertices for Surface '" << surface.name().get() << "'."); | |
| 223 | } | ||
| 224 |
3/3✓ Branch 1 taken 3395 times.
✓ Branch 8 taken 407 times.
✓ Branch 9 taken 3395 times.
|
3802 | for (SubSurface& subSurface : surface.subSurfaces()) { |
| 225 |
3/3✓ Branch 1 taken 407 times.
✓ Branch 4 taken 407 times.
✓ Branch 7 taken 407 times.
|
407 | test = subSurface.setVertices(childTransformation * subSurface.vertices()); |
| 226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 407 times.
|
407 | if (!test) { |
| 227 | ✗ | LOG(Error, "Could not transform vertices for SubSurface '" << subSurface.name().get() << "'."); | |
| 228 | } | ||
| 229 | 3395 | } | |
| 230 | 680 | } | |
| 231 | |||
| 232 |
3/3✓ Branch 1 taken 680 times.
✓ Branch 8 taken 78 times.
✓ Branch 9 taken 680 times.
|
758 | for (ShadingSurfaceGroup& shadingSurfaceGroup : this->shadingSurfaceGroups()) { |
| 233 |
3/3✓ Branch 1 taken 78 times.
✓ Branch 4 taken 78 times.
✓ Branch 7 taken 78 times.
|
78 | bool test = shadingSurfaceGroup.setTransformation(childTransformation * shadingSurfaceGroup.transformation()); |
| 234 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 78 times.
✗ Branch 3 not taken.
|
78 | OS_ASSERT(test); |
| 235 | 680 | } | |
| 236 | |||
| 237 |
3/3✓ Branch 1 taken 680 times.
✓ Branch 8 taken 35 times.
✓ Branch 9 taken 680 times.
|
715 | for (InteriorPartitionSurfaceGroup& interiorPartitionSurfaceGroup : this->interiorPartitionSurfaceGroups()) { |
| 238 |
3/3✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
✓ Branch 7 taken 35 times.
|
35 | bool test = interiorPartitionSurfaceGroup.setTransformation(childTransformation * interiorPartitionSurfaceGroup.transformation()); |
| 239 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
✗ Branch 3 not taken.
|
35 | OS_ASSERT(test); |
| 240 | 680 | } | |
| 241 | |||
| 242 |
2/3✓ Branch 1 taken 680 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 680 times.
|
680 | for (Luminaire& luminaire : this->luminaires()) { |
| 243 | ✗ | bool test = luminaire.setTransformation(childTransformation * luminaire.transformation()); | |
| 244 | ✗ | OS_ASSERT(test); | |
| 245 | 680 | } | |
| 246 | |||
| 247 |
3/3✓ Branch 1 taken 680 times.
✓ Branch 8 taken 53 times.
✓ Branch 9 taken 680 times.
|
733 | for (DaylightingControl& daylightingControl : this->daylightingControls()) { |
| 248 |
3/3✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
|
53 | bool test = daylightingControl.setTransformation(childTransformation * daylightingControl.transformation()); |
| 249 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
|
53 | OS_ASSERT(test); |
| 250 | 680 | } | |
| 251 | |||
| 252 |
3/3✓ Branch 1 taken 680 times.
✓ Branch 8 taken 42 times.
✓ Branch 9 taken 680 times.
|
722 | for (IlluminanceMap& illuminanceMap : this->illuminanceMaps()) { |
| 253 |
3/3✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
✓ Branch 7 taken 42 times.
|
42 | bool test = illuminanceMap.setTransformation(childTransformation * illuminanceMap.transformation()); |
| 254 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
✗ Branch 3 not taken.
|
42 | OS_ASSERT(test); |
| 255 | 680 | } | |
| 256 | |||
| 257 | 680 | return true; | |
| 258 | 680 | } | |
| 259 | |||
| 260 | 38798 | BoundingBox Space_Impl::boundingBox() const { | |
| 261 | 38798 | BoundingBox result; | |
| 262 | |||
| 263 |
3/3✓ Branch 1 taken 38798 times.
✓ Branch 7 taken 369093 times.
✓ Branch 8 taken 38798 times.
|
407891 | for (Surface& surface : this->surfaces()) { |
| 264 |
2/2✓ Branch 1 taken 369093 times.
✓ Branch 4 taken 369093 times.
|
369093 | result.addPoints(surface.vertices()); |
| 265 | 38798 | } | |
| 266 | |||
| 267 |
3/3✓ Branch 1 taken 38798 times.
✓ Branch 7 taken 870 times.
✓ Branch 8 taken 38798 times.
|
39668 | for (ShadingSurfaceGroup& shadingSurfaceGroup : this->shadingSurfaceGroups()) { |
| 268 |
5/5✓ Branch 1 taken 870 times.
✓ Branch 4 taken 870 times.
✓ Branch 7 taken 870 times.
✓ Branch 10 taken 870 times.
✓ Branch 13 taken 870 times.
|
870 | result.addPoints(shadingSurfaceGroup.transformation() * shadingSurfaceGroup.boundingBox().corners()); |
| 269 | 38798 | } | |
| 270 | |||
| 271 |
3/3✓ Branch 1 taken 38798 times.
✓ Branch 7 taken 176 times.
✓ Branch 8 taken 38798 times.
|
38974 | for (InteriorPartitionSurfaceGroup& interiorPartitionSurfaceGroup : this->interiorPartitionSurfaceGroups()) { |
| 272 |
5/5✓ Branch 1 taken 176 times.
✓ Branch 4 taken 176 times.
✓ Branch 7 taken 176 times.
✓ Branch 10 taken 176 times.
✓ Branch 13 taken 176 times.
|
176 | result.addPoints(interiorPartitionSurfaceGroup.transformation() * interiorPartitionSurfaceGroup.boundingBox().corners()); |
| 273 | 38798 | } | |
| 274 | |||
| 275 |
2/3✓ Branch 1 taken 38798 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 38798 times.
|
38798 | for (Luminaire& luminaire : this->luminaires()) { |
| 276 | ✗ | result.addPoint(luminaire.position()); | |
| 277 | 38798 | } | |
| 278 | |||
| 279 |
3/3✓ Branch 1 taken 38798 times.
✓ Branch 7 taken 324 times.
✓ Branch 8 taken 38798 times.
|
39122 | for (DaylightingControl& daylightingControl : this->daylightingControls()) { |
| 280 |
2/2✓ Branch 1 taken 324 times.
✓ Branch 4 taken 324 times.
|
324 | result.addPoint(daylightingControl.position()); |
| 281 | 38798 | } | |
| 282 | |||
| 283 |
3/3✓ Branch 1 taken 38798 times.
✓ Branch 7 taken 176 times.
✓ Branch 8 taken 38798 times.
|
38974 | for (IlluminanceMap& illuminanceMap : this->illuminanceMaps()) { |
| 284 |
4/4✓ Branch 1 taken 176 times.
✓ Branch 4 taken 176 times.
✓ Branch 7 taken 176 times.
✓ Branch 10 taken 176 times.
|
176 | result.addPoints(illuminanceMap.transformation() * illuminanceMap.corners()); |
| 285 | 38798 | } | |
| 286 | |||
| 287 |
3/3✓ Branch 1 taken 38798 times.
✓ Branch 7 taken 176 times.
✓ Branch 8 taken 38798 times.
|
38974 | for (GlareSensor& glareSensor : this->glareSensors()) { |
| 288 |
2/2✓ Branch 1 taken 176 times.
✓ Branch 4 taken 176 times.
|
176 | result.addPoint(glareSensor.position()); |
| 289 | 38798 | } | |
| 290 | |||
| 291 | 38798 | return result; | |
| 292 | } | ||
| 293 | |||
| 294 | 7283 | double Space_Impl::directionofRelativeNorth() const { | |
| 295 |
1/1✓ Branch 1 taken 7283 times.
|
7283 | boost::optional<double> value = getDouble(OS_SpaceFields::DirectionofRelativeNorth, true); |
| 296 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 7283 times.
✗ Branch 4 not taken.
|
7283 | OS_ASSERT(value); |
| 297 |
1/1✓ Branch 1 taken 7283 times.
|
14566 | return value.get(); |
| 298 | } | ||
| 299 | |||
| 300 | 1139 | bool Space_Impl::isDirectionofRelativeNorthDefaulted() const { | |
| 301 | 1139 | return isEmpty(OS_SpaceFields::DirectionofRelativeNorth); | |
| 302 | } | ||
| 303 | |||
| 304 | 8256 | double Space_Impl::xOrigin() const { | |
| 305 |
1/1✓ Branch 1 taken 8256 times.
|
8256 | boost::optional<double> value = getDouble(OS_SpaceFields::XOrigin, true); |
| 306 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 8256 times.
✗ Branch 4 not taken.
|
8256 | OS_ASSERT(value); |
| 307 |
1/1✓ Branch 1 taken 8256 times.
|
16512 | return value.get(); |
| 308 | } | ||
| 309 | |||
| 310 | 56 | bool Space_Impl::isXOriginDefaulted() const { | |
| 311 | 56 | return isEmpty(OS_SpaceFields::XOrigin); | |
| 312 | } | ||
| 313 | |||
| 314 | 8256 | double Space_Impl::yOrigin() const { | |
| 315 |
1/1✓ Branch 1 taken 8256 times.
|
8256 | boost::optional<double> value = getDouble(OS_SpaceFields::YOrigin, true); |
| 316 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 8256 times.
✗ Branch 4 not taken.
|
8256 | OS_ASSERT(value); |
| 317 |
1/1✓ Branch 1 taken 8256 times.
|
16512 | return value.get(); |
| 318 | } | ||
| 319 | |||
| 320 | 56 | bool Space_Impl::isYOriginDefaulted() const { | |
| 321 | 56 | return isEmpty(OS_SpaceFields::YOrigin); | |
| 322 | } | ||
| 323 | |||
| 324 | 8256 | double Space_Impl::zOrigin() const { | |
| 325 |
1/1✓ Branch 1 taken 8256 times.
|
8256 | boost::optional<double> value = getDouble(OS_SpaceFields::ZOrigin, true); |
| 326 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 8256 times.
✗ Branch 4 not taken.
|
8256 | OS_ASSERT(value); |
| 327 |
1/1✓ Branch 1 taken 8256 times.
|
16512 | return value.get(); |
| 328 | } | ||
| 329 | |||
| 330 | 56 | bool Space_Impl::isZOriginDefaulted() const { | |
| 331 | 56 | return isEmpty(OS_SpaceFields::ZOrigin); | |
| 332 | } | ||
| 333 | |||
| 334 | 1274 | bool Space_Impl::partofTotalFloorArea() const { | |
| 335 |
1/1✓ Branch 1 taken 1274 times.
|
1274 | boost::optional<std::string> value = getString(OS_SpaceFields::PartofTotalFloorArea, false, true); |
| 336 |
2/2✓ Branch 1 taken 1199 times.
✓ Branch 2 taken 75 times.
|
1274 | if (!value) { |
| 337 |
3/3✓ Branch 1 taken 1199 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 1193 times.
|
1199 | if (this->isPlenum()) { |
| 338 | 6 | return false; | |
| 339 | } | ||
| 340 |
1/1✓ Branch 1 taken 1193 times.
|
1193 | value = getString(OS_SpaceFields::PartofTotalFloorArea, true); |
| 341 | } | ||
| 342 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1268 times.
✗ Branch 4 not taken.
|
1268 | OS_ASSERT(value); |
| 343 |
3/3✓ Branch 1 taken 1268 times.
✓ Branch 4 taken 1268 times.
✓ Branch 7 taken 1268 times.
|
2536 | return openstudio::istringEqual(value.get(), "Yes"); |
| 344 | 1274 | } | |
| 345 | |||
| 346 | ✗ | bool Space_Impl::isPartofTotalFloorAreaDefaulted() const { | |
| 347 | ✗ | return isEmpty(OS_SpaceFields::PartofTotalFloorArea); | |
| 348 | } | ||
| 349 | |||
| 350 | 760 | bool Space_Impl::setDirectionofRelativeNorth(double directionofRelativeNorth, bool driverMethod) { | |
| 351 | 760 | bool result = setDouble(OS_SpaceFields::DirectionofRelativeNorth, directionofRelativeNorth, driverMethod); | |
| 352 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 760 times.
|
760 | OS_ASSERT(result); |
| 353 | 760 | return result; | |
| 354 | } | ||
| 355 | |||
| 356 | 56 | void Space_Impl::resetDirectionofRelativeNorth() { | |
| 357 |
2/2✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
|
112 | bool result = setString(OS_SpaceFields::DirectionofRelativeNorth, ""); |
| 358 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
56 | OS_ASSERT(result); |
| 359 | 56 | } | |
| 360 | |||
| 361 | 1231 | bool Space_Impl::setXOrigin(double xOrigin, bool driverMethod) { | |
| 362 | 1231 | bool result = setDouble(OS_SpaceFields::XOrigin, xOrigin, driverMethod); | |
| 363 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1231 times.
|
1231 | OS_ASSERT(result); |
| 364 | 1231 | return result; | |
| 365 | } | ||
| 366 | |||
| 367 | 56 | void Space_Impl::resetXOrigin() { | |
| 368 |
2/2✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
|
112 | bool result = setString(OS_SpaceFields::XOrigin, ""); |
| 369 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
56 | OS_ASSERT(result); |
| 370 | 56 | } | |
| 371 | |||
| 372 | 1173 | bool Space_Impl::setYOrigin(double yOrigin, bool driverMethod) { | |
| 373 | 1173 | bool result = setDouble(OS_SpaceFields::YOrigin, yOrigin, driverMethod); | |
| 374 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1173 times.
|
1173 | OS_ASSERT(result); |
| 375 | 1173 | return result; | |
| 376 | } | ||
| 377 | |||
| 378 | 56 | void Space_Impl::resetYOrigin() { | |
| 379 |
2/2✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
|
112 | bool result = setString(OS_SpaceFields::YOrigin, ""); |
| 380 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
56 | OS_ASSERT(result); |
| 381 | 56 | } | |
| 382 | |||
| 383 | 841 | bool Space_Impl::setZOrigin(double zOrigin, bool driverMethod) { | |
| 384 | 841 | bool result = setDouble(OS_SpaceFields::ZOrigin, zOrigin, driverMethod); | |
| 385 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 841 times.
|
841 | OS_ASSERT(result); |
| 386 | 841 | return result; | |
| 387 | } | ||
| 388 | |||
| 389 | 56 | void Space_Impl::resetZOrigin() { | |
| 390 |
2/2✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
|
112 | bool result = setString(OS_SpaceFields::ZOrigin, ""); |
| 391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
56 | OS_ASSERT(result); |
| 392 | 56 | } | |
| 393 | |||
| 394 | 88 | bool Space_Impl::setPartofTotalFloorArea(bool partofTotalFloorArea) { | |
| 395 | 88 | bool result = false; | |
| 396 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 9 times.
|
88 | if (partofTotalFloorArea) { |
| 397 |
2/2✓ Branch 1 taken 79 times.
✓ Branch 4 taken 79 times.
|
237 | result = setString(OS_SpaceFields::PartofTotalFloorArea, "Yes"); |
| 398 | } else { | ||
| 399 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
27 | result = setString(OS_SpaceFields::PartofTotalFloorArea, "No"); |
| 400 | } | ||
| 401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
88 | OS_ASSERT(result); |
| 402 | 88 | return result; | |
| 403 | } | ||
| 404 | |||
| 405 | ✗ | void Space_Impl::resetPartofTotalFloorArea() { | |
| 406 | ✗ | bool result = setString(OS_SpaceFields::PartofTotalFloorArea, ""); | |
| 407 | ✗ | OS_ASSERT(result); | |
| 408 | ✗ | } | |
| 409 | |||
| 410 | 2 | bool Space_Impl::setCeilingHeight(double ceilingHeight) { | |
| 411 | 2 | bool result = setDouble(OS_SpaceFields::CeilingHeight, ceilingHeight); | |
| 412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | OS_ASSERT(result); |
| 413 | 2 | return result; | |
| 414 | } | ||
| 415 | |||
| 416 | 1 | void Space_Impl::autocalculateCeilingHeight() { | |
| 417 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_SpaceFields::CeilingHeight, "Autocalculate"); |
| 418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 419 | 1 | } | |
| 420 | |||
| 421 | 1 | void Space_Impl::resetCeilingHeight() { | |
| 422 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_SpaceFields::CeilingHeight, ""); |
| 423 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 424 | 1 | } | |
| 425 | |||
| 426 | 258 | bool Space_Impl::setVolume(double volume) { | |
| 427 | 258 | bool result = setDouble(OS_SpaceFields::Volume, volume); | |
| 428 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 258 times.
|
258 | OS_ASSERT(result); |
| 429 | 258 | return result; | |
| 430 | } | ||
| 431 | |||
| 432 | 1 | void Space_Impl::autocalculateVolume() { | |
| 433 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_SpaceFields::Volume, "Autocalculate"); |
| 434 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 435 | 1 | } | |
| 436 | |||
| 437 | 1 | void Space_Impl::resetVolume() { | |
| 438 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_SpaceFields::Volume, ""); |
| 439 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 440 | 1 | } | |
| 441 | |||
| 442 | 4 | bool Space_Impl::setFloorArea(double floorArea) { | |
| 443 | 4 | bool result = setDouble(OS_SpaceFields::FloorArea, floorArea); | |
| 444 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | OS_ASSERT(result); |
| 445 | 4 | return result; | |
| 446 | } | ||
| 447 | |||
| 448 | 1 | void Space_Impl::autocalculateFloorArea() { | |
| 449 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_SpaceFields::FloorArea, "Autocalculate"); |
| 450 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 451 | 1 | } | |
| 452 | |||
| 453 | 1 | void Space_Impl::resetFloorArea() { | |
| 454 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_SpaceFields::FloorArea, ""); |
| 455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 456 | 1 | } | |
| 457 | |||
| 458 | 83137 | boost::optional<SpaceType> Space_Impl::spaceType() const { | |
| 459 |
2/2✓ Branch 1 taken 83137 times.
✓ Branch 4 taken 83137 times.
|
83137 | boost::optional<SpaceType> result = getObject<ModelObject>().getModelObjectTarget<SpaceType>(OS_SpaceFields::SpaceTypeName); |
| 460 |
2/2✓ Branch 1 taken 45283 times.
✓ Branch 2 taken 37854 times.
|
83137 | if (!result) { |
| 461 |
3/3✓ Branch 1 taken 45283 times.
✓ Branch 3 taken 22 times.
✓ Branch 4 taken 45261 times.
|
45283 | if (this->isPlenum()) { |
| 462 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
|
22 | result = this->model().plenumSpaceType(); |
| 463 | } else { | ||
| 464 |
2/2✓ Branch 1 taken 45261 times.
✓ Branch 4 taken 45261 times.
|
45261 | boost::optional<Building> building = this->model().building(); |
| 465 |
2/2✓ Branch 0 taken 43811 times.
✓ Branch 1 taken 1450 times.
|
45261 | if (building) { |
| 466 |
2/2✓ Branch 1 taken 43811 times.
✓ Branch 4 taken 43811 times.
|
43811 | result = building->spaceType(); |
| 467 | } | ||
| 468 | 45261 | } | |
| 469 | } | ||
| 470 | 83137 | return result; | |
| 471 | ✗ | } | |
| 472 | |||
| 473 | 40208 | bool Space_Impl::isSpaceTypeDefaulted() const { | |
| 474 | 40208 | return isEmpty(OS_SpaceFields::SpaceTypeName); | |
| 475 | } | ||
| 476 | |||
| 477 | 1727 | bool Space_Impl::setSpaceType(const SpaceType& spaceType) { | |
| 478 |
2/2✓ Branch 1 taken 1727 times.
✓ Branch 4 taken 1727 times.
|
1727 | return setPointer(OS_SpaceFields::SpaceTypeName, spaceType.handle()); |
| 479 | } | ||
| 480 | |||
| 481 | 49 | void Space_Impl::resetSpaceType() { | |
| 482 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
98 | setString(OS_SpaceFields::SpaceTypeName, ""); |
| 483 | 49 | } | |
| 484 | |||
| 485 | 47544 | boost::optional<DefaultConstructionSet> Space_Impl::defaultConstructionSet() const { | |
| 486 |
2/2✓ Branch 1 taken 47544 times.
✓ Branch 4 taken 47544 times.
|
47544 | return getObject<ModelObject>().getModelObjectTarget<DefaultConstructionSet>(OS_SpaceFields::DefaultConstructionSetName); |
| 487 | } | ||
| 488 | |||
| 489 | ✗ | boost::optional<ConstructionBase> Space_Impl::getDefaultConstruction(const PlanarSurface& planarSurface) const { | |
| 490 | ✗ | boost::optional<std::pair<ConstructionBase, int>> result = this->getDefaultConstructionWithSearchDistance(planarSurface); | |
| 491 | ✗ | if (result) { | |
| 492 | ✗ | return result->first; | |
| 493 | } | ||
| 494 | ✗ | return boost::none; | |
| 495 | ✗ | } | |
| 496 | |||
| 497 | 44109 | boost::optional<std::pair<ConstructionBase, int>> Space_Impl::getDefaultConstructionWithSearchDistance(const PlanarSurface& planarSurface) const { | |
| 498 | 44109 | boost::optional<ConstructionBase> result; | |
| 499 | 44109 | boost::optional<DefaultConstructionSet> defaultConstructionSet; | |
| 500 | 44109 | boost::optional<SpaceType> spaceType; | |
| 501 | 44109 | boost::optional<BuildingStory> buildingStory; | |
| 502 | 44109 | boost::optional<Building> building; | |
| 503 | |||
| 504 | // first check this object | ||
| 505 |
1/1✓ Branch 1 taken 44109 times.
|
44109 | defaultConstructionSet = this->defaultConstructionSet(); |
| 506 |
2/2✓ Branch 0 taken 608 times.
✓ Branch 1 taken 43501 times.
|
44109 | if (defaultConstructionSet) { |
| 507 |
2/2✓ Branch 1 taken 608 times.
✓ Branch 4 taken 608 times.
|
608 | result = defaultConstructionSet->getDefaultConstruction(planarSurface); |
| 508 |
2/2✓ Branch 0 taken 201 times.
✓ Branch 1 taken 407 times.
|
608 | if (result) { |
| 509 |
3/3✓ Branch 1 taken 201 times.
✓ Branch 4 taken 201 times.
✓ Branch 7 taken 201 times.
|
201 | return std::make_pair(*result, 1); |
| 510 | } | ||
| 511 | } | ||
| 512 | |||
| 513 | // then check space type | ||
| 514 |
1/1✓ Branch 1 taken 43908 times.
|
43908 | spaceType = this->spaceType(); |
| 515 |
7/7✓ Branch 0 taken 39342 times.
✓ Branch 1 taken 4566 times.
✓ Branch 3 taken 39342 times.
✓ Branch 5 taken 17677 times.
✓ Branch 6 taken 21665 times.
✓ Branch 7 taken 17677 times.
✓ Branch 8 taken 26231 times.
|
43908 | if (spaceType && !this->isSpaceTypeDefaulted()) { |
| 516 |
2/2✓ Branch 1 taken 17677 times.
✓ Branch 4 taken 17677 times.
|
17677 | defaultConstructionSet = spaceType->defaultConstructionSet(); |
| 517 |
2/2✓ Branch 0 taken 251 times.
✓ Branch 1 taken 17426 times.
|
17677 | if (defaultConstructionSet) { |
| 518 |
2/2✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
|
251 | result = defaultConstructionSet->getDefaultConstruction(planarSurface); |
| 519 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 222 times.
|
251 | if (result) { |
| 520 |
3/3✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 7 taken 29 times.
|
29 | return std::make_pair(*result, 2); |
| 521 | } | ||
| 522 | } | ||
| 523 | } | ||
| 524 | |||
| 525 | // then check building story | ||
| 526 |
1/1✓ Branch 1 taken 43879 times.
|
43879 | buildingStory = this->buildingStory(); |
| 527 |
2/2✓ Branch 0 taken 38152 times.
✓ Branch 1 taken 5727 times.
|
43879 | if (buildingStory) { |
| 528 |
2/2✓ Branch 1 taken 38152 times.
✓ Branch 4 taken 38152 times.
|
38152 | defaultConstructionSet = buildingStory->defaultConstructionSet(); |
| 529 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 38100 times.
|
38152 | if (defaultConstructionSet) { |
| 530 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | result = defaultConstructionSet->getDefaultConstruction(planarSurface); |
| 531 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
|
52 | if (result) { |
| 532 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
26 | return std::make_pair(*result, 3); |
| 533 | } | ||
| 534 | } | ||
| 535 | } | ||
| 536 | |||
| 537 | // then check building | ||
| 538 |
2/2✓ Branch 1 taken 43853 times.
✓ Branch 4 taken 43853 times.
|
43853 | building = this->model().building(); |
| 539 |
2/2✓ Branch 0 taken 42297 times.
✓ Branch 1 taken 1556 times.
|
43853 | if (building) { |
| 540 |
2/2✓ Branch 1 taken 42297 times.
✓ Branch 4 taken 42297 times.
|
42297 | defaultConstructionSet = building->defaultConstructionSet(); |
| 541 |
2/2✓ Branch 0 taken 21894 times.
✓ Branch 1 taken 20403 times.
|
42297 | if (defaultConstructionSet) { |
| 542 |
2/2✓ Branch 1 taken 21894 times.
✓ Branch 4 taken 21894 times.
|
21894 | result = defaultConstructionSet->getDefaultConstruction(planarSurface); |
| 543 |
2/2✓ Branch 0 taken 21402 times.
✓ Branch 1 taken 492 times.
|
21894 | if (result) { |
| 544 |
3/3✓ Branch 1 taken 21402 times.
✓ Branch 4 taken 21402 times.
✓ Branch 7 taken 21402 times.
|
21402 | return std::make_pair(*result, 4); |
| 545 | } | ||
| 546 | } | ||
| 547 | |||
| 548 | // then check building's space type | ||
| 549 |
2/2✓ Branch 1 taken 20895 times.
✓ Branch 4 taken 20895 times.
|
20895 | spaceType = building->spaceType(); |
| 550 |
2/2✓ Branch 0 taken 1162 times.
✓ Branch 1 taken 19733 times.
|
20895 | if (spaceType) { |
| 551 |
2/2✓ Branch 1 taken 1162 times.
✓ Branch 4 taken 1162 times.
|
1162 | defaultConstructionSet = spaceType->defaultConstructionSet(); |
| 552 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 1131 times.
|
1162 | if (defaultConstructionSet) { |
| 553 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | result = defaultConstructionSet->getDefaultConstruction(planarSurface); |
| 554 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | if (result) { |
| 555 |
3/3✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
|
31 | return std::make_pair(*result, 5); |
| 556 | } | ||
| 557 | } | ||
| 558 | } | ||
| 559 | } | ||
| 560 | |||
| 561 | 22420 | return boost::none; | |
| 562 | 44109 | } | |
| 563 | |||
| 564 | 243 | bool Space_Impl::setDefaultConstructionSet(const DefaultConstructionSet& defaultConstructionSet) { | |
| 565 |
2/2✓ Branch 1 taken 243 times.
✓ Branch 4 taken 243 times.
|
243 | return setPointer(OS_SpaceFields::DefaultConstructionSetName, defaultConstructionSet.handle()); |
| 566 | } | ||
| 567 | |||
| 568 | 692 | void Space_Impl::resetDefaultConstructionSet() { | |
| 569 |
2/2✓ Branch 1 taken 692 times.
✓ Branch 4 taken 692 times.
|
1384 | setString(OS_SpaceFields::DefaultConstructionSetName, ""); |
| 570 | 692 | } | |
| 571 | |||
| 572 | 613 | boost::optional<DefaultScheduleSet> Space_Impl::defaultScheduleSet() const { | |
| 573 |
2/2✓ Branch 1 taken 613 times.
✓ Branch 4 taken 613 times.
|
613 | return getObject<ModelObject>().getModelObjectTarget<DefaultScheduleSet>(OS_SpaceFields::DefaultScheduleSetName); |
| 574 | } | ||
| 575 | |||
| 576 | 613 | boost::optional<Schedule> Space_Impl::getDefaultSchedule(const DefaultScheduleType& defaultScheduleType) const { | |
| 577 | 613 | boost::optional<Schedule> result; | |
| 578 | 613 | boost::optional<DefaultScheduleSet> defaultScheduleSet; | |
| 579 | 613 | boost::optional<SpaceType> spaceType; | |
| 580 | 613 | boost::optional<BuildingStory> buildingStory; | |
| 581 | 613 | boost::optional<Building> building; | |
| 582 | |||
| 583 | // first check this object | ||
| 584 |
1/1✓ Branch 1 taken 613 times.
|
613 | defaultScheduleSet = this->defaultScheduleSet(); |
| 585 |
2/2✓ Branch 0 taken 185 times.
✓ Branch 1 taken 428 times.
|
613 | if (defaultScheduleSet) { |
| 586 |
2/2✓ Branch 1 taken 185 times.
✓ Branch 4 taken 185 times.
|
185 | result = defaultScheduleSet->getDefaultSchedule(defaultScheduleType); |
| 587 |
2/2✓ Branch 0 taken 184 times.
✓ Branch 1 taken 1 time.
|
185 | if (result) { |
| 588 | 184 | return result; | |
| 589 | } | ||
| 590 | } | ||
| 591 | |||
| 592 | // then check space type | ||
| 593 |
1/1✓ Branch 1 taken 429 times.
|
429 | spaceType = this->spaceType(); |
| 594 |
2/2✓ Branch 0 taken 342 times.
✓ Branch 1 taken 87 times.
|
429 | if (spaceType) { |
| 595 |
2/2✓ Branch 1 taken 342 times.
✓ Branch 4 taken 342 times.
|
342 | defaultScheduleSet = spaceType->defaultScheduleSet(); |
| 596 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 336 times.
|
342 | if (defaultScheduleSet) { |
| 597 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | result = defaultScheduleSet->getDefaultSchedule(defaultScheduleType); |
| 598 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if (result) { |
| 599 | 6 | return result; | |
| 600 | } | ||
| 601 | } | ||
| 602 | } | ||
| 603 | |||
| 604 | // then check building story | ||
| 605 |
1/1✓ Branch 1 taken 423 times.
|
423 | buildingStory = this->buildingStory(); |
| 606 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 388 times.
|
423 | if (buildingStory) { |
| 607 |
2/2✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
|
35 | defaultScheduleSet = buildingStory->defaultScheduleSet(); |
| 608 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if (defaultScheduleSet) { |
| 609 | ✗ | result = defaultScheduleSet->getDefaultSchedule(defaultScheduleType); | |
| 610 | ✗ | if (result) { | |
| 611 | ✗ | return result; | |
| 612 | } | ||
| 613 | } | ||
| 614 | } | ||
| 615 | |||
| 616 | // then check building | ||
| 617 |
2/2✓ Branch 1 taken 423 times.
✓ Branch 4 taken 423 times.
|
423 | building = this->model().building(); |
| 618 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 39 times.
|
423 | if (building) { |
| 619 |
2/2✓ Branch 1 taken 384 times.
✓ Branch 4 taken 384 times.
|
384 | defaultScheduleSet = building->defaultScheduleSet(); |
| 620 |
2/2✓ Branch 0 taken 37 times.
✓ Branch 1 taken 347 times.
|
384 | if (defaultScheduleSet) { |
| 621 |
2/2✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
|
37 | result = defaultScheduleSet->getDefaultSchedule(defaultScheduleType); |
| 622 |
1/2✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
|
37 | if (result) { |
| 623 | 37 | return result; | |
| 624 | } | ||
| 625 | } | ||
| 626 | |||
| 627 | // then check building's space type | ||
| 628 |
2/2✓ Branch 1 taken 347 times.
✓ Branch 4 taken 347 times.
|
347 | spaceType = building->spaceType(); |
| 629 |
2/2✓ Branch 0 taken 158 times.
✓ Branch 1 taken 189 times.
|
347 | if (spaceType) { |
| 630 |
2/2✓ Branch 1 taken 158 times.
✓ Branch 4 taken 158 times.
|
158 | defaultScheduleSet = spaceType->defaultScheduleSet(); |
| 631 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 158 times.
|
158 | if (defaultScheduleSet) { |
| 632 | ✗ | result = defaultScheduleSet->getDefaultSchedule(defaultScheduleType); | |
| 633 | ✗ | if (result) { | |
| 634 | ✗ | return result; | |
| 635 | } | ||
| 636 | } | ||
| 637 | } | ||
| 638 | } | ||
| 639 | |||
| 640 | 386 | return boost::none; | |
| 641 | 613 | } | |
| 642 | |||
| 643 | 1 | bool Space_Impl::setDefaultScheduleSet(const DefaultScheduleSet& defaultScheduleSet) { | |
| 644 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | return setPointer(OS_SpaceFields::DefaultScheduleSetName, defaultScheduleSet.handle()); |
| 645 | } | ||
| 646 | |||
| 647 | ✗ | void Space_Impl::resetDefaultScheduleSet() { | |
| 648 | ✗ | setString(OS_SpaceFields::DefaultScheduleSetName, ""); | |
| 649 | ✗ | } | |
| 650 | |||
| 651 | 86735 | OptionalThermalZone Space_Impl::thermalZone() const { | |
| 652 |
2/2✓ Branch 1 taken 86735 times.
✓ Branch 4 taken 86735 times.
|
86735 | return getObject<ModelObject>().getModelObjectTarget<ThermalZone>(OS_SpaceFields::ThermalZoneName); |
| 653 | } | ||
| 654 | |||
| 655 | 2523 | bool Space_Impl::setThermalZone(ThermalZone& thermalZone) { | |
| 656 |
2/2✓ Branch 1 taken 2523 times.
✓ Branch 4 taken 2523 times.
|
2523 | bool result = this->setPointer(OS_SpaceFields::ThermalZoneName, thermalZone.handle()); |
| 657 |
1/2✓ Branch 0 taken 2523 times.
✗ Branch 1 not taken.
|
2523 | if (result) { |
| 658 | 2523 | thermalZone.checkDaylightingControlsAndIlluminanceMaps(); | |
| 659 | } | ||
| 660 | 2523 | return result; | |
| 661 | } | ||
| 662 | |||
| 663 | 14 | void Space_Impl::resetThermalZone() { | |
| 664 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
28 | bool result = this->setString(OS_SpaceFields::ThermalZoneName, ""); |
| 665 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | OS_ASSERT(result); |
| 666 | 14 | } | |
| 667 | |||
| 668 | 78941 | OptionalBuildingStory Space_Impl::buildingStory() const { | |
| 669 |
2/2✓ Branch 1 taken 78941 times.
✓ Branch 4 taken 78941 times.
|
78941 | return getObject<ModelObject>().getModelObjectTarget<BuildingStory>(OS_SpaceFields::BuildingStoryName); |
| 670 | } | ||
| 671 | |||
| 672 | 2177 | bool Space_Impl::setBuildingStory(const BuildingStory& buildingStory) { | |
| 673 |
2/2✓ Branch 1 taken 2177 times.
✓ Branch 4 taken 2177 times.
|
2177 | return this->setPointer(OS_SpaceFields::BuildingStoryName, buildingStory.handle()); |
| 674 | } | ||
| 675 | |||
| 676 | 36 | void Space_Impl::resetBuildingStory() { | |
| 677 |
2/2✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
|
72 | bool result = this->setString(OS_SpaceFields::BuildingStoryName, ""); |
| 678 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
|
36 | OS_ASSERT(result); |
| 679 | 36 | } | |
| 680 | |||
| 681 | 25728 | boost::optional<BuildingUnit> Space_Impl::buildingUnit() const { | |
| 682 |
2/2✓ Branch 1 taken 25728 times.
✓ Branch 4 taken 25728 times.
|
25728 | return getObject<ModelObject>().getModelObjectTarget<BuildingUnit>(OS_SpaceFields::BuildingUnitName); |
| 683 | } | ||
| 684 | |||
| 685 | 81 | bool Space_Impl::setBuildingUnit(const BuildingUnit& buildingUnit) { | |
| 686 |
2/2✓ Branch 1 taken 81 times.
✓ Branch 4 taken 81 times.
|
81 | return this->setPointer(OS_SpaceFields::BuildingUnitName, buildingUnit.handle()); |
| 687 | } | ||
| 688 | |||
| 689 | 49 | void Space_Impl::resetBuildingUnit() { | |
| 690 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
98 | bool result = this->setString(OS_SpaceFields::BuildingUnitName, ""); |
| 691 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 49 times.
|
49 | OS_ASSERT(result); |
| 692 | 49 | } | |
| 693 | |||
| 694 | 42040 | ShadingSurfaceGroupVector Space_Impl::shadingSurfaceGroups() const { | |
| 695 |
3/3✓ Branch 1 taken 42040 times.
✓ Branch 4 taken 42040 times.
✓ Branch 7 taken 42040 times.
|
42040 | return getObject<ModelObject>().getModelObjectSources<ShadingSurfaceGroup>(ShadingSurfaceGroup::iddObjectType()); |
| 696 | } | ||
| 697 | |||
| 698 | 42039 | InteriorPartitionSurfaceGroupVector Space_Impl::interiorPartitionSurfaceGroups() const { | |
| 699 |
3/3✓ Branch 1 taken 42039 times.
✓ Branch 4 taken 42039 times.
✓ Branch 7 taken 42039 times.
|
42039 | return getObject<ModelObject>().getModelObjectSources<InteriorPartitionSurfaceGroup>(InteriorPartitionSurfaceGroup::iddObjectType()); |
| 700 | } | ||
| 701 | |||
| 702 | 168587 | SurfaceVector Space_Impl::surfaces() const { | |
| 703 |
3/3✓ Branch 1 taken 168587 times.
✓ Branch 4 taken 168587 times.
✓ Branch 7 taken 168587 times.
|
168587 | return getObject<ModelObject>().getModelObjectSources<Surface>(Surface::iddObjectType()); |
| 704 | } | ||
| 705 | |||
| 706 | 2320 | std::vector<InternalMass> Space_Impl::internalMass() const { | |
| 707 |
3/3✓ Branch 1 taken 2320 times.
✓ Branch 4 taken 2320 times.
✓ Branch 7 taken 2320 times.
|
2320 | return getObject<Space>().getModelObjectSources<InternalMass>(InternalMass::iddObjectType()); |
| 708 | } | ||
| 709 | |||
| 710 | 3335 | PeopleVector Space_Impl::people() const { | |
| 711 |
3/3✓ Branch 1 taken 3335 times.
✓ Branch 4 taken 3335 times.
✓ Branch 7 taken 3335 times.
|
3335 | return getObject<ModelObject>().getModelObjectSources<People>(People::iddObjectType()); |
| 712 | } | ||
| 713 | |||
| 714 | 2584 | LightsVector Space_Impl::lights() const { | |
| 715 |
3/3✓ Branch 1 taken 2584 times.
✓ Branch 4 taken 2584 times.
✓ Branch 7 taken 2584 times.
|
2584 | return getObject<ModelObject>().getModelObjectSources<Lights>(Lights::iddObjectType()); |
| 716 | } | ||
| 717 | |||
| 718 | 42051 | LuminaireVector Space_Impl::luminaires() const { | |
| 719 |
3/3✓ Branch 1 taken 42051 times.
✓ Branch 4 taken 42051 times.
✓ Branch 7 taken 42051 times.
|
42051 | return getObject<ModelObject>().getModelObjectSources<Luminaire>(Luminaire::iddObjectType()); |
| 720 | } | ||
| 721 | |||
| 722 | 2508 | ElectricEquipmentVector Space_Impl::electricEquipment() const { | |
| 723 |
3/3✓ Branch 1 taken 2508 times.
✓ Branch 4 taken 2508 times.
✓ Branch 7 taken 2508 times.
|
2508 | return getObject<ModelObject>().getModelObjectSources<ElectricEquipment>(ElectricEquipment::iddObjectType()); |
| 724 | } | ||
| 725 | |||
| 726 | 2385 | ElectricEquipmentITEAirCooledVector Space_Impl::electricEquipmentITEAirCooled() const { | |
| 727 |
3/3✓ Branch 1 taken 2385 times.
✓ Branch 4 taken 2385 times.
✓ Branch 7 taken 2385 times.
|
2385 | return getObject<ModelObject>().getModelObjectSources<ElectricEquipmentITEAirCooled>(ElectricEquipmentITEAirCooled::iddObjectType()); |
| 728 | } | ||
| 729 | |||
| 730 | 2357 | GasEquipmentVector Space_Impl::gasEquipment() const { | |
| 731 |
3/3✓ Branch 1 taken 2357 times.
✓ Branch 4 taken 2357 times.
✓ Branch 7 taken 2357 times.
|
2357 | return getObject<ModelObject>().getModelObjectSources<GasEquipment>(GasEquipment::iddObjectType()); |
| 732 | } | ||
| 733 | |||
| 734 | 2356 | HotWaterEquipmentVector Space_Impl::hotWaterEquipment() const { | |
| 735 |
3/3✓ Branch 1 taken 2356 times.
✓ Branch 4 taken 2356 times.
✓ Branch 7 taken 2356 times.
|
2356 | return getObject<ModelObject>().getModelObjectSources<HotWaterEquipment>(HotWaterEquipment::iddObjectType()); |
| 736 | } | ||
| 737 | |||
| 738 | 2320 | SteamEquipmentVector Space_Impl::steamEquipment() const { | |
| 739 |
3/3✓ Branch 1 taken 2320 times.
✓ Branch 4 taken 2320 times.
✓ Branch 7 taken 2320 times.
|
2320 | return getObject<ModelObject>().getModelObjectSources<SteamEquipment>(SteamEquipment::iddObjectType()); |
| 740 | } | ||
| 741 | |||
| 742 | 2320 | OtherEquipmentVector Space_Impl::otherEquipment() const { | |
| 743 |
3/3✓ Branch 1 taken 2320 times.
✓ Branch 4 taken 2320 times.
✓ Branch 7 taken 2320 times.
|
2320 | return getObject<ModelObject>().getModelObjectSources<OtherEquipment>(OtherEquipment::iddObjectType()); |
| 744 | } | ||
| 745 | |||
| 746 | 1749 | WaterUseEquipmentVector Space_Impl::waterUseEquipment() const { | |
| 747 |
3/3✓ Branch 1 taken 1749 times.
✓ Branch 4 taken 1749 times.
✓ Branch 7 taken 1749 times.
|
1749 | return getObject<ModelObject>().getModelObjectSources<WaterUseEquipment>(WaterUseEquipment::iddObjectType()); |
| 748 | } | ||
| 749 | |||
| 750 | 43001 | DaylightingControlVector Space_Impl::daylightingControls() const { | |
| 751 |
3/3✓ Branch 1 taken 43001 times.
✓ Branch 4 taken 43001 times.
✓ Branch 7 taken 43001 times.
|
43001 | return getObject<ModelObject>().getModelObjectSources<DaylightingControl>(DaylightingControl::iddObjectType()); |
| 752 | } | ||
| 753 | |||
| 754 | 41839 | IlluminanceMapVector Space_Impl::illuminanceMaps() const { | |
| 755 |
3/3✓ Branch 1 taken 41839 times.
✓ Branch 4 taken 41839 times.
✓ Branch 7 taken 41839 times.
|
41839 | return getObject<ModelObject>().getModelObjectSources<IlluminanceMap>(IlluminanceMap::iddObjectType()); |
| 756 | } | ||
| 757 | |||
| 758 | 40586 | GlareSensorVector Space_Impl::glareSensors() const { | |
| 759 |
3/3✓ Branch 1 taken 40586 times.
✓ Branch 4 taken 40586 times.
✓ Branch 7 taken 40586 times.
|
40586 | return getObject<ModelObject>().getModelObjectSources<GlareSensor>(GlareSensor::iddObjectType()); |
| 760 | } | ||
| 761 | |||
| 762 | 2361 | SpaceInfiltrationDesignFlowRateVector Space_Impl::spaceInfiltrationDesignFlowRates() const { | |
| 763 |
3/3✓ Branch 1 taken 2361 times.
✓ Branch 4 taken 2361 times.
✓ Branch 7 taken 2361 times.
|
2361 | return getObject<ModelObject>().getModelObjectSources<SpaceInfiltrationDesignFlowRate>(SpaceInfiltrationDesignFlowRate::iddObjectType()); |
| 764 | } | ||
| 765 | |||
| 766 | 2320 | SpaceInfiltrationEffectiveLeakageAreaVector Space_Impl::spaceInfiltrationEffectiveLeakageAreas() const { | |
| 767 |
1/1✓ Branch 1 taken 2320 times.
|
4640 | return getObject<ModelObject>().getModelObjectSources<SpaceInfiltrationEffectiveLeakageArea>( |
| 768 |
2/2✓ Branch 1 taken 2320 times.
✓ Branch 4 taken 2320 times.
|
4640 | SpaceInfiltrationEffectiveLeakageArea::iddObjectType()); |
| 769 | } | ||
| 770 | |||
| 771 | 2323 | SpaceInfiltrationFlowCoefficientVector Space_Impl::spaceInfiltrationFlowCoefficients() const { | |
| 772 |
3/3✓ Branch 1 taken 2323 times.
✓ Branch 4 taken 2323 times.
✓ Branch 7 taken 2323 times.
|
2323 | return getObject<ModelObject>().getModelObjectSources<SpaceInfiltrationFlowCoefficient>(SpaceInfiltrationFlowCoefficient::iddObjectType()); |
| 773 | } | ||
| 774 | |||
| 775 | 789 | boost::optional<DesignSpecificationOutdoorAir> Space_Impl::designSpecificationOutdoorAir() const { | |
| 776 | 789 | boost::optional<DesignSpecificationOutdoorAir> result; | |
| 777 | |||
| 778 |
2/2✓ Branch 1 taken 789 times.
✓ Branch 4 taken 789 times.
|
789 | result = getObject<ModelObject>().getModelObjectTarget<DesignSpecificationOutdoorAir>(OS_SpaceFields::DesignSpecificationOutdoorAirObjectName); |
| 779 | |||
| 780 |
2/2✓ Branch 1 taken 702 times.
✓ Branch 2 taken 87 times.
|
789 | if (!result) { |
| 781 |
1/1✓ Branch 1 taken 702 times.
|
702 | boost::optional<SpaceType> spaceType = this->spaceType(); |
| 782 |
2/2✓ Branch 0 taken 546 times.
✓ Branch 1 taken 156 times.
|
702 | if (spaceType) { |
| 783 |
2/2✓ Branch 1 taken 546 times.
✓ Branch 4 taken 546 times.
|
546 | result = spaceType->designSpecificationOutdoorAir(); |
| 784 | } | ||
| 785 | 702 | } | |
| 786 | |||
| 787 | 789 | return result; | |
| 788 | ✗ | } | |
| 789 | |||
| 790 | 54 | bool Space_Impl::isDesignSpecificationOutdoorAirDefaulted() const { | |
| 791 | 54 | return isEmpty(OS_SpaceFields::DesignSpecificationOutdoorAirObjectName); | |
| 792 | } | ||
| 793 | |||
| 794 | 130 | bool Space_Impl::setDesignSpecificationOutdoorAir(const DesignSpecificationOutdoorAir& designSpecificationOutdoorAir) { | |
| 795 |
2/2✓ Branch 1 taken 130 times.
✓ Branch 4 taken 130 times.
|
130 | return setPointer(OS_SpaceFields::DesignSpecificationOutdoorAirObjectName, designSpecificationOutdoorAir.handle()); |
| 796 | } | ||
| 797 | |||
| 798 | 1 | void Space_Impl::resetDesignSpecificationOutdoorAir() { | |
| 799 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool test = setString(OS_SpaceFields::DesignSpecificationOutdoorAirObjectName, ""); |
| 800 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(test); |
| 801 | 1 | } | |
| 802 | |||
| 803 | 1771 | int Space_Impl::multiplier() const { | |
| 804 | 1771 | int result = 1; | |
| 805 |
1/1✓ Branch 1 taken 1771 times.
|
1771 | OptionalThermalZone thermalZone = this->thermalZone(); |
| 806 |
2/2✓ Branch 0 taken 1388 times.
✓ Branch 1 taken 383 times.
|
1771 | if (thermalZone) { |
| 807 |
2/2✓ Branch 1 taken 1388 times.
✓ Branch 4 taken 1388 times.
|
1388 | result = thermalZone->multiplier(); |
| 808 | } | ||
| 809 | 1771 | return result; | |
| 810 | 1771 | } | |
| 811 | |||
| 812 | 50 | double Space_Impl::exteriorArea() const { | |
| 813 | 50 | double result = 0; | |
| 814 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 8 taken 240 times.
✓ Branch 9 taken 50 times.
|
290 | for (const Surface& surface : this->surfaces()) { |
| 815 |
5/5✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
✓ Branch 7 taken 240 times.
✓ Branch 11 taken 180 times.
✓ Branch 12 taken 60 times.
|
480 | if (istringEqual(surface.outsideBoundaryCondition(), "Outdoors")) { |
| 816 |
1/1✓ Branch 1 taken 180 times.
|
180 | result += surface.grossArea(); |
| 817 | } | ||
| 818 | 50 | } | |
| 819 | 50 | return result; | |
| 820 | } | ||
| 821 | |||
| 822 | 37 | double Space_Impl::exteriorWallArea() const { | |
| 823 | 37 | double result = 0; | |
| 824 |
3/3✓ Branch 1 taken 37 times.
✓ Branch 8 taken 162 times.
✓ Branch 9 taken 37 times.
|
199 | for (const Surface& surface : this->surfaces()) { |
| 825 |
5/5✓ Branch 1 taken 162 times.
✓ Branch 4 taken 162 times.
✓ Branch 7 taken 162 times.
✓ Branch 11 taken 135 times.
✓ Branch 12 taken 27 times.
|
324 | if (istringEqual(surface.outsideBoundaryCondition(), "Outdoors")) { |
| 826 |
5/5✓ Branch 1 taken 135 times.
✓ Branch 4 taken 135 times.
✓ Branch 7 taken 135 times.
✓ Branch 11 taken 108 times.
✓ Branch 12 taken 27 times.
|
270 | if (istringEqual(surface.surfaceType(), "Wall")) { |
| 827 |
1/1✓ Branch 1 taken 108 times.
|
108 | result += surface.grossArea(); |
| 828 | } | ||
| 829 | } | ||
| 830 | 37 | } | |
| 831 | 37 | return result; | |
| 832 | } | ||
| 833 | |||
| 834 | 873 | Polyhedron Space_Impl::polyhedron() const { | |
| 835 |
1/1✓ Branch 1 taken 873 times.
|
873 | auto sfs = surfaces(); |
| 836 | 873 | std::vector<Surface3d> surface3ds; | |
| 837 |
1/1✓ Branch 2 taken 873 times.
|
873 | surface3ds.reserve(sfs.size()); |
| 838 |
2/2✓ Branch 4 taken 6193 times.
✓ Branch 5 taken 873 times.
|
7066 | for (size_t surfNum = 0; auto& surface : sfs) { |
| 839 |
3/3✓ Branch 1 taken 6193 times.
✓ Branch 4 taken 6193 times.
✓ Branch 7 taken 6193 times.
|
6193 | surface3ds.emplace_back(surface.vertices(), surface.nameString(), surfNum++); |
| 840 | } | ||
| 841 |
2/2✓ Branch 1 taken 873 times.
✓ Branch 4 taken 873 times.
|
1746 | return {surface3ds}; |
| 842 | 873 | } | |
| 843 | |||
| 844 | 4356 | bool Space_Impl::isEnclosedVolume() const { | |
| 845 |
2/2✓ Branch 1 taken 4338 times.
✓ Branch 2 taken 18 times.
|
4356 | if (m_cachedIsEnclosed.has_value()) { |
| 846 |
1/1✓ Branch 1 taken 4338 times.
|
4338 | return m_cachedIsEnclosed.get(); |
| 847 | } | ||
| 848 |
1/1✓ Branch 1 taken 18 times.
|
18 | auto volumePoly = this->polyhedron(); |
| 849 |
1/1✓ Branch 1 taken 18 times.
|
18 | auto isVolEnclosed = volumePoly.isEnclosedVolume(); |
| 850 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 16 times.
|
18 | if (!isVolEnclosed) { |
| 851 |
1/1✓ Branch 1 taken 2 times.
|
2 | const auto edgesNot2 = volumePoly.edgesNotTwo(); |
| 852 |
9/9✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 21 taken 2 times.
✓ Branch 24 taken 2 times.
✓ Branch 27 taken 2 times.
|
2 | LOG(Warn, briefDescription() << " is not enclosed, there are " << edgesNot2.size() << " edges that aren't used exactly twice"); |
| 853 |
2/2✓ Branch 5 taken 8 times.
✓ Branch 6 taken 2 times.
|
10 | for (const auto& edge : edgesNot2) { |
| 854 |
5/5✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
✓ Branch 13 taken 8 times.
|
8 | LOG(Debug, edge); |
| 855 | } | ||
| 856 | 2 | } | |
| 857 | 18 | return isVolEnclosed; | |
| 858 | 18 | } | |
| 859 | |||
| 860 | 39 | double Space_Impl::ceilingHeight() const { | |
| 861 |
1/1✓ Branch 1 taken 39 times.
|
39 | boost::optional<double> value = getDouble(OS_SpaceFields::CeilingHeight, true); |
| 862 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 38 times.
|
39 | if (value) { |
| 863 |
1/1✓ Branch 1 taken 1 time.
|
1 | return value.get(); |
| 864 | } | ||
| 865 | |||
| 866 | 38 | double result = 0; | |
| 867 | |||
| 868 | // TODO: need a better method | ||
| 869 | 38 | double roofHeight = 0; | |
| 870 | 38 | int numRoof = 0; | |
| 871 | 38 | double floorHeight = 0; | |
| 872 | 38 | int numFloor = 0; | |
| 873 |
3/3✓ Branch 1 taken 38 times.
✓ Branch 8 taken 169 times.
✓ Branch 9 taken 38 times.
|
207 | for (const Surface& surface : this->surfaces()) { |
| 874 |
5/5✓ Branch 1 taken 169 times.
✓ Branch 4 taken 169 times.
✓ Branch 7 taken 169 times.
✓ Branch 11 taken 44 times.
✓ Branch 12 taken 125 times.
|
338 | if (istringEqual(surface.surfaceType(), "Floor")) { |
| 875 |
3/3✓ Branch 1 taken 44 times.
✓ Branch 7 taken 180 times.
✓ Branch 8 taken 44 times.
|
224 | for (const Point3d& point : surface.vertices()) { |
| 876 |
1/1✓ Branch 1 taken 180 times.
|
180 | floorHeight += point.z(); |
| 877 | 180 | ++numFloor; | |
| 878 | 44 | } | |
| 879 |
5/5✓ Branch 1 taken 125 times.
✓ Branch 4 taken 125 times.
✓ Branch 7 taken 125 times.
✓ Branch 11 taken 24 times.
✓ Branch 12 taken 101 times.
|
250 | } else if (istringEqual(surface.surfaceType(), "RoofCeiling")) { |
| 880 |
3/3✓ Branch 1 taken 24 times.
✓ Branch 7 taken 100 times.
✓ Branch 8 taken 24 times.
|
124 | for (const Point3d& point : surface.vertices()) { |
| 881 |
1/1✓ Branch 1 taken 100 times.
|
100 | roofHeight += point.z(); |
| 882 | 100 | ++numRoof; | |
| 883 | 24 | } | |
| 884 | } | ||
| 885 | 38 | } | |
| 886 | |||
| 887 |
3/4✓ Branch 0 taken 16 times.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
|
38 | if ((numRoof > 0) && (numFloor > 0)) { |
| 888 | 16 | roofHeight /= numRoof; | |
| 889 | 16 | floorHeight /= numFloor; | |
| 890 | 16 | result = roofHeight - floorHeight; | |
| 891 | } | ||
| 892 | |||
| 893 | 38 | return result; | |
| 894 | } | ||
| 895 | |||
| 896 | 576 | bool Space_Impl::isCeilingHeightDefaulted() const { | |
| 897 | 576 | return isEmpty(OS_SpaceFields::CeilingHeight); | |
| 898 | } | ||
| 899 | |||
| 900 | 5 | bool Space_Impl::isCeilingHeightAutocalculated() const { | |
| 901 | 5 | bool result = false; | |
| 902 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<std::string> value = getString(OS_SpaceFields::CeilingHeight, true); |
| 903 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (value) { |
| 904 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
10 | result = openstudio::istringEqual(value.get(), "Autocalculate"); |
| 905 | } | ||
| 906 | 5 | return result; | |
| 907 | 5 | } | |
| 908 | |||
| 909 | ✗ | std::vector<Surface> Space_Impl::findSurfacesWithIncorrectOrientationRaycasting() const { | |
| 910 | ✗ | std::vector<Surface> result; | |
| 911 | |||
| 912 | ✗ | const Point3d p0{}; | |
| 913 | |||
| 914 | ✗ | auto surfaces = this->surfaces(); | |
| 915 | ✗ | for (const auto& surface : surfaces) { | |
| 916 | |||
| 917 | ✗ | auto outwardNormal = surface.outwardNormal(); | |
| 918 | ✗ | auto inwardNormal = outwardNormal.reverseVector(); | |
| 919 | |||
| 920 | ✗ | auto surfacePoint = surface.centroid(); | |
| 921 | ✗ | bool found = false; | |
| 922 | ✗ | for (const auto& anotherSurface : surfaces) { | |
| 923 | ✗ | if (surface == anotherSurface) { | |
| 924 | ✗ | continue; | |
| 925 | } | ||
| 926 | ✗ | auto anotherPlane = anotherSurface.plane(); | |
| 927 | ✗ | const double vd = anotherPlane.outwardNormal().dot(outwardNormal); | |
| 928 | |||
| 929 | ✗ | auto reversedPlane = anotherPlane.reversePlane(); | |
| 930 | ✗ | const double vd2 = reversedPlane.outwardNormal().dot(inwardNormal); | |
| 931 | ✗ | OS_ASSERT(vd == vd2); | |
| 932 | |||
| 933 | // If this isn't orthogonal | ||
| 934 | ✗ | if (std::abs(vd) < 0.001) { | |
| 935 | ✗ | LOG(Debug, "Surface " << surface.nameString() << " is orthogonal to " << anotherSurface.nameString()); | |
| 936 | ✗ | continue; | |
| 937 | ✗ | } | |
| 938 | ✗ | if (vd < 0) { | |
| 939 | ✗ | LOG(Debug, "Surfaces '" << surface.nameString() << "' and '" << anotherSurface.nameString() | |
| 940 | << "' are seemingly pointing in the opposite outward direction, which is a good sign."); | ||
| 941 | } else { | ||
| 942 | ✗ | LOG(Debug, "Surfaces '" << surface.nameString() << "' and '" << anotherSurface.nameString() | |
| 943 | << "' are seemingly pointing in the same outward direction, potentially one is in the wrong direction."); | ||
| 944 | } | ||
| 945 | |||
| 946 | ✗ | const double v0 = anotherPlane.outwardNormal().dot(surfacePoint - p0) + anotherPlane.d(); | |
| 947 | ✗ | const double v02 = -(reversedPlane.outwardNormal().dot(surfacePoint - p0) + reversedPlane.d()); | |
| 948 | ✗ | OS_ASSERT(v0 == v02); | |
| 949 | ✗ | const double t = v0 / vd; | |
| 950 | ✗ | if (t > 0.0) { | |
| 951 | ✗ | LOG(Debug, "Surface '" << surface.nameString() << "' raycasts to " << anotherSurface.nameString()); | |
| 952 | ✗ | found = true; | |
| 953 | ✗ | break; | |
| 954 | } else { | ||
| 955 | ✗ | LOG(Debug, "Surface '" << surface.nameString() << "' does not raycast to " << anotherSurface.nameString()); | |
| 956 | } | ||
| 957 | } | ||
| 958 | ✗ | if (!found) { | |
| 959 | ✗ | result.push_back(surface); | |
| 960 | } | ||
| 961 | ✗ | } | |
| 962 | |||
| 963 | ✗ | return result; | |
| 964 | ✗ | } | |
| 965 | |||
| 966 | 590 | std::vector<Surface> Space_Impl::findSurfacesWithIncorrectOrientationPolyhedron(const Polyhedron& volumePoly) const { | |
| 967 |
1/1✓ Branch 1 taken 590 times.
|
590 | auto sf3ds = volumePoly.findSurfacesWithIncorrectOrientation(); |
| 968 |
2/2✓ Branch 1 taken 571 times.
✓ Branch 2 taken 19 times.
|
590 | if (sf3ds.empty()) { |
| 969 | 571 | return {}; | |
| 970 | } | ||
| 971 | 19 | std::vector<std::string> sfNames; | |
| 972 |
1/1✓ Branch 2 taken 19 times.
|
19 | sfNames.reserve(sf3ds.size()); |
| 973 |
2/2✓ Branch 2 taken 19 times.
✓ Branch 7 taken 19 times.
|
53 | std::transform(sf3ds.cbegin(), sf3ds.cend(), std::back_inserter(sfNames), [](const auto& sf3d) { return sf3d.name; }); |
| 974 |
1/1✓ Branch 1 taken 19 times.
|
19 | std::vector<Surface> surfaces = this->surfaces(); |
| 975 |
2/2✓ Branch 4 taken 19 times.
✓ Branch 8 taken 19 times.
|
19 | surfaces.erase(std::remove_if(surfaces.begin(), surfaces.end(), |
| 976 | 149 | [&sfNames](const auto& surface) { | |
| 977 |
2/2✓ Branch 2 taken 149 times.
✓ Branch 7 taken 149 times.
|
149 | return std::find(sfNames.cbegin(), sfNames.cend(), surface.nameString()) == sfNames.cend(); |
| 978 | }), | ||
| 979 | 19 | surfaces.end()); | |
| 980 | 19 | return surfaces; | |
| 981 | 590 | } | |
| 982 | |||
| 983 | 4371 | std::vector<Surface> Space_Impl::findSurfacesWithIncorrectOrientation() const { | |
| 984 |
2/2✓ Branch 1 taken 4338 times.
✓ Branch 2 taken 33 times.
|
4371 | if (m_cachedNonConvexSurfaces.has_value()) { |
| 985 |
2/2✓ Branch 1 taken 4338 times.
✓ Branch 4 taken 4338 times.
|
4338 | return m_cachedNonConvexSurfaces.get(); |
| 986 | } | ||
| 987 |
1/1✓ Branch 1 taken 33 times.
|
33 | auto volumePoly = this->polyhedron(); |
| 988 | // Actually, its perfectly fine to lookup incorrect orientations even if the polyhedron isn't enclosed... | ||
| 989 | // If a Box space is missing one wall for eg, the opposite wall will be deemed incorrectly oriented if using ray casting. | ||
| 990 |
1/1✓ Branch 1 taken 33 times.
|
33 | return findSurfacesWithIncorrectOrientationPolyhedron(volumePoly); |
| 991 | // if (volumePoly.isEnclosedVolume()) { | ||
| 992 | // return findSurfacesWithIncorrectOrientationPolyhedron(volumePoly); | ||
| 993 | // } | ||
| 994 | // LOG(Warn, "Can't lookup surfaces with incorrect orientations for a non-enclosed Polyhedron, falling back to the Raycasting method. " | ||
| 995 | // "This will produce false-negatives for non-convex spaces such as H-shaped spaces."); | ||
| 996 | // return findSurfacesWithIncorrectOrientationRaycasting(); | ||
| 997 | 33 | } | |
| 998 | |||
| 999 | 20 | bool Space_Impl::areAllSurfacesCorrectlyOriented() const { | |
| 1000 |
1/1✓ Branch 1 taken 20 times.
|
20 | auto surfaces = findSurfacesWithIncorrectOrientation(); |
| 1001 |
2/2✓ Branch 5 taken 11 times.
✓ Branch 6 taken 20 times.
|
31 | for (const auto& surface : surfaces) { |
| 1002 |
11/11✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✓ Branch 10 taken 11 times.
✓ Branch 13 taken 11 times.
✓ Branch 16 taken 11 times.
✓ Branch 19 taken 11 times.
✓ Branch 22 taken 11 times.
✓ Branch 27 taken 11 times.
✓ Branch 30 taken 11 times.
✓ Branch 33 taken 11 times.
|
11 | LOG(Error, |
| 1003 | "In Space '" << nameString() << "', Surface '" << surface.nameString() << "' has an outward normal pointing in the wrong direction."); | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | 40 | return surfaces.empty(); | |
| 1007 | 20 | } | |
| 1008 | |||
| 1009 | 5 | bool Space_Impl::fixSurfacesWithIncorrectOrientation() { | |
| 1010 | |||
| 1011 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto surfaces = findSurfacesWithIncorrectOrientation(); |
| 1012 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | if (surfaces.empty()) { |
| 1013 | ✗ | return false; | |
| 1014 | } | ||
| 1015 | |||
| 1016 |
2/2✓ Branch 5 taken 10 times.
✓ Branch 6 taken 5 times.
|
15 | for (auto& surface : surfaces) { |
| 1017 |
1/1✓ Branch 1 taken 10 times.
|
10 | auto vertices = surface.vertices(); |
| 1018 | |||
| 1019 |
11/11✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
✓ Branch 16 taken 10 times.
✓ Branch 19 taken 10 times.
✓ Branch 22 taken 10 times.
✓ Branch 27 taken 10 times.
✓ Branch 30 taken 10 times.
✓ Branch 33 taken 10 times.
|
10 | LOG(Error, "In Space '" << nameString() << "', Surface '" << surface.nameString() |
| 1020 | << "' has an outward normal pointing in the wrong direction. Flipping it."); | ||
| 1021 |
1/1✓ Branch 3 taken 10 times.
|
10 | std::reverse(vertices.begin(), vertices.end()); |
| 1022 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | surface.setVertices(openstudio::reorderULC(vertices)); |
| 1023 | 10 | } | |
| 1024 | 5 | return true; | |
| 1025 | 5 | } | |
| 1026 | |||
| 1027 | 398 | double Space_Impl::volume() const { | |
| 1028 |
1/1✓ Branch 1 taken 398 times.
|
398 | boost::optional<double> value = getDouble(OS_SpaceFields::Volume, true); |
| 1029 |
2/2✓ Branch 0 taken 134 times.
✓ Branch 1 taken 264 times.
|
398 | if (value) { |
| 1030 |
1/1✓ Branch 1 taken 134 times.
|
134 | return value.get(); |
| 1031 | } | ||
| 1032 | |||
| 1033 |
1/1✓ Branch 1 taken 264 times.
|
264 | auto volumePoly = this->polyhedron(); |
| 1034 | |||
| 1035 |
3/3✓ Branch 1 taken 264 times.
✓ Branch 3 taken 237 times.
✓ Branch 4 taken 27 times.
|
264 | if (volumePoly.isEnclosedVolume()) { |
| 1036 |
3/3✓ Branch 1 taken 237 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 236 times.
|
237 | if (volumePoly.isCompletelyInsideOut()) { |
| 1037 |
1/1✓ Branch 1 taken 1 time.
|
1 | const double volume = volumePoly.polyhedronVolume(); |
| 1038 |
7/7✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
|
1 | LOG(Error, briefDescription() << " has all of its Surfaces that are inside-out. Call Space::fixSurfacesWithIncorrectOrientation()."); |
| 1039 | 1 | return -volume; | |
| 1040 |
3/3✓ Branch 1 taken 236 times.
✓ Branch 3 taken 234 times.
✓ Branch 4 taken 2 times.
|
236 | } else if (!volumePoly.hasAnySurfaceWithIncorrectOrientation()) { |
| 1041 |
1/1✓ Branch 1 taken 234 times.
|
234 | return volumePoly.polyhedronVolume(); |
| 1042 | } else { | ||
| 1043 |
7/7✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 20 taken 2 times.
|
2 | LOG(Warn, briefDescription() << " has some Surfaces with incorrection orientation. Call Space::fixSurfacesWithIncorrectOrientation(). " |
| 1044 | "Falling back to ceilingHeight * floorArea. Volume calculation will be potentially inaccurate."); | ||
| 1045 | } | ||
| 1046 | } else { | ||
| 1047 |
10/10✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
✓ Branch 7 taken 27 times.
✓ Branch 10 taken 27 times.
✓ Branch 13 taken 27 times.
✓ Branch 17 taken 27 times.
✓ Branch 20 taken 27 times.
✓ Branch 25 taken 27 times.
✓ Branch 28 taken 27 times.
✓ Branch 31 taken 27 times.
|
27 | LOG(Warn, briefDescription() << " is not enclosed, there are " << volumePoly.edgesNotTwo().size() |
| 1048 | << " edges that aren't used exactly twice. " | ||
| 1049 | "Falling back to ceilingHeight * floorArea. Volume calculation will be potentially inaccurate."); | ||
| 1050 | } | ||
| 1051 | |||
| 1052 |
2/2✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
|
29 | const double result = this->ceilingHeight() * this->floorArea(); |
| 1053 | |||
| 1054 | 29 | return result; | |
| 1055 | 264 | } | |
| 1056 | |||
| 1057 | 576 | bool Space_Impl::isVolumeDefaulted() const { | |
| 1058 | 576 | return isEmpty(OS_SpaceFields::Volume); | |
| 1059 | } | ||
| 1060 | |||
| 1061 | 8 | bool Space_Impl::isVolumeAutocalculated() const { | |
| 1062 | 8 | bool result = false; | |
| 1063 |
1/1✓ Branch 1 taken 8 times.
|
8 | boost::optional<std::string> value = getString(OS_SpaceFields::Volume, true); |
| 1064 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (value) { |
| 1065 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
|
16 | result = openstudio::istringEqual(value.get(), "Autocalculate"); |
| 1066 | } | ||
| 1067 | 8 | return result; | |
| 1068 | 8 | } | |
| 1069 | |||
| 1070 | 15688 | double Space_Impl::floorArea() const { | |
| 1071 |
1/1✓ Branch 1 taken 15688 times.
|
15688 | boost::optional<double> value = getDouble(OS_SpaceFields::FloorArea, true); |
| 1072 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 15671 times.
|
15688 | if (value) { |
| 1073 |
1/1✓ Branch 1 taken 17 times.
|
17 | return value.get(); |
| 1074 | } | ||
| 1075 | |||
| 1076 | // get all surfaces, sort so results are repeatable | ||
| 1077 |
1/1✓ Branch 1 taken 15671 times.
|
15671 | std::vector<Surface> surfaces = this->surfaces(); |
| 1078 |
1/1✓ Branch 3 taken 15671 times.
|
15671 | std::sort(surfaces.begin(), surfaces.end(), IdfObjectNameLess()); |
| 1079 | |||
| 1080 | 15671 | double result = 0; | |
| 1081 |
2/2✓ Branch 5 taken 132150 times.
✓ Branch 6 taken 15671 times.
|
147821 | for (const Surface& surface : surfaces) { |
| 1082 |
5/5✓ Branch 1 taken 132150 times.
✓ Branch 4 taken 132150 times.
✓ Branch 7 taken 132150 times.
✓ Branch 11 taken 15740 times.
✓ Branch 12 taken 116410 times.
|
264300 | if (istringEqual(surface.surfaceType(), "Floor")) { |
| 1083 |
3/3✓ Branch 1 taken 15740 times.
✓ Branch 3 taken 77 times.
✓ Branch 4 taken 15663 times.
|
15740 | if (surface.isAirWall()) { |
| 1084 | 77 | continue; | |
| 1085 | } | ||
| 1086 |
1/1✓ Branch 1 taken 15663 times.
|
15663 | result += surface.grossArea(); |
| 1087 | } | ||
| 1088 | } | ||
| 1089 | 15671 | return result; | |
| 1090 | 15671 | } | |
| 1091 | |||
| 1092 | 576 | bool Space_Impl::isFloorAreaDefaulted() const { | |
| 1093 | 576 | return isEmpty(OS_SpaceFields::FloorArea); | |
| 1094 | } | ||
| 1095 | |||
| 1096 | 5 | bool Space_Impl::isFloorAreaAutocalculated() const { | |
| 1097 | 5 | bool result = false; | |
| 1098 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<std::string> value = getString(OS_SpaceFields::FloorArea, true); |
| 1099 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (value) { |
| 1100 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
10 | result = openstudio::istringEqual(value.get(), "Autocalculate"); |
| 1101 | } | ||
| 1102 | 5 | return result; | |
| 1103 | 5 | } | |
| 1104 | |||
| 1105 | 962 | double Space_Impl::numberOfPeople() const { | |
| 1106 | 962 | double result = 0.0; | |
| 1107 | 962 | const double area = floorArea(); | |
| 1108 | |||
| 1109 |
3/3✓ Branch 1 taken 962 times.
✓ Branch 7 taken 39 times.
✓ Branch 8 taken 962 times.
|
1001 | for (const People& person : this->people()) { |
| 1110 |
1/1✓ Branch 1 taken 39 times.
|
39 | result += person.getNumberOfPeople(area); |
| 1111 | 962 | } | |
| 1112 | |||
| 1113 |
3/3✓ Branch 1 taken 962 times.
✓ Branch 3 taken 685 times.
✓ Branch 4 taken 277 times.
|
1924 | if (OptionalSpaceType st = spaceType()) { |
| 1114 |
4/4✓ Branch 1 taken 685 times.
✓ Branch 4 taken 685 times.
✓ Branch 10 taken 415 times.
✓ Branch 11 taken 685 times.
|
1100 | for (const People& person : st->people()) { |
| 1115 |
1/1✓ Branch 1 taken 415 times.
|
415 | result += person.getNumberOfPeople(area); |
| 1116 | 685 | } | |
| 1117 | 962 | } | |
| 1118 | |||
| 1119 | 962 | return result; | |
| 1120 | } | ||
| 1121 | |||
| 1122 | ✗ | bool Space_Impl::setNumberOfPeople(double numberOfPeople) { | |
| 1123 | ✗ | OptionalPeople templatePeople; | |
| 1124 | ✗ | PeopleVector myPeople = people(); | |
| 1125 | ✗ | if (myPeople.empty()) { | |
| 1126 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1127 | ✗ | myPeople = st->people(); | |
| 1128 | ✗ | } | |
| 1129 | } | ||
| 1130 | ✗ | if (!myPeople.empty()) { | |
| 1131 | ✗ | templatePeople = myPeople[0]; | |
| 1132 | } | ||
| 1133 | ✗ | return setNumberOfPeople(numberOfPeople, templatePeople); | |
| 1134 | ✗ | } | |
| 1135 | |||
| 1136 | ✗ | bool Space_Impl::setNumberOfPeople(double numberOfPeople, const boost::optional<People>& templatePeople) { | |
| 1137 | ✗ | if (numberOfPeople < 0.0) { | |
| 1138 | ✗ | LOG(Error, "Space cannot set numberOfPeople to " << numberOfPeople << ", the value must be >= 0.0."); | |
| 1139 | ✗ | return false; | |
| 1140 | } | ||
| 1141 | |||
| 1142 | // create or modify People and PeopleDefinition object | ||
| 1143 | ✗ | OptionalPeople myPeople = getMySpaceLoadInstance<People, PeopleDefinition>(templatePeople); | |
| 1144 | ✗ | if (!myPeople) { | |
| 1145 | ✗ | LOG(Error, "The templatePeople object must be in the same Model as this Space."); | |
| 1146 | ✗ | return false; | |
| 1147 | } | ||
| 1148 | |||
| 1149 | // set space and number of people | ||
| 1150 | ✗ | bool ok(true); | |
| 1151 | ✗ | myPeople->makeUnique(); | |
| 1152 | ✗ | ok = myPeople->setSpace(getObject<Space>()); | |
| 1153 | ✗ | OS_ASSERT(ok); | |
| 1154 | ✗ | ok = myPeople->peopleDefinition().setNumberofPeople(numberOfPeople); | |
| 1155 | ✗ | OS_ASSERT(ok); | |
| 1156 | ✗ | ok = myPeople->setMultiplier(1); | |
| 1157 | ✗ | OS_ASSERT(ok); | |
| 1158 | |||
| 1159 | // remove all other people from space | ||
| 1160 | ✗ | PeopleVector allMyPeople = people(); | |
| 1161 | ✗ | removeAllButOneSpaceLoadInstance<People>(allMyPeople, *myPeople); | |
| 1162 | |||
| 1163 | // handle space type | ||
| 1164 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 1165 | ✗ | if (!spaceType->people().empty()) { | |
| 1166 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1167 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1168 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1169 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1170 | ✗ | setSpaceType(*spaceType); | |
| 1171 | } | ||
| 1172 | ✗ | allMyPeople = spaceType->people(); | |
| 1173 | ✗ | for (People& peopleObject : allMyPeople) { | |
| 1174 | ✗ | peopleObject.remove(); | |
| 1175 | } | ||
| 1176 | } | ||
| 1177 | ✗ | } | |
| 1178 | |||
| 1179 | ✗ | return true; | |
| 1180 | ✗ | } | |
| 1181 | |||
| 1182 | 44 | double Space_Impl::peoplePerFloorArea() const { | |
| 1183 | 44 | double result = 0.0; | |
| 1184 | 44 | double area = floorArea(); | |
| 1185 | |||
| 1186 |
2/3✓ Branch 1 taken 44 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 44 times.
|
44 | for (const People& person : this->people()) { |
| 1187 | ✗ | result += person.getPeoplePerFloorArea(area); | |
| 1188 | 44 | } | |
| 1189 | |||
| 1190 |
2/3✓ Branch 1 taken 44 times.
✓ Branch 3 taken 44 times.
✗ Branch 4 not taken.
|
88 | if (OptionalSpaceType st = spaceType()) { |
| 1191 |
4/4✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 10 taken 44 times.
✓ Branch 11 taken 44 times.
|
88 | for (const People& person : st->people()) { |
| 1192 |
1/1✓ Branch 1 taken 44 times.
|
44 | result += person.getPeoplePerFloorArea(area); |
| 1193 | 44 | } | |
| 1194 | 44 | } | |
| 1195 | |||
| 1196 | 44 | return result; | |
| 1197 | } | ||
| 1198 | |||
| 1199 | 2 | bool Space_Impl::setPeoplePerFloorArea(double peoplePerFloorArea) { | |
| 1200 | 2 | OptionalPeople templatePeople; | |
| 1201 |
1/1✓ Branch 1 taken 2 times.
|
2 | PeopleVector myPeople = people(); |
| 1202 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | if (myPeople.empty()) { |
| 1203 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
|
4 | if (OptionalSpaceType st = spaceType()) { |
| 1204 | ✗ | myPeople = st->people(); | |
| 1205 | 2 | } | |
| 1206 | } | ||
| 1207 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if (!myPeople.empty()) { |
| 1208 | ✗ | templatePeople = myPeople[0]; | |
| 1209 | } | ||
| 1210 |
1/1✓ Branch 1 taken 2 times.
|
4 | return setPeoplePerFloorArea(peoplePerFloorArea, templatePeople); |
| 1211 | 2 | } | |
| 1212 | |||
| 1213 | 2 | bool Space_Impl::setPeoplePerFloorArea(double peoplePerFloorArea, const boost::optional<People>& templatePeople) { | |
| 1214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (peoplePerFloorArea < 0.0) { |
| 1215 | ✗ | LOG(Error, "Space cannot set peoplePerFloorArea to " << peoplePerFloorArea << ", the value must be >= 0.0."); | |
| 1216 | ✗ | return false; | |
| 1217 | } | ||
| 1218 | |||
| 1219 | // create or modify People and PeopleDefinition object | ||
| 1220 |
1/1✓ Branch 1 taken 2 times.
|
2 | OptionalPeople myPeople = getMySpaceLoadInstance<People, PeopleDefinition>(templatePeople); |
| 1221 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if (!myPeople) { |
| 1222 | ✗ | LOG(Error, "The templatePeople object must be in the same Model as this Space."); | |
| 1223 | ✗ | return false; | |
| 1224 | } | ||
| 1225 | |||
| 1226 | // set space and number of people | ||
| 1227 | 2 | bool ok(true); | |
| 1228 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | myPeople->makeUnique(); |
| 1229 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | ok = myPeople->setSpace(getObject<Space>()); |
| 1230 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
|
2 | OS_ASSERT(ok); |
| 1231 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | ok = myPeople->peopleDefinition().setPeopleperSpaceFloorArea(peoplePerFloorArea); |
| 1232 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
|
2 | OS_ASSERT(ok); |
| 1233 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | ok = myPeople->setMultiplier(1); |
| 1234 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
|
2 | OS_ASSERT(ok); |
| 1235 | |||
| 1236 | // remove all other people from space | ||
| 1237 |
1/1✓ Branch 1 taken 2 times.
|
2 | PeopleVector allMyPeople = people(); |
| 1238 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | removeAllButOneSpaceLoadInstance<People>(allMyPeople, *myPeople); |
| 1239 | |||
| 1240 | // handle space type | ||
| 1241 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
|
4 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1242 | ✗ | if (!spaceType->people().empty()) { | |
| 1243 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1244 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1245 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1246 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1247 | ✗ | setSpaceType(*spaceType); | |
| 1248 | } | ||
| 1249 | ✗ | allMyPeople = spaceType->people(); | |
| 1250 | ✗ | for (People& peopleObject : allMyPeople) { | |
| 1251 | ✗ | peopleObject.remove(); | |
| 1252 | } | ||
| 1253 | } | ||
| 1254 | 2 | } | |
| 1255 | |||
| 1256 | 2 | return true; | |
| 1257 | 2 | } | |
| 1258 | |||
| 1259 | 44 | double Space_Impl::floorAreaPerPerson() const { | |
| 1260 | 44 | return 1.0 / peoplePerFloorArea(); | |
| 1261 | } | ||
| 1262 | |||
| 1263 | ✗ | bool Space_Impl::setFloorAreaPerPerson(double floorAreaPerPerson) { | |
| 1264 | ✗ | OptionalPeople templatePeople; | |
| 1265 | ✗ | PeopleVector myPeople = people(); | |
| 1266 | ✗ | if (myPeople.empty()) { | |
| 1267 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1268 | ✗ | myPeople = st->people(); | |
| 1269 | ✗ | } | |
| 1270 | } | ||
| 1271 | ✗ | if (!myPeople.empty()) { | |
| 1272 | ✗ | templatePeople = myPeople[0]; | |
| 1273 | } | ||
| 1274 | ✗ | return setFloorAreaPerPerson(floorAreaPerPerson, templatePeople); | |
| 1275 | ✗ | } | |
| 1276 | |||
| 1277 | ✗ | bool Space_Impl::setFloorAreaPerPerson(double floorAreaPerPerson, const boost::optional<People>& templatePeople) { | |
| 1278 | ✗ | if (floorAreaPerPerson < 0.0) { | |
| 1279 | ✗ | LOG(Error, "Space cannot set floorAreaPerPerson to " << floorAreaPerPerson << ", the value must be >= 0.0."); | |
| 1280 | ✗ | return false; | |
| 1281 | } | ||
| 1282 | |||
| 1283 | // create or modify People and PeopleDefinition object | ||
| 1284 | ✗ | OptionalPeople myPeople = getMySpaceLoadInstance<People, PeopleDefinition>(templatePeople); | |
| 1285 | ✗ | if (!myPeople) { | |
| 1286 | ✗ | LOG(Error, "The templatePeople object must be in the same Model as this Space."); | |
| 1287 | ✗ | return false; | |
| 1288 | } | ||
| 1289 | |||
| 1290 | // set space and number of people | ||
| 1291 | ✗ | bool ok(true); | |
| 1292 | ✗ | myPeople->makeUnique(); | |
| 1293 | ✗ | ok = myPeople->setSpace(getObject<Space>()); | |
| 1294 | ✗ | OS_ASSERT(ok); | |
| 1295 | ✗ | ok = myPeople->peopleDefinition().setSpaceFloorAreaperPerson(floorAreaPerPerson); | |
| 1296 | ✗ | OS_ASSERT(ok); | |
| 1297 | ✗ | ok = myPeople->setMultiplier(1); | |
| 1298 | ✗ | OS_ASSERT(ok); | |
| 1299 | |||
| 1300 | // remove all other people from space | ||
| 1301 | ✗ | PeopleVector allMyPeople = people(); | |
| 1302 | ✗ | removeAllButOneSpaceLoadInstance<People>(allMyPeople, *myPeople); | |
| 1303 | |||
| 1304 | // handle space type | ||
| 1305 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 1306 | ✗ | if (!spaceType->people().empty()) { | |
| 1307 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1308 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1309 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1310 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1311 | ✗ | setSpaceType(*spaceType); | |
| 1312 | } | ||
| 1313 | ✗ | allMyPeople = spaceType->people(); | |
| 1314 | ✗ | for (People& peopleObject : allMyPeople) { | |
| 1315 | ✗ | peopleObject.remove(); | |
| 1316 | } | ||
| 1317 | } | ||
| 1318 | ✗ | } | |
| 1319 | |||
| 1320 | ✗ | return true; | |
| 1321 | ✗ | } | |
| 1322 | |||
| 1323 | 66 | double Space_Impl::lightingPower() const { | |
| 1324 | 66 | double result(0.0); | |
| 1325 | 66 | double area = floorArea(); | |
| 1326 | 66 | double numPeople = numberOfPeople(); | |
| 1327 | |||
| 1328 |
3/3✓ Branch 1 taken 66 times.
✓ Branch 7 taken 24 times.
✓ Branch 8 taken 66 times.
|
90 | for (const Lights& light : lights()) { |
| 1329 |
1/1✓ Branch 1 taken 24 times.
|
24 | result += light.getLightingPower(area, numPeople); |
| 1330 | 66 | } | |
| 1331 |
2/3✓ Branch 1 taken 66 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 66 times.
|
66 | for (const Luminaire& luminaire : luminaires()) { |
| 1332 | ✗ | result += luminaire.lightingPower(); | |
| 1333 | 66 | } | |
| 1334 | |||
| 1335 |
3/3✓ Branch 1 taken 66 times.
✓ Branch 3 taken 46 times.
✓ Branch 4 taken 20 times.
|
132 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1336 |
4/4✓ Branch 1 taken 46 times.
✓ Branch 4 taken 46 times.
✓ Branch 10 taken 40 times.
✓ Branch 11 taken 46 times.
|
86 | for (const Lights& light : spaceType->lights()) { |
| 1337 |
1/1✓ Branch 1 taken 40 times.
|
40 | result += light.getLightingPower(area, numPeople); |
| 1338 | 46 | } | |
| 1339 |
3/4✓ Branch 1 taken 46 times.
✓ Branch 4 taken 46 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 46 times.
|
46 | for (const Luminaire& luminaire : spaceType->luminaires()) { |
| 1340 | ✗ | result += luminaire.lightingPower(); | |
| 1341 | 46 | } | |
| 1342 | 66 | } | |
| 1343 | |||
| 1344 | 66 | return result; | |
| 1345 | } | ||
| 1346 | |||
| 1347 | ✗ | bool Space_Impl::setLightingPower(double lightingPower) { | |
| 1348 | ✗ | OptionalLights templateLights; | |
| 1349 | ✗ | LightsVector myLights = lights(); | |
| 1350 | ✗ | if (myLights.empty()) { | |
| 1351 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1352 | ✗ | myLights = st->lights(); | |
| 1353 | ✗ | } | |
| 1354 | } | ||
| 1355 | ✗ | if (!myLights.empty()) { | |
| 1356 | ✗ | templateLights = myLights[0]; | |
| 1357 | } | ||
| 1358 | ✗ | return setLightingPower(lightingPower, templateLights); | |
| 1359 | ✗ | } | |
| 1360 | |||
| 1361 | ✗ | bool Space_Impl::setLightingPower(double lightingPower, const boost::optional<Lights>& templateLights) { | |
| 1362 | ✗ | if (lightingPower < 0.0) { | |
| 1363 | ✗ | LOG(Error, "Space cannot set lightingPower to " << lightingPower << ", the value must be >= 0.0."); | |
| 1364 | ✗ | return false; | |
| 1365 | } | ||
| 1366 | |||
| 1367 | // create or modify Lights and LightsDefinition object | ||
| 1368 | ✗ | OptionalLights myLights = getMySpaceLoadInstance<Lights, LightsDefinition>(templateLights); | |
| 1369 | ✗ | if (!myLights) { | |
| 1370 | ✗ | LOG(Error, "The templateLights object must be in the same Model as this Space."); | |
| 1371 | ✗ | return false; | |
| 1372 | } | ||
| 1373 | |||
| 1374 | // set space and lighting power | ||
| 1375 | ✗ | bool ok(true); | |
| 1376 | ✗ | myLights->makeUnique(); | |
| 1377 | ✗ | ok = myLights->setSpace(getObject<Space>()); | |
| 1378 | ✗ | OS_ASSERT(ok); | |
| 1379 | ✗ | ok = myLights->lightsDefinition().setLightingLevel(lightingPower); | |
| 1380 | ✗ | OS_ASSERT(ok); | |
| 1381 | ✗ | ok = myLights->setMultiplier(1); | |
| 1382 | ✗ | OS_ASSERT(ok); | |
| 1383 | |||
| 1384 | // remove all other lights from space | ||
| 1385 | ✗ | LightsVector allMyLights = lights(); | |
| 1386 | ✗ | removeAllButOneSpaceLoadInstance<Lights>(allMyLights, *myLights); | |
| 1387 | // remove all luminaires from space | ||
| 1388 | ✗ | LuminaireVector allMyLuminaires = luminaires(); | |
| 1389 | ✗ | for (Luminaire& luminaire : allMyLuminaires) { | |
| 1390 | ✗ | luminaire.remove(); | |
| 1391 | } | ||
| 1392 | |||
| 1393 | // handle space type | ||
| 1394 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 1395 | ✗ | if (!spaceType->lights().empty() || !spaceType->luminaires().empty()) { | |
| 1396 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1397 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1398 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1399 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1400 | ✗ | setSpaceType(*spaceType); | |
| 1401 | } | ||
| 1402 | ✗ | allMyLights = spaceType->lights(); | |
| 1403 | ✗ | for (Lights& light : allMyLights) { | |
| 1404 | ✗ | light.remove(); | |
| 1405 | } | ||
| 1406 | ✗ | allMyLuminaires = spaceType->luminaires(); | |
| 1407 | ✗ | for (Luminaire& luminaire : allMyLuminaires) { | |
| 1408 | ✗ | luminaire.remove(); | |
| 1409 | } | ||
| 1410 | } | ||
| 1411 | ✗ | } | |
| 1412 | |||
| 1413 | ✗ | return true; | |
| 1414 | ✗ | } | |
| 1415 | |||
| 1416 | 183 | double Space_Impl::lightingPowerPerFloorArea() const { | |
| 1417 | 183 | double result(0.0); | |
| 1418 | 183 | double area = floorArea(); | |
| 1419 | 183 | double numPeople = numberOfPeople(); | |
| 1420 | |||
| 1421 |
3/3✓ Branch 1 taken 183 times.
✓ Branch 7 taken 13 times.
✓ Branch 8 taken 183 times.
|
196 | for (const Lights& light : lights()) { |
| 1422 |
1/1✓ Branch 1 taken 13 times.
|
13 | result += light.getPowerPerFloorArea(area, numPeople); |
| 1423 | 183 | } | |
| 1424 |
2/3✓ Branch 1 taken 183 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 183 times.
|
183 | for (const Luminaire& luminaire : luminaires()) { |
| 1425 | ✗ | result += luminaire.getPowerPerFloorArea(area); | |
| 1426 | 183 | } | |
| 1427 | |||
| 1428 |
3/3✓ Branch 1 taken 183 times.
✓ Branch 3 taken 118 times.
✓ Branch 4 taken 65 times.
|
366 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1429 |
4/4✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
✓ Branch 10 taken 79 times.
✓ Branch 11 taken 118 times.
|
197 | for (const Lights& light : spaceType->lights()) { |
| 1430 |
1/1✓ Branch 1 taken 79 times.
|
79 | result += light.getPowerPerFloorArea(area, numPeople); |
| 1431 | 118 | } | |
| 1432 |
3/4✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 118 times.
|
118 | for (const Luminaire& luminaire : spaceType->luminaires()) { |
| 1433 | ✗ | result += luminaire.getPowerPerFloorArea(area); | |
| 1434 | 118 | } | |
| 1435 | 183 | } | |
| 1436 | |||
| 1437 | 183 | return result; | |
| 1438 | } | ||
| 1439 | |||
| 1440 | ✗ | bool Space_Impl::setLightingPowerPerFloorArea(double lightingPowerPerFloorArea) { | |
| 1441 | ✗ | OptionalLights templateLights; | |
| 1442 | ✗ | LightsVector myLights = lights(); | |
| 1443 | ✗ | if (myLights.empty()) { | |
| 1444 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1445 | ✗ | myLights = st->lights(); | |
| 1446 | ✗ | } | |
| 1447 | } | ||
| 1448 | ✗ | if (!myLights.empty()) { | |
| 1449 | ✗ | templateLights = myLights[0]; | |
| 1450 | } | ||
| 1451 | ✗ | return setLightingPowerPerFloorArea(lightingPowerPerFloorArea, templateLights); | |
| 1452 | ✗ | } | |
| 1453 | |||
| 1454 | ✗ | bool Space_Impl::setLightingPowerPerFloorArea(double lightingPowerPerFloorArea, const boost::optional<Lights>& templateLights) { | |
| 1455 | ✗ | if (lightingPowerPerFloorArea < 0.0) { | |
| 1456 | ✗ | LOG(Error, "Space cannot set lightingPowerPerFloorArea to " << lightingPowerPerFloorArea << ", the value must be >= 0.0."); | |
| 1457 | ✗ | return false; | |
| 1458 | } | ||
| 1459 | |||
| 1460 | // create or modify Lights and LightsDefinition object | ||
| 1461 | ✗ | OptionalLights myLights = getMySpaceLoadInstance<Lights, LightsDefinition>(templateLights); | |
| 1462 | ✗ | if (!myLights) { | |
| 1463 | ✗ | LOG(Error, "The templateLights object must be in the same Model as this Space."); | |
| 1464 | ✗ | return false; | |
| 1465 | } | ||
| 1466 | |||
| 1467 | // set space and lighting power | ||
| 1468 | ✗ | bool ok(true); | |
| 1469 | ✗ | myLights->makeUnique(); | |
| 1470 | ✗ | ok = myLights->setSpace(getObject<Space>()); | |
| 1471 | ✗ | OS_ASSERT(ok); | |
| 1472 | ✗ | ok = myLights->lightsDefinition().setWattsperSpaceFloorArea(lightingPowerPerFloorArea); | |
| 1473 | ✗ | OS_ASSERT(ok); | |
| 1474 | ✗ | ok = myLights->setMultiplier(1); | |
| 1475 | ✗ | OS_ASSERT(ok); | |
| 1476 | |||
| 1477 | // remove all other lights from space | ||
| 1478 | ✗ | LightsVector allMyLights = lights(); | |
| 1479 | ✗ | removeAllButOneSpaceLoadInstance<Lights>(allMyLights, *myLights); | |
| 1480 | // remove all luminaires from space | ||
| 1481 | ✗ | LuminaireVector allMyLuminaires = luminaires(); | |
| 1482 | ✗ | for (Luminaire& luminaire : allMyLuminaires) { | |
| 1483 | ✗ | luminaire.remove(); | |
| 1484 | } | ||
| 1485 | |||
| 1486 | // handle space type | ||
| 1487 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 1488 | ✗ | if (!spaceType->lights().empty() || !spaceType->luminaires().empty()) { | |
| 1489 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1490 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1491 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1492 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1493 | ✗ | setSpaceType(*spaceType); | |
| 1494 | } | ||
| 1495 | ✗ | allMyLights = spaceType->lights(); | |
| 1496 | ✗ | for (Lights& light : allMyLights) { | |
| 1497 | ✗ | light.remove(); | |
| 1498 | } | ||
| 1499 | ✗ | allMyLuminaires = spaceType->luminaires(); | |
| 1500 | ✗ | for (Luminaire& luminaire : allMyLuminaires) { | |
| 1501 | ✗ | luminaire.remove(); | |
| 1502 | } | ||
| 1503 | } | ||
| 1504 | ✗ | } | |
| 1505 | |||
| 1506 | ✗ | return true; | |
| 1507 | ✗ | } | |
| 1508 | |||
| 1509 | 4 | double Space_Impl::lightingPowerPerPerson() const { | |
| 1510 | 4 | double result(0.0); | |
| 1511 | 4 | double area = floorArea(); | |
| 1512 | 4 | double numPeople = numberOfPeople(); | |
| 1513 | |||
| 1514 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 4 times.
|
5 | for (const Lights& light : lights()) { |
| 1515 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += light.getPowerPerPerson(area, numPeople); |
| 1516 | 4 | } | |
| 1517 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
|
4 | for (const Luminaire& luminaire : luminaires()) { |
| 1518 | ✗ | result += luminaire.getPowerPerPerson(numPeople); | |
| 1519 | 4 | } | |
| 1520 | |||
| 1521 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1522 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 4 times.
|
8 | for (const Lights& light : spaceType->lights()) { |
| 1523 |
1/1✓ Branch 1 taken 4 times.
|
4 | result += light.getPowerPerPerson(area, numPeople); |
| 1524 | 4 | } | |
| 1525 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
|
4 | for (const Luminaire& luminaire : spaceType->luminaires()) { |
| 1526 | ✗ | result += luminaire.getPowerPerPerson(numPeople); | |
| 1527 | 4 | } | |
| 1528 | 4 | } | |
| 1529 | |||
| 1530 | 4 | return result; | |
| 1531 | } | ||
| 1532 | |||
| 1533 | ✗ | bool Space_Impl::setLightingPowerPerPerson(double lightingPowerPerPerson) { | |
| 1534 | ✗ | OptionalLights templateLights; | |
| 1535 | ✗ | LightsVector myLights = lights(); | |
| 1536 | ✗ | if (myLights.empty()) { | |
| 1537 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1538 | ✗ | myLights = st->lights(); | |
| 1539 | ✗ | } | |
| 1540 | } | ||
| 1541 | ✗ | if (!myLights.empty()) { | |
| 1542 | ✗ | templateLights = myLights[0]; | |
| 1543 | } | ||
| 1544 | ✗ | return setLightingPowerPerPerson(lightingPowerPerPerson, templateLights); | |
| 1545 | ✗ | } | |
| 1546 | |||
| 1547 | ✗ | bool Space_Impl::setLightingPowerPerPerson(double lightingPowerPerPerson, const boost::optional<Lights>& templateLights) { | |
| 1548 | ✗ | if (lightingPowerPerPerson < 0.0) { | |
| 1549 | ✗ | LOG(Error, "Space cannot set lightingPowerPerPerson to " << lightingPowerPerPerson << ", the value must be >= 0.0."); | |
| 1550 | ✗ | return false; | |
| 1551 | } | ||
| 1552 | |||
| 1553 | // create or modify Lights and LightsDefinition object | ||
| 1554 | ✗ | OptionalLights myLights = getMySpaceLoadInstance<Lights, LightsDefinition>(templateLights); | |
| 1555 | ✗ | if (!myLights) { | |
| 1556 | ✗ | LOG(Error, "The templateLights object must be in the same Model as this Space."); | |
| 1557 | ✗ | return false; | |
| 1558 | } | ||
| 1559 | |||
| 1560 | // set space and lighting power | ||
| 1561 | ✗ | bool ok(true); | |
| 1562 | ✗ | myLights->makeUnique(); | |
| 1563 | ✗ | ok = myLights->setSpace(getObject<Space>()); | |
| 1564 | ✗ | OS_ASSERT(ok); | |
| 1565 | ✗ | ok = myLights->lightsDefinition().setWattsperPerson(lightingPowerPerPerson); | |
| 1566 | ✗ | OS_ASSERT(ok); | |
| 1567 | ✗ | ok = myLights->setMultiplier(1); | |
| 1568 | ✗ | OS_ASSERT(ok); | |
| 1569 | |||
| 1570 | // remove all other lights from space | ||
| 1571 | ✗ | LightsVector allMyLights = lights(); | |
| 1572 | ✗ | removeAllButOneSpaceLoadInstance<Lights>(allMyLights, *myLights); | |
| 1573 | // remove all luminaires from space | ||
| 1574 | ✗ | LuminaireVector allMyLuminaires = luminaires(); | |
| 1575 | ✗ | for (Luminaire& luminaire : allMyLuminaires) { | |
| 1576 | ✗ | luminaire.remove(); | |
| 1577 | } | ||
| 1578 | |||
| 1579 | // handle space type | ||
| 1580 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 1581 | ✗ | if (!spaceType->lights().empty() || !spaceType->luminaires().empty()) { | |
| 1582 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1583 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1584 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1585 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1586 | ✗ | setSpaceType(*spaceType); | |
| 1587 | } | ||
| 1588 | ✗ | allMyLights = spaceType->lights(); | |
| 1589 | ✗ | for (Lights& light : allMyLights) { | |
| 1590 | ✗ | light.remove(); | |
| 1591 | } | ||
| 1592 | ✗ | allMyLuminaires = spaceType->luminaires(); | |
| 1593 | ✗ | for (Luminaire& luminaire : allMyLuminaires) { | |
| 1594 | ✗ | luminaire.remove(); | |
| 1595 | } | ||
| 1596 | } | ||
| 1597 | ✗ | } | |
| 1598 | |||
| 1599 | ✗ | return true; | |
| 1600 | ✗ | } | |
| 1601 | |||
| 1602 | 40 | double Space_Impl::electricEquipmentPower() const { | |
| 1603 | 40 | double result(0.0); | |
| 1604 | 40 | double area = floorArea(); | |
| 1605 | 40 | double numPeople = numberOfPeople(); | |
| 1606 | |||
| 1607 |
3/3✓ Branch 1 taken 40 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 40 times.
|
47 | for (const ElectricEquipment& equipment : electricEquipment()) { |
| 1608 |
1/1✓ Branch 1 taken 7 times.
|
7 | result += equipment.getDesignLevel(area, numPeople); |
| 1609 | 40 | } | |
| 1610 | |||
| 1611 |
2/3✓ Branch 1 taken 40 times.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
|
80 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1612 |
4/4✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
✓ Branch 10 taken 40 times.
✓ Branch 11 taken 40 times.
|
80 | for (const ElectricEquipment& equipment : spaceType->electricEquipment()) { |
| 1613 |
1/1✓ Branch 1 taken 40 times.
|
40 | result += equipment.getDesignLevel(area, numPeople); |
| 1614 | 40 | } | |
| 1615 | 40 | } | |
| 1616 | |||
| 1617 | 40 | return result; | |
| 1618 | } | ||
| 1619 | |||
| 1620 | 8 | double Space_Impl::electricEquipmentITEAirCooledPower() const { | |
| 1621 | 8 | double result(0.0); | |
| 1622 | 8 | double area = floorArea(); | |
| 1623 | |||
| 1624 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 8 times.
|
12 | for (const ElectricEquipmentITEAirCooled& iTequipment : electricEquipmentITEAirCooled()) { |
| 1625 |
1/1✓ Branch 1 taken 4 times.
|
4 | result += iTequipment.getDesignLevel(area); |
| 1626 | 8 | } | |
| 1627 | |||
| 1628 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
|
16 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1629 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 6 times.
|
12 | for (const ElectricEquipmentITEAirCooled& iTequipment : spaceType->electricEquipmentITEAirCooled()) { |
| 1630 |
1/1✓ Branch 1 taken 6 times.
|
6 | result += iTequipment.getDesignLevel(area); |
| 1631 | 6 | } | |
| 1632 | 8 | } | |
| 1633 | |||
| 1634 | 8 | return result; | |
| 1635 | } | ||
| 1636 | |||
| 1637 | ✗ | bool Space_Impl::setElectricEquipmentPower(double electricEquipmentPower) { | |
| 1638 | ✗ | OptionalElectricEquipment templateEquipment; | |
| 1639 | ✗ | ElectricEquipmentVector myEquipment = electricEquipment(); | |
| 1640 | ✗ | if (myEquipment.empty()) { | |
| 1641 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1642 | ✗ | myEquipment = st->electricEquipment(); | |
| 1643 | ✗ | } | |
| 1644 | } | ||
| 1645 | ✗ | if (!myEquipment.empty()) { | |
| 1646 | ✗ | templateEquipment = myEquipment[0]; | |
| 1647 | } | ||
| 1648 | ✗ | return setElectricEquipmentPower(electricEquipmentPower, templateEquipment); | |
| 1649 | ✗ | } | |
| 1650 | |||
| 1651 | 1 | bool Space_Impl::setElectricEquipmentPower(double electricEquipmentPower, const boost::optional<ElectricEquipment>& templateElectricEquipment) { | |
| 1652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (electricEquipmentPower < 0.0) { |
| 1653 | ✗ | LOG(Error, "Space cannot set electricEquipmentPower to " << electricEquipmentPower << ", the value must be >= 0.0."); | |
| 1654 | ✗ | return false; | |
| 1655 | } | ||
| 1656 | |||
| 1657 | // create or modify Lights and LightsDefinition object | ||
| 1658 |
1/1✓ Branch 1 taken 1 time.
|
1 | OptionalElectricEquipment myEquipment = getMySpaceLoadInstance<ElectricEquipment, ElectricEquipmentDefinition>(templateElectricEquipment); |
| 1659 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!myEquipment) { |
| 1660 | ✗ | LOG(Error, "The templateElectricEquipment object must be in the same Model as this Space."); | |
| 1661 | ✗ | return false; | |
| 1662 | } | ||
| 1663 | |||
| 1664 | // set space and power level | ||
| 1665 | 1 | bool ok(true); | |
| 1666 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | myEquipment->makeUnique(); |
| 1667 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ok = myEquipment->setSpace(getObject<Space>()); |
| 1668 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 1669 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ok = myEquipment->electricEquipmentDefinition().setDesignLevel(electricEquipmentPower); |
| 1670 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 1671 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | ok = myEquipment->setMultiplier(1); |
| 1672 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 1673 | |||
| 1674 | // remove all other electric equipment from space | ||
| 1675 |
1/1✓ Branch 1 taken 1 time.
|
1 | ElectricEquipmentVector allMyEquipment = electricEquipment(); |
| 1676 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | removeAllButOneSpaceLoadInstance<ElectricEquipment>(allMyEquipment, *myEquipment); |
| 1677 | |||
| 1678 | // handle space type | ||
| 1679 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1680 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 time.
|
1 | if (!spaceType->electricEquipment().empty()) { |
| 1681 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1682 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1683 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1684 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1685 | ✗ | setSpaceType(*spaceType); | |
| 1686 | } | ||
| 1687 | ✗ | allMyEquipment = spaceType->electricEquipment(); | |
| 1688 | ✗ | for (ElectricEquipment& equipment : allMyEquipment) { | |
| 1689 | ✗ | equipment.remove(); | |
| 1690 | } | ||
| 1691 | } | ||
| 1692 | 1 | } | |
| 1693 | |||
| 1694 | 1 | return true; | |
| 1695 | 1 | } | |
| 1696 | |||
| 1697 | 136 | double Space_Impl::electricEquipmentPowerPerFloorArea() const { | |
| 1698 | 136 | double result(0.0); | |
| 1699 | 136 | double area = floorArea(); | |
| 1700 | 136 | double numPeople = numberOfPeople(); | |
| 1701 | |||
| 1702 |
3/3✓ Branch 1 taken 136 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 136 times.
|
148 | for (const ElectricEquipment& equipment : electricEquipment()) { |
| 1703 |
1/1✓ Branch 1 taken 12 times.
|
12 | result += equipment.getPowerPerFloorArea(area, numPeople); |
| 1704 | 136 | } | |
| 1705 | |||
| 1706 |
3/3✓ Branch 1 taken 136 times.
✓ Branch 3 taken 83 times.
✓ Branch 4 taken 53 times.
|
272 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1707 |
4/4✓ Branch 1 taken 83 times.
✓ Branch 4 taken 83 times.
✓ Branch 10 taken 48 times.
✓ Branch 11 taken 83 times.
|
131 | for (const ElectricEquipment& equipment : spaceType->electricEquipment()) { |
| 1708 |
1/1✓ Branch 1 taken 48 times.
|
48 | result += equipment.getPowerPerFloorArea(area, numPeople); |
| 1709 | 83 | } | |
| 1710 | 136 | } | |
| 1711 | |||
| 1712 | 136 | return result; | |
| 1713 | } | ||
| 1714 | |||
| 1715 | 4 | double Space_Impl::electricEquipmentITEAirCooledPowerPerFloorArea() const { | |
| 1716 | 4 | double result(0.0); | |
| 1717 | 4 | double area = floorArea(); | |
| 1718 | |||
| 1719 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 4 times.
|
6 | for (const ElectricEquipmentITEAirCooled& iTequipment : electricEquipmentITEAirCooled()) { |
| 1720 |
1/1✓ Branch 1 taken 2 times.
|
2 | result += iTequipment.getPowerPerFloorArea(area); |
| 1721 | 4 | } | |
| 1722 | |||
| 1723 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
|
8 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1724 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 2 times.
|
4 | for (const ElectricEquipmentITEAirCooled& iTequipment : spaceType->electricEquipmentITEAirCooled()) { |
| 1725 |
1/1✓ Branch 1 taken 2 times.
|
2 | result += iTequipment.getPowerPerFloorArea(area); |
| 1726 | 2 | } | |
| 1727 | 4 | } | |
| 1728 | |||
| 1729 | 4 | return result; | |
| 1730 | } | ||
| 1731 | |||
| 1732 | ✗ | bool Space_Impl::setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea) { | |
| 1733 | ✗ | OptionalElectricEquipment templateEquipment; | |
| 1734 | ✗ | ElectricEquipmentVector myEquipment = electricEquipment(); | |
| 1735 | ✗ | if (myEquipment.empty()) { | |
| 1736 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1737 | ✗ | myEquipment = st->electricEquipment(); | |
| 1738 | ✗ | } | |
| 1739 | } | ||
| 1740 | ✗ | if (!myEquipment.empty()) { | |
| 1741 | ✗ | templateEquipment = myEquipment[0]; | |
| 1742 | } | ||
| 1743 | ✗ | return setElectricEquipmentPowerPerFloorArea(electricEquipmentPowerPerFloorArea, templateEquipment); | |
| 1744 | ✗ | } | |
| 1745 | |||
| 1746 | ✗ | bool Space_Impl::setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea, | |
| 1747 | const boost::optional<ElectricEquipment>& templateElectricEquipment) { | ||
| 1748 | ✗ | if (electricEquipmentPowerPerFloorArea < 0.0) { | |
| 1749 | ✗ | LOG(Error, "Space cannot set electricEquipmentPowerPerFloorArea to " << electricEquipmentPowerPerFloorArea << ", the value must be >= 0.0."); | |
| 1750 | ✗ | return false; | |
| 1751 | } | ||
| 1752 | |||
| 1753 | // create or modify Lights and LightsDefinition object | ||
| 1754 | ✗ | OptionalElectricEquipment myEquipment = getMySpaceLoadInstance<ElectricEquipment, ElectricEquipmentDefinition>(templateElectricEquipment); | |
| 1755 | ✗ | if (!myEquipment) { | |
| 1756 | ✗ | LOG(Error, "The templateElectricEquipment object must be in the same Model as this Space."); | |
| 1757 | ✗ | return false; | |
| 1758 | } | ||
| 1759 | |||
| 1760 | // set space and power level | ||
| 1761 | ✗ | bool ok(true); | |
| 1762 | ✗ | myEquipment->makeUnique(); | |
| 1763 | ✗ | ok = myEquipment->setSpace(getObject<Space>()); | |
| 1764 | ✗ | OS_ASSERT(ok); | |
| 1765 | ✗ | ok = myEquipment->electricEquipmentDefinition().setWattsperSpaceFloorArea(electricEquipmentPowerPerFloorArea); | |
| 1766 | ✗ | OS_ASSERT(ok); | |
| 1767 | ✗ | ok = myEquipment->setMultiplier(1); | |
| 1768 | ✗ | OS_ASSERT(ok); | |
| 1769 | |||
| 1770 | // remove all other electric equipment from space | ||
| 1771 | ✗ | ElectricEquipmentVector allMyEquipment = electricEquipment(); | |
| 1772 | ✗ | removeAllButOneSpaceLoadInstance<ElectricEquipment>(allMyEquipment, *myEquipment); | |
| 1773 | |||
| 1774 | // handle space type | ||
| 1775 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 1776 | ✗ | if (!spaceType->electricEquipment().empty()) { | |
| 1777 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1778 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1779 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1780 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1781 | ✗ | setSpaceType(*spaceType); | |
| 1782 | } | ||
| 1783 | ✗ | allMyEquipment = spaceType->electricEquipment(); | |
| 1784 | ✗ | for (ElectricEquipment& equipment : allMyEquipment) { | |
| 1785 | ✗ | equipment.remove(); | |
| 1786 | } | ||
| 1787 | } | ||
| 1788 | ✗ | } | |
| 1789 | |||
| 1790 | ✗ | return true; | |
| 1791 | ✗ | } | |
| 1792 | |||
| 1793 | 4 | double Space_Impl::electricEquipmentPowerPerPerson() const { | |
| 1794 | 4 | double result(0.0); | |
| 1795 | 4 | double area = floorArea(); | |
| 1796 | 4 | double numPeople = numberOfPeople(); | |
| 1797 | |||
| 1798 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 4 times.
|
5 | for (const ElectricEquipment& equipment : electricEquipment()) { |
| 1799 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += equipment.getPowerPerPerson(area, numPeople); |
| 1800 | 4 | } | |
| 1801 | |||
| 1802 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1803 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 4 times.
|
8 | for (const ElectricEquipment& equipment : spaceType->electricEquipment()) { |
| 1804 |
1/1✓ Branch 1 taken 4 times.
|
4 | result += equipment.getPowerPerPerson(area, numPeople); |
| 1805 | 4 | } | |
| 1806 | 4 | } | |
| 1807 | |||
| 1808 | 4 | return result; | |
| 1809 | } | ||
| 1810 | |||
| 1811 | ✗ | bool Space_Impl::setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson) { | |
| 1812 | ✗ | OptionalElectricEquipment templateEquipment; | |
| 1813 | ✗ | ElectricEquipmentVector myEquipment = electricEquipment(); | |
| 1814 | ✗ | if (myEquipment.empty()) { | |
| 1815 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1816 | ✗ | myEquipment = st->electricEquipment(); | |
| 1817 | ✗ | } | |
| 1818 | } | ||
| 1819 | ✗ | if (!myEquipment.empty()) { | |
| 1820 | ✗ | templateEquipment = myEquipment[0]; | |
| 1821 | } | ||
| 1822 | ✗ | return setElectricEquipmentPowerPerPerson(electricEquipmentPowerPerPerson, templateEquipment); | |
| 1823 | ✗ | } | |
| 1824 | |||
| 1825 | ✗ | bool Space_Impl::setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson, | |
| 1826 | const boost::optional<ElectricEquipment>& templateElectricEquipment) { | ||
| 1827 | ✗ | if (electricEquipmentPowerPerPerson < 0.0) { | |
| 1828 | ✗ | LOG(Error, "Space cannot set electricEquipmentPowerPerPerson to " << electricEquipmentPowerPerPerson << ", the value must be >= 0.0."); | |
| 1829 | ✗ | return false; | |
| 1830 | } | ||
| 1831 | |||
| 1832 | // create or modify Lights and LightsDefinition object | ||
| 1833 | ✗ | OptionalElectricEquipment myEquipment = getMySpaceLoadInstance<ElectricEquipment, ElectricEquipmentDefinition>(templateElectricEquipment); | |
| 1834 | ✗ | if (!myEquipment) { | |
| 1835 | ✗ | LOG(Error, "The templateElectricEquipment object must be in the same Model as this Space."); | |
| 1836 | ✗ | return false; | |
| 1837 | } | ||
| 1838 | |||
| 1839 | // set space and power level | ||
| 1840 | ✗ | bool ok(true); | |
| 1841 | ✗ | myEquipment->makeUnique(); | |
| 1842 | ✗ | ok = myEquipment->setSpace(getObject<Space>()); | |
| 1843 | ✗ | OS_ASSERT(ok); | |
| 1844 | ✗ | ok = myEquipment->electricEquipmentDefinition().setWattsperPerson(electricEquipmentPowerPerPerson); | |
| 1845 | ✗ | OS_ASSERT(ok); | |
| 1846 | ✗ | ok = myEquipment->setMultiplier(1); | |
| 1847 | ✗ | OS_ASSERT(ok); | |
| 1848 | |||
| 1849 | // remove all other electric equipment from space | ||
| 1850 | ✗ | ElectricEquipmentVector allMyEquipment = electricEquipment(); | |
| 1851 | ✗ | removeAllButOneSpaceLoadInstance<ElectricEquipment>(allMyEquipment, *myEquipment); | |
| 1852 | |||
| 1853 | // handle space type | ||
| 1854 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 1855 | ✗ | if (!spaceType->electricEquipment().empty()) { | |
| 1856 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1857 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1858 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1859 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1860 | ✗ | setSpaceType(*spaceType); | |
| 1861 | } | ||
| 1862 | ✗ | allMyEquipment = spaceType->electricEquipment(); | |
| 1863 | ✗ | for (ElectricEquipment& equipment : allMyEquipment) { | |
| 1864 | ✗ | equipment.remove(); | |
| 1865 | } | ||
| 1866 | } | ||
| 1867 | ✗ | } | |
| 1868 | |||
| 1869 | ✗ | return true; | |
| 1870 | ✗ | } | |
| 1871 | |||
| 1872 | 28 | double Space_Impl::gasEquipmentPower() const { | |
| 1873 | 28 | double result(0.0); | |
| 1874 | 28 | double area = floorArea(); | |
| 1875 | 28 | double numPeople = numberOfPeople(); | |
| 1876 | |||
| 1877 |
3/3✓ Branch 1 taken 28 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 28 times.
|
35 | for (const GasEquipment& equipment : gasEquipment()) { |
| 1878 |
1/1✓ Branch 1 taken 7 times.
|
7 | result += equipment.getDesignLevel(area, numPeople); |
| 1879 | 28 | } | |
| 1880 | |||
| 1881 |
2/3✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
|
56 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1882 |
4/4✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 10 taken 28 times.
✓ Branch 11 taken 28 times.
|
56 | for (const GasEquipment& equipment : spaceType->gasEquipment()) { |
| 1883 |
1/1✓ Branch 1 taken 28 times.
|
28 | result += equipment.getDesignLevel(area, numPeople); |
| 1884 | 28 | } | |
| 1885 | 28 | } | |
| 1886 | |||
| 1887 | 28 | return result; | |
| 1888 | } | ||
| 1889 | |||
| 1890 | ✗ | bool Space_Impl::setGasEquipmentPower(double gasEquipmentPower) { | |
| 1891 | ✗ | OptionalGasEquipment templateEquipment; | |
| 1892 | ✗ | GasEquipmentVector myEquipment = gasEquipment(); | |
| 1893 | ✗ | if (myEquipment.empty()) { | |
| 1894 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1895 | ✗ | myEquipment = st->gasEquipment(); | |
| 1896 | ✗ | } | |
| 1897 | } | ||
| 1898 | ✗ | if (!myEquipment.empty()) { | |
| 1899 | ✗ | templateEquipment = myEquipment[0]; | |
| 1900 | } | ||
| 1901 | ✗ | return setGasEquipmentPower(gasEquipmentPower, templateEquipment); | |
| 1902 | ✗ | } | |
| 1903 | |||
| 1904 | 1 | bool Space_Impl::setGasEquipmentPower(double gasEquipmentPower, const boost::optional<GasEquipment>& templateGasEquipment) { | |
| 1905 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (gasEquipmentPower < 0.0) { |
| 1906 | ✗ | LOG(Error, "Space cannot set gasEquipmentPower to " << gasEquipmentPower << ", the value must be >= 0.0."); | |
| 1907 | ✗ | return false; | |
| 1908 | } | ||
| 1909 | |||
| 1910 | // create or modify Lights and LightsDefinition object | ||
| 1911 |
1/1✓ Branch 1 taken 1 time.
|
1 | OptionalGasEquipment myEquipment = getMySpaceLoadInstance<GasEquipment, GasEquipmentDefinition>(templateGasEquipment); |
| 1912 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!myEquipment) { |
| 1913 | ✗ | LOG(Error, "The templateGasEquipment object must be in the same Model as this Space."); | |
| 1914 | ✗ | return false; | |
| 1915 | } | ||
| 1916 | |||
| 1917 | // set space and power level | ||
| 1918 | 1 | bool ok(true); | |
| 1919 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | myEquipment->makeUnique(); |
| 1920 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ok = myEquipment->setSpace(getObject<Space>()); |
| 1921 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 1922 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ok = myEquipment->gasEquipmentDefinition().setDesignLevel(gasEquipmentPower); |
| 1923 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 1924 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | ok = myEquipment->setMultiplier(1); |
| 1925 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 1926 | |||
| 1927 | // remove all other gas equipment from space | ||
| 1928 |
1/1✓ Branch 1 taken 1 time.
|
1 | GasEquipmentVector allMyEquipment = gasEquipment(); |
| 1929 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | removeAllButOneSpaceLoadInstance<GasEquipment>(allMyEquipment, *myEquipment); |
| 1930 | |||
| 1931 | // handle space type | ||
| 1932 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1933 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 time.
|
1 | if (!spaceType->gasEquipment().empty()) { |
| 1934 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 1935 | // SpaceLoadInstances), create and use clone instead of original | ||
| 1936 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 1937 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 1938 | ✗ | setSpaceType(*spaceType); | |
| 1939 | } | ||
| 1940 | ✗ | allMyEquipment = spaceType->gasEquipment(); | |
| 1941 | ✗ | for (GasEquipment& equipment : allMyEquipment) { | |
| 1942 | ✗ | equipment.remove(); | |
| 1943 | } | ||
| 1944 | } | ||
| 1945 | 1 | } | |
| 1946 | |||
| 1947 | 1 | return true; | |
| 1948 | 1 | } | |
| 1949 | |||
| 1950 | 4 | double Space_Impl::gasEquipmentPowerPerFloorArea() const { | |
| 1951 | 4 | double result(0.0); | |
| 1952 | 4 | double area = floorArea(); | |
| 1953 | 4 | double numPeople = numberOfPeople(); | |
| 1954 | |||
| 1955 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 4 times.
|
5 | for (const GasEquipment& equipment : gasEquipment()) { |
| 1956 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += equipment.getPowerPerFloorArea(area, numPeople); |
| 1957 | 4 | } | |
| 1958 | |||
| 1959 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 1960 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 4 times.
|
8 | for (const GasEquipment& equipment : spaceType->gasEquipment()) { |
| 1961 |
1/1✓ Branch 1 taken 4 times.
|
4 | result += equipment.getPowerPerFloorArea(area, numPeople); |
| 1962 | 4 | } | |
| 1963 | 4 | } | |
| 1964 | |||
| 1965 | 4 | return result; | |
| 1966 | } | ||
| 1967 | |||
| 1968 | ✗ | bool Space_Impl::setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea) { | |
| 1969 | ✗ | OptionalGasEquipment templateEquipment; | |
| 1970 | ✗ | GasEquipmentVector myEquipment = gasEquipment(); | |
| 1971 | ✗ | if (myEquipment.empty()) { | |
| 1972 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 1973 | ✗ | myEquipment = st->gasEquipment(); | |
| 1974 | ✗ | } | |
| 1975 | } | ||
| 1976 | ✗ | if (!myEquipment.empty()) { | |
| 1977 | ✗ | templateEquipment = myEquipment[0]; | |
| 1978 | } | ||
| 1979 | ✗ | return setGasEquipmentPowerPerFloorArea(gasEquipmentPowerPerFloorArea, templateEquipment); | |
| 1980 | ✗ | } | |
| 1981 | |||
| 1982 | ✗ | bool Space_Impl::setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea, | |
| 1983 | const boost::optional<GasEquipment>& templateGasEquipment) { | ||
| 1984 | ✗ | if (gasEquipmentPowerPerFloorArea < 0.0) { | |
| 1985 | ✗ | LOG(Error, "Space cannot set gasEquipmentPowerPerFloorArea to " << gasEquipmentPowerPerFloorArea << ", the value must be >= 0.0."); | |
| 1986 | ✗ | return false; | |
| 1987 | } | ||
| 1988 | |||
| 1989 | // create or modify Lights and LightsDefinition object | ||
| 1990 | ✗ | OptionalGasEquipment myEquipment = getMySpaceLoadInstance<GasEquipment, GasEquipmentDefinition>(templateGasEquipment); | |
| 1991 | ✗ | if (!myEquipment) { | |
| 1992 | ✗ | LOG(Error, "The templateGasEquipment object must be in the same Model as this Space."); | |
| 1993 | ✗ | return false; | |
| 1994 | } | ||
| 1995 | |||
| 1996 | // set space and power level | ||
| 1997 | ✗ | bool ok(true); | |
| 1998 | ✗ | myEquipment->makeUnique(); | |
| 1999 | ✗ | ok = myEquipment->setSpace(getObject<Space>()); | |
| 2000 | ✗ | OS_ASSERT(ok); | |
| 2001 | ✗ | ok = myEquipment->gasEquipmentDefinition().setWattsperSpaceFloorArea(gasEquipmentPowerPerFloorArea); | |
| 2002 | ✗ | OS_ASSERT(ok); | |
| 2003 | ✗ | ok = myEquipment->setMultiplier(1); | |
| 2004 | ✗ | OS_ASSERT(ok); | |
| 2005 | |||
| 2006 | // remove all other gas equipment from space | ||
| 2007 | ✗ | GasEquipmentVector allMyEquipment = gasEquipment(); | |
| 2008 | ✗ | removeAllButOneSpaceLoadInstance<GasEquipment>(allMyEquipment, *myEquipment); | |
| 2009 | |||
| 2010 | // handle space type | ||
| 2011 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 2012 | ✗ | if (!spaceType->gasEquipment().empty()) { | |
| 2013 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 2014 | // SpaceLoadInstances), create and use clone instead of original | ||
| 2015 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 2016 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 2017 | ✗ | setSpaceType(*spaceType); | |
| 2018 | } | ||
| 2019 | ✗ | allMyEquipment = spaceType->gasEquipment(); | |
| 2020 | ✗ | for (GasEquipment& equipment : allMyEquipment) { | |
| 2021 | ✗ | equipment.remove(); | |
| 2022 | } | ||
| 2023 | } | ||
| 2024 | ✗ | } | |
| 2025 | |||
| 2026 | ✗ | return true; | |
| 2027 | ✗ | } | |
| 2028 | |||
| 2029 | 4 | double Space_Impl::gasEquipmentPowerPerPerson() const { | |
| 2030 | 4 | double result(0.0); | |
| 2031 | 4 | double area = floorArea(); | |
| 2032 | 4 | double numPeople = numberOfPeople(); | |
| 2033 | |||
| 2034 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 4 times.
|
5 | for (const GasEquipment& equipment : gasEquipment()) { |
| 2035 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += equipment.getPowerPerPerson(area, numPeople); |
| 2036 | 4 | } | |
| 2037 | |||
| 2038 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 2039 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 4 times.
|
8 | for (const GasEquipment& equipment : spaceType->gasEquipment()) { |
| 2040 |
1/1✓ Branch 1 taken 4 times.
|
4 | result += equipment.getPowerPerPerson(area, numPeople); |
| 2041 | 4 | } | |
| 2042 | 4 | } | |
| 2043 | |||
| 2044 | 4 | return result; | |
| 2045 | } | ||
| 2046 | |||
| 2047 | ✗ | bool Space_Impl::setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson) { | |
| 2048 | ✗ | OptionalGasEquipment templateEquipment; | |
| 2049 | ✗ | GasEquipmentVector myEquipment = gasEquipment(); | |
| 2050 | ✗ | if (myEquipment.empty()) { | |
| 2051 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 2052 | ✗ | myEquipment = st->gasEquipment(); | |
| 2053 | ✗ | } | |
| 2054 | } | ||
| 2055 | ✗ | if (!myEquipment.empty()) { | |
| 2056 | ✗ | templateEquipment = myEquipment[0]; | |
| 2057 | } | ||
| 2058 | ✗ | return setGasEquipmentPowerPerPerson(gasEquipmentPowerPerPerson, templateEquipment); | |
| 2059 | ✗ | } | |
| 2060 | |||
| 2061 | ✗ | bool Space_Impl::setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson, const boost::optional<GasEquipment>& templateGasEquipment) { | |
| 2062 | ✗ | if (gasEquipmentPowerPerPerson < 0.0) { | |
| 2063 | ✗ | LOG(Error, "Space cannot set gasEquipmentPowerPerPerson to " << gasEquipmentPowerPerPerson << ", the value must be >= 0.0."); | |
| 2064 | ✗ | return false; | |
| 2065 | } | ||
| 2066 | |||
| 2067 | // create or modify Lights and LightsDefinition object | ||
| 2068 | ✗ | OptionalGasEquipment myEquipment = getMySpaceLoadInstance<GasEquipment, GasEquipmentDefinition>(templateGasEquipment); | |
| 2069 | ✗ | if (!myEquipment) { | |
| 2070 | ✗ | LOG(Error, "The templateGasEquipment object must be in the same Model as this Space."); | |
| 2071 | ✗ | return false; | |
| 2072 | } | ||
| 2073 | |||
| 2074 | // set space and power level | ||
| 2075 | ✗ | bool ok(true); | |
| 2076 | ✗ | myEquipment->makeUnique(); | |
| 2077 | ✗ | ok = myEquipment->setSpace(getObject<Space>()); | |
| 2078 | ✗ | OS_ASSERT(ok); | |
| 2079 | ✗ | ok = myEquipment->gasEquipmentDefinition().setWattsperPerson(gasEquipmentPowerPerPerson); | |
| 2080 | ✗ | OS_ASSERT(ok); | |
| 2081 | ✗ | ok = myEquipment->setMultiplier(1); | |
| 2082 | ✗ | OS_ASSERT(ok); | |
| 2083 | |||
| 2084 | // remove all other gas equipment from space | ||
| 2085 | ✗ | GasEquipmentVector allMyEquipment = gasEquipment(); | |
| 2086 | ✗ | removeAllButOneSpaceLoadInstance<GasEquipment>(allMyEquipment, *myEquipment); | |
| 2087 | |||
| 2088 | // handle space type | ||
| 2089 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 2090 | ✗ | if (!spaceType->gasEquipment().empty()) { | |
| 2091 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 2092 | // SpaceLoadInstances), create and use clone instead of original | ||
| 2093 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 2094 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 2095 | ✗ | setSpaceType(*spaceType); | |
| 2096 | } | ||
| 2097 | ✗ | allMyEquipment = spaceType->gasEquipment(); | |
| 2098 | ✗ | for (GasEquipment& equipment : allMyEquipment) { | |
| 2099 | ✗ | equipment.remove(); | |
| 2100 | } | ||
| 2101 | } | ||
| 2102 | ✗ | } | |
| 2103 | |||
| 2104 | ✗ | return true; | |
| 2105 | ✗ | } | |
| 2106 | |||
| 2107 | 28 | double Space_Impl::hotWaterEquipmentPower() const { | |
| 2108 | 28 | double result(0.0); | |
| 2109 | 28 | double area = floorArea(); | |
| 2110 | 28 | double numPeople = numberOfPeople(); | |
| 2111 | |||
| 2112 |
3/3✓ Branch 1 taken 28 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 28 times.
|
35 | for (const HotWaterEquipment& equipment : hotWaterEquipment()) { |
| 2113 |
1/1✓ Branch 1 taken 7 times.
|
7 | result += equipment.getDesignLevel(area, numPeople); |
| 2114 | 28 | } | |
| 2115 | |||
| 2116 |
2/3✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
|
56 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 2117 |
4/4✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 10 taken 28 times.
✓ Branch 11 taken 28 times.
|
56 | for (const HotWaterEquipment& equipment : spaceType->hotWaterEquipment()) { |
| 2118 |
1/1✓ Branch 1 taken 28 times.
|
28 | result += equipment.getDesignLevel(area, numPeople); |
| 2119 | 28 | } | |
| 2120 | 28 | } | |
| 2121 | |||
| 2122 | 28 | return result; | |
| 2123 | } | ||
| 2124 | |||
| 2125 | ✗ | bool Space_Impl::setHotWaterEquipmentPower(double hotWaterEquipmentPower) { | |
| 2126 | ✗ | OptionalHotWaterEquipment templateEquipment; | |
| 2127 | ✗ | HotWaterEquipmentVector myEquipment = hotWaterEquipment(); | |
| 2128 | ✗ | if (myEquipment.empty()) { | |
| 2129 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 2130 | ✗ | myEquipment = st->hotWaterEquipment(); | |
| 2131 | ✗ | } | |
| 2132 | } | ||
| 2133 | ✗ | if (!myEquipment.empty()) { | |
| 2134 | ✗ | templateEquipment = myEquipment[0]; | |
| 2135 | } | ||
| 2136 | ✗ | return setHotWaterEquipmentPower(hotWaterEquipmentPower, templateEquipment); | |
| 2137 | ✗ | } | |
| 2138 | |||
| 2139 | ✗ | bool Space_Impl::setHotWaterEquipmentPower(double hotWaterEquipmentPower, const boost::optional<HotWaterEquipment>& templateHotWaterEquipment) { | |
| 2140 | ✗ | if (hotWaterEquipmentPower < 0.0) { | |
| 2141 | ✗ | LOG(Error, "Space cannot set hotWaterEquipmentPower to " << hotWaterEquipmentPower << ", the value must be >= 0.0."); | |
| 2142 | ✗ | return false; | |
| 2143 | } | ||
| 2144 | |||
| 2145 | // create or modify Lights and LightsDefinition object | ||
| 2146 | ✗ | OptionalHotWaterEquipment myEquipment = getMySpaceLoadInstance<HotWaterEquipment, HotWaterEquipmentDefinition>(templateHotWaterEquipment); | |
| 2147 | ✗ | if (!myEquipment) { | |
| 2148 | ✗ | LOG(Error, "The templateHotWaterEquipment object must be in the same Model as this Space."); | |
| 2149 | ✗ | return false; | |
| 2150 | } | ||
| 2151 | |||
| 2152 | // set space and power level | ||
| 2153 | ✗ | bool ok(true); | |
| 2154 | ✗ | myEquipment->makeUnique(); | |
| 2155 | ✗ | ok = myEquipment->setSpace(getObject<Space>()); | |
| 2156 | ✗ | OS_ASSERT(ok); | |
| 2157 | ✗ | ok = myEquipment->hotWaterEquipmentDefinition().setDesignLevel(hotWaterEquipmentPower); | |
| 2158 | ✗ | OS_ASSERT(ok); | |
| 2159 | ✗ | ok = myEquipment->setMultiplier(1); | |
| 2160 | ✗ | OS_ASSERT(ok); | |
| 2161 | |||
| 2162 | // remove all other equipment from space | ||
| 2163 | ✗ | HotWaterEquipmentVector allMyEquipment = hotWaterEquipment(); | |
| 2164 | ✗ | removeAllButOneSpaceLoadInstance<HotWaterEquipment>(allMyEquipment, *myEquipment); | |
| 2165 | |||
| 2166 | // handle space type | ||
| 2167 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 2168 | ✗ | if (!spaceType->hotWaterEquipment().empty()) { | |
| 2169 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 2170 | // SpaceLoadInstances), create and use clone instead of original | ||
| 2171 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 2172 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 2173 | ✗ | setSpaceType(*spaceType); | |
| 2174 | } | ||
| 2175 | ✗ | allMyEquipment = spaceType->hotWaterEquipment(); | |
| 2176 | ✗ | for (HotWaterEquipment& equipment : allMyEquipment) { | |
| 2177 | ✗ | equipment.remove(); | |
| 2178 | } | ||
| 2179 | } | ||
| 2180 | ✗ | } | |
| 2181 | |||
| 2182 | ✗ | return true; | |
| 2183 | ✗ | } | |
| 2184 | |||
| 2185 | 4 | double Space_Impl::hotWaterEquipmentPowerPerFloorArea() const { | |
| 2186 | 4 | double result(0.0); | |
| 2187 | 4 | double area = floorArea(); | |
| 2188 | 4 | double numPeople = numberOfPeople(); | |
| 2189 | |||
| 2190 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 4 times.
|
5 | for (const HotWaterEquipment& equipment : hotWaterEquipment()) { |
| 2191 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += equipment.getPowerPerFloorArea(area, numPeople); |
| 2192 | 4 | } | |
| 2193 | |||
| 2194 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 2195 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 4 times.
|
8 | for (const HotWaterEquipment& equipment : spaceType->hotWaterEquipment()) { |
| 2196 |
1/1✓ Branch 1 taken 4 times.
|
4 | result += equipment.getPowerPerFloorArea(area, numPeople); |
| 2197 | 4 | } | |
| 2198 | 4 | } | |
| 2199 | |||
| 2200 | 4 | return result; | |
| 2201 | } | ||
| 2202 | |||
| 2203 | ✗ | bool Space_Impl::setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea) { | |
| 2204 | ✗ | OptionalHotWaterEquipment templateEquipment; | |
| 2205 | ✗ | HotWaterEquipmentVector myEquipment = hotWaterEquipment(); | |
| 2206 | ✗ | if (myEquipment.empty()) { | |
| 2207 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 2208 | ✗ | myEquipment = st->hotWaterEquipment(); | |
| 2209 | ✗ | } | |
| 2210 | } | ||
| 2211 | ✗ | if (!myEquipment.empty()) { | |
| 2212 | ✗ | templateEquipment = myEquipment[0]; | |
| 2213 | } | ||
| 2214 | ✗ | return setHotWaterEquipmentPowerPerFloorArea(hotWaterEquipmentPowerPerFloorArea, templateEquipment); | |
| 2215 | ✗ | } | |
| 2216 | |||
| 2217 | ✗ | bool Space_Impl::setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea, | |
| 2218 | const boost::optional<HotWaterEquipment>& templateHotWaterEquipment) { | ||
| 2219 | ✗ | if (hotWaterEquipmentPowerPerFloorArea < 0.0) { | |
| 2220 | ✗ | LOG(Error, "Space cannot set hotWaterEquipmentPowerPerFloorArea to " << hotWaterEquipmentPowerPerFloorArea << ", the value must be >= 0.0."); | |
| 2221 | ✗ | return false; | |
| 2222 | } | ||
| 2223 | |||
| 2224 | // create or modify Lights and LightsDefinition object | ||
| 2225 | ✗ | OptionalHotWaterEquipment myEquipment = getMySpaceLoadInstance<HotWaterEquipment, HotWaterEquipmentDefinition>(templateHotWaterEquipment); | |
| 2226 | ✗ | if (!myEquipment) { | |
| 2227 | ✗ | LOG(Error, "The templateHotWaterEquipment object must be in the same Model as this Space."); | |
| 2228 | ✗ | return false; | |
| 2229 | } | ||
| 2230 | |||
| 2231 | // set space and power level | ||
| 2232 | ✗ | bool ok(true); | |
| 2233 | ✗ | myEquipment->makeUnique(); | |
| 2234 | ✗ | ok = myEquipment->setSpace(getObject<Space>()); | |
| 2235 | ✗ | OS_ASSERT(ok); | |
| 2236 | ✗ | ok = myEquipment->hotWaterEquipmentDefinition().setWattsperSpaceFloorArea(hotWaterEquipmentPowerPerFloorArea); | |
| 2237 | ✗ | OS_ASSERT(ok); | |
| 2238 | ✗ | ok = myEquipment->setMultiplier(1); | |
| 2239 | ✗ | OS_ASSERT(ok); | |
| 2240 | |||
| 2241 | // remove all other equipment from space | ||
| 2242 | ✗ | HotWaterEquipmentVector allMyEquipment = hotWaterEquipment(); | |
| 2243 | ✗ | removeAllButOneSpaceLoadInstance<HotWaterEquipment>(allMyEquipment, *myEquipment); | |
| 2244 | |||
| 2245 | // handle space type | ||
| 2246 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 2247 | ✗ | if (!spaceType->hotWaterEquipment().empty()) { | |
| 2248 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 2249 | // SpaceLoadInstances), create and use clone instead of original | ||
| 2250 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 2251 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 2252 | ✗ | setSpaceType(*spaceType); | |
| 2253 | } | ||
| 2254 | ✗ | allMyEquipment = spaceType->hotWaterEquipment(); | |
| 2255 | ✗ | for (HotWaterEquipment& equipment : allMyEquipment) { | |
| 2256 | ✗ | equipment.remove(); | |
| 2257 | } | ||
| 2258 | } | ||
| 2259 | ✗ | } | |
| 2260 | |||
| 2261 | ✗ | return true; | |
| 2262 | ✗ | } | |
| 2263 | |||
| 2264 | 4 | double Space_Impl::hotWaterEquipmentPowerPerPerson() const { | |
| 2265 | 4 | double result(0.0); | |
| 2266 | 4 | double area = floorArea(); | |
| 2267 | 4 | double numPeople = numberOfPeople(); | |
| 2268 | |||
| 2269 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 4 times.
|
5 | for (const HotWaterEquipment& equipment : hotWaterEquipment()) { |
| 2270 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += equipment.getPowerPerPerson(area, numPeople); |
| 2271 | 4 | } | |
| 2272 | |||
| 2273 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (OptionalSpaceType spaceType = this->spaceType()) { |
| 2274 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 4 times.
|
8 | for (const HotWaterEquipment& equipment : spaceType->hotWaterEquipment()) { |
| 2275 |
1/1✓ Branch 1 taken 4 times.
|
4 | result += equipment.getPowerPerPerson(area, numPeople); |
| 2276 | 4 | } | |
| 2277 | 4 | } | |
| 2278 | |||
| 2279 | 4 | return result; | |
| 2280 | } | ||
| 2281 | |||
| 2282 | ✗ | bool Space_Impl::setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson) { | |
| 2283 | ✗ | OptionalHotWaterEquipment templateEquipment; | |
| 2284 | ✗ | HotWaterEquipmentVector myEquipment = hotWaterEquipment(); | |
| 2285 | ✗ | if (myEquipment.empty()) { | |
| 2286 | ✗ | if (OptionalSpaceType st = spaceType()) { | |
| 2287 | ✗ | myEquipment = st->hotWaterEquipment(); | |
| 2288 | ✗ | } | |
| 2289 | } | ||
| 2290 | ✗ | if (!myEquipment.empty()) { | |
| 2291 | ✗ | templateEquipment = myEquipment[0]; | |
| 2292 | } | ||
| 2293 | ✗ | return setHotWaterEquipmentPowerPerPerson(hotWaterEquipmentPowerPerPerson, templateEquipment); | |
| 2294 | ✗ | } | |
| 2295 | |||
| 2296 | ✗ | bool Space_Impl::setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson, | |
| 2297 | const boost::optional<HotWaterEquipment>& templateHotWaterEquipment) { | ||
| 2298 | ✗ | if (hotWaterEquipmentPowerPerPerson < 0.0) { | |
| 2299 | ✗ | LOG(Error, "Space cannot set hotWaterEquipmentPowerPerPerson to " << hotWaterEquipmentPowerPerPerson << ", the value must be >= 0.0."); | |
| 2300 | ✗ | return false; | |
| 2301 | } | ||
| 2302 | |||
| 2303 | // create or modify Lights and LightsDefinition object | ||
| 2304 | ✗ | OptionalHotWaterEquipment myEquipment = getMySpaceLoadInstance<HotWaterEquipment, HotWaterEquipmentDefinition>(templateHotWaterEquipment); | |
| 2305 | ✗ | if (!myEquipment) { | |
| 2306 | ✗ | LOG(Error, "The templateHotWaterEquipment object must be in the same Model as this Space."); | |
| 2307 | ✗ | return false; | |
| 2308 | } | ||
| 2309 | |||
| 2310 | // set space and power level | ||
| 2311 | ✗ | bool ok(true); | |
| 2312 | ✗ | myEquipment->makeUnique(); | |
| 2313 | ✗ | ok = myEquipment->setSpace(getObject<Space>()); | |
| 2314 | ✗ | OS_ASSERT(ok); | |
| 2315 | ✗ | ok = myEquipment->hotWaterEquipmentDefinition().setWattsperPerson(hotWaterEquipmentPowerPerPerson); | |
| 2316 | ✗ | OS_ASSERT(ok); | |
| 2317 | ✗ | ok = myEquipment->setMultiplier(1); | |
| 2318 | ✗ | OS_ASSERT(ok); | |
| 2319 | |||
| 2320 | // remove all other equipment from space | ||
| 2321 | ✗ | HotWaterEquipmentVector allMyEquipment = hotWaterEquipment(); | |
| 2322 | ✗ | removeAllButOneSpaceLoadInstance<HotWaterEquipment>(allMyEquipment, *myEquipment); | |
| 2323 | |||
| 2324 | // handle space type | ||
| 2325 | ✗ | if (OptionalSpaceType spaceType = this->spaceType()) { | |
| 2326 | ✗ | if (!spaceType->hotWaterEquipment().empty()) { | |
| 2327 | // if spaceType is used by multiple ParentObjects (includes Space, Building, excludes | ||
| 2328 | // SpaceLoadInstances), create and use clone instead of original | ||
| 2329 | ✗ | if (spaceType->getModelObjectSources<ParentObject>().size() > 1u) { | |
| 2330 | ✗ | spaceType = spaceType->clone().cast<SpaceType>(); | |
| 2331 | ✗ | setSpaceType(*spaceType); | |
| 2332 | } | ||
| 2333 | ✗ | allMyEquipment = spaceType->hotWaterEquipment(); | |
| 2334 | ✗ | for (HotWaterEquipment& equipment : allMyEquipment) { | |
| 2335 | ✗ | equipment.remove(); | |
| 2336 | } | ||
| 2337 | } | ||
| 2338 | ✗ | } | |
| 2339 | |||
| 2340 | ✗ | return true; | |
| 2341 | ✗ | } | |
| 2342 | |||
| 2343 | 8 | double Space_Impl::infiltrationDesignFlowRate() const { | |
| 2344 | 8 | double result(0.0); | |
| 2345 | 8 | double floorArea = this->floorArea(); | |
| 2346 | 8 | double exteriorSurfaceArea = this->exteriorArea(); | |
| 2347 | 8 | double exteriorWallArea = this->exteriorWallArea(); | |
| 2348 | 8 | double airVolume = volume(); | |
| 2349 | |||
| 2350 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 8 times.
|
15 | for (const SpaceInfiltrationDesignFlowRate& idfr : spaceInfiltrationDesignFlowRates()) { |
| 2351 |
1/1✓ Branch 1 taken 7 times.
|
7 | result += idfr.getDesignFlowRate(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2352 | 8 | } | |
| 2353 | |||
| 2354 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
|
16 | if (OptionalSpaceType st = spaceType()) { |
| 2355 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 6 times.
|
12 | for (const SpaceInfiltrationDesignFlowRate& idfr : st->spaceInfiltrationDesignFlowRates()) { |
| 2356 |
1/1✓ Branch 1 taken 6 times.
|
6 | result += idfr.getDesignFlowRate(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2357 | 6 | } | |
| 2358 | 8 | } | |
| 2359 | |||
| 2360 | 8 | return result; | |
| 2361 | } | ||
| 2362 | |||
| 2363 | 2 | double Space_Impl::infiltrationDesignFlowPerSpaceFloorArea() const { | |
| 2364 | 2 | double result(0.0); | |
| 2365 | 2 | double floorArea = this->floorArea(); | |
| 2366 | 2 | double exteriorSurfaceArea = this->exteriorArea(); | |
| 2367 | 2 | double exteriorWallArea = this->exteriorWallArea(); | |
| 2368 | 2 | double airVolume = volume(); | |
| 2369 | |||
| 2370 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 2 times.
|
4 | for (const SpaceInfiltrationDesignFlowRate& idfr : spaceInfiltrationDesignFlowRates()) { |
| 2371 |
1/1✓ Branch 1 taken 2 times.
|
2 | result += idfr.getFlowPerSpaceFloorArea(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2372 | 2 | } | |
| 2373 | |||
| 2374 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
4 | if (OptionalSpaceType st = spaceType()) { |
| 2375 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 1 time.
|
2 | for (const SpaceInfiltrationDesignFlowRate& idfr : st->spaceInfiltrationDesignFlowRates()) { |
| 2376 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += idfr.getFlowPerSpaceFloorArea(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2377 | 1 | } | |
| 2378 | 2 | } | |
| 2379 | |||
| 2380 | 2 | return result; | |
| 2381 | } | ||
| 2382 | |||
| 2383 | 2 | double Space_Impl::infiltrationDesignFlowPerExteriorSurfaceArea() const { | |
| 2384 | 2 | double result(0.0); | |
| 2385 | 2 | double floorArea = this->floorArea(); | |
| 2386 | 2 | double exteriorSurfaceArea = this->exteriorArea(); | |
| 2387 | 2 | double exteriorWallArea = this->exteriorWallArea(); | |
| 2388 | 2 | double airVolume = volume(); | |
| 2389 | |||
| 2390 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 2 times.
|
4 | for (const SpaceInfiltrationDesignFlowRate& idfr : spaceInfiltrationDesignFlowRates()) { |
| 2391 |
1/1✓ Branch 1 taken 2 times.
|
2 | result += idfr.getFlowPerExteriorSurfaceArea(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2392 | 2 | } | |
| 2393 | |||
| 2394 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
4 | if (OptionalSpaceType st = spaceType()) { |
| 2395 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 1 time.
|
2 | for (const SpaceInfiltrationDesignFlowRate& idfr : st->spaceInfiltrationDesignFlowRates()) { |
| 2396 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += idfr.getFlowPerExteriorSurfaceArea(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2397 | 1 | } | |
| 2398 | 2 | } | |
| 2399 | |||
| 2400 | 2 | return result; | |
| 2401 | } | ||
| 2402 | |||
| 2403 | 2 | double Space_Impl::infiltrationDesignFlowPerExteriorWallArea() const { | |
| 2404 | 2 | double result(0.0); | |
| 2405 | 2 | double floorArea = this->floorArea(); | |
| 2406 | 2 | double exteriorSurfaceArea = this->exteriorArea(); | |
| 2407 | 2 | double exteriorWallArea = this->exteriorWallArea(); | |
| 2408 | 2 | double airVolume = volume(); | |
| 2409 | |||
| 2410 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 2 times.
|
4 | for (const SpaceInfiltrationDesignFlowRate& idfr : spaceInfiltrationDesignFlowRates()) { |
| 2411 |
1/1✓ Branch 1 taken 2 times.
|
2 | result += idfr.getFlowPerExteriorWallArea(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2412 | 2 | } | |
| 2413 | |||
| 2414 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
4 | if (OptionalSpaceType st = spaceType()) { |
| 2415 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 1 time.
|
2 | for (const SpaceInfiltrationDesignFlowRate& idfr : st->spaceInfiltrationDesignFlowRates()) { |
| 2416 |
1/1✓ Branch 1 taken 1 time.
|
1 | result += idfr.getFlowPerExteriorWallArea(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2417 | 1 | } | |
| 2418 | 2 | } | |
| 2419 | |||
| 2420 | 2 | return result; | |
| 2421 | } | ||
| 2422 | |||
| 2423 | 12 | double Space_Impl::infiltrationDesignAirChangesPerHour() const { | |
| 2424 | 12 | double result(0.0); | |
| 2425 | 12 | double floorArea = this->floorArea(); | |
| 2426 | 12 | double exteriorSurfaceArea = this->exteriorArea(); | |
| 2427 | 12 | double exteriorWallArea = this->exteriorWallArea(); | |
| 2428 | 12 | double airVolume = volume(); | |
| 2429 | |||
| 2430 |
3/3✓ Branch 1 taken 12 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 12 times.
|
17 | for (const SpaceInfiltrationDesignFlowRate& idfr : spaceInfiltrationDesignFlowRates()) { |
| 2431 |
1/1✓ Branch 1 taken 5 times.
|
5 | result += idfr.getAirChangesPerHour(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2432 | 12 | } | |
| 2433 | |||
| 2434 |
3/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 1 time.
|
24 | if (OptionalSpaceType st = spaceType()) { |
| 2435 |
4/4✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 10 taken 5 times.
✓ Branch 11 taken 11 times.
|
16 | for (const SpaceInfiltrationDesignFlowRate& idfr : st->spaceInfiltrationDesignFlowRates()) { |
| 2436 |
1/1✓ Branch 1 taken 5 times.
|
5 | result += idfr.getAirChangesPerHour(floorArea, exteriorSurfaceArea, exteriorWallArea, airVolume); |
| 2437 | 11 | } | |
| 2438 | 12 | } | |
| 2439 | |||
| 2440 | 12 | return result; | |
| 2441 | } | ||
| 2442 | |||
| 2443 | 3 | SpaceInfiltrationDesignFlowRate Space_Impl::setInfiltrationDesignFlowRateHelper() { | |
| 2444 | // We try to grab an existing one, whether that's on the SpaceType or Space, because we want to retain other parameters like Term Coefficients | ||
| 2445 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto spis = this->spaceInfiltrationDesignFlowRates(); |
| 2446 | |||
| 2447 | 3 | boost::optional<SpaceInfiltrationDesignFlowRate> spi_; | |
| 2448 | |||
| 2449 | // handle space type | ||
| 2450 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (auto sp_ = this->spaceType()) { |
| 2451 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto sp_spis = sp_->spaceInfiltrationDesignFlowRates(); |
| 2452 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 time.
|
3 | if (!sp_spis.empty()) { |
| 2453 | // if sp is used by multiple ParentObjects (includes Space, Building, excludes SpaceLoadInstances), create and use clone instead of original | ||
| 2454 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 1 time.
|
2 | if (sp_->getModelObjectSources<ParentObject>().size() > 1u) { |
| 2455 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | sp_ = sp_->clone().cast<SpaceType>(); |
| 2456 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | sp_spis = sp_->spaceInfiltrationDesignFlowRates(); |
| 2457 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | setSpaceType(*sp_); |
| 2458 | } | ||
| 2459 | // If the Space didn't have one, we move the SpaceType one to the space | ||
| 2460 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | if (spis.empty()) { |
| 2461 |
1/1✓ Branch 3 taken 2 times.
|
2 | spi_ = std::move(sp_spis.front()); |
| 2462 |
1/1✓ Branch 3 taken 2 times.
|
2 | sp_spis.erase(sp_spis.begin()); |
| 2463 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | spi_->setSpace(getObject<Space>()); |
| 2464 | } | ||
| 2465 | |||
| 2466 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | for (auto& spi : sp_spis) { |
| 2467 | ✗ | spi.remove(); | |
| 2468 | } | ||
| 2469 | } | ||
| 2470 | 6 | } | |
| 2471 | |||
| 2472 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (spi_) { |
| 2473 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | return *spi_; |
| 2474 | } | ||
| 2475 | |||
| 2476 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (spis.empty()) { |
| 2477 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | SpaceInfiltrationDesignFlowRate spi(this->model()); |
| 2478 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | spi.setSpace(getObject<Space>()); |
| 2479 | 1 | return spi; | |
| 2480 | 1 | } | |
| 2481 | |||
| 2482 | ✗ | auto& spi = spis[0]; | |
| 2483 | ✗ | for (auto& spi : spis | std::views::drop(1)) { | |
| 2484 | ✗ | spi.remove(); | |
| 2485 | } | ||
| 2486 | ✗ | return spi; | |
| 2487 | 3 | } | |
| 2488 | |||
| 2489 | ✗ | bool Space_Impl::setInfiltrationDesignFlowRate(double infiltrationDesignFlowRate) { | |
| 2490 | ✗ | auto spi = setInfiltrationDesignFlowRateHelper(); | |
| 2491 | ✗ | return spi.setDesignFlowRate(infiltrationDesignFlowRate); | |
| 2492 | ✗ | } | |
| 2493 | |||
| 2494 | ✗ | bool Space_Impl::setInfiltrationDesignFlowPerSpaceFloorArea(double infiltrationDesignFlowPerSpaceFloorArea) { | |
| 2495 | ✗ | auto spi = setInfiltrationDesignFlowRateHelper(); | |
| 2496 | ✗ | return spi.setFlowperSpaceFloorArea(infiltrationDesignFlowPerSpaceFloorArea); | |
| 2497 | ✗ | } | |
| 2498 | |||
| 2499 | ✗ | bool Space_Impl::setInfiltrationDesignFlowPerExteriorSurfaceArea(double infiltrationDesignFlowPerExteriorSurfaceArea) { | |
| 2500 | ✗ | auto spi = setInfiltrationDesignFlowRateHelper(); | |
| 2501 | ✗ | return spi.setFlowperExteriorSurfaceArea(infiltrationDesignFlowPerExteriorSurfaceArea); | |
| 2502 | ✗ | } | |
| 2503 | |||
| 2504 | ✗ | bool Space_Impl::setInfiltrationDesignFlowPerExteriorWallArea(double infiltrationDesignFlowPerExteriorWallArea) { | |
| 2505 | ✗ | auto spi = setInfiltrationDesignFlowRateHelper(); | |
| 2506 | ✗ | return spi.setFlowperExteriorWallArea(infiltrationDesignFlowPerExteriorWallArea); | |
| 2507 | ✗ | } | |
| 2508 | |||
| 2509 | 3 | bool Space_Impl::setInfiltrationDesignAirChangesPerHour(double infiltrationDesignAirChangesPerHour) { | |
| 2510 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto spi = setInfiltrationDesignFlowRateHelper(); |
| 2511 |
1/1✓ Branch 1 taken 3 times.
|
6 | return spi.setAirChangesperHour(infiltrationDesignAirChangesPerHour); |
| 2512 | 3 | } | |
| 2513 | |||
| 2514 | 85 | void Space_Impl::hardApplySpaceType(bool hardSizeLoads) { | |
| 2515 |
1/1✓ Branch 1 taken 85 times.
|
85 | Model model = this->model(); |
| 2516 |
1/1✓ Branch 1 taken 85 times.
|
85 | auto space = this->getObject<Space>(); |
| 2517 | |||
| 2518 |
1/1✓ Branch 1 taken 85 times.
|
85 | std::string plenumSpaceTypeName = model.plenumSpaceTypeName(); |
| 2519 | |||
| 2520 |
1/1✓ Branch 1 taken 85 times.
|
85 | boost::optional<SpaceType> spaceType = this->spaceType(); |
| 2521 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 27 times.
|
85 | if (spaceType) { |
| 2522 | |||
| 2523 | // Clone the space type if there is a space type | ||
| 2524 |
5/5✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
✓ Branch 7 taken 58 times.
✓ Branch 10 taken 58 times.
✓ Branch 13 taken 58 times.
|
58 | spaceType = spaceType->clone(model).cast<SpaceType>(); |
| 2525 | |||
| 2526 | // Hard apply schedules to space type loads if there is a space type | ||
| 2527 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
58 | spaceType->hardApplySpaceLoadSchedules(); |
| 2528 | |||
| 2529 | // Move space loads from space type to space if there is a space type | ||
| 2530 |
4/4✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
✓ Branch 11 taken 53 times.
✓ Branch 12 taken 58 times.
|
111 | for (const ModelObject& child : spaceType->children()) { |
| 2531 |
2/3✓ Branch 1 taken 53 times.
✓ Branch 3 taken 53 times.
✗ Branch 4 not taken.
|
106 | if (auto load_ = child.optionalCast<SpaceLoad>()) { |
| 2532 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | bool test = load_->setSpace(space); |
| 2533 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
|
53 | OS_ASSERT(test); |
| 2534 | 53 | } | |
| 2535 | 58 | } | |
| 2536 | |||
| 2537 | // Merge space type default constructions with space default constructions if there is a space type | ||
| 2538 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
58 | boost::optional<DefaultConstructionSet> spaceTypeDefaultConstructionSet = spaceType->defaultConstructionSet(); |
| 2539 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
|
58 | if (spaceTypeDefaultConstructionSet) { |
| 2540 | ✗ | boost::optional<DefaultConstructionSet> defaultConstructionSet = this->defaultConstructionSet(); | |
| 2541 | ✗ | if (defaultConstructionSet) { | |
| 2542 | ✗ | defaultConstructionSet->merge(*spaceTypeDefaultConstructionSet); | |
| 2543 | } else { | ||
| 2544 | ✗ | this->setDefaultConstructionSet(*spaceTypeDefaultConstructionSet); | |
| 2545 | } | ||
| 2546 | ✗ | } | |
| 2547 | |||
| 2548 | 58 | } else { | |
| 2549 | // create a new space type | ||
| 2550 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | spaceType = SpaceType(model); |
| 2551 | } | ||
| 2552 | |||
| 2553 | // always set space type to prevent picking up building level space type | ||
| 2554 |
2/2✓ Branch 1 taken 85 times.
✓ Branch 4 taken 85 times.
|
85 | space.setSpaceType(*spaceType); |
| 2555 | |||
| 2556 | // Hard apply schedules to space loads, do this before clearing space type default schedule set | ||
| 2557 |
1/1✓ Branch 1 taken 85 times.
|
85 | this->hardApplySpaceLoadSchedules(); |
| 2558 | |||
| 2559 | // If hard sizing loads, make each space load refer to unique definition and hard size it | ||
| 2560 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 1 time.
|
85 | if (hardSizeLoads) { |
| 2561 |
3/3✓ Branch 1 taken 84 times.
✓ Branch 8 taken 491 times.
✓ Branch 9 taken 84 times.
|
575 | for (const ModelObject& child : this->children()) { |
| 2562 |
3/3✓ Branch 1 taken 491 times.
✓ Branch 3 taken 75 times.
✓ Branch 4 taken 416 times.
|
982 | if (auto load_ = child.optionalCast<SpaceLoad>()) { |
| 2563 |
2/2✓ Branch 1 taken 75 times.
✓ Branch 4 taken 75 times.
|
75 | load_->hardSize(); |
| 2564 | 491 | } | |
| 2565 | 84 | } | |
| 2566 | } | ||
| 2567 | |||
| 2568 | // clean the cloned space type | ||
| 2569 |
2/2✓ Branch 1 taken 85 times.
✓ Branch 4 taken 85 times.
|
85 | spaceType->resetRenderingColor(); |
| 2570 |
2/2✓ Branch 1 taken 85 times.
✓ Branch 4 taken 85 times.
|
85 | spaceType->resetDefaultConstructionSet(); |
| 2571 |
2/2✓ Branch 1 taken 85 times.
✓ Branch 4 taken 85 times.
|
85 | spaceType->resetDefaultScheduleSet(); |
| 2572 | 85 | } | |
| 2573 | |||
| 2574 | 85 | void Space_Impl::hardApplySpaceLoadSchedules() { | |
| 2575 |
3/3✓ Branch 1 taken 85 times.
✓ Branch 8 taken 492 times.
✓ Branch 9 taken 85 times.
|
577 | for (const ModelObject& child : this->children()) { |
| 2576 |
3/3✓ Branch 1 taken 492 times.
✓ Branch 3 taken 76 times.
✓ Branch 4 taken 416 times.
|
984 | if (auto load_ = child.optionalCast<SpaceLoad>()) { |
| 2577 |
2/2✓ Branch 1 taken 76 times.
✓ Branch 4 taken 76 times.
|
76 | load_->hardApplySchedules(); |
| 2578 | 492 | } | |
| 2579 | 85 | } | |
| 2580 | 85 | } | |
| 2581 | |||
| 2582 | 105 | void Space_Impl::hardApplyConstructions() { | |
| 2583 | |||
| 2584 |
3/3✓ Branch 1 taken 105 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 105 times.
|
108 | for (const ShadingSurfaceGroup& shadingSurfaceGroup : this->shadingSurfaceGroups()) { |
| 2585 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 3 times.
|
6 | for (ShadingSurface& shadingSurface : shadingSurfaceGroup.shadingSurfaces()) { |
| 2586 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (boost::optional<ConstructionBase> construction = shadingSurface.construction()) { |
| 2587 | ✗ | shadingSurface.setConstruction(*construction); | |
| 2588 | 3 | } | |
| 2589 | 3 | } | |
| 2590 | 105 | } | |
| 2591 | |||
| 2592 |
3/3✓ Branch 1 taken 105 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 105 times.
|
108 | for (const InteriorPartitionSurfaceGroup& interiorPartitionSurfaceGroup : this->interiorPartitionSurfaceGroups()) { |
| 2593 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 3 times.
|
6 | for (InteriorPartitionSurface& interiorPartitionSurface : interiorPartitionSurfaceGroup.interiorPartitionSurfaces()) { |
| 2594 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (boost::optional<ConstructionBase> construction = interiorPartitionSurface.construction()) { |
| 2595 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | interiorPartitionSurface.setConstruction(*construction); |
| 2596 | 3 | } | |
| 2597 | 3 | } | |
| 2598 | 105 | } | |
| 2599 | |||
| 2600 |
3/3✓ Branch 1 taken 105 times.
✓ Branch 8 taken 519 times.
✓ Branch 9 taken 105 times.
|
624 | for (Surface& surface : this->surfaces()) { |
| 2601 |
1/1✓ Branch 1 taken 519 times.
|
519 | boost::optional<ConstructionBase> construction = surface.construction(); |
| 2602 |
2/2✓ Branch 0 taken 74 times.
✓ Branch 1 taken 445 times.
|
519 | if (construction) { |
| 2603 |
2/2✓ Branch 1 taken 74 times.
✓ Branch 4 taken 74 times.
|
74 | surface.setConstruction(*construction); |
| 2604 | } else { | ||
| 2605 |
3/3✓ Branch 1 taken 445 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 421 times.
|
890 | if (boost::optional<Surface> adjacentSurface = surface.adjacentSurface()) { |
| 2606 |
2/2✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
|
24 | construction = adjacentSurface->construction(); |
| 2607 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if (construction) { |
| 2608 | ✗ | surface.setConstruction(*construction); | |
| 2609 | } | ||
| 2610 | 445 | } | |
| 2611 | } | ||
| 2612 | |||
| 2613 |
3/3✓ Branch 1 taken 519 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 519 times.
|
525 | for (SubSurface& subSurface : surface.subSurfaces()) { |
| 2614 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<ConstructionBase> construction = subSurface.construction(); |
| 2615 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if (construction) { |
| 2616 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | subSurface.setConstruction(*construction); |
| 2617 | } else { | ||
| 2618 | ✗ | if (boost::optional<SubSurface> adjacentSubSurface = subSurface.adjacentSubSurface()) { | |
| 2619 | ✗ | construction = adjacentSubSurface->construction(); | |
| 2620 | ✗ | if (construction) { | |
| 2621 | ✗ | subSurface.setConstruction(*construction); | |
| 2622 | } | ||
| 2623 | ✗ | } | |
| 2624 | } | ||
| 2625 | 525 | } | |
| 2626 | 624 | } | |
| 2627 | 105 | } | |
| 2628 | |||
| 2629 | 1 | void Space_Impl::unmatchSurfaces() { | |
| 2630 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 1 time.
|
2 | for (Surface& surface : this->surfaces()) { |
| 2631 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<Surface> adjacentSurface = surface.adjacentSurface(); |
| 2632 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (adjacentSurface) { |
| 2633 |
1/1✓ Branch 1 taken 1 time.
|
1 | surface.resetAdjacentSurface(); |
| 2634 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | adjacentSurface->resetAdjacentSurface(); |
| 2635 | } | ||
| 2636 | |||
| 2637 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 1 time.
|
2 | for (SubSurface& subSurface : surface.subSurfaces()) { |
| 2638 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<SubSurface> adjacentSubSurface = subSurface.adjacentSubSurface(); |
| 2639 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (adjacentSubSurface) { |
| 2640 | ✗ | subSurface.resetAdjacentSubSurface(); | |
| 2641 | ✗ | adjacentSubSurface->resetAdjacentSubSurface(); | |
| 2642 | } | ||
| 2643 | 2 | } | |
| 2644 | 2 | } | |
| 2645 | 1 | } | |
| 2646 | |||
| 2647 | 9815 | void Space_Impl::matchSurfaces(Space& other) { | |
| 2648 | 9815 | double tol = 0.01; | |
| 2649 | |||
| 2650 |
4/5✓ Branch 1 taken 9815 times.
✓ Branch 4 taken 9815 times.
✓ Branch 7 taken 9815 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 9815 times.
|
9815 | if (this->handle() == other.handle()) { |
| 2651 | ✗ | return; | |
| 2652 | } | ||
| 2653 | |||
| 2654 | // transform from other to this coordinates | ||
| 2655 |
4/4✓ Branch 1 taken 9815 times.
✓ Branch 4 taken 9815 times.
✓ Branch 7 taken 9815 times.
✓ Branch 10 taken 9815 times.
|
9815 | Transformation transformation = this->transformation().inverse() * other.transformation(); |
| 2656 | |||
| 2657 |
3/3✓ Branch 1 taken 9815 times.
✓ Branch 8 taken 97494 times.
✓ Branch 9 taken 9815 times.
|
107309 | for (Surface& surface : this->surfaces()) { |
| 2658 |
3/3✓ Branch 1 taken 97494 times.
✓ Branch 4 taken 28695 times.
✓ Branch 5 taken 68799 times.
|
194988 | if (surface.adjacentSurface()) { |
| 2659 | 28695 | continue; | |
| 2660 | } | ||
| 2661 |
1/1✓ Branch 1 taken 68799 times.
|
68799 | std::vector<Point3d> vertices = surface.vertices(); |
| 2662 |
1/1✓ Branch 1 taken 68799 times.
|
68799 | boost::optional<Vector3d> outwardNormal = getOutwardNormal(vertices); |
| 2663 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 68799 times.
|
68799 | if (!outwardNormal) { |
| 2664 | ✗ | continue; | |
| 2665 | } | ||
| 2666 | |||
| 2667 |
3/3✓ Branch 1 taken 68799 times.
✓ Branch 8 taken 718292 times.
✓ Branch 9 taken 68799 times.
|
787091 | for (Surface& otherSurface : other.surfaces()) { |
| 2668 |
3/3✓ Branch 1 taken 718292 times.
✓ Branch 4 taken 125209 times.
✓ Branch 5 taken 593083 times.
|
1436584 | if (otherSurface.adjacentSurface()) { |
| 2669 | 636557 | continue; | |
| 2670 | } | ||
| 2671 |
2/2✓ Branch 1 taken 593083 times.
✓ Branch 4 taken 593083 times.
|
593083 | std::vector<Point3d> otherVertices = transformation * otherSurface.vertices(); |
| 2672 |
1/1✓ Branch 1 taken 593083 times.
|
593083 | boost::optional<Vector3d> otherOutwardNormal = getOutwardNormal(otherVertices); |
| 2673 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 593083 times.
|
593083 | if (!otherOutwardNormal) { |
| 2674 | ✗ | continue; | |
| 2675 | } | ||
| 2676 | |||
| 2677 |
3/3✓ Branch 1 taken 593083 times.
✓ Branch 4 taken 593083 times.
✓ Branch 7 taken 593083 times.
|
593083 | double dot = outwardNormal->dot(*otherOutwardNormal); |
| 2678 | |||
| 2679 |
2/2✓ Branch 0 taken 511348 times.
✓ Branch 1 taken 81735 times.
|
593083 | if (dot > -0.98) { |
| 2680 | 511348 | continue; | |
| 2681 | } | ||
| 2682 | |||
| 2683 |
1/1✓ Branch 3 taken 81735 times.
|
81735 | std::reverse(otherVertices.begin(), otherVertices.end()); |
| 2684 | |||
| 2685 |
3/3✓ Branch 1 taken 81735 times.
✓ Branch 3 taken 7183 times.
✓ Branch 4 taken 74552 times.
|
81735 | if (circularEqual(vertices, otherVertices, tol)) { |
| 2686 | |||
| 2687 | // TODO: check constructions? | ||
| 2688 |
1/1✓ Branch 1 taken 7183 times.
|
7183 | surface.setAdjacentSurface(otherSurface); |
| 2689 |
1/1✓ Branch 1 taken 7183 times.
|
7183 | otherSurface.setAdjacentSurface(surface); |
| 2690 | |||
| 2691 | // once surfaces are matched, check subsurfaces | ||
| 2692 |
3/3✓ Branch 1 taken 7183 times.
✓ Branch 8 taken 22 times.
✓ Branch 9 taken 7183 times.
|
7205 | for (SubSurface& subSurface : surface.subSurfaces()) { |
| 2693 | |||
| 2694 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | vertices = removeCollinear(subSurface.vertices()); |
| 2695 | |||
| 2696 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 8 taken 34 times.
✓ Branch 9 taken 22 times.
|
56 | for (SubSurface& otherSubSurface : otherSurface.subSurfaces()) { |
| 2697 | |||
| 2698 |
3/3✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
✓ Branch 7 taken 34 times.
|
34 | otherVertices = removeCollinear(transformation * otherSubSurface.vertices()); |
| 2699 |
1/1✓ Branch 3 taken 34 times.
|
34 | std::reverse(otherVertices.begin(), otherVertices.end()); |
| 2700 | |||
| 2701 |
3/3✓ Branch 1 taken 34 times.
✓ Branch 3 taken 22 times.
✓ Branch 4 taken 12 times.
|
34 | if (circularEqual(vertices, otherVertices, tol)) { |
| 2702 | |||
| 2703 | // TODO: check constructions? | ||
| 2704 |
1/1✓ Branch 1 taken 22 times.
|
22 | subSurface.setAdjacentSubSurface(otherSubSurface); |
| 2705 |
1/1✓ Branch 1 taken 22 times.
|
22 | otherSubSurface.setAdjacentSubSurface(subSurface); |
| 2706 | } | ||
| 2707 | 22 | } | |
| 2708 | 7183 | } | |
| 2709 | } | ||
| 2710 | 1173230 | } | |
| 2711 | 78614 | } | |
| 2712 | 9815 | } | |
| 2713 | |||
| 2714 | 8714 | void Space_Impl::intersectSurfaces(Space& other) { | |
| 2715 |
4/5✓ Branch 1 taken 8714 times.
✓ Branch 4 taken 8714 times.
✓ Branch 7 taken 8714 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8714 times.
|
8714 | if (this->handle() == other.handle()) { |
| 2716 | ✗ | return; | |
| 2717 | } | ||
| 2718 | |||
| 2719 |
1/1✓ Branch 1 taken 8714 times.
|
8714 | std::string name = nameString(); |
| 2720 |
1/1✓ Branch 1 taken 8714 times.
|
8714 | std::string otherName = other.nameString(); |
| 2721 |
8/8✓ Branch 1 taken 8714 times.
✓ Branch 4 taken 8714 times.
✓ Branch 7 taken 8714 times.
✓ Branch 10 taken 8714 times.
✓ Branch 13 taken 8714 times.
✓ Branch 16 taken 8714 times.
✓ Branch 19 taken 8714 times.
✓ Branch 22 taken 8714 times.
|
8714 | LOG(Debug, "Intersecting space " << name << " with space " << otherName); |
| 2722 | |||
| 2723 |
1/1✓ Branch 1 taken 8714 times.
|
8714 | std::vector<Surface> surfaces = this->surfaces(); |
| 2724 |
1/1✓ Branch 1 taken 8714 times.
|
8714 | std::vector<Surface> otherSurfaces = other.surfaces(); |
| 2725 | |||
| 2726 |
1/1✓ Branch 3 taken 8714 times.
|
345385 | std::sort(surfaces.begin(), surfaces.end(), [](const Surface& a, const Surface& b) -> bool { return a.grossArea() > b.grossArea(); }); |
| 2727 |
1/1✓ Branch 3 taken 8714 times.
|
343040 | std::sort(otherSurfaces.begin(), otherSurfaces.end(), [](const Surface& a, const Surface& b) -> bool { return a.grossArea() > b.grossArea(); }); |
| 2728 | |||
| 2729 | 8714 | std::map<std::string, bool> hasSubSurfaceMap; | |
| 2730 | 8714 | std::map<std::string, bool> hasAdjacentSurfaceMap; | |
| 2731 | 8714 | std::set<std::string> completedIntersections; | |
| 2732 | |||
| 2733 | 8714 | bool anyNewSurfaces = true; | |
| 2734 |
2/2✓ Branch 0 taken 10421 times.
✓ Branch 1 taken 8714 times.
|
19135 | while (anyNewSurfaces) { |
| 2735 | |||
| 2736 | 10421 | anyNewSurfaces = false; | |
| 2737 | 10421 | std::vector<Surface> newSurfaces; | |
| 2738 | 10421 | std::vector<Surface> newOtherSurfaces; | |
| 2739 | |||
| 2740 |
2/2✓ Branch 5 taken 119059 times.
✓ Branch 6 taken 10421 times.
|
129480 | for (Surface& surface : surfaces) { |
| 2741 |
2/2✓ Branch 1 taken 119059 times.
✓ Branch 4 taken 119059 times.
|
119059 | std::string surfaceHandle = toString(surface.handle()); |
| 2742 | |||
| 2743 |
3/3✓ Branch 2 taken 119059 times.
✓ Branch 5 taken 90904 times.
✓ Branch 6 taken 28155 times.
|
119059 | if (hasSubSurfaceMap.find(surfaceHandle) == hasSubSurfaceMap.end()) { |
| 2744 |
2/2✓ Branch 1 taken 90904 times.
✓ Branch 5 taken 90904 times.
|
90904 | hasSubSurfaceMap[surfaceHandle] = !surface.subSurfaces().empty(); |
| 2745 |
2/2✓ Branch 1 taken 90904 times.
✓ Branch 5 taken 90904 times.
|
90904 | hasAdjacentSurfaceMap[surfaceHandle] = surface.adjacentSurface().has_value(); |
| 2746 | } | ||
| 2747 | |||
| 2748 |
8/8✓ Branch 1 taken 119059 times.
✓ Branch 3 taken 114379 times.
✓ Branch 4 taken 4680 times.
✓ Branch 6 taken 114379 times.
✓ Branch 8 taken 35465 times.
✓ Branch 9 taken 78914 times.
✓ Branch 10 taken 40145 times.
✓ Branch 11 taken 78914 times.
|
119059 | if (hasSubSurfaceMap[surfaceHandle] || hasAdjacentSurfaceMap[surfaceHandle]) { |
| 2749 | 40145 | continue; | |
| 2750 | } | ||
| 2751 | |||
| 2752 |
2/2✓ Branch 5 taken 876722 times.
✓ Branch 6 taken 78914 times.
|
955636 | for (Surface& otherSurface : otherSurfaces) { |
| 2753 |
2/2✓ Branch 1 taken 876722 times.
✓ Branch 4 taken 876722 times.
|
876722 | std::string otherSurfaceHandle = toString(otherSurface.handle()); |
| 2754 | |||
| 2755 |
3/3✓ Branch 2 taken 876722 times.
✓ Branch 5 taken 91495 times.
✓ Branch 6 taken 785227 times.
|
876722 | if (hasSubSurfaceMap.find(otherSurfaceHandle) == hasSubSurfaceMap.end()) { |
| 2756 |
2/2✓ Branch 1 taken 91495 times.
✓ Branch 5 taken 91495 times.
|
91495 | hasSubSurfaceMap[otherSurfaceHandle] = !otherSurface.subSurfaces().empty(); |
| 2757 |
2/2✓ Branch 1 taken 91495 times.
✓ Branch 5 taken 91495 times.
|
91495 | hasAdjacentSurfaceMap[otherSurfaceHandle] = otherSurface.adjacentSurface().has_value(); |
| 2758 | } | ||
| 2759 | |||
| 2760 |
8/8✓ Branch 1 taken 876722 times.
✓ Branch 3 taken 837198 times.
✓ Branch 4 taken 39524 times.
✓ Branch 6 taken 837198 times.
✓ Branch 8 taken 111001 times.
✓ Branch 9 taken 726197 times.
✓ Branch 10 taken 150525 times.
✓ Branch 11 taken 726197 times.
|
876722 | if (hasSubSurfaceMap[otherSurfaceHandle] || hasAdjacentSurfaceMap[otherSurfaceHandle]) { |
| 2761 | 150525 | continue; | |
| 2762 | } | ||
| 2763 | |||
| 2764 | // see if we have already tested these for intersection, | ||
| 2765 | // surfaces that previously did not intersect will not intersect if vertices change | ||
| 2766 | // surfaces that previously did intersect will intersect exactly | ||
| 2767 |
1/1✓ Branch 1 taken 726197 times.
|
726197 | std::string intersectionKey = surfaceHandle + otherSurfaceHandle; |
| 2768 |
3/3✓ Branch 2 taken 726197 times.
✓ Branch 5 taken 205550 times.
✓ Branch 6 taken 520647 times.
|
726197 | if (completedIntersections.find(intersectionKey) != completedIntersections.end()) { |
| 2769 | 205550 | continue; | |
| 2770 | } | ||
| 2771 |
1/1✓ Branch 1 taken 520647 times.
|
520647 | completedIntersections.insert(intersectionKey); |
| 2772 | |||
| 2773 | // number of surfaces in each space will only increase in intersect | ||
| 2774 |
1/1✓ Branch 1 taken 520647 times.
|
520647 | boost::optional<SurfaceIntersection> intersection = surface.computeIntersection(otherSurface); |
| 2775 |
2/2✓ Branch 0 taken 6427 times.
✓ Branch 1 taken 514220 times.
|
520647 | if (intersection) { |
| 2776 |
2/2✓ Branch 1 taken 6427 times.
✓ Branch 4 taken 6427 times.
|
6427 | std::vector<Surface> newSurfaces1 = intersection->newSurfaces1(); |
| 2777 |
2/2✓ Branch 1 taken 6427 times.
✓ Branch 4 taken 6427 times.
|
6427 | std::vector<Surface> newSurfaces2 = intersection->newSurfaces2(); |
| 2778 | |||
| 2779 | // surfaces involved in this intersection are ineligible to be re-intersected with other surfaces in this intersection | ||
| 2780 | 6427 | std::vector<Surface> ineligibleSurfaces; | |
| 2781 |
1/1✓ Branch 2 taken 6427 times.
|
6427 | ineligibleSurfaces.reserve(newSurfaces1.size() + 1); |
| 2782 |
1/1✓ Branch 1 taken 6427 times.
|
6427 | ineligibleSurfaces.push_back(surface); |
| 2783 |
1/1✓ Branch 5 taken 6427 times.
|
6427 | ineligibleSurfaces.insert(ineligibleSurfaces.end(), newSurfaces1.begin(), newSurfaces1.end()); |
| 2784 | |||
| 2785 | 6427 | std::vector<Surface> ineligibleOtherSurfaces; | |
| 2786 |
1/1✓ Branch 2 taken 6427 times.
|
6427 | ineligibleOtherSurfaces.reserve(newSurfaces2.size() + 1); |
| 2787 |
1/1✓ Branch 1 taken 6427 times.
|
6427 | ineligibleOtherSurfaces.push_back(otherSurface); |
| 2788 |
1/1✓ Branch 5 taken 6427 times.
|
6427 | ineligibleOtherSurfaces.insert(ineligibleOtherSurfaces.end(), newSurfaces2.begin(), newSurfaces2.end()); |
| 2789 |
2/2✓ Branch 5 taken 7826 times.
✓ Branch 6 taken 6427 times.
|
14253 | for (Surface& ineligibleSurface : ineligibleSurfaces) { |
| 2790 |
2/2✓ Branch 5 taken 9804 times.
✓ Branch 6 taken 7826 times.
|
17630 | for (Surface& ineligibleOtherSurface : ineligibleOtherSurfaces) { |
| 2791 |
5/5✓ Branch 1 taken 9804 times.
✓ Branch 4 taken 9804 times.
✓ Branch 7 taken 9804 times.
✓ Branch 10 taken 9804 times.
✓ Branch 13 taken 9804 times.
|
9804 | std::string ineligibleIntersectionKey = toString(ineligibleSurface.handle()) + toString(ineligibleOtherSurface.handle()); |
| 2792 |
1/1✓ Branch 1 taken 9804 times.
|
9804 | completedIntersections.insert(ineligibleIntersectionKey); |
| 2793 | 9804 | } | |
| 2794 | } | ||
| 2795 | |||
| 2796 |
1/1✓ Branch 3 taken 6427 times.
|
6427 | newSurfaces.reserve(newSurfaces.size() + newSurfaces1.size()); |
| 2797 |
3/3✓ Branch 2 taken 6427 times.
✓ Branch 6 taken 6427 times.
✓ Branch 11 taken 6427 times.
|
6427 | newSurfaces.insert(newSurfaces.end(), std::make_move_iterator(newSurfaces1.begin()), std::make_move_iterator(newSurfaces1.end())); |
| 2798 |
1/1✓ Branch 3 taken 6427 times.
|
6427 | newOtherSurfaces.reserve(newOtherSurfaces.size() + newSurfaces2.size()); |
| 2799 |
3/3✓ Branch 2 taken 6427 times.
✓ Branch 6 taken 6427 times.
✓ Branch 11 taken 6427 times.
|
6427 | newOtherSurfaces.insert(newOtherSurfaces.end(), std::make_move_iterator(newSurfaces2.begin()), |
| 2800 | std::make_move_iterator(newSurfaces2.end())); | ||
| 2801 | 6427 | } | |
| 2802 | 1082272 | } | |
| 2803 | 119059 | } | |
| 2804 | |||
| 2805 |
2/2✓ Branch 1 taken 1100 times.
✓ Branch 2 taken 9321 times.
|
10421 | if (!newSurfaces.empty()) { |
| 2806 |
1/1✓ Branch 5 taken 1100 times.
|
1100 | surfaces.insert(surfaces.end(), newSurfaces.begin(), newSurfaces.end()); |
| 2807 | 1100 | anyNewSurfaces = true; | |
| 2808 | } | ||
| 2809 |
2/2✓ Branch 1 taken 1084 times.
✓ Branch 2 taken 9337 times.
|
10421 | if (!newOtherSurfaces.empty()) { |
| 2810 |
1/1✓ Branch 5 taken 1084 times.
|
1084 | otherSurfaces.insert(otherSurfaces.end(), newOtherSurfaces.begin(), newOtherSurfaces.end()); |
| 2811 | 1084 | anyNewSurfaces = true; | |
| 2812 | } | ||
| 2813 | 10421 | } | |
| 2814 | 8714 | } | |
| 2815 | |||
| 2816 | 422 | std::vector<Surface> Space_Impl::findSurfaces(boost::optional<double> minDegreesFromNorth, boost::optional<double> maxDegreesFromNorth, | |
| 2817 | boost::optional<double> minDegreesTilt, boost::optional<double> maxDegreesTilt, double tol) { | ||
| 2818 | |||
| 2819 | 422 | std::vector<PlanarSurface> planarSurfaces; | |
| 2820 |
1/1✓ Branch 1 taken 422 times.
|
422 | auto thisSurfaces = this->surfaces(); |
| 2821 |
1/1✓ Branch 2 taken 422 times.
|
422 | planarSurfaces.reserve(thisSurfaces.size()); |
| 2822 |
3/3✓ Branch 2 taken 422 times.
✓ Branch 6 taken 422 times.
✓ Branch 11 taken 422 times.
|
422 | planarSurfaces.insert(planarSurfaces.end(), std::make_move_iterator(thisSurfaces.begin()), std::make_move_iterator(thisSurfaces.end())); |
| 2823 | |||
| 2824 | planarSurfaces = | ||
| 2825 |
1/1✓ Branch 1 taken 422 times.
|
422 | PlanarSurface::findPlanarSurfaces(planarSurfaces, minDegreesFromNorth, maxDegreesFromNorth, minDegreesTilt, maxDegreesTilt, tol); |
| 2826 | |||
| 2827 | 422 | std::vector<Surface> result; | |
| 2828 |
1/1✓ Branch 2 taken 422 times.
|
422 | result.reserve(planarSurfaces.size()); |
| 2829 |
2/2✓ Branch 4 taken 426 times.
✓ Branch 5 taken 422 times.
|
848 | for (const PlanarSurface& planarSurface : planarSurfaces) { |
| 2830 |
2/2✓ Branch 1 taken 426 times.
✓ Branch 4 taken 426 times.
|
426 | result.emplace_back(planarSurface.cast<Surface>()); |
| 2831 | } | ||
| 2832 | |||
| 2833 | 844 | return result; | |
| 2834 | 422 | } | |
| 2835 | |||
| 2836 | ✗ | boost::optional<ModelObject> Space_Impl::spaceTypeAsModelObject() const { | |
| 2837 | ✗ | OptionalModelObject result; | |
| 2838 | ✗ | OptionalSpaceType intermediate = spaceType(); | |
| 2839 | ✗ | if (intermediate) { | |
| 2840 | ✗ | result = *intermediate; | |
| 2841 | } | ||
| 2842 | ✗ | return result; | |
| 2843 | ✗ | } | |
| 2844 | |||
| 2845 | ✗ | boost::optional<ModelObject> Space_Impl::defaultConstructionSetAsModelObject() const { | |
| 2846 | ✗ | OptionalModelObject result; | |
| 2847 | ✗ | OptionalDefaultConstructionSet intermediate = defaultConstructionSet(); | |
| 2848 | ✗ | if (intermediate) { | |
| 2849 | ✗ | result = *intermediate; | |
| 2850 | } | ||
| 2851 | ✗ | return result; | |
| 2852 | ✗ | } | |
| 2853 | |||
| 2854 | ✗ | boost::optional<ModelObject> Space_Impl::defaultScheduleSetAsModelObject() const { | |
| 2855 | ✗ | OptionalModelObject result; | |
| 2856 | ✗ | OptionalDefaultScheduleSet intermediate = defaultScheduleSet(); | |
| 2857 | ✗ | if (intermediate) { | |
| 2858 | ✗ | result = *intermediate; | |
| 2859 | } | ||
| 2860 | ✗ | return result; | |
| 2861 | ✗ | } | |
| 2862 | |||
| 2863 | ✗ | boost::optional<ModelObject> Space_Impl::thermalZoneAsModelObject() const { | |
| 2864 | ✗ | OptionalModelObject result; | |
| 2865 | ✗ | OptionalThermalZone intermediate = thermalZone(); | |
| 2866 | ✗ | if (intermediate) { | |
| 2867 | ✗ | result = *intermediate; | |
| 2868 | } | ||
| 2869 | ✗ | return result; | |
| 2870 | ✗ | } | |
| 2871 | |||
| 2872 | ✗ | boost::optional<ModelObject> Space_Impl::buildingStoryAsModelObject() const { | |
| 2873 | ✗ | OptionalModelObject result; | |
| 2874 | ✗ | OptionalBuildingStory intermediate = buildingStory(); | |
| 2875 | ✗ | if (intermediate) { | |
| 2876 | ✗ | result = *intermediate; | |
| 2877 | } | ||
| 2878 | ✗ | return result; | |
| 2879 | ✗ | } | |
| 2880 | |||
| 2881 | ✗ | std::vector<ModelObject> Space_Impl::shadingSurfaceGroupsAsModelObjects() const { | |
| 2882 | ✗ | ModelObjectVector result = castVector<ModelObject>(shadingSurfaceGroups()); | |
| 2883 | ✗ | return result; | |
| 2884 | } | ||
| 2885 | |||
| 2886 | ✗ | std::vector<ModelObject> Space_Impl::interiorPartitionSurfaceGroupsAsModelObjects() const { | |
| 2887 | ✗ | ModelObjectVector result = castVector<ModelObject>(interiorPartitionSurfaceGroups()); | |
| 2888 | ✗ | return result; | |
| 2889 | } | ||
| 2890 | |||
| 2891 | ✗ | std::vector<ModelObject> Space_Impl::surfacesAsModelObjects() const { | |
| 2892 | ✗ | ModelObjectVector result = castVector<ModelObject>(surfaces()); | |
| 2893 | ✗ | return result; | |
| 2894 | } | ||
| 2895 | |||
| 2896 | ✗ | std::vector<ModelObject> Space_Impl::internalMassAsModelObjects() const { | |
| 2897 | ✗ | ModelObjectVector result = castVector<ModelObject>(internalMass()); | |
| 2898 | ✗ | return result; | |
| 2899 | } | ||
| 2900 | |||
| 2901 | ✗ | std::vector<ModelObject> Space_Impl::peopleAsModelObjects() const { | |
| 2902 | ✗ | ModelObjectVector result = castVector<ModelObject>(people()); | |
| 2903 | ✗ | return result; | |
| 2904 | } | ||
| 2905 | |||
| 2906 | ✗ | std::vector<ModelObject> Space_Impl::lightsAsModelObjects() const { | |
| 2907 | ✗ | ModelObjectVector result = castVector<ModelObject>(lights()); | |
| 2908 | ✗ | return result; | |
| 2909 | } | ||
| 2910 | |||
| 2911 | ✗ | std::vector<ModelObject> Space_Impl::luminairesAsModelObjects() const { | |
| 2912 | ✗ | ModelObjectVector result = castVector<ModelObject>(luminaires()); | |
| 2913 | ✗ | return result; | |
| 2914 | } | ||
| 2915 | |||
| 2916 | ✗ | std::vector<ModelObject> Space_Impl::electricEquipmentAsModelObjects() const { | |
| 2917 | ✗ | ModelObjectVector result = castVector<ModelObject>(electricEquipment()); | |
| 2918 | ✗ | return result; | |
| 2919 | } | ||
| 2920 | |||
| 2921 | ✗ | std::vector<ModelObject> Space_Impl::electricEquipmentITEAirCooledAsModelObjects() const { | |
| 2922 | ✗ | ModelObjectVector result = castVector<ModelObject>(electricEquipmentITEAirCooled()); | |
| 2923 | ✗ | return result; | |
| 2924 | } | ||
| 2925 | |||
| 2926 | ✗ | std::vector<ModelObject> Space_Impl::gasEquipmentAsModelObjects() const { | |
| 2927 | ✗ | ModelObjectVector result = castVector<ModelObject>(gasEquipment()); | |
| 2928 | ✗ | return result; | |
| 2929 | } | ||
| 2930 | |||
| 2931 | ✗ | std::vector<ModelObject> Space_Impl::hotWaterEquipmentAsModelObjects() const { | |
| 2932 | ✗ | ModelObjectVector result = castVector<ModelObject>(hotWaterEquipment()); | |
| 2933 | ✗ | return result; | |
| 2934 | } | ||
| 2935 | |||
| 2936 | ✗ | std::vector<ModelObject> Space_Impl::steamEquipmentAsModelObjects() const { | |
| 2937 | ✗ | ModelObjectVector result = castVector<ModelObject>(steamEquipment()); | |
| 2938 | ✗ | return result; | |
| 2939 | } | ||
| 2940 | |||
| 2941 | ✗ | std::vector<ModelObject> Space_Impl::otherEquipmentAsModelObjects() const { | |
| 2942 | ✗ | ModelObjectVector result = castVector<ModelObject>(otherEquipment()); | |
| 2943 | ✗ | return result; | |
| 2944 | } | ||
| 2945 | |||
| 2946 | ✗ | std::vector<ModelObject> Space_Impl::daylightingControlsAsModelObjects() const { | |
| 2947 | ✗ | ModelObjectVector result = castVector<ModelObject>(daylightingControls()); | |
| 2948 | ✗ | return result; | |
| 2949 | } | ||
| 2950 | |||
| 2951 | ✗ | std::vector<ModelObject> Space_Impl::illuminanceMapsAsModelObjects() const { | |
| 2952 | ✗ | ModelObjectVector result = castVector<ModelObject>(illuminanceMaps()); | |
| 2953 | ✗ | return result; | |
| 2954 | } | ||
| 2955 | |||
| 2956 | ✗ | std::vector<ModelObject> Space_Impl::spaceInfiltrationDesignFlowRatesAsModelObjects() const { | |
| 2957 | ✗ | ModelObjectVector result = castVector<ModelObject>(spaceInfiltrationDesignFlowRates()); | |
| 2958 | ✗ | return result; | |
| 2959 | } | ||
| 2960 | |||
| 2961 | ✗ | std::vector<ModelObject> Space_Impl::spaceInfiltrationEffectiveLeakageAreasAsModelObjects() const { | |
| 2962 | ✗ | ModelObjectVector result = castVector<ModelObject>(spaceInfiltrationEffectiveLeakageAreas()); | |
| 2963 | ✗ | return result; | |
| 2964 | } | ||
| 2965 | |||
| 2966 | ✗ | std::vector<ModelObject> Space_Impl::spaceInfiltrationFlowCoefficientsAsModelObjects() const { | |
| 2967 | ✗ | ModelObjectVector result = castVector<ModelObject>(spaceInfiltrationFlowCoefficients()); | |
| 2968 | ✗ | return result; | |
| 2969 | } | ||
| 2970 | |||
| 2971 | ✗ | bool Space_Impl::setSpaceTypeAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 2972 | ✗ | if (modelObject) { | |
| 2973 | ✗ | OptionalSpaceType intermediate = modelObject->optionalCast<SpaceType>(); | |
| 2974 | ✗ | if (intermediate) { | |
| 2975 | ✗ | return setSpaceType(*intermediate); | |
| 2976 | } else { | ||
| 2977 | ✗ | return false; | |
| 2978 | } | ||
| 2979 | ✗ | } else { | |
| 2980 | ✗ | resetSpaceType(); | |
| 2981 | } | ||
| 2982 | ✗ | return true; | |
| 2983 | } | ||
| 2984 | |||
| 2985 | ✗ | bool Space_Impl::setDefaultConstructionSetAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 2986 | ✗ | if (modelObject) { | |
| 2987 | ✗ | OptionalDefaultConstructionSet intermediate = modelObject->optionalCast<DefaultConstructionSet>(); | |
| 2988 | ✗ | if (intermediate) { | |
| 2989 | ✗ | return setDefaultConstructionSet(*intermediate); | |
| 2990 | } else { | ||
| 2991 | ✗ | return false; | |
| 2992 | } | ||
| 2993 | ✗ | } else { | |
| 2994 | ✗ | resetDefaultConstructionSet(); | |
| 2995 | } | ||
| 2996 | ✗ | return true; | |
| 2997 | } | ||
| 2998 | |||
| 2999 | ✗ | bool Space_Impl::setDefaultScheduleSetAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 3000 | ✗ | if (modelObject) { | |
| 3001 | ✗ | OptionalDefaultScheduleSet intermediate = modelObject->optionalCast<DefaultScheduleSet>(); | |
| 3002 | ✗ | if (intermediate) { | |
| 3003 | ✗ | return setDefaultScheduleSet(*intermediate); | |
| 3004 | } else { | ||
| 3005 | ✗ | return false; | |
| 3006 | } | ||
| 3007 | ✗ | } else { | |
| 3008 | ✗ | resetDefaultScheduleSet(); | |
| 3009 | } | ||
| 3010 | ✗ | return true; | |
| 3011 | } | ||
| 3012 | |||
| 3013 | ✗ | bool Space_Impl::setThermalZoneAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 3014 | ✗ | if (modelObject) { | |
| 3015 | ✗ | OptionalThermalZone intermediate = modelObject->optionalCast<ThermalZone>(); | |
| 3016 | ✗ | if (intermediate) { | |
| 3017 | ✗ | return setThermalZone(*intermediate); | |
| 3018 | } | ||
| 3019 | ✗ | } | |
| 3020 | ✗ | return false; | |
| 3021 | } | ||
| 3022 | |||
| 3023 | ✗ | bool Space_Impl::setBuildingStoryAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 3024 | ✗ | if (modelObject) { | |
| 3025 | ✗ | OptionalBuildingStory intermediate = modelObject->optionalCast<BuildingStory>(); | |
| 3026 | ✗ | if (intermediate) { | |
| 3027 | ✗ | return setBuildingStory(*intermediate); | |
| 3028 | } | ||
| 3029 | ✗ | } | |
| 3030 | ✗ | return false; | |
| 3031 | } | ||
| 3032 | |||
| 3033 | template <typename T, typename TDef> | ||
| 3034 | 4 | boost::optional<T> Space_Impl::getMySpaceLoadInstance(const boost::optional<T>& templateSpaceLoadInstance) { | |
| 3035 | 4 | boost::optional<T> result; | |
| 3036 |
3/10boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (!templateSpaceLoadInstance) { |
| 3037 |
2/10boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | TDef myDefinition(model()); |
| 3038 |
1/5boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✓ Branch 1 taken 2 times.
|
2 | T myInstance(myDefinition); |
| 3039 |
1/5boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✓ Branch 1 taken 2 times.
|
2 | result = myInstance; |
| 3040 | 2 | } else { | |
| 3041 |
4/10boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
|
2 | boost::optional<Space> templateSpace = templateSpaceLoadInstance->space(); |
| 3042 |
6/65boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 time.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 time.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
|
4 | if (templateSpace && (templateSpace.get() == getObject<Space>())) { |
| 3043 | ✗ | result = templateSpaceLoadInstance; | |
| 3044 |
10/30boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
2 | } else if (templateSpaceLoadInstance->model() != model()) { |
| 3045 | ✗ | return boost::none; | |
| 3046 |
12/60boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
2 | } else if (!templateSpace && !templateSpaceLoadInstance->spaceType()) { |
| 3047 |
2/5boost::optional<openstudio::model::ElectricEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::ElectricEquipment, openstudio::model::ElectricEquipmentDefinition>(boost::optional<openstudio::model::ElectricEquipment> const&):
✓ Branch 1 taken 1 time.
boost::optional<openstudio::model::GasEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::GasEquipment, openstudio::model::GasEquipmentDefinition>(boost::optional<openstudio::model::GasEquipment> const&):
✓ Branch 1 taken 1 time.
boost::optional<openstudio::model::HotWaterEquipment> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::HotWaterEquipment, openstudio::model::HotWaterEquipmentDefinition>(boost::optional<openstudio::model::HotWaterEquipment> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::Lights> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::Lights, openstudio::model::LightsDefinition>(boost::optional<openstudio::model::Lights> const&):
✗ Branch 1 not taken.
boost::optional<openstudio::model::People> openstudio::model::detail::Space_Impl::getMySpaceLoadInstance<openstudio::model::People, openstudio::model::PeopleDefinition>(boost::optional<openstudio::model::People> const&):
✗ Branch 1 not taken.
|
2 | result = templateSpaceLoadInstance; |
| 3048 | } else { | ||
| 3049 | ✗ | T myInstance = templateSpaceLoadInstance->clone().template cast<T>(); | |
| 3050 | ✗ | result = myInstance; | |
| 3051 | ✗ | } | |
| 3052 | 2 | } | |
| 3053 | 4 | return result; | |
| 3054 | 4 | } | |
| 3055 | |||
| 3056 | template <typename T> | ||
| 3057 | 4 | void Space_Impl::removeAllButOneSpaceLoadInstance(std::vector<T>& instances, const T& instanceToKeep) { | |
| 3058 | 4 | int count(0); | |
| 3059 |
6/10void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::ElectricEquipment>(std::vector<openstudio::model::ElectricEquipment, std::allocator<openstudio::model::ElectricEquipment> >&, openstudio::model::ElectricEquipment const&):
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::GasEquipment>(std::vector<openstudio::model::GasEquipment, std::allocator<openstudio::model::GasEquipment> >&, openstudio::model::GasEquipment const&):
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::HotWaterEquipment>(std::vector<openstudio::model::HotWaterEquipment, std::allocator<openstudio::model::HotWaterEquipment> >&, openstudio::model::HotWaterEquipment const&):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::Lights>(std::vector<openstudio::model::Lights, std::allocator<openstudio::model::Lights> >&, openstudio::model::Lights const&):
✗ Branch 5 not taken.
✗ Branch 6 not taken.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::People>(std::vector<openstudio::model::People, std::allocator<openstudio::model::People> >&, openstudio::model::People const&):
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
|
8 | for (auto& instance : instances) { |
| 3060 |
6/15void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::ElectricEquipment>(std::vector<openstudio::model::ElectricEquipment, std::allocator<openstudio::model::ElectricEquipment> >&, openstudio::model::ElectricEquipment const&):
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::GasEquipment>(std::vector<openstudio::model::GasEquipment, std::allocator<openstudio::model::GasEquipment> >&, openstudio::model::GasEquipment const&):
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::HotWaterEquipment>(std::vector<openstudio::model::HotWaterEquipment, std::allocator<openstudio::model::HotWaterEquipment> >&, openstudio::model::HotWaterEquipment const&):
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::Lights>(std::vector<openstudio::model::Lights, std::allocator<openstudio::model::Lights> >&, openstudio::model::Lights const&):
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::People>(std::vector<openstudio::model::People, std::allocator<openstudio::model::People> >&, openstudio::model::People const&):
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (instance == instanceToKeep) { |
| 3061 | 4 | ++count; | |
| 3062 | 4 | continue; | |
| 3063 | } | ||
| 3064 | ✗ | instance.remove(); | |
| 3065 | } | ||
| 3066 |
3/10void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::ElectricEquipment>(std::vector<openstudio::model::ElectricEquipment, std::allocator<openstudio::model::ElectricEquipment> >&, openstudio::model::ElectricEquipment const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::GasEquipment>(std::vector<openstudio::model::GasEquipment, std::allocator<openstudio::model::GasEquipment> >&, openstudio::model::GasEquipment const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::HotWaterEquipment>(std::vector<openstudio::model::HotWaterEquipment, std::allocator<openstudio::model::HotWaterEquipment> >&, openstudio::model::HotWaterEquipment const&):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::Lights>(std::vector<openstudio::model::Lights, std::allocator<openstudio::model::Lights> >&, openstudio::model::Lights const&):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
void openstudio::model::detail::Space_Impl::removeAllButOneSpaceLoadInstance<openstudio::model::People>(std::vector<openstudio::model::People, std::allocator<openstudio::model::People> >&, openstudio::model::People const&):
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
4 | OS_ASSERT(count == 1); |
| 3067 | 4 | } | |
| 3068 | |||
| 3069 | 596 | std::vector<Point3d> Space_Impl::floorPrint() const { | |
| 3070 | 596 | double tol = 0.01; // 1 cm tolerance | |
| 3071 | |||
| 3072 | // get all surfaces, sort so results are repeatable | ||
| 3073 |
1/1✓ Branch 1 taken 596 times.
|
596 | std::vector<Surface> surfaces = this->surfaces(); |
| 3074 |
1/1✓ Branch 3 taken 596 times.
|
596 | std::sort(surfaces.begin(), surfaces.end(), IdfObjectNameLess()); |
| 3075 | |||
| 3076 | // find all floors | ||
| 3077 | 596 | boost::optional<double> z; | |
| 3078 | 596 | std::vector<Surface> floors; | |
| 3079 |
2/2✓ Branch 5 taken 4624 times.
✓ Branch 6 taken 595 times.
|
5219 | for (const Surface& surface : surfaces) { |
| 3080 |
2/3✓ Branch 1 taken 4624 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4624 times.
|
4624 | if (surface.vertices().size() < 3) { |
| 3081 | ✗ | LOG(Warn, "Skipping floor with fewer than 3 vertices"); | |
| 3082 | ✗ | continue; | |
| 3083 | ✗ | } | |
| 3084 |
5/5✓ Branch 1 taken 4624 times.
✓ Branch 4 taken 4624 times.
✓ Branch 7 taken 4624 times.
✓ Branch 11 taken 741 times.
✓ Branch 12 taken 3883 times.
|
13872 | if (istringEqual("Floor", surface.surfaceType())) { |
| 3085 |
1/1✓ Branch 1 taken 741 times.
|
741 | floors.push_back(surface); |
| 3086 |
3/3✓ Branch 1 taken 741 times.
✓ Branch 8 taken 3437 times.
✓ Branch 9 taken 740 times.
|
4177 | for (const Point3d& point : surface.vertices()) { |
| 3087 |
2/2✓ Branch 1 taken 594 times.
✓ Branch 2 taken 2843 times.
|
3437 | if (!z) { |
| 3088 |
2/2✓ Branch 1 taken 594 times.
✓ Branch 4 taken 594 times.
|
594 | z = point.z(); |
| 3089 |
4/4✓ Branch 1 taken 2843 times.
✓ Branch 4 taken 2843 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 2842 times.
|
2843 | } else if (std::abs(z.get() - point.z()) > tol) { |
| 3090 |
5/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
|
1 | LOG(Error, "All floor surfaces must lie on the same x, y plane to compute space floor print"); |
| 3091 | 1 | return {}; | |
| 3092 | } | ||
| 3093 | 741 | } | |
| 3094 | } | ||
| 3095 | } | ||
| 3096 | |||
| 3097 | 595 | std::vector<Point3d> result; | |
| 3098 | 595 | std::vector<Point3d> allPoints; | |
| 3099 | |||
| 3100 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 593 times.
|
595 | if (floors.empty()) { |
| 3101 |
5/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
|
2 | LOG(Error, "No floor surfaces found to compute space floor print"); |
| 3102 | 2 | return {}; | |
| 3103 | |||
| 3104 |
2/2✓ Branch 1 taken 527 times.
✓ Branch 2 taken 66 times.
|
593 | } else if (floors.size() == 1) { |
| 3105 | // just return this floors vertices | ||
| 3106 |
1/1✓ Branch 2 taken 527 times.
|
527 | result = floors[0].vertices(); |
| 3107 | |||
| 3108 | // remove collinear points | ||
| 3109 |
1/1✓ Branch 1 taken 527 times.
|
527 | result = removeCollinearLegacy(result); |
| 3110 | |||
| 3111 | // reorder the points | ||
| 3112 |
1/1✓ Branch 1 taken 527 times.
|
527 | result = reorderULC(result); |
| 3113 | |||
| 3114 | // remove additional collinear points that occur after reordering | ||
| 3115 |
1/1✓ Branch 1 taken 527 times.
|
527 | result = removeCollinearLegacy(result); |
| 3116 | |||
| 3117 | } else { | ||
| 3118 | |||
| 3119 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 66 times.
✗ Branch 4 not taken.
|
66 | OS_ASSERT(z); |
| 3120 | |||
| 3121 | using BoostPoint = boost::geometry::model::d2::point_xy<double>; | ||
| 3122 | using BoostPolygon = boost::geometry::model::polygon<BoostPoint>; | ||
| 3123 | using BoostRing = boost::geometry::model::ring<BoostPoint>; | ||
| 3124 | using BoostMultiPolygon = boost::geometry::model::multi_polygon<BoostPolygon>; | ||
| 3125 | |||
| 3126 | 66 | BoostMultiPolygon boostResult; | |
| 3127 | |||
| 3128 | try { | ||
| 3129 |
2/2✓ Branch 5 taken 212 times.
✓ Branch 6 taken 66 times.
|
278 | for (const Surface& floor : floors) { |
| 3130 |
1/1✓ Branch 1 taken 212 times.
|
212 | BoostPolygon boostPolygon; |
| 3131 |
1/1✓ Branch 1 taken 212 times.
|
212 | std::vector<Point3d> vertices = floor.vertices(); |
| 3132 |
2/2✓ Branch 4 taken 940 times.
✓ Branch 5 taken 212 times.
|
1152 | for (const Point3d& point : vertices) { |
| 3133 |
2/2✓ Branch 1 taken 940 times.
✓ Branch 4 taken 940 times.
|
940 | boost::geometry::append(boostPolygon, point3dToTuple(point, allPoints, tol)); |
| 3134 | } | ||
| 3135 |
2/2✓ Branch 2 taken 212 times.
✓ Branch 5 taken 212 times.
|
212 | boost::geometry::append(boostPolygon, point3dToTuple(vertices[0], allPoints, tol)); |
| 3136 | |||
| 3137 | 212 | BoostMultiPolygon tmpResult; | |
| 3138 |
1/1✓ Branch 1 taken 212 times.
|
212 | boost::geometry::union_(boostResult, boostPolygon, tmpResult); |
| 3139 |
1/1✓ Branch 1 taken 212 times.
|
212 | boostResult = tmpResult; |
| 3140 | 212 | } | |
| 3141 | ✗ | } catch (const std::exception& e) { | |
| 3142 | ✗ | LOG(Error, e.what()); | |
| 3143 | ✗ | boostResult.clear(); | |
| 3144 | ✗ | } | |
| 3145 | |||
| 3146 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 63 times.
|
66 | if (boostResult.size() != 1) { |
| 3147 | 3 | return {}; | |
| 3148 | } | ||
| 3149 | |||
| 3150 |
2/2✓ Branch 7 taken 516 times.
✓ Branch 8 taken 63 times.
|
579 | for (const BoostPoint& boostPoint : boostResult[0].outer()) { |
| 3151 |
4/4✓ Branch 1 taken 516 times.
✓ Branch 4 taken 516 times.
✓ Branch 7 taken 516 times.
✓ Branch 10 taken 516 times.
|
516 | Point3d point(boostPoint.x(), boostPoint.y(), *z); |
| 3152 |
1/1✓ Branch 1 taken 516 times.
|
516 | result.push_back(point); |
| 3153 | 516 | } | |
| 3154 | 63 | result.pop_back(); | |
| 3155 | |||
| 3156 | // remove collinear points | ||
| 3157 |
1/1✓ Branch 1 taken 63 times.
|
63 | result = removeCollinearLegacy(result); |
| 3158 | |||
| 3159 | // reorder the points | ||
| 3160 |
1/1✓ Branch 1 taken 63 times.
|
63 | result = reorderULC(result); |
| 3161 | |||
| 3162 | // remove additional collinear points that occur after reordering | ||
| 3163 |
1/1✓ Branch 1 taken 63 times.
|
63 | result = removeCollinearLegacy(result); |
| 3164 | |||
| 3165 | // if result is now empty just quit | ||
| 3166 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
|
63 | if (result.size() < 3) { |
| 3167 | ✗ | return {}; | |
| 3168 | } | ||
| 3169 | |||
| 3170 |
1/1✓ Branch 2 taken 63 times.
|
63 | Point3d lastOuterVertex = result.back(); |
| 3171 | |||
| 3172 |
2/2✓ Branch 7 taken 1 time.
✓ Branch 8 taken 63 times.
|
64 | for (const BoostRing& boostInner : boostResult[0].inners()) { |
| 3173 | |||
| 3174 | 1 | std::vector<Point3d> innerLoop; | |
| 3175 |
2/2✓ Branch 4 taken 5 times.
✓ Branch 5 taken 1 time.
|
6 | for (auto boostPoint = boostInner.rbegin(); boostPoint != boostInner.rend(); ++boostPoint) { |
| 3176 |
6/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
|
5 | Point3d point(boostPoint->x(), boostPoint->y(), *z); |
| 3177 |
1/1✓ Branch 1 taken 5 times.
|
5 | innerLoop.push_back(point); |
| 3178 | 5 | } | |
| 3179 | |||
| 3180 | // remove collinear points | ||
| 3181 |
1/1✓ Branch 1 taken 1 time.
|
1 | innerLoop = removeCollinearLegacy(innerLoop); |
| 3182 | |||
| 3183 | // reorder the points | ||
| 3184 |
1/1✓ Branch 1 taken 1 time.
|
1 | innerLoop = reorderULC(innerLoop); |
| 3185 | |||
| 3186 | // remove additional collinear points that occur after reordering | ||
| 3187 |
1/1✓ Branch 1 taken 1 time.
|
1 | innerLoop = removeCollinearLegacy(innerLoop); |
| 3188 | |||
| 3189 | // if inner loop is now empty just ignore it | ||
| 3190 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (innerLoop.size() < 3) { |
| 3191 | ✗ | continue; | |
| 3192 | } | ||
| 3193 | |||
| 3194 | // reverse the inner loop | ||
| 3195 |
1/1✓ Branch 3 taken 1 time.
|
1 | std::reverse(innerLoop.begin(), innerLoop.end()); |
| 3196 | |||
| 3197 | // close the inner loop | ||
| 3198 |
1/1✓ Branch 2 taken 1 time.
|
1 | innerLoop.push_back(innerLoop.front()); |
| 3199 | |||
| 3200 | // insert the inner loop | ||
| 3201 |
1/1✓ Branch 5 taken 1 time.
|
1 | result.insert(result.end(), innerLoop.begin(), innerLoop.end()); |
| 3202 | |||
| 3203 | // add the last point back in | ||
| 3204 |
1/1✓ Branch 1 taken 1 time.
|
1 | result.push_back(lastOuterVertex); |
| 3205 | 1 | } | |
| 3206 | 66 | } | |
| 3207 | |||
| 3208 | // remove collinear points | ||
| 3209 |
1/1✓ Branch 1 taken 590 times.
|
590 | result = removeCollinearLegacy(result); |
| 3210 | |||
| 3211 | // reorder the points | ||
| 3212 |
1/1✓ Branch 1 taken 590 times.
|
590 | result = reorderULC(result); |
| 3213 | |||
| 3214 | // remove additional collinear points that occur after reordering | ||
| 3215 |
1/1✓ Branch 1 taken 590 times.
|
590 | result = removeCollinearLegacy(result); |
| 3216 | |||
| 3217 | // if result is now empty just quit | ||
| 3218 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 590 times.
|
590 | if (result.size() < 3) { |
| 3219 | ✗ | return {}; | |
| 3220 | } | ||
| 3221 | |||
| 3222 | 590 | return result; | |
| 3223 | 596 | } | |
| 3224 | |||
| 3225 | 4919 | bool Space_Impl::isConvex() const { | |
| 3226 |
2/2✓ Branch 1 taken 4338 times.
✓ Branch 2 taken 581 times.
|
4919 | if (m_cachedIsConvex.has_value()) { |
| 3227 |
1/1✓ Branch 1 taken 4338 times.
|
4338 | return m_cachedIsConvex.get(); |
| 3228 | } | ||
| 3229 |
1/1✓ Branch 1 taken 581 times.
|
581 | auto points = floorPrint(); |
| 3230 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 2 taken 577 times.
|
581 | if (points.empty()) { |
| 3231 |
7/7✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 14 taken 4 times.
✓ Branch 17 taken 4 times.
✓ Branch 20 taken 4 times.
|
4 | LOG(Warn, "Can't compute a floorPrint for " << briefDescription()); |
| 3232 | 4 | return false; | |
| 3233 | } | ||
| 3234 |
3/3✓ Branch 1 taken 577 times.
✓ Branch 5 taken 577 times.
✓ Branch 8 taken 577 times.
|
1154 | Surface3d sf3d(points, fmt::format("{} floorPrint", nameString()), 0); |
| 3235 |
1/1✓ Branch 1 taken 577 times.
|
577 | return sf3d.isConvex(); |
| 3236 | 581 | } | |
| 3237 | |||
| 3238 | 24 | std::vector<Surface> Space_Impl::findNonConvexSurfaces() const { | |
| 3239 | 24 | auto surfaces = this->surfaces(); | |
| 3240 |
2/2✓ Branch 6 taken 24 times.
✓ Branch 10 taken 24 times.
|
255 | surfaces.erase(std::remove_if(surfaces.begin(), surfaces.end(), [](const auto& surface) { return surface.isConvex(); }), surfaces.end()); |
| 3241 | 24 | return surfaces; | |
| 3242 | ✗ | } | |
| 3243 | |||
| 3244 | 557 | void Space_Impl::cacheGeometryDiagnostics() { | |
| 3245 |
2/2✓ Branch 1 taken 557 times.
✓ Branch 4 taken 557 times.
|
557 | m_cachedIsConvex = isConvex(); |
| 3246 |
1/1✓ Branch 1 taken 557 times.
|
557 | auto volumePoly = this->polyhedron(); |
| 3247 |
2/2✓ Branch 1 taken 557 times.
✓ Branch 4 taken 557 times.
|
557 | m_cachedIsEnclosed = volumePoly.isEnclosedVolume(); |
| 3248 | // Actually, its perfectly fine to lookup incorrect orientations even if the polyhedron isn't enclosed... | ||
| 3249 | // If a Box space is missing one wall for eg, the opposite wall will be deemed incorrectly oriented if using ray casting. | ||
| 3250 |
2/2✓ Branch 1 taken 557 times.
✓ Branch 4 taken 557 times.
|
557 | m_cachedNonConvexSurfaces = findSurfacesWithIncorrectOrientationPolyhedron(volumePoly); |
| 3251 | 557 | } | |
| 3252 | |||
| 3253 | 557 | void Space_Impl::resetCachedGeometryDiagnostics() { | |
| 3254 | 557 | m_cachedNonConvexSurfaces.reset(); | |
| 3255 | 557 | m_cachedIsConvex.reset(); | |
| 3256 | 557 | m_cachedIsEnclosed.reset(); | |
| 3257 | 557 | } | |
| 3258 | |||
| 3259 | 46490 | bool Space_Impl::isPlenum() const { | |
| 3260 | 46490 | bool result = false; | |
| 3261 |
1/1✓ Branch 1 taken 46490 times.
|
46490 | boost::optional<ThermalZone> thermalZone = this->thermalZone(); |
| 3262 |
2/2✓ Branch 0 taken 18907 times.
✓ Branch 1 taken 27583 times.
|
46490 | if (thermalZone) { |
| 3263 |
2/2✓ Branch 1 taken 18907 times.
✓ Branch 4 taken 18907 times.
|
18907 | result = thermalZone->isPlenum(); |
| 3264 | } | ||
| 3265 | 46490 | return result; | |
| 3266 | 46490 | } | |
| 3267 | |||
| 3268 | 60 | double Space_Impl::exposedPerimeter(const Polygon3d& buildingPerimeter) const { | |
| 3269 |
1/1✓ Branch 1 taken 60 times.
|
60 | Transformation tr = transformation(); |
| 3270 | |||
| 3271 | 60 | double perimeter = 0; | |
| 3272 |
3/3✓ Branch 1 taken 60 times.
✓ Branch 8 taken 411 times.
✓ Branch 9 taken 60 times.
|
471 | for (const auto& surface : surfaces()) { |
| 3273 |
12/18✓ Branch 1 taken 411 times.
✓ Branch 4 taken 411 times.
✓ Branch 6 taken 60 times.
✓ Branch 7 taken 351 times.
✓ Branch 9 taken 60 times.
✓ Branch 12 taken 60 times.
✓ Branch 14 taken 60 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 60 times.
✓ Branch 17 taken 351 times.
✓ Branch 19 taken 411 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 60 times.
✓ Branch 23 taken 351 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
|
411 | if (surface.surfaceType() == "Floor" && surface.outsideBoundaryCondition() == "Ground") { |
| 3274 |
1/1✓ Branch 1 taken 60 times.
|
60 | auto vertices = surface.vertices(); |
| 3275 |
4/7✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 60 times.
✓ Branch 7 taken 60 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 60 times.
✗ Branch 10 not taken.
|
60 | if (!vertices.empty() && vertices[0].z() == 0.0) { |
| 3276 |
1/1✓ Branch 1 taken 60 times.
|
60 | vertices = tr * vertices; |
| 3277 |
2/2✓ Branch 1 taken 291 times.
✓ Branch 2 taken 60 times.
|
351 | for (size_t i = 0; i < vertices.size(); i++) { |
| 3278 | 291 | Point3dVector line; | |
| 3279 |
1/1✓ Branch 2 taken 291 times.
|
291 | line.push_back(vertices[i]); |
| 3280 |
1/1✓ Branch 3 taken 291 times.
|
291 | line.push_back(vertices[(i + 1) % vertices.size()]); |
| 3281 |
1/1✓ Branch 1 taken 291 times.
|
291 | Point3dVectorVector overlaps = buildingPerimeter.overlap(line); |
| 3282 |
2/2✓ Branch 4 taken 81 times.
✓ Branch 5 taken 291 times.
|
372 | for (const auto& overlap : overlaps) { |
| 3283 |
1/1✓ Branch 3 taken 81 times.
|
81 | perimeter += openstudio::getDistance(overlap[0], overlap[1]); |
| 3284 | } | ||
| 3285 | 291 | } | |
| 3286 | } | ||
| 3287 | 60 | } | |
| 3288 | 60 | } | |
| 3289 | 60 | return perimeter; | |
| 3290 | 60 | } | |
| 3291 | |||
| 3292 | // helper function to get a boost polygon point from a Point3d | ||
| 3293 | 1152 | boost::tuple<double, double> Space_Impl::point3dToTuple(const Point3d& point3d, std::vector<Point3d>& allPoints, double tol) const { | |
| 3294 | // simple method | ||
| 3295 | //return boost::make_tuple(point3d.x(), point3d.y()); | ||
| 3296 | |||
| 3297 | // detailed method, try to combine points within tolerance | ||
| 3298 |
2/2✓ Branch 5 taken 7377 times.
✓ Branch 6 taken 627 times.
|
8004 | for (const Point3d& otherPoint : allPoints) { |
| 3299 |
6/6✓ Branch 1 taken 7377 times.
✓ Branch 4 taken 7377 times.
✓ Branch 8 taken 7377 times.
✓ Branch 11 taken 7377 times.
✓ Branch 14 taken 525 times.
✓ Branch 15 taken 6852 times.
|
7377 | if (std::sqrt(std::pow(point3d.x() - otherPoint.x(), 2) + std::pow(point3d.y() - otherPoint.y(), 2)) < tol) { |
| 3300 |
3/3✓ Branch 1 taken 525 times.
✓ Branch 4 taken 525 times.
✓ Branch 7 taken 525 times.
|
525 | return boost::make_tuple(otherPoint.x(), otherPoint.y()); |
| 3301 | } | ||
| 3302 | } | ||
| 3303 | 627 | allPoints.push_back(point3d); | |
| 3304 |
3/3✓ Branch 1 taken 627 times.
✓ Branch 4 taken 627 times.
✓ Branch 7 taken 627 times.
|
627 | return boost::make_tuple(point3d.x(), point3d.y()); |
| 3305 | } | ||
| 3306 | |||
| 3307 | 1959 | std::vector<ZoneMixing> Space_Impl::zoneMixing() const { | |
| 3308 |
2/2✓ Branch 1 taken 1959 times.
✓ Branch 4 taken 1959 times.
|
1959 | return getObject<ModelObject>().getModelObjectSources<ZoneMixing>(); |
| 3309 | } | ||
| 3310 | |||
| 3311 | 1854 | std::vector<ZoneMixing> Space_Impl::supplyZoneMixing() const { | |
| 3312 |
1/1✓ Branch 1 taken 1854 times.
|
1854 | std::vector<ZoneMixing> result = this->zoneMixing(); |
| 3313 | |||
| 3314 |
1/1✓ Branch 1 taken 1854 times.
|
1854 | Handle handle = this->handle(); |
| 3315 | auto new_end = | ||
| 3316 |
4/4✓ Branch 3 taken 1854 times.
✓ Branch 6 taken 126 times.
✓ Branch 9 taken 126 times.
✓ Branch 12 taken 126 times.
|
1980 | std::remove_if(result.begin(), result.end(), [&](const ZoneMixing& mixing) { return (mixing.zoneOrSpace().handle() != handle); }); |
| 3317 | |||
| 3318 |
1/1✓ Branch 4 taken 1854 times.
|
1854 | result.erase(new_end, result.end()); |
| 3319 | 3708 | return result; | |
| 3320 | ✗ | } | |
| 3321 | |||
| 3322 | 105 | std::vector<ZoneMixing> Space_Impl::exhaustZoneMixing() const { | |
| 3323 |
1/1✓ Branch 1 taken 105 times.
|
105 | std::vector<ZoneMixing> result = this->zoneMixing(); |
| 3324 | |||
| 3325 |
1/1✓ Branch 1 taken 105 times.
|
105 | Handle handle = this->handle(); |
| 3326 |
1/1✓ Branch 3 taken 105 times.
|
105 | auto new_end = std::remove_if(result.begin(), result.end(), [&](const ZoneMixing& mixing) { |
| 3327 |
9/17✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
✓ Branch 13 taken 9 times.
✓ Branch 16 taken 9 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 9 times.
✓ Branch 20 taken 9 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 9 times.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
|
9 | return (!mixing.sourceZoneOrSpace() || (mixing.sourceZoneOrSpace()->handle() != handle)); |
| 3328 | }); | ||
| 3329 | |||
| 3330 |
1/1✓ Branch 4 taken 105 times.
|
105 | result.erase(new_end, result.end()); |
| 3331 | 210 | return result; | |
| 3332 | ✗ | } | |
| 3333 | |||
| 3334 | } // namespace detail | ||
| 3335 | |||
| 3336 | 4036 | Space::Space(const Model& model) : PlanarSurfaceGroup(Space::iddObjectType(), model) { | |
| 3337 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 4036 times.
✗ Branch 5 not taken.
|
4036 | OS_ASSERT(getImpl<detail::Space_Impl>()); |
| 3338 | 4036 | } | |
| 3339 | |||
| 3340 | 30334 | IddObjectType Space::iddObjectType() { | |
| 3341 |
1/1✓ Branch 1 taken 30334 times.
|
30334 | IddObjectType result(IddObjectType::OS_Space); |
| 3342 | 30334 | return result; | |
| 3343 | } | ||
| 3344 | |||
| 3345 | 636 | boost::optional<Space> Space::fromFloorPrint(const std::vector<Point3d>& floorPrint, double floorHeight, Model& model, | |
| 3346 | const std::string& spaceName) { | ||
| 3347 | // check floor height | ||
| 3348 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 636 times.
|
636 | if (floorHeight <= 0) { |
| 3349 | ✗ | LOG(Error, "Cannot create a space with floorHeight " << floorHeight << "."); | |
| 3350 | ✗ | return boost::none; | |
| 3351 | } | ||
| 3352 | |||
| 3353 | // check floor print | ||
| 3354 | 636 | unsigned numPoints = floorPrint.size(); | |
| 3355 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 636 times.
|
636 | if (numPoints < 3) { |
| 3356 | ✗ | LOG(Error, "Cannot create a space for floorPrint of size " << floorPrint.size() << "."); | |
| 3357 | ✗ | return boost::none; | |
| 3358 | } | ||
| 3359 | |||
| 3360 |
1/1✓ Branch 2 taken 636 times.
|
636 | double z = floorPrint[0].z(); |
| 3361 | 636 | double tol = 0.000001; | |
| 3362 |
2/2✓ Branch 5 taken 2787 times.
✓ Branch 6 taken 636 times.
|
3423 | for (const Point3d& point : floorPrint) { |
| 3363 |
2/3✓ Branch 1 taken 2787 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2787 times.
|
2787 | if (std::abs(point.z() - z) > tol) { |
| 3364 | ✗ | LOG(Error, "Inconsistent z height in floorPrint."); | |
| 3365 | ✗ | return boost::none; | |
| 3366 | } | ||
| 3367 | } | ||
| 3368 | |||
| 3369 | // Enforce the same z | ||
| 3370 | 636 | std::vector<Point3d> reorderedFloorPrint; | |
| 3371 |
1/1✓ Branch 2 taken 636 times.
|
636 | reorderedFloorPrint.reserve(floorPrint.size()); |
| 3372 |
2/2✓ Branch 1 taken 636 times.
✓ Branch 6 taken 636 times.
|
636 | std::transform(floorPrint.cbegin(), floorPrint.cend(), std::back_inserter(reorderedFloorPrint), |
| 3373 | 2787 | [&z](const auto& pt) { return Point3d{pt.x(), pt.y(), z}; }); | |
| 3374 | |||
| 3375 |
1/1✓ Branch 1 taken 636 times.
|
636 | boost::optional<Vector3d> outwardNormal = getOutwardNormal(reorderedFloorPrint); |
| 3376 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 636 times.
|
636 | if (!outwardNormal) { |
| 3377 | ✗ | LOG(Error, "Cannot compute outwardNormal for floorPrint."); | |
| 3378 | ✗ | return boost::none; | |
| 3379 | } | ||
| 3380 | |||
| 3381 |
3/4✓ Branch 1 taken 636 times.
✓ Branch 4 taken 636 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 636 times.
|
636 | if (outwardNormal->z() > -1 + tol) { |
| 3382 | ✗ | LOG(Error, "OutwardNormal of floorPrint must point down to create space."); | |
| 3383 | ✗ | return boost::none; | |
| 3384 | } | ||
| 3385 | |||
| 3386 | // reorderedFloorPrint = openstudio::reorderULC(reorderedFloorPrint); | ||
| 3387 | |||
| 3388 | // we are good to go, create the space | ||
| 3389 |
1/1✓ Branch 1 taken 636 times.
|
636 | Space space(model); |
| 3390 | |||
| 3391 | // create the floor | ||
| 3392 |
1/1✓ Branch 1 taken 636 times.
|
636 | Surface floor(reorderedFloorPrint, model); |
| 3393 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 2 taken 611 times.
|
636 | if (!spaceName.empty()) { |
| 3394 |
1/1✓ Branch 1 taken 25 times.
|
25 | space.setName(spaceName); |
| 3395 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 5 taken 25 times.
|
50 | floor.setName(fmt::format("{} Floor", space.nameString())); |
| 3396 | } | ||
| 3397 |
1/1✓ Branch 1 taken 636 times.
|
636 | floor.setSpace(space); |
| 3398 | |||
| 3399 | 636 | double zCeiling = z + floorHeight; | |
| 3400 | 636 | std::vector<Point3d> points; | |
| 3401 |
1/1✓ Branch 1 taken 636 times.
|
636 | points.reserve(4); |
| 3402 | // create each wall | ||
| 3403 |
2/2✓ Branch 0 taken 2787 times.
✓ Branch 1 taken 636 times.
|
3423 | for (unsigned i = 1; i <= numPoints; ++i) { |
| 3404 | // Counter clockwise, Upper Left Corner convention | ||
| 3405 |
2/4✓ Branch 0 taken 11148 times.
✓ Branch 1 taken 2787 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13935 | points = { |
| 3406 | 5574 | {reorderedFloorPrint[i - 1].x(), reorderedFloorPrint[i - 1].y(), zCeiling}, // Upper Left Corner | |
| 3407 | 5574 | {reorderedFloorPrint[i % numPoints].x(), reorderedFloorPrint[i % numPoints].y(), zCeiling}, // Upper Right Corner | |
| 3408 | 5574 | {reorderedFloorPrint[i % numPoints].x(), reorderedFloorPrint[i % numPoints].y(), z}, // Lower Right Corner | |
| 3409 | 5574 | {reorderedFloorPrint[i - 1].x(), reorderedFloorPrint[i - 1].y(), z}, // Lower Left Corner | |
| 3410 | 13935 | }; | |
| 3411 | |||
| 3412 |
1/1✓ Branch 1 taken 2787 times.
|
2787 | Surface wall(points, model); |
| 3413 |
2/2✓ Branch 1 taken 180 times.
✓ Branch 2 taken 2607 times.
|
2787 | if (!spaceName.empty()) { |
| 3414 |
2/2✓ Branch 1 taken 180 times.
✓ Branch 5 taken 180 times.
|
360 | wall.setName(fmt::format("{} Wall {}", space.nameString(), i)); |
| 3415 | } | ||
| 3416 | |||
| 3417 |
1/1✓ Branch 1 taken 2787 times.
|
2787 | wall.setSpace(space); |
| 3418 | 2787 | } | |
| 3419 | |||
| 3420 | // create the roofCeiling | ||
| 3421 | 636 | std::vector<Point3d> ceilingPoints; | |
| 3422 |
1/1✓ Branch 2 taken 636 times.
|
636 | ceilingPoints.reserve(reorderedFloorPrint.size()); |
| 3423 |
2/2✓ Branch 1 taken 636 times.
✓ Branch 6 taken 636 times.
|
636 | std::transform(reorderedFloorPrint.crbegin(), reorderedFloorPrint.crend(), std::back_inserter(ceilingPoints), |
| 3424 | 2787 | [zCeiling](const auto& pt) { return Point3d{pt.x(), pt.y(), zCeiling}; }); | |
| 3425 |
1/1✓ Branch 1 taken 636 times.
|
636 | Surface roofCeiling(ceilingPoints, model); |
| 3426 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 2 taken 611 times.
|
636 | if (!spaceName.empty()) { |
| 3427 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 5 taken 25 times.
|
50 | roofCeiling.setName(fmt::format("{} RoofCeiling", space.nameString())); |
| 3428 | } | ||
| 3429 |
1/1✓ Branch 1 taken 636 times.
|
636 | roofCeiling.setSpace(space); |
| 3430 | |||
| 3431 |
1/1✓ Branch 1 taken 636 times.
|
636 | return space; |
| 3432 | 3423 | } | |
| 3433 | |||
| 3434 | 1274 | bool Space::partofTotalFloorArea() const { | |
| 3435 |
1/1✓ Branch 3 taken 1274 times.
|
1274 | return getImpl<detail::Space_Impl>()->partofTotalFloorArea(); |
| 3436 | } | ||
| 3437 | |||
| 3438 | ✗ | bool Space::isPartofTotalFloorAreaDefaulted() const { | |
| 3439 | ✗ | return getImpl<detail::Space_Impl>()->isPartofTotalFloorAreaDefaulted(); | |
| 3440 | } | ||
| 3441 | |||
| 3442 | 88 | bool Space::setPartofTotalFloorArea(bool partofTotalFloorArea) { | |
| 3443 |
1/1✓ Branch 3 taken 88 times.
|
88 | return getImpl<detail::Space_Impl>()->setPartofTotalFloorArea(partofTotalFloorArea); |
| 3444 | } | ||
| 3445 | |||
| 3446 | ✗ | void Space::resetPartofTotalFloorArea() { | |
| 3447 | ✗ | getImpl<detail::Space_Impl>()->resetPartofTotalFloorArea(); | |
| 3448 | ✗ | } | |
| 3449 | |||
| 3450 | 2 | bool Space::setCeilingHeight(double ceilingHeight) { | |
| 3451 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::Space_Impl>()->setCeilingHeight(ceilingHeight); |
| 3452 | } | ||
| 3453 | |||
| 3454 | 1 | void Space::autocalculateCeilingHeight() { | |
| 3455 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::Space_Impl>()->autocalculateCeilingHeight(); |
| 3456 | 1 | } | |
| 3457 | |||
| 3458 | 1 | void Space::resetCeilingHeight() { | |
| 3459 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::Space_Impl>()->resetCeilingHeight(); |
| 3460 | 1 | } | |
| 3461 | |||
| 3462 | 258 | bool Space::setVolume(double volume) { | |
| 3463 |
1/1✓ Branch 3 taken 258 times.
|
258 | return getImpl<detail::Space_Impl>()->setVolume(volume); |
| 3464 | } | ||
| 3465 | |||
| 3466 | 1 | void Space::autocalculateVolume() { | |
| 3467 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::Space_Impl>()->autocalculateVolume(); |
| 3468 | 1 | } | |
| 3469 | |||
| 3470 | 1 | void Space::resetVolume() { | |
| 3471 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::Space_Impl>()->resetVolume(); |
| 3472 | 1 | } | |
| 3473 | |||
| 3474 | 4 | bool Space::setFloorArea(double floorArea) { | |
| 3475 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::Space_Impl>()->setFloorArea(floorArea); |
| 3476 | } | ||
| 3477 | |||
| 3478 | 1 | void Space::autocalculateFloorArea() { | |
| 3479 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::Space_Impl>()->autocalculateFloorArea(); |
| 3480 | 1 | } | |
| 3481 | |||
| 3482 | 1 | void Space::resetFloorArea() { | |
| 3483 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::Space_Impl>()->resetFloorArea(); |
| 3484 | 1 | } | |
| 3485 | |||
| 3486 | 36455 | boost::optional<SpaceType> Space::spaceType() const { | |
| 3487 |
1/1✓ Branch 3 taken 36455 times.
|
36455 | return getImpl<detail::Space_Impl>()->spaceType(); |
| 3488 | } | ||
| 3489 | |||
| 3490 | 866 | bool Space::isSpaceTypeDefaulted() const { | |
| 3491 |
1/1✓ Branch 3 taken 866 times.
|
866 | return getImpl<detail::Space_Impl>()->isSpaceTypeDefaulted(); |
| 3492 | } | ||
| 3493 | |||
| 3494 | 1726 | bool Space::setSpaceType(const SpaceType& spaceType) { | |
| 3495 |
1/1✓ Branch 3 taken 1726 times.
|
1726 | return getImpl<detail::Space_Impl>()->setSpaceType(spaceType); |
| 3496 | } | ||
| 3497 | |||
| 3498 | 49 | void Space::resetSpaceType() { | |
| 3499 |
1/1✓ Branch 3 taken 49 times.
|
49 | getImpl<detail::Space_Impl>()->resetSpaceType(); |
| 3500 | 49 | } | |
| 3501 | |||
| 3502 | 3435 | boost::optional<DefaultConstructionSet> Space::defaultConstructionSet() const { | |
| 3503 |
1/1✓ Branch 3 taken 3435 times.
|
3435 | return getImpl<detail::Space_Impl>()->defaultConstructionSet(); |
| 3504 | } | ||
| 3505 | |||
| 3506 | ✗ | boost::optional<ConstructionBase> Space::getDefaultConstruction(const PlanarSurface& planarSurface) const { | |
| 3507 | ✗ | return getImpl<detail::Space_Impl>()->getDefaultConstruction(planarSurface); | |
| 3508 | } | ||
| 3509 | |||
| 3510 | 44109 | boost::optional<std::pair<ConstructionBase, int>> Space::getDefaultConstructionWithSearchDistance(const PlanarSurface& planarSurface) const { | |
| 3511 |
1/1✓ Branch 3 taken 44109 times.
|
44109 | return getImpl<detail::Space_Impl>()->getDefaultConstructionWithSearchDistance(planarSurface); |
| 3512 | } | ||
| 3513 | |||
| 3514 | 243 | bool Space::setDefaultConstructionSet(const DefaultConstructionSet& defaultConstructionSet) { | |
| 3515 |
1/1✓ Branch 3 taken 243 times.
|
243 | return getImpl<detail::Space_Impl>()->setDefaultConstructionSet(defaultConstructionSet); |
| 3516 | } | ||
| 3517 | |||
| 3518 | 692 | void Space::resetDefaultConstructionSet() { | |
| 3519 |
1/1✓ Branch 3 taken 692 times.
|
692 | getImpl<detail::Space_Impl>()->resetDefaultConstructionSet(); |
| 3520 | 692 | } | |
| 3521 | |||
| 3522 | ✗ | boost::optional<DefaultScheduleSet> Space::defaultScheduleSet() const { | |
| 3523 | ✗ | return getImpl<detail::Space_Impl>()->defaultScheduleSet(); | |
| 3524 | } | ||
| 3525 | |||
| 3526 | 613 | boost::optional<Schedule> Space::getDefaultSchedule(const DefaultScheduleType& defaultScheduleType) const { | |
| 3527 |
1/1✓ Branch 3 taken 613 times.
|
613 | return getImpl<detail::Space_Impl>()->getDefaultSchedule(defaultScheduleType); |
| 3528 | } | ||
| 3529 | |||
| 3530 | 1 | bool Space::setDefaultScheduleSet(const DefaultScheduleSet& defaultScheduleSet) { | |
| 3531 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::Space_Impl>()->setDefaultScheduleSet(defaultScheduleSet); |
| 3532 | } | ||
| 3533 | |||
| 3534 | ✗ | void Space::resetDefaultScheduleSet() { | |
| 3535 | ✗ | getImpl<detail::Space_Impl>()->resetDefaultScheduleSet(); | |
| 3536 | ✗ | } | |
| 3537 | |||
| 3538 | 38474 | boost::optional<ThermalZone> Space::thermalZone() const { | |
| 3539 |
1/1✓ Branch 3 taken 38474 times.
|
38474 | return getImpl<detail::Space_Impl>()->thermalZone(); |
| 3540 | } | ||
| 3541 | |||
| 3542 | 2523 | bool Space::setThermalZone(ThermalZone& thermalZone) { | |
| 3543 |
1/1✓ Branch 3 taken 2523 times.
|
2523 | return getImpl<detail::Space_Impl>()->setThermalZone(thermalZone); |
| 3544 | } | ||
| 3545 | |||
| 3546 | 14 | void Space::resetThermalZone() { | |
| 3547 |
1/1✓ Branch 3 taken 14 times.
|
14 | getImpl<detail::Space_Impl>()->resetThermalZone(); |
| 3548 | 14 | } | |
| 3549 | |||
| 3550 | 34639 | boost::optional<BuildingStory> Space::buildingStory() const { | |
| 3551 |
1/1✓ Branch 3 taken 34639 times.
|
34639 | return getImpl<detail::Space_Impl>()->buildingStory(); |
| 3552 | } | ||
| 3553 | |||
| 3554 | 2177 | bool Space::setBuildingStory(const BuildingStory& buildingStory) { | |
| 3555 |
1/1✓ Branch 3 taken 2177 times.
|
2177 | return getImpl<detail::Space_Impl>()->setBuildingStory(buildingStory); |
| 3556 | } | ||
| 3557 | |||
| 3558 | 36 | void Space::resetBuildingStory() { | |
| 3559 |
1/1✓ Branch 3 taken 36 times.
|
36 | getImpl<detail::Space_Impl>()->resetBuildingStory(); |
| 3560 | 36 | } | |
| 3561 | |||
| 3562 | 25728 | boost::optional<BuildingUnit> Space::buildingUnit() const { | |
| 3563 |
1/1✓ Branch 3 taken 25728 times.
|
25728 | return getImpl<detail::Space_Impl>()->buildingUnit(); |
| 3564 | } | ||
| 3565 | |||
| 3566 | 81 | bool Space::setBuildingUnit(const BuildingUnit& buildingUnit) { | |
| 3567 |
1/1✓ Branch 3 taken 81 times.
|
81 | return getImpl<detail::Space_Impl>()->setBuildingUnit(buildingUnit); |
| 3568 | } | ||
| 3569 | |||
| 3570 | 49 | void Space::resetBuildingUnit() { | |
| 3571 |
1/1✓ Branch 3 taken 49 times.
|
49 | getImpl<detail::Space_Impl>()->resetBuildingUnit(); |
| 3572 | 49 | } | |
| 3573 | |||
| 3574 | 708 | std::vector<ShadingSurfaceGroup> Space::shadingSurfaceGroups() const { | |
| 3575 |
1/1✓ Branch 3 taken 708 times.
|
708 | return getImpl<detail::Space_Impl>()->shadingSurfaceGroups(); |
| 3576 | } | ||
| 3577 | |||
| 3578 | 707 | std::vector<InteriorPartitionSurfaceGroup> Space::interiorPartitionSurfaceGroups() const { | |
| 3579 |
1/1✓ Branch 3 taken 707 times.
|
707 | return getImpl<detail::Space_Impl>()->interiorPartitionSurfaceGroups(); |
| 3580 | } | ||
| 3581 | |||
| 3582 | 90935 | std::vector<Surface> Space::surfaces() const { | |
| 3583 |
1/1✓ Branch 3 taken 90935 times.
|
90935 | return getImpl<detail::Space_Impl>()->surfaces(); |
| 3584 | } | ||
| 3585 | |||
| 3586 | 571 | std::vector<InternalMass> Space::internalMass() const { | |
| 3587 |
1/1✓ Branch 3 taken 571 times.
|
571 | return getImpl<detail::Space_Impl>()->internalMass(); |
| 3588 | } | ||
| 3589 | |||
| 3590 | 576 | std::vector<People> Space::people() const { | |
| 3591 |
1/1✓ Branch 3 taken 576 times.
|
576 | return getImpl<detail::Space_Impl>()->people(); |
| 3592 | } | ||
| 3593 | |||
| 3594 | 582 | std::vector<Lights> Space::lights() const { | |
| 3595 |
1/1✓ Branch 3 taken 582 times.
|
582 | return getImpl<detail::Space_Impl>()->lights(); |
| 3596 | } | ||
| 3597 | |||
| 3598 | 571 | std::vector<Luminaire> Space::luminaires() const { | |
| 3599 |
1/1✓ Branch 3 taken 571 times.
|
571 | return getImpl<detail::Space_Impl>()->luminaires(); |
| 3600 | } | ||
| 3601 | |||
| 3602 | 578 | std::vector<ElectricEquipment> Space::electricEquipment() const { | |
| 3603 |
1/1✓ Branch 3 taken 578 times.
|
578 | return getImpl<detail::Space_Impl>()->electricEquipment(); |
| 3604 | } | ||
| 3605 | |||
| 3606 | 624 | std::vector<ElectricEquipmentITEAirCooled> Space::electricEquipmentITEAirCooled() const { | |
| 3607 |
1/1✓ Branch 3 taken 624 times.
|
624 | return getImpl<detail::Space_Impl>()->electricEquipmentITEAirCooled(); |
| 3608 | } | ||
| 3609 | |||
| 3610 | 571 | std::vector<GasEquipment> Space::gasEquipment() const { | |
| 3611 |
1/1✓ Branch 3 taken 571 times.
|
571 | return getImpl<detail::Space_Impl>()->gasEquipment(); |
| 3612 | } | ||
| 3613 | |||
| 3614 | 571 | std::vector<HotWaterEquipment> Space::hotWaterEquipment() const { | |
| 3615 |
1/1✓ Branch 3 taken 571 times.
|
571 | return getImpl<detail::Space_Impl>()->hotWaterEquipment(); |
| 3616 | } | ||
| 3617 | |||
| 3618 | 571 | std::vector<SteamEquipment> Space::steamEquipment() const { | |
| 3619 |
1/1✓ Branch 3 taken 571 times.
|
571 | return getImpl<detail::Space_Impl>()->steamEquipment(); |
| 3620 | } | ||
| 3621 | |||
| 3622 | 571 | std::vector<OtherEquipment> Space::otherEquipment() const { | |
| 3623 |
1/1✓ Branch 3 taken 571 times.
|
571 | return getImpl<detail::Space_Impl>()->otherEquipment(); |
| 3624 | } | ||
| 3625 | |||
| 3626 | ✗ | std::vector<WaterUseEquipment> Space::waterUseEquipment() const { | |
| 3627 | ✗ | return getImpl<detail::Space_Impl>()->waterUseEquipment(); | |
| 3628 | } | ||
| 3629 | |||
| 3630 | 1774 | std::vector<DaylightingControl> Space::daylightingControls() const { | |
| 3631 |
1/1✓ Branch 3 taken 1774 times.
|
1774 | return getImpl<detail::Space_Impl>()->daylightingControls(); |
| 3632 | } | ||
| 3633 | |||
| 3634 | 612 | std::vector<IlluminanceMap> Space::illuminanceMaps() const { | |
| 3635 |
1/1✓ Branch 3 taken 612 times.
|
612 | return getImpl<detail::Space_Impl>()->illuminanceMaps(); |
| 3636 | } | ||
| 3637 | |||
| 3638 | 39 | std::vector<GlareSensor> Space::glareSensors() const { | |
| 3639 |
1/1✓ Branch 3 taken 39 times.
|
39 | return getImpl<detail::Space_Impl>()->glareSensors(); |
| 3640 | } | ||
| 3641 | |||
| 3642 | 583 | std::vector<SpaceInfiltrationDesignFlowRate> Space::spaceInfiltrationDesignFlowRates() const { | |
| 3643 |
1/1✓ Branch 3 taken 583 times.
|
583 | return getImpl<detail::Space_Impl>()->spaceInfiltrationDesignFlowRates(); |
| 3644 | } | ||
| 3645 | |||
| 3646 | 571 | std::vector<SpaceInfiltrationEffectiveLeakageArea> Space::spaceInfiltrationEffectiveLeakageAreas() const { | |
| 3647 |
1/1✓ Branch 3 taken 571 times.
|
571 | return getImpl<detail::Space_Impl>()->spaceInfiltrationEffectiveLeakageAreas(); |
| 3648 | } | ||
| 3649 | |||
| 3650 | 574 | std::vector<SpaceInfiltrationFlowCoefficient> Space::spaceInfiltrationFlowCoefficients() const { | |
| 3651 |
1/1✓ Branch 3 taken 574 times.
|
574 | return getImpl<detail::Space_Impl>()->spaceInfiltrationFlowCoefficients(); |
| 3652 | } | ||
| 3653 | |||
| 3654 | 789 | boost::optional<DesignSpecificationOutdoorAir> Space::designSpecificationOutdoorAir() const { | |
| 3655 |
1/1✓ Branch 3 taken 789 times.
|
789 | return getImpl<detail::Space_Impl>()->designSpecificationOutdoorAir(); |
| 3656 | } | ||
| 3657 | |||
| 3658 | 54 | bool Space::isDesignSpecificationOutdoorAirDefaulted() const { | |
| 3659 |
1/1✓ Branch 3 taken 54 times.
|
54 | return getImpl<detail::Space_Impl>()->isDesignSpecificationOutdoorAirDefaulted(); |
| 3660 | } | ||
| 3661 | |||
| 3662 | 130 | bool Space::setDesignSpecificationOutdoorAir(const DesignSpecificationOutdoorAir& designSpecificationOutdoorAir) { | |
| 3663 |
1/1✓ Branch 3 taken 130 times.
|
130 | return getImpl<detail::Space_Impl>()->setDesignSpecificationOutdoorAir(designSpecificationOutdoorAir); |
| 3664 | } | ||
| 3665 | |||
| 3666 | 1 | void Space::resetDesignSpecificationOutdoorAir() { | |
| 3667 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::Space_Impl>()->resetDesignSpecificationOutdoorAir(); |
| 3668 | } | ||
| 3669 | |||
| 3670 | 1771 | int Space::multiplier() const { | |
| 3671 |
1/1✓ Branch 3 taken 1771 times.
|
1771 | return getImpl<detail::Space_Impl>()->multiplier(); |
| 3672 | } | ||
| 3673 | |||
| 3674 | 24 | double Space::exteriorArea() const { | |
| 3675 |
1/1✓ Branch 3 taken 24 times.
|
24 | return getImpl<detail::Space_Impl>()->exteriorArea(); |
| 3676 | } | ||
| 3677 | |||
| 3678 | 11 | double Space::exteriorWallArea() const { | |
| 3679 |
1/1✓ Branch 3 taken 11 times.
|
11 | return getImpl<detail::Space_Impl>()->exteriorWallArea(); |
| 3680 | } | ||
| 3681 | |||
| 3682 | 10 | double Space::ceilingHeight() const { | |
| 3683 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::Space_Impl>()->ceilingHeight(); |
| 3684 | } | ||
| 3685 | |||
| 3686 | 576 | bool Space::isCeilingHeightDefaulted() const { | |
| 3687 |
1/1✓ Branch 3 taken 576 times.
|
576 | return getImpl<detail::Space_Impl>()->isCeilingHeightDefaulted(); |
| 3688 | } | ||
| 3689 | |||
| 3690 | 5 | bool Space::isCeilingHeightAutocalculated() const { | |
| 3691 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::Space_Impl>()->isCeilingHeightAutocalculated(); |
| 3692 | } | ||
| 3693 | |||
| 3694 | 372 | double Space::volume() const { | |
| 3695 |
1/1✓ Branch 3 taken 372 times.
|
372 | return getImpl<detail::Space_Impl>()->volume(); |
| 3696 | } | ||
| 3697 | |||
| 3698 | 576 | bool Space::isVolumeDefaulted() const { | |
| 3699 |
1/1✓ Branch 3 taken 576 times.
|
576 | return getImpl<detail::Space_Impl>()->isVolumeDefaulted(); |
| 3700 | } | ||
| 3701 | |||
| 3702 | 8 | bool Space::isVolumeAutocalculated() const { | |
| 3703 |
1/1✓ Branch 3 taken 8 times.
|
8 | return getImpl<detail::Space_Impl>()->isVolumeAutocalculated(); |
| 3704 | } | ||
| 3705 | |||
| 3706 | 14110 | double Space::floorArea() const { | |
| 3707 |
1/1✓ Branch 3 taken 14110 times.
|
14110 | return getImpl<detail::Space_Impl>()->floorArea(); |
| 3708 | } | ||
| 3709 | |||
| 3710 | 576 | bool Space::isFloorAreaDefaulted() const { | |
| 3711 |
1/1✓ Branch 3 taken 576 times.
|
576 | return getImpl<detail::Space_Impl>()->isFloorAreaDefaulted(); |
| 3712 | } | ||
| 3713 | |||
| 3714 | 5 | bool Space::isFloorAreaAutocalculated() const { | |
| 3715 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::Space_Impl>()->isFloorAreaAutocalculated(); |
| 3716 | } | ||
| 3717 | |||
| 3718 | 457 | double Space::numberOfPeople() const { | |
| 3719 |
1/1✓ Branch 3 taken 457 times.
|
457 | return getImpl<detail::Space_Impl>()->numberOfPeople(); |
| 3720 | } | ||
| 3721 | |||
| 3722 | ✗ | bool Space::setNumberOfPeople(double numberOfPeople) { | |
| 3723 | ✗ | return getImpl<detail::Space_Impl>()->setNumberOfPeople(numberOfPeople); | |
| 3724 | } | ||
| 3725 | |||
| 3726 | ✗ | bool Space::setNumberOfPeople(double numberOfPeople, const People& templatePeople) { | |
| 3727 | ✗ | return getImpl<detail::Space_Impl>()->setNumberOfPeople(numberOfPeople, templatePeople); | |
| 3728 | } | ||
| 3729 | |||
| 3730 | ✗ | double Space::peoplePerFloorArea() const { | |
| 3731 | ✗ | return getImpl<detail::Space_Impl>()->peoplePerFloorArea(); | |
| 3732 | } | ||
| 3733 | |||
| 3734 | 2 | bool Space::setPeoplePerFloorArea(double peoplePerFloorArea) { | |
| 3735 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::Space_Impl>()->setPeoplePerFloorArea(peoplePerFloorArea); |
| 3736 | } | ||
| 3737 | |||
| 3738 | ✗ | bool Space::setPeoplePerFloorArea(double peoplePerFloorArea, const People& templatePeople) { | |
| 3739 | ✗ | return getImpl<detail::Space_Impl>()->setPeoplePerFloorArea(peoplePerFloorArea, templatePeople); | |
| 3740 | } | ||
| 3741 | |||
| 3742 | 44 | double Space::floorAreaPerPerson() const { | |
| 3743 |
1/1✓ Branch 3 taken 44 times.
|
44 | return getImpl<detail::Space_Impl>()->floorAreaPerPerson(); |
| 3744 | } | ||
| 3745 | |||
| 3746 | ✗ | bool Space::setFloorAreaPerPerson(double floorAreaPerPerson) { | |
| 3747 | ✗ | return getImpl<detail::Space_Impl>()->setFloorAreaPerPerson(floorAreaPerPerson); | |
| 3748 | } | ||
| 3749 | |||
| 3750 | ✗ | bool Space::setFloorAreaPerPerson(double floorAreaPerPerson, const People& templatePeople) { | |
| 3751 | ✗ | return getImpl<detail::Space_Impl>()->setFloorAreaPerPerson(floorAreaPerPerson, templatePeople); | |
| 3752 | } | ||
| 3753 | |||
| 3754 | 66 | double Space::lightingPower() const { | |
| 3755 |
1/1✓ Branch 3 taken 66 times.
|
66 | return getImpl<detail::Space_Impl>()->lightingPower(); |
| 3756 | } | ||
| 3757 | |||
| 3758 | ✗ | bool Space::setLightingPower(double lightingPower) { | |
| 3759 | ✗ | return getImpl<detail::Space_Impl>()->setLightingPower(lightingPower); | |
| 3760 | } | ||
| 3761 | |||
| 3762 | ✗ | bool Space::setLightingPower(double lightingPower, const Lights& templateLights) { | |
| 3763 | ✗ | return getImpl<detail::Space_Impl>()->setLightingPower(lightingPower, templateLights); | |
| 3764 | } | ||
| 3765 | |||
| 3766 | 183 | double Space::lightingPowerPerFloorArea() const { | |
| 3767 |
1/1✓ Branch 3 taken 183 times.
|
183 | return getImpl<detail::Space_Impl>()->lightingPowerPerFloorArea(); |
| 3768 | } | ||
| 3769 | |||
| 3770 | ✗ | bool Space::setLightingPowerPerFloorArea(double lightingPowerPerFloorArea) { | |
| 3771 | ✗ | return getImpl<detail::Space_Impl>()->setLightingPowerPerFloorArea(lightingPowerPerFloorArea); | |
| 3772 | } | ||
| 3773 | |||
| 3774 | ✗ | bool Space::setLightingPowerPerFloorArea(double lightingPowerPerFloorArea, const Lights& templateLights) { | |
| 3775 | ✗ | return getImpl<detail::Space_Impl>()->setLightingPowerPerFloorArea(lightingPowerPerFloorArea, templateLights); | |
| 3776 | } | ||
| 3777 | |||
| 3778 | 4 | double Space::lightingPowerPerPerson() const { | |
| 3779 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::Space_Impl>()->lightingPowerPerPerson(); |
| 3780 | } | ||
| 3781 | |||
| 3782 | ✗ | bool Space::setLightingPowerPerPerson(double lightingPowerPerPerson) { | |
| 3783 | ✗ | return getImpl<detail::Space_Impl>()->setLightingPowerPerPerson(lightingPowerPerPerson); | |
| 3784 | } | ||
| 3785 | |||
| 3786 | ✗ | bool Space::setLightingPowerPerPerson(double lightingPowerPerPerson, const Lights& templateLights) { | |
| 3787 | ✗ | return getImpl<detail::Space_Impl>()->setLightingPowerPerPerson(lightingPowerPerPerson, templateLights); | |
| 3788 | } | ||
| 3789 | |||
| 3790 | 40 | double Space::electricEquipmentPower() const { | |
| 3791 |
1/1✓ Branch 3 taken 40 times.
|
40 | return getImpl<detail::Space_Impl>()->electricEquipmentPower(); |
| 3792 | } | ||
| 3793 | |||
| 3794 | 8 | double Space::electricEquipmentITEAirCooledPower() const { | |
| 3795 |
1/1✓ Branch 3 taken 8 times.
|
8 | return getImpl<detail::Space_Impl>()->electricEquipmentITEAirCooledPower(); |
| 3796 | } | ||
| 3797 | |||
| 3798 | ✗ | bool Space::setElectricEquipmentPower(double electricEquipmentPower) { | |
| 3799 | ✗ | return getImpl<detail::Space_Impl>()->setElectricEquipmentPower(electricEquipmentPower); | |
| 3800 | } | ||
| 3801 | |||
| 3802 | 1 | bool Space::setElectricEquipmentPower(double electricEquipmentPower, const ElectricEquipment& templateElectricEquipment) { | |
| 3803 |
2/2✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | return getImpl<detail::Space_Impl>()->setElectricEquipmentPower(electricEquipmentPower, templateElectricEquipment); |
| 3804 | } | ||
| 3805 | |||
| 3806 | 136 | double Space::electricEquipmentPowerPerFloorArea() const { | |
| 3807 |
1/1✓ Branch 3 taken 136 times.
|
136 | return getImpl<detail::Space_Impl>()->electricEquipmentPowerPerFloorArea(); |
| 3808 | } | ||
| 3809 | |||
| 3810 | 4 | double Space::electricEquipmentITEAirCooledPowerPerFloorArea() const { | |
| 3811 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::Space_Impl>()->electricEquipmentITEAirCooledPowerPerFloorArea(); |
| 3812 | } | ||
| 3813 | |||
| 3814 | ✗ | bool Space::setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea) { | |
| 3815 | ✗ | return getImpl<detail::Space_Impl>()->setElectricEquipmentPowerPerFloorArea(electricEquipmentPowerPerFloorArea); | |
| 3816 | } | ||
| 3817 | |||
| 3818 | ✗ | bool Space::setElectricEquipmentPowerPerFloorArea(double electricEquipmentPowerPerFloorArea, const ElectricEquipment& templateElectricEquipment) { | |
| 3819 | ✗ | return getImpl<detail::Space_Impl>()->setElectricEquipmentPowerPerFloorArea(electricEquipmentPowerPerFloorArea, templateElectricEquipment); | |
| 3820 | } | ||
| 3821 | |||
| 3822 | 4 | double Space::electricEquipmentPowerPerPerson() const { | |
| 3823 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::Space_Impl>()->electricEquipmentPowerPerPerson(); |
| 3824 | } | ||
| 3825 | |||
| 3826 | ✗ | bool Space::setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson) { | |
| 3827 | ✗ | return getImpl<detail::Space_Impl>()->setElectricEquipmentPowerPerPerson(electricEquipmentPowerPerPerson); | |
| 3828 | } | ||
| 3829 | |||
| 3830 | ✗ | bool Space::setElectricEquipmentPowerPerPerson(double electricEquipmentPowerPerPerson, const ElectricEquipment& templateElectricEquipment) { | |
| 3831 | ✗ | return getImpl<detail::Space_Impl>()->setElectricEquipmentPowerPerPerson(electricEquipmentPowerPerPerson, templateElectricEquipment); | |
| 3832 | } | ||
| 3833 | |||
| 3834 | 28 | double Space::gasEquipmentPower() const { | |
| 3835 |
1/1✓ Branch 3 taken 28 times.
|
28 | return getImpl<detail::Space_Impl>()->gasEquipmentPower(); |
| 3836 | } | ||
| 3837 | |||
| 3838 | ✗ | bool Space::setGasEquipmentPower(double gasEquipmentPower) { | |
| 3839 | ✗ | return getImpl<detail::Space_Impl>()->setGasEquipmentPower(gasEquipmentPower); | |
| 3840 | } | ||
| 3841 | |||
| 3842 | 1 | bool Space::setGasEquipmentPower(double gasEquipmentPower, const GasEquipment& templateGasEquipment) { | |
| 3843 |
2/2✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | return getImpl<detail::Space_Impl>()->setGasEquipmentPower(gasEquipmentPower, templateGasEquipment); |
| 3844 | } | ||
| 3845 | |||
| 3846 | 4 | double Space::gasEquipmentPowerPerFloorArea() const { | |
| 3847 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::Space_Impl>()->gasEquipmentPowerPerFloorArea(); |
| 3848 | } | ||
| 3849 | |||
| 3850 | ✗ | bool Space::setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea) { | |
| 3851 | ✗ | return getImpl<detail::Space_Impl>()->setGasEquipmentPowerPerFloorArea(gasEquipmentPowerPerFloorArea); | |
| 3852 | } | ||
| 3853 | |||
| 3854 | ✗ | bool Space::setGasEquipmentPowerPerFloorArea(double gasEquipmentPowerPerFloorArea, const GasEquipment& templateGasEquipment) { | |
| 3855 | ✗ | return getImpl<detail::Space_Impl>()->setGasEquipmentPowerPerFloorArea(gasEquipmentPowerPerFloorArea, templateGasEquipment); | |
| 3856 | } | ||
| 3857 | |||
| 3858 | 4 | double Space::gasEquipmentPowerPerPerson() const { | |
| 3859 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::Space_Impl>()->gasEquipmentPowerPerPerson(); |
| 3860 | } | ||
| 3861 | |||
| 3862 | ✗ | bool Space::setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson) { | |
| 3863 | ✗ | return getImpl<detail::Space_Impl>()->setGasEquipmentPowerPerPerson(gasEquipmentPowerPerPerson); | |
| 3864 | } | ||
| 3865 | |||
| 3866 | ✗ | bool Space::setGasEquipmentPowerPerPerson(double gasEquipmentPowerPerPerson, const GasEquipment& templateGasEquipment) { | |
| 3867 | ✗ | return getImpl<detail::Space_Impl>()->setGasEquipmentPowerPerPerson(gasEquipmentPowerPerPerson, templateGasEquipment); | |
| 3868 | } | ||
| 3869 | |||
| 3870 | 28 | double Space::hotWaterEquipmentPower() const { | |
| 3871 |
1/1✓ Branch 3 taken 28 times.
|
28 | return getImpl<detail::Space_Impl>()->hotWaterEquipmentPower(); |
| 3872 | } | ||
| 3873 | |||
| 3874 | ✗ | bool Space::setHotWaterEquipmentPower(double hotWaterEquipmentPower) { | |
| 3875 | ✗ | return getImpl<detail::Space_Impl>()->setHotWaterEquipmentPower(hotWaterEquipmentPower); | |
| 3876 | } | ||
| 3877 | |||
| 3878 | ✗ | bool Space::setHotWaterEquipmentPower(double hotWaterEquipmentPower, const HotWaterEquipment& templateHotWaterEquipment) { | |
| 3879 | ✗ | return getImpl<detail::Space_Impl>()->setHotWaterEquipmentPower(hotWaterEquipmentPower, templateHotWaterEquipment); | |
| 3880 | } | ||
| 3881 | |||
| 3882 | 4 | double Space::hotWaterEquipmentPowerPerFloorArea() const { | |
| 3883 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::Space_Impl>()->hotWaterEquipmentPowerPerFloorArea(); |
| 3884 | } | ||
| 3885 | |||
| 3886 | ✗ | bool Space::setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea) { | |
| 3887 | ✗ | return getImpl<detail::Space_Impl>()->setHotWaterEquipmentPowerPerFloorArea(hotWaterEquipmentPowerPerFloorArea); | |
| 3888 | } | ||
| 3889 | |||
| 3890 | ✗ | bool Space::setHotWaterEquipmentPowerPerFloorArea(double hotWaterEquipmentPowerPerFloorArea, const HotWaterEquipment& templateHotWaterEquipment) { | |
| 3891 | ✗ | return getImpl<detail::Space_Impl>()->setHotWaterEquipmentPowerPerFloorArea(hotWaterEquipmentPowerPerFloorArea, templateHotWaterEquipment); | |
| 3892 | } | ||
| 3893 | |||
| 3894 | 4 | double Space::hotWaterEquipmentPowerPerPerson() const { | |
| 3895 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::Space_Impl>()->hotWaterEquipmentPowerPerPerson(); |
| 3896 | } | ||
| 3897 | |||
| 3898 | ✗ | bool Space::setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson) { | |
| 3899 | ✗ | return getImpl<detail::Space_Impl>()->setHotWaterEquipmentPowerPerPerson(hotWaterEquipmentPowerPerPerson); | |
| 3900 | } | ||
| 3901 | |||
| 3902 | ✗ | bool Space::setHotWaterEquipmentPowerPerPerson(double hotWaterEquipmentPowerPerPerson, const HotWaterEquipment& templateHotWaterEquipment) { | |
| 3903 | ✗ | return getImpl<detail::Space_Impl>()->setHotWaterEquipmentPowerPerPerson(hotWaterEquipmentPowerPerPerson, templateHotWaterEquipment); | |
| 3904 | } | ||
| 3905 | |||
| 3906 | 8 | double Space::infiltrationDesignFlowRate() const { | |
| 3907 |
1/1✓ Branch 3 taken 8 times.
|
8 | return getImpl<detail::Space_Impl>()->infiltrationDesignFlowRate(); |
| 3908 | } | ||
| 3909 | |||
| 3910 | 2 | double Space::infiltrationDesignFlowPerSpaceFloorArea() const { | |
| 3911 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::Space_Impl>()->infiltrationDesignFlowPerSpaceFloorArea(); |
| 3912 | } | ||
| 3913 | |||
| 3914 | 2 | double Space::infiltrationDesignFlowPerExteriorSurfaceArea() const { | |
| 3915 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::Space_Impl>()->infiltrationDesignFlowPerExteriorSurfaceArea(); |
| 3916 | } | ||
| 3917 | |||
| 3918 | 2 | double Space::infiltrationDesignFlowPerExteriorWallArea() const { | |
| 3919 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::Space_Impl>()->infiltrationDesignFlowPerExteriorWallArea(); |
| 3920 | } | ||
| 3921 | |||
| 3922 | 12 | double Space::infiltrationDesignAirChangesPerHour() const { | |
| 3923 |
1/1✓ Branch 3 taken 12 times.
|
12 | return getImpl<detail::Space_Impl>()->infiltrationDesignAirChangesPerHour(); |
| 3924 | } | ||
| 3925 | |||
| 3926 | ✗ | bool Space::setInfiltrationDesignFlowRate(double infiltrationDesignFlowRate) { | |
| 3927 | ✗ | return getImpl<detail::Space_Impl>()->setInfiltrationDesignFlowRate(infiltrationDesignFlowRate); | |
| 3928 | } | ||
| 3929 | |||
| 3930 | ✗ | bool Space::setInfiltrationDesignFlowPerSpaceFloorArea(double infiltrationDesignFlowPerSpaceFloorArea) { | |
| 3931 | ✗ | return getImpl<detail::Space_Impl>()->setInfiltrationDesignFlowPerSpaceFloorArea(infiltrationDesignFlowPerSpaceFloorArea); | |
| 3932 | } | ||
| 3933 | |||
| 3934 | ✗ | bool Space::setInfiltrationDesignFlowPerExteriorSurfaceArea(double infiltrationDesignFlowPerExteriorSurfaceArea) { | |
| 3935 | ✗ | return getImpl<detail::Space_Impl>()->setInfiltrationDesignFlowPerExteriorSurfaceArea(infiltrationDesignFlowPerExteriorSurfaceArea); | |
| 3936 | } | ||
| 3937 | |||
| 3938 | ✗ | bool Space::setInfiltrationDesignFlowPerExteriorWallArea(double infiltrationDesignFlowPerExteriorWallArea) { | |
| 3939 | ✗ | return getImpl<detail::Space_Impl>()->setInfiltrationDesignFlowPerExteriorWallArea(infiltrationDesignFlowPerExteriorWallArea); | |
| 3940 | } | ||
| 3941 | |||
| 3942 | 3 | bool Space::setInfiltrationDesignAirChangesPerHour(double infiltrationDesignAirChangesPerHour) { | |
| 3943 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::Space_Impl>()->setInfiltrationDesignAirChangesPerHour(infiltrationDesignAirChangesPerHour); |
| 3944 | } | ||
| 3945 | |||
| 3946 | 85 | void Space::hardApplySpaceType(bool hardSizeLoads) { | |
| 3947 |
1/1✓ Branch 3 taken 85 times.
|
85 | getImpl<detail::Space_Impl>()->hardApplySpaceType(hardSizeLoads); |
| 3948 | 85 | } | |
| 3949 | |||
| 3950 | ✗ | void Space::hardApplySpaceLoadSchedules() { | |
| 3951 | ✗ | getImpl<detail::Space_Impl>()->hardApplySpaceLoadSchedules(); | |
| 3952 | ✗ | } | |
| 3953 | |||
| 3954 | 105 | void Space::hardApplyConstructions() { | |
| 3955 |
1/1✓ Branch 3 taken 105 times.
|
105 | getImpl<detail::Space_Impl>()->hardApplyConstructions(); |
| 3956 | 105 | } | |
| 3957 | |||
| 3958 | 1 | void Space::unmatchSurfaces() { | |
| 3959 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::Space_Impl>()->unmatchSurfaces(); |
| 3960 | 1 | } | |
| 3961 | |||
| 3962 | 9815 | void Space::matchSurfaces(Space& space) { | |
| 3963 |
1/1✓ Branch 3 taken 9815 times.
|
9815 | getImpl<detail::Space_Impl>()->matchSurfaces(space); |
| 3964 | 9815 | } | |
| 3965 | |||
| 3966 | 8714 | void Space::intersectSurfaces(Space& space) { | |
| 3967 |
1/1✓ Branch 3 taken 8714 times.
|
8714 | getImpl<detail::Space_Impl>()->intersectSurfaces(space); |
| 3968 | 8714 | } | |
| 3969 | |||
| 3970 | 422 | std::vector<Surface> Space::findSurfaces(boost::optional<double> minDegreesFromNorth, boost::optional<double> maxDegreesFromNorth, | |
| 3971 | boost::optional<double> minDegreesTilt, boost::optional<double> maxDegreesTilt, double tol) { | ||
| 3972 |
1/1✓ Branch 3 taken 422 times.
|
422 | return getImpl<detail::Space_Impl>()->findSurfaces(minDegreesFromNorth, maxDegreesFromNorth, minDegreesTilt, maxDegreesTilt, tol); |
| 3973 | } | ||
| 3974 | |||
| 3975 | 15 | std::vector<Point3d> Space::floorPrint() const { | |
| 3976 |
1/1✓ Branch 3 taken 15 times.
|
15 | return getImpl<detail::Space_Impl>()->floorPrint(); |
| 3977 | } | ||
| 3978 | |||
| 3979 | 8 | bool Space::isPlenum() const { | |
| 3980 |
1/1✓ Branch 3 taken 8 times.
|
8 | return getImpl<detail::Space_Impl>()->isPlenum(); |
| 3981 | } | ||
| 3982 | |||
| 3983 | 60 | double Space::exposedPerimeter(const Polygon3d& buildingPerimeter) const { | |
| 3984 |
1/1✓ Branch 3 taken 60 times.
|
60 | return getImpl<detail::Space_Impl>()->exposedPerimeter(buildingPerimeter); |
| 3985 | } | ||
| 3986 | |||
| 3987 | 1 | Polyhedron Space::polyhedron() const { | |
| 3988 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::Space_Impl>()->polyhedron(); |
| 3989 | } | ||
| 3990 | |||
| 3991 | 4356 | bool Space::isEnclosedVolume() const { | |
| 3992 |
1/1✓ Branch 3 taken 4356 times.
|
4356 | return getImpl<detail::Space_Impl>()->isEnclosedVolume(); |
| 3993 | } | ||
| 3994 | |||
| 3995 | ✗ | std::vector<ZoneMixing> Space::zoneMixing() const { | |
| 3996 | ✗ | return getImpl<detail::Space_Impl>()->zoneMixing(); | |
| 3997 | } | ||
| 3998 | |||
| 3999 | 105 | std::vector<ZoneMixing> Space::supplyZoneMixing() const { | |
| 4000 |
1/1✓ Branch 3 taken 105 times.
|
105 | return getImpl<detail::Space_Impl>()->supplyZoneMixing(); |
| 4001 | } | ||
| 4002 | |||
| 4003 | 105 | std::vector<ZoneMixing> Space::exhaustZoneMixing() const { | |
| 4004 |
1/1✓ Branch 3 taken 105 times.
|
105 | return getImpl<detail::Space_Impl>()->exhaustZoneMixing(); |
| 4005 | } | ||
| 4006 | |||
| 4007 | 4346 | std::vector<Surface> Space::findSurfacesWithIncorrectOrientation() const { | |
| 4008 |
1/1✓ Branch 3 taken 4346 times.
|
4346 | return getImpl<detail::Space_Impl>()->findSurfacesWithIncorrectOrientation(); |
| 4009 | } | ||
| 4010 | |||
| 4011 | 20 | bool Space::areAllSurfacesCorrectlyOriented() const { | |
| 4012 |
1/1✓ Branch 3 taken 20 times.
|
20 | return getImpl<detail::Space_Impl>()->areAllSurfacesCorrectlyOriented(); |
| 4013 | } | ||
| 4014 | |||
| 4015 | 5 | bool Space::fixSurfacesWithIncorrectOrientation() { | |
| 4016 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::Space_Impl>()->fixSurfacesWithIncorrectOrientation(); |
| 4017 | } | ||
| 4018 | |||
| 4019 | 4362 | bool Space::isConvex() const { | |
| 4020 |
1/1✓ Branch 3 taken 4362 times.
|
4362 | return getImpl<detail::Space_Impl>()->isConvex(); |
| 4021 | } | ||
| 4022 | |||
| 4023 | 24 | std::vector<Surface> Space::findNonConvexSurfaces() const { | |
| 4024 |
1/1✓ Branch 3 taken 24 times.
|
24 | return getImpl<detail::Space_Impl>()->findNonConvexSurfaces(); |
| 4025 | } | ||
| 4026 | |||
| 4027 | /// @cond | ||
| 4028 | 557 | void Space::cacheGeometryDiagnostics() { | |
| 4029 |
1/1✓ Branch 3 taken 557 times.
|
557 | getImpl<detail::Space_Impl>()->cacheGeometryDiagnostics(); |
| 4030 | 557 | } | |
| 4031 | 557 | void Space::resetCachedGeometryDiagnostics() { | |
| 4032 |
1/1✓ Branch 3 taken 557 times.
|
557 | getImpl<detail::Space_Impl>()->resetCachedGeometryDiagnostics(); |
| 4033 | 557 | } | |
| 4034 | /// @endcond | ||
| 4035 | |||
| 4036 | /// @cond | ||
| 4037 |
1/1✓ Branch 3 taken 1223477 times.
|
1223477 | Space::Space(std::shared_ptr<detail::Space_Impl> impl) : PlanarSurfaceGroup(std::move(impl)) {} |
| 4038 | /// @endcond | ||
| 4039 | |||
| 4040 | 18 | void intersectSurfaces(std::vector<Space>& t_spaces) { | |
| 4041 |
1/1✓ Branch 1 taken 18 times.
|
18 | std::vector<Space> spaces(t_spaces); |
| 4042 |
1/1✓ Branch 3 taken 18 times.
|
146 | std::sort(spaces.begin(), spaces.end(), [](const Space& a, const Space& b) -> bool { return a.floorArea() < b.floorArea(); }); |
| 4043 | |||
| 4044 | 18 | std::vector<BoundingBox> bounds; | |
| 4045 |
2/2✓ Branch 4 taken 70 times.
✓ Branch 5 taken 18 times.
|
88 | for (const Space& space : spaces) { |
| 4046 |
4/4✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
✓ Branch 7 taken 70 times.
✓ Branch 10 taken 70 times.
|
70 | bounds.push_back(space.transformation() * space.boundingBox()); |
| 4047 | } | ||
| 4048 | |||
| 4049 |
2/2✓ Branch 1 taken 70 times.
✓ Branch 2 taken 18 times.
|
88 | for (unsigned i = 0; i < spaces.size(); ++i) { |
| 4050 |
2/2✓ Branch 1 taken 179 times.
✓ Branch 2 taken 70 times.
|
249 | for (unsigned j = i + 1; j < spaces.size(); ++j) { |
| 4051 |
3/3✓ Branch 3 taken 179 times.
✓ Branch 5 taken 55 times.
✓ Branch 6 taken 124 times.
|
179 | if (!bounds[i].intersects(bounds[j])) { |
| 4052 | 55 | continue; | |
| 4053 | } | ||
| 4054 |
1/1✓ Branch 3 taken 124 times.
|
124 | spaces[i].intersectSurfaces(spaces[j]); |
| 4055 | } | ||
| 4056 | } | ||
| 4057 | 18 | } | |
| 4058 | |||
| 4059 | 188 | void matchSurfaces(std::vector<Space>& spaces) { | |
| 4060 | 188 | std::vector<BoundingBox> bounds; | |
| 4061 |
2/2✓ Branch 4 taken 756 times.
✓ Branch 5 taken 188 times.
|
944 | for (const Space& space : spaces) { |
| 4062 |
4/4✓ Branch 1 taken 756 times.
✓ Branch 4 taken 756 times.
✓ Branch 7 taken 756 times.
✓ Branch 10 taken 756 times.
|
756 | bounds.push_back(space.transformation() * space.boundingBox()); |
| 4063 | } | ||
| 4064 | |||
| 4065 |
2/2✓ Branch 1 taken 756 times.
✓ Branch 2 taken 188 times.
|
944 | for (unsigned i = 0; i < spaces.size(); ++i) { |
| 4066 |
2/2✓ Branch 1 taken 1226 times.
✓ Branch 2 taken 756 times.
|
1982 | for (unsigned j = i + 1; j < spaces.size(); ++j) { |
| 4067 |
3/3✓ Branch 3 taken 1226 times.
✓ Branch 5 taken 55 times.
✓ Branch 6 taken 1171 times.
|
1226 | if (!bounds[i].intersects(bounds[j])) { |
| 4068 | 55 | continue; | |
| 4069 | } | ||
| 4070 |
1/1✓ Branch 3 taken 1171 times.
|
1171 | spaces[i].matchSurfaces(spaces[j]); |
| 4071 | } | ||
| 4072 | } | ||
| 4073 | 188 | } | |
| 4074 | |||
| 4075 | ✗ | void unmatchSurfaces(std::vector<Space>& spaces) { | |
| 4076 | ✗ | for (Space& space : spaces) { | |
| 4077 | ✗ | space.unmatchSurfaces(); | |
| 4078 | } | ||
| 4079 | ✗ | } | |
| 4080 | |||
| 4081 | 24 | std::vector<std::vector<Point3d>> generateSkylightPattern(const std::vector<Space>& spaces, double directionOfRelativeNorth, | |
| 4082 | double skylightToProjectedFloorRatio, double desiredWidth, double desiredHeight) { | ||
| 4083 | 24 | std::vector<std::vector<Point3d>> result; | |
| 4084 | |||
| 4085 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 19 times.
|
24 | if (skylightToProjectedFloorRatio <= 0.0) { |
| 4086 | 5 | return result; | |
| 4087 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | } else if (skylightToProjectedFloorRatio >= 1.0) { |
| 4088 | ✗ | return result; | |
| 4089 | } | ||
| 4090 | |||
| 4091 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 18 times.
|
19 | if (desiredWidth <= 0) { |
| 4092 | 1 | return result; | |
| 4093 | } | ||
| 4094 | |||
| 4095 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 17 times.
|
18 | if (desiredHeight <= 0) { |
| 4096 | 1 | return result; | |
| 4097 | } | ||
| 4098 | |||
| 4099 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
|
17 | if (spaces.empty()) { |
| 4100 | ✗ | return result; | |
| 4101 | } | ||
| 4102 | |||
| 4103 | // rotate negative amount around the z axis, EnergyPlus defines rotation clockwise | ||
| 4104 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
|
17 | Transformation buildingToGridTransformation = Transformation::rotation(Vector3d(0, 0, 1), -openstudio::degToRad(directionOfRelativeNorth)); |
| 4105 | |||
| 4106 | // rotate positive amount around the z axis, EnergyPlus defines rotation clockwise | ||
| 4107 |
1/1✓ Branch 1 taken 17 times.
|
17 | Transformation gridToBuildingTransformation = buildingToGridTransformation.inverse(); |
| 4108 | |||
| 4109 | // find extents in grid coordinate system | ||
| 4110 | 17 | double xmin = std::numeric_limits<double>::max(); | |
| 4111 | 17 | double xmax = std::numeric_limits<double>::min(); | |
| 4112 | 17 | double ymin = std::numeric_limits<double>::max(); | |
| 4113 | 17 | double ymax = std::numeric_limits<double>::min(); | |
| 4114 |
2/2✓ Branch 5 taken 17 times.
✓ Branch 6 taken 17 times.
|
34 | for (const Space& space : spaces) { |
| 4115 |
1/1✓ Branch 1 taken 17 times.
|
17 | Transformation spaceToBuildingTransformation = space.buildingTransformation(); |
| 4116 |
1/1✓ Branch 1 taken 17 times.
|
17 | Transformation transformation = buildingToGridTransformation * spaceToBuildingTransformation; |
| 4117 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 8 taken 49 times.
✓ Branch 9 taken 17 times.
|
66 | for (const Surface& surface : space.surfaces()) { |
| 4118 |
15/36✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
✓ Branch 7 taken 49 times.
✓ Branch 9 taken 49 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 49 times.
✓ Branch 15 taken 49 times.
✓ Branch 18 taken 49 times.
✓ Branch 20 taken 49 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 49 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 49 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 49 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 49 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 49 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 49 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 49 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
|
245 | if (istringEqual("RoofCeiling", surface.surfaceType()) && istringEqual("Outdoors", surface.outsideBoundaryCondition())) { |
| 4119 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
49 | std::vector<Point3d> vertices = transformation * surface.vertices(); |
| 4120 |
2/2✓ Branch 4 taken 196 times.
✓ Branch 5 taken 49 times.
|
245 | for (const Point3d& vertex : vertices) { |
| 4121 |
1/1✓ Branch 1 taken 196 times.
|
196 | xmin = std::min(xmin, vertex.x()); |
| 4122 |
1/1✓ Branch 1 taken 196 times.
|
196 | xmax = std::max(xmax, vertex.x()); |
| 4123 |
1/1✓ Branch 1 taken 196 times.
|
196 | ymin = std::min(ymin, vertex.y()); |
| 4124 |
1/1✓ Branch 1 taken 196 times.
|
196 | ymax = std::max(ymax, vertex.y()); |
| 4125 | } | ||
| 4126 | 49 | } | |
| 4127 | 17 | } | |
| 4128 | 17 | } | |
| 4129 |
2/4✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
17 | if ((xmin > xmax) || (ymin > ymax)) { |
| 4130 | ✗ | return result; | |
| 4131 | } | ||
| 4132 | |||
| 4133 | 17 | double floorPrintWidth = (xmax - xmin); | |
| 4134 | 17 | double floorPrintHeight = (ymax - ymin); | |
| 4135 | |||
| 4136 | 17 | double numSkylightsX = std::sqrt(skylightToProjectedFloorRatio) * floorPrintWidth / desiredWidth; | |
| 4137 | 17 | double numSkylightsY = std::sqrt(skylightToProjectedFloorRatio) * floorPrintHeight / desiredHeight; | |
| 4138 | |||
| 4139 | // space is distance from end of one skylight to beginning of next | ||
| 4140 | 17 | double xSpace = (floorPrintWidth - numSkylightsX * desiredWidth) / (std::ceil(numSkylightsX)); | |
| 4141 | 17 | double ySpace = (floorPrintHeight - numSkylightsY * desiredHeight) / (std::ceil(numSkylightsY)); | |
| 4142 | |||
| 4143 |
2/4✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
17 | if ((xSpace <= 0.0) || (ySpace <= 0.0)) { |
| 4144 | ✗ | return result; | |
| 4145 | } | ||
| 4146 | |||
| 4147 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 17 times.
|
113 | for (double x = xmin + xSpace / 2.0; x < xmax - xSpace / 2.0; x += desiredWidth + xSpace) { |
| 4148 |
2/2✓ Branch 0 taken 488 times.
✓ Branch 1 taken 96 times.
|
584 | for (double y = ymin + ySpace / 2.0; y < ymax - ySpace / 2.0; y += desiredHeight + ySpace) { |
| 4149 | |||
| 4150 | 488 | double x2 = std::min(x + desiredWidth, xmax - xSpace / 2.0); | |
| 4151 | 488 | double y2 = std::min(y + desiredHeight, ymax - ySpace / 2.0); | |
| 4152 | |||
| 4153 | // skylight in grid coordinates | ||
| 4154 | std::vector<Point3d> skylight{ | ||
| 4155 | {x, y, 0}, | ||
| 4156 | {x2, y, 0}, | ||
| 4157 | {x2, y2, 0}, | ||
| 4158 | {x, y2, 0}, | ||
| 4159 |
3/5✓ Branch 1 taken 488 times.
✓ Branch 3 taken 1952 times.
✓ Branch 4 taken 488 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2928 | }; |
| 4160 | |||
| 4161 | // put results into building coordinates | ||
| 4162 |
2/2✓ Branch 1 taken 488 times.
✓ Branch 4 taken 488 times.
|
488 | result.push_back(gridToBuildingTransformation * skylight); |
| 4163 | 488 | } | |
| 4164 | } | ||
| 4165 | |||
| 4166 | 17 | return result; | |
| 4167 | 505 | } | |
| 4168 | |||
| 4169 | } // namespace model | ||
| 4170 | } // namespace openstudio | ||
| 4171 |