src/model/PipeOutdoor.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 "PipeOutdoor.hpp" | ||
| 7 | #include "PipeOutdoor_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Construction.hpp" | ||
| 10 | #include "Construction_Impl.hpp" | ||
| 11 | #include "Node.hpp" | ||
| 12 | #include "Node_Impl.hpp" | ||
| 13 | |||
| 14 | #include "../utilities/core/Assert.hpp" | ||
| 15 | #include "../utilities/data/DataEnums.hpp" | ||
| 16 | |||
| 17 | #include <utilities/idd/IddEnums.hxx> | ||
| 18 | #include <utilities/idd/OS_Pipe_Outdoor_FieldEnums.hxx> | ||
| 19 | |||
| 20 | namespace openstudio { | ||
| 21 | namespace model { | ||
| 22 | |||
| 23 | namespace detail { | ||
| 24 | |||
| 25 | 1 | PipeOutdoor_Impl::PipeOutdoor_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 26 | 1 | : StraightComponent_Impl(idfObject, model, keepHandle) { | |
| 27 |
4/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 time.
✗ Branch 13 not taken.
|
1 | OS_ASSERT(idfObject.iddObject().type() == PipeOutdoor::iddObjectType()); |
| 28 | 1 | } | |
| 29 | |||
| 30 | ✗ | PipeOutdoor_Impl::PipeOutdoor_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 31 | ✗ | : StraightComponent_Impl(other, model, keepHandle) { | |
| 32 | ✗ | OS_ASSERT(other.iddObject().type() == PipeOutdoor::iddObjectType()); | |
| 33 | ✗ | } | |
| 34 | |||
| 35 | ✗ | PipeOutdoor_Impl::PipeOutdoor_Impl(const PipeOutdoor_Impl& other, Model_Impl* model, bool keepHandle) | |
| 36 | ✗ | : StraightComponent_Impl(other, model, keepHandle) {} | |
| 37 | |||
| 38 | ✗ | const std::vector<std::string>& PipeOutdoor_Impl::outputVariableNames() const { | |
| 39 | static const std::vector<std::string> result{"Pipe Fluid Heat Transfer Rate", "Pipe Fluid Heat Transfer Energy", "Pipe Mass Flow Rate", | ||
| 40 | ✗ | "Pipe Inlet Temperature", "Pipe Outlet Temperature", "Pipe Volume Flow Rate"}; | |
| 41 | ✗ | return result; | |
| 42 | ✗ | } | |
| 43 | |||
| 44 | ✗ | IddObjectType PipeOutdoor_Impl::iddObjectType() const { | |
| 45 | ✗ | return PipeOutdoor::iddObjectType(); | |
| 46 | } | ||
| 47 | |||
| 48 | ✗ | unsigned PipeOutdoor_Impl::inletPort() const { | |
| 49 | ✗ | return OS_Pipe_OutdoorFields::FluidInletNode; | |
| 50 | } | ||
| 51 | |||
| 52 | ✗ | unsigned PipeOutdoor_Impl::outletPort() const { | |
| 53 | ✗ | return OS_Pipe_OutdoorFields::FluidOutletNode; | |
| 54 | } | ||
| 55 | |||
| 56 | ✗ | boost::optional<Construction> PipeOutdoor_Impl::construction() const { | |
| 57 | ✗ | return getObject<ModelObject>().getModelObjectTarget<Construction>(OS_Pipe_OutdoorFields::Construction); | |
| 58 | } | ||
| 59 | |||
| 60 | ✗ | boost::optional<Node> PipeOutdoor_Impl::ambientTemperatureOutdoorAirNode() const { | |
| 61 | ✗ | return getObject<ModelObject>().getModelObjectTarget<Node>(OS_Pipe_OutdoorFields::AmbientTemperatureOutdoorAirNode); | |
| 62 | } | ||
| 63 | |||
| 64 | ✗ | double PipeOutdoor_Impl::pipeInsideDiameter() const { | |
| 65 | ✗ | boost::optional<double> value = getDouble(OS_Pipe_OutdoorFields::PipeInsideDiameter, true); | |
| 66 | ✗ | OS_ASSERT(value); | |
| 67 | ✗ | return value.get(); | |
| 68 | } | ||
| 69 | |||
| 70 | ✗ | double PipeOutdoor_Impl::pipeLength() const { | |
| 71 | ✗ | boost::optional<double> value = getDouble(OS_Pipe_OutdoorFields::PipeLength, true); | |
| 72 | ✗ | OS_ASSERT(value); | |
| 73 | ✗ | return value.get(); | |
| 74 | } | ||
| 75 | |||
| 76 | ✗ | bool PipeOutdoor_Impl::setConstruction(const boost::optional<Construction>& construction) { | |
| 77 | ✗ | bool result(false); | |
| 78 | ✗ | if (construction) { | |
| 79 | ✗ | result = setPointer(OS_Pipe_OutdoorFields::Construction, construction.get().handle()); | |
| 80 | } else { | ||
| 81 | ✗ | resetConstruction(); | |
| 82 | ✗ | result = true; | |
| 83 | } | ||
| 84 | ✗ | return result; | |
| 85 | } | ||
| 86 | |||
| 87 | ✗ | void PipeOutdoor_Impl::resetConstruction() { | |
| 88 | ✗ | bool result = setString(OS_Pipe_OutdoorFields::Construction, ""); | |
| 89 | ✗ | OS_ASSERT(result); | |
| 90 | ✗ | } | |
| 91 | |||
| 92 | ✗ | bool PipeOutdoor_Impl::setAmbientTemperatureOutdoorAirNode(const boost::optional<Node>& node) { | |
| 93 | ✗ | bool result(false); | |
| 94 | ✗ | if (node) { | |
| 95 | ✗ | result = setPointer(OS_Pipe_OutdoorFields::AmbientTemperatureOutdoorAirNode, node.get().handle()); | |
| 96 | } else { | ||
| 97 | ✗ | resetAmbientTemperatureOutdoorAirNode(); | |
| 98 | ✗ | result = true; | |
| 99 | } | ||
| 100 | ✗ | return result; | |
| 101 | } | ||
| 102 | |||
| 103 | ✗ | void PipeOutdoor_Impl::resetAmbientTemperatureOutdoorAirNode() { | |
| 104 | ✗ | bool result = setString(OS_Pipe_OutdoorFields::AmbientTemperatureOutdoorAirNode, ""); | |
| 105 | ✗ | OS_ASSERT(result); | |
| 106 | ✗ | } | |
| 107 | |||
| 108 | 1 | bool PipeOutdoor_Impl::setPipeInsideDiameter(double pipeInsideDiameter) { | |
| 109 | 1 | bool result = setDouble(OS_Pipe_OutdoorFields::PipeInsideDiameter, pipeInsideDiameter); | |
| 110 | 1 | return result; | |
| 111 | } | ||
| 112 | |||
| 113 | 1 | bool PipeOutdoor_Impl::setPipeLength(double pipeLength) { | |
| 114 | 1 | bool result = setDouble(OS_Pipe_OutdoorFields::PipeLength, pipeLength); | |
| 115 | 1 | return result; | |
| 116 | } | ||
| 117 | |||
| 118 | ✗ | bool PipeOutdoor_Impl::addToNode(Node& node) { | |
| 119 | ✗ | if (node.plantLoop()) { | |
| 120 | ✗ | return StraightComponent_Impl::addToNode(node); | |
| 121 | } | ||
| 122 | |||
| 123 | ✗ | return false; | |
| 124 | } | ||
| 125 | |||
| 126 | ✗ | ComponentType PipeOutdoor_Impl::componentType() const { | |
| 127 | ✗ | return ComponentType::None; | |
| 128 | } | ||
| 129 | |||
| 130 | ✗ | std::vector<FuelType> PipeOutdoor_Impl::coolingFuelTypes() const { | |
| 131 | ✗ | return {}; | |
| 132 | } | ||
| 133 | |||
| 134 | ✗ | std::vector<FuelType> PipeOutdoor_Impl::heatingFuelTypes() const { | |
| 135 | ✗ | return {}; | |
| 136 | } | ||
| 137 | |||
| 138 | ✗ | std::vector<AppGFuelType> PipeOutdoor_Impl::appGHeatingFuelTypes() const { | |
| 139 | ✗ | return {}; | |
| 140 | } | ||
| 141 | |||
| 142 | } // namespace detail | ||
| 143 | |||
| 144 | 1 | PipeOutdoor::PipeOutdoor(const Model& model) : StraightComponent(PipeOutdoor::iddObjectType(), model) { | |
| 145 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
|
1 | OS_ASSERT(getImpl<detail::PipeOutdoor_Impl>()); |
| 146 | |||
| 147 | 1 | bool ok = true; | |
| 148 | // ok = setHandle(); | ||
| 149 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 150 |
1/1✓ Branch 1 taken 1 time.
|
1 | ok = setPipeInsideDiameter(0.05); |
| 151 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 152 |
1/1✓ Branch 1 taken 1 time.
|
1 | ok = setPipeLength(100.0); |
| 153 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(ok); |
| 154 | 1 | } | |
| 155 | |||
| 156 | 7600 | IddObjectType PipeOutdoor::iddObjectType() { | |
| 157 |
1/1✓ Branch 1 taken 7600 times.
|
7600 | return {IddObjectType::OS_Pipe_Outdoor}; |
| 158 | } | ||
| 159 | |||
| 160 | ✗ | boost::optional<Construction> PipeOutdoor::construction() const { | |
| 161 | ✗ | return getImpl<detail::PipeOutdoor_Impl>()->construction(); | |
| 162 | } | ||
| 163 | |||
| 164 | ✗ | boost::optional<Node> PipeOutdoor::ambientTemperatureOutdoorAirNode() const { | |
| 165 | ✗ | return getImpl<detail::PipeOutdoor_Impl>()->ambientTemperatureOutdoorAirNode(); | |
| 166 | } | ||
| 167 | |||
| 168 | ✗ | double PipeOutdoor::pipeInsideDiameter() const { | |
| 169 | ✗ | return getImpl<detail::PipeOutdoor_Impl>()->pipeInsideDiameter(); | |
| 170 | } | ||
| 171 | |||
| 172 | ✗ | double PipeOutdoor::pipeLength() const { | |
| 173 | ✗ | return getImpl<detail::PipeOutdoor_Impl>()->pipeLength(); | |
| 174 | } | ||
| 175 | |||
| 176 | ✗ | bool PipeOutdoor::setConstruction(const Construction& construction) { | |
| 177 | ✗ | return getImpl<detail::PipeOutdoor_Impl>()->setConstruction(construction); | |
| 178 | } | ||
| 179 | |||
| 180 | ✗ | void PipeOutdoor::resetConstruction() { | |
| 181 | ✗ | getImpl<detail::PipeOutdoor_Impl>()->resetConstruction(); | |
| 182 | ✗ | } | |
| 183 | |||
| 184 | ✗ | bool PipeOutdoor::setAmbientTemperatureOutdoorAirNode(const Node& node) { | |
| 185 | ✗ | return getImpl<detail::PipeOutdoor_Impl>()->setAmbientTemperatureOutdoorAirNode(node); | |
| 186 | } | ||
| 187 | |||
| 188 | ✗ | void PipeOutdoor::resetAmbientTemperatureOutdoorAirNode() { | |
| 189 | ✗ | getImpl<detail::PipeOutdoor_Impl>()->resetAmbientTemperatureOutdoorAirNode(); | |
| 190 | ✗ | } | |
| 191 | |||
| 192 | 1 | bool PipeOutdoor::setPipeInsideDiameter(double pipeInsideDiameter) { | |
| 193 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::PipeOutdoor_Impl>()->setPipeInsideDiameter(pipeInsideDiameter); |
| 194 | } | ||
| 195 | |||
| 196 | 1 | bool PipeOutdoor::setPipeLength(double pipeLength) { | |
| 197 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::PipeOutdoor_Impl>()->setPipeLength(pipeLength); |
| 198 | } | ||
| 199 | |||
| 200 | /// @cond | ||
| 201 | ✗ | PipeOutdoor::PipeOutdoor(std::shared_ptr<detail::PipeOutdoor_Impl> impl) : StraightComponent(std::move(impl)) {} | |
| 202 | /// @endcond | ||
| 203 | |||
| 204 | } // namespace model | ||
| 205 | } // namespace openstudio | ||
| 206 |