src/model/CoilHeatingElectricMultiStage.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 "Model.hpp" | ||
| 7 | #include "Model_Impl.hpp" | ||
| 8 | #include "CoilHeatingElectricMultiStage.hpp" | ||
| 9 | #include "CoilHeatingElectricMultiStage_Impl.hpp" | ||
| 10 | #include "Schedule.hpp" | ||
| 11 | #include "Schedule_Impl.hpp" | ||
| 12 | #include "CoilHeatingElectricMultiStageStageData.hpp" | ||
| 13 | #include "CoilHeatingElectricMultiStageStageData_Impl.hpp" | ||
| 14 | #include "AirLoopHVACUnitarySystem.hpp" | ||
| 15 | #include "AirLoopHVACUnitarySystem_Impl.hpp" | ||
| 16 | #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.hpp" | ||
| 17 | #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl.hpp" | ||
| 18 | #include "ScheduleTypeLimits.hpp" | ||
| 19 | #include "ScheduleTypeRegistry.hpp" | ||
| 20 | |||
| 21 | #include <utilities/idd/OS_Coil_Heating_Electric_MultiStage_FieldEnums.hxx> | ||
| 22 | #include <utilities/idd/IddEnums.hxx> | ||
| 23 | #include "../utilities/core/Assert.hpp" | ||
| 24 | #include "../utilities/data/DataEnums.hpp" | ||
| 25 | #include "../utilities/idf/WorkspaceExtensibleGroup.hpp" | ||
| 26 | |||
| 27 | namespace openstudio { | ||
| 28 | namespace model { | ||
| 29 | |||
| 30 | namespace detail { | ||
| 31 | |||
| 32 | 19 | CoilHeatingElectricMultiStage_Impl::CoilHeatingElectricMultiStage_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 33 | 19 | : StraightComponent_Impl(idfObject, model, keepHandle) { | |
| 34 |
4/6✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
✓ Branch 7 taken 19 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 19 times.
✗ Branch 13 not taken.
|
19 | OS_ASSERT(idfObject.iddObject().type() == CoilHeatingElectricMultiStage::iddObjectType()); |
| 35 | 19 | } | |
| 36 | |||
| 37 | 1 | CoilHeatingElectricMultiStage_Impl::CoilHeatingElectricMultiStage_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 38 | 1 | bool keepHandle) | |
| 39 | 1 | : StraightComponent_Impl(other, model, keepHandle) { | |
| 40 |
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(other.iddObject().type() == CoilHeatingElectricMultiStage::iddObjectType()); |
| 41 | 1 | } | |
| 42 | |||
| 43 | 12 | CoilHeatingElectricMultiStage_Impl::CoilHeatingElectricMultiStage_Impl(const CoilHeatingElectricMultiStage_Impl& other, Model_Impl* model, | |
| 44 | 12 | bool keepHandle) | |
| 45 | 12 | : StraightComponent_Impl(other, model, keepHandle) {} | |
| 46 | |||
| 47 | ✗ | const std::vector<std::string>& CoilHeatingElectricMultiStage_Impl::outputVariableNames() const { | |
| 48 | static const std::vector<std::string> result{"Heating Coil Heating Energy", "Heating Coil Heating Rate", "Heating Coil Electric Consumption", | ||
| 49 | ✗ | "Heating Coil Electricity Rate"}; | |
| 50 | ✗ | return result; | |
| 51 | ✗ | } | |
| 52 | |||
| 53 | 8 | IddObjectType CoilHeatingElectricMultiStage_Impl::iddObjectType() const { | |
| 54 | 8 | return CoilHeatingElectricMultiStage::iddObjectType(); | |
| 55 | } | ||
| 56 | |||
| 57 | ✗ | std::vector<ScheduleTypeKey> CoilHeatingElectricMultiStage_Impl::getScheduleTypeKeys(const Schedule& schedule) const { | |
| 58 | ✗ | std::vector<ScheduleTypeKey> result; | |
| 59 | ✗ | UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); | |
| 60 | ✗ | UnsignedVector::const_iterator b(fieldIndices.begin()); | |
| 61 | ✗ | UnsignedVector::const_iterator e(fieldIndices.end()); | |
| 62 | ✗ | if (std::find(b, e, OS_Coil_Heating_Electric_MultiStageFields::AvailabilitySchedule) != e) { | |
| 63 | ✗ | result.emplace_back("CoilHeatingElectricMultiStage", "Availability Schedule"); | |
| 64 | } | ||
| 65 | ✗ | return result; | |
| 66 | ✗ | } | |
| 67 | |||
| 68 | 9 | unsigned CoilHeatingElectricMultiStage_Impl::inletPort() const { | |
| 69 | 9 | return OS_Coil_Heating_Electric_MultiStageFields::AirInletNode; | |
| 70 | } | ||
| 71 | |||
| 72 | 9 | unsigned CoilHeatingElectricMultiStage_Impl::outletPort() const { | |
| 73 | 9 | return OS_Coil_Heating_Electric_MultiStageFields::AirOutletNode; | |
| 74 | } | ||
| 75 | |||
| 76 | 3 | ModelObject CoilHeatingElectricMultiStage_Impl::clone(Model model) const { | |
| 77 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | auto t_clone = StraightComponent_Impl::clone(model).cast<CoilHeatingElectricMultiStage>(); |
| 78 | |||
| 79 | // Deal with the stages: we want them cloned, so first clear and then clone + assign each | ||
| 80 |
1/1✓ Branch 1 taken 3 times.
|
3 | t_clone.removeAllStages(); |
| 81 | |||
| 82 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 3 times.
|
7 | for (const auto& stage : stages()) { |
| 83 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | auto stageClone = stage.clone(model).cast<CoilHeatingElectricMultiStageStageData>(); |
| 84 |
1/1✓ Branch 1 taken 4 times.
|
4 | t_clone.addStage(stageClone); |
| 85 | 7 | } | |
| 86 | 6 | return std::move(t_clone); | |
| 87 | 3 | } | |
| 88 | |||
| 89 | 11 | std::vector<ModelObject> CoilHeatingElectricMultiStage_Impl::children() const { | |
| 90 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | return subsetCastVector<ModelObject>(stages()); |
| 91 | } | ||
| 92 | |||
| 93 | 4 | boost::optional<HVACComponent> CoilHeatingElectricMultiStage_Impl::containingHVACComponent() const { | |
| 94 | // AirLoopHVACUnitarySystem | ||
| 95 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | std::vector<AirLoopHVACUnitarySystem> airLoopHVACUnitarySystems = this->model().getConcreteModelObjects<AirLoopHVACUnitarySystem>(); |
| 96 | |||
| 97 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
|
4 | for (const auto& airLoopHVACUnitarySystem : airLoopHVACUnitarySystems) { |
| 98 | ✗ | if (boost::optional<HVACComponent> heatingCoil = airLoopHVACUnitarySystem.heatingCoil()) { | |
| 99 | ✗ | if (heatingCoil->handle() == this->handle()) { | |
| 100 | ✗ | return airLoopHVACUnitarySystem; | |
| 101 | } | ||
| 102 | ✗ | } | |
| 103 | ✗ | if (boost::optional<HVACComponent> suppHeatingCoil = airLoopHVACUnitarySystem.supplementalHeatingCoil()) { | |
| 104 | ✗ | if (suppHeatingCoil->handle() == this->handle()) { | |
| 105 | ✗ | return airLoopHVACUnitarySystem; | |
| 106 | } | ||
| 107 | ✗ | } | |
| 108 | } | ||
| 109 | |||
| 110 | // AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed | ||
| 111 | std::vector<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed> airLoopHVACUnitaryHeatPumpAirToAirMultiSpeeds = | ||
| 112 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed>(); |
| 113 | |||
| 114 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
|
4 | for (const auto& airLoopHVACUnitaryHeatPumpAirToAirMultiSpeed : airLoopHVACUnitaryHeatPumpAirToAirMultiSpeeds) { |
| 115 | ✗ | if (boost::optional<HVACComponent> heatingCoil = airLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.heatingCoil()) { | |
| 116 | ✗ | if (heatingCoil->handle() == this->handle()) { | |
| 117 | ✗ | return airLoopHVACUnitaryHeatPumpAirToAirMultiSpeed; | |
| 118 | } | ||
| 119 | ✗ | } | |
| 120 | } | ||
| 121 | |||
| 122 | 4 | return boost::none; | |
| 123 | 4 | } | |
| 124 | |||
| 125 | 1 | bool CoilHeatingElectricMultiStage_Impl::addToNode(Node& /*node*/) { | |
| 126 | 1 | return false; | |
| 127 | } | ||
| 128 | |||
| 129 | 8 | boost::optional<Schedule> CoilHeatingElectricMultiStage_Impl::optionalAvailabilitySchedule() const { | |
| 130 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Coil_Heating_Electric_MultiStageFields::AvailabilitySchedule); |
| 131 | } | ||
| 132 | |||
| 133 | 8 | Schedule CoilHeatingElectricMultiStage_Impl::availabilitySchedule() const { | |
| 134 |
1/1✓ Branch 1 taken 8 times.
|
8 | boost::optional<Schedule> value = optionalAvailabilitySchedule(); |
| 135 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
8 | if (!value) { |
| 136 | // it is an error if we get here, however we don't want to crash | ||
| 137 | // so we hook up to global always on schedule | ||
| 138 | ✗ | LOG(Error, "Required availability schedule not set, using 'Always On' schedule"); | |
| 139 | ✗ | value = this->model().alwaysOnDiscreteSchedule(); | |
| 140 | ✗ | OS_ASSERT(value); | |
| 141 | ✗ | const_cast<CoilHeatingElectricMultiStage_Impl*>(this)->setAvailabilitySchedule(*value); | |
| 142 | ✗ | value = optionalAvailabilitySchedule(); | |
| 143 | } | ||
| 144 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 4 not taken.
|
8 | OS_ASSERT(value); |
| 145 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
16 | return value.get(); |
| 146 | 8 | } | |
| 147 | |||
| 148 | 22 | bool CoilHeatingElectricMultiStage_Impl::setAvailabilitySchedule(Schedule& schedule) { | |
| 149 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
|
88 | bool result = setSchedule(OS_Coil_Heating_Electric_MultiStageFields::AvailabilitySchedule, "CoilHeatingElectricMultiStage", |
| 150 | "Availability Schedule", schedule); | ||
| 151 | 22 | return result; | |
| 152 | } | ||
| 153 | |||
| 154 | 30 | unsigned CoilHeatingElectricMultiStage_Impl::numberOfStages() const { | |
| 155 | 30 | return numExtensibleGroups(); | |
| 156 | } | ||
| 157 | |||
| 158 | 55 | std::vector<CoilHeatingElectricMultiStageStageData> CoilHeatingElectricMultiStage_Impl::stages() const { | |
| 159 | 55 | std::vector<CoilHeatingElectricMultiStageStageData> result; | |
| 160 |
3/3✓ Branch 1 taken 55 times.
✓ Branch 8 taken 94 times.
✓ Branch 9 taken 55 times.
|
149 | for (const auto& group : extensibleGroups()) { |
| 161 |
3/4✓ Branch 1 taken 94 times.
✓ Branch 4 taken 94 times.
✓ Branch 8 taken 94 times.
✗ Branch 9 not taken.
|
188 | if (auto target = group.cast<WorkspaceExtensibleGroup>().getTarget(OS_Coil_Heating_Electric_MultiStageExtensibleFields::Stage)) { |
| 162 |
3/4✓ Branch 1 taken 94 times.
✓ Branch 4 taken 94 times.
✓ Branch 6 taken 94 times.
✗ Branch 7 not taken.
|
188 | if (auto stage = target->optionalCast<CoilHeatingElectricMultiStageStageData>()) { |
| 163 |
2/2✓ Branch 1 taken 94 times.
✓ Branch 4 taken 94 times.
|
94 | result.push_back(stage.get()); |
| 164 | 94 | } | |
| 165 | 94 | } | |
| 166 | 55 | } | |
| 167 | 55 | return result; | |
| 168 | ✗ | } | |
| 169 | |||
| 170 | 8 | boost::optional<unsigned> CoilHeatingElectricMultiStage_Impl::stageIndex(const CoilHeatingElectricMultiStageStageData& stage) const { | |
| 171 | |||
| 172 | 8 | boost::optional<unsigned> result; | |
| 173 | |||
| 174 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | auto egs = castVector<WorkspaceExtensibleGroup>(extensibleGroups()); |
| 175 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | auto h = openstudio::toString(stage.handle()); |
| 176 |
1/1✓ Branch 3 taken 8 times.
|
8 | auto it = std::find_if(egs.begin(), egs.end(), [&](const WorkspaceExtensibleGroup& eg) { |
| 177 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | return (eg.getField(OS_Coil_Heating_Electric_MultiStageExtensibleFields::Stage).get() == h); |
| 178 | }); | ||
| 179 | |||
| 180 | // If found, we compute the index by using std::distance between the start of vector and the iterator returned by std::find_if | ||
| 181 |
2/2✓ Branch 2 taken 7 times.
✓ Branch 3 taken 1 time.
|
8 | if (it != egs.end()) { |
| 182 |
1/1✓ Branch 2 taken 7 times.
|
14 | result = std::distance(egs.begin(), it) + 1; |
| 183 | } | ||
| 184 | |||
| 185 | 8 | return result; | |
| 186 | 8 | } | |
| 187 | |||
| 188 | 34 | bool CoilHeatingElectricMultiStage_Impl::addStage(const CoilHeatingElectricMultiStageStageData& stage) { | |
| 189 |
3/3✓ Branch 1 taken 34 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 33 times.
|
68 | if (auto _c = stage.parentCoil()) { |
| 190 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
|
1 | if (this->handle() == _c->handle()) { |
| 191 | ✗ | return true; // already the case | |
| 192 | } else { | ||
| 193 |
15/15✓ 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.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
✓ Branch 34 taken 1 time.
✓ Branch 40 taken 1 time.
✓ Branch 43 taken 1 time.
✓ Branch 46 taken 1 time.
|
1 | LOG(Error, "For " << briefDescription() << " cannot add " << stage.briefDescription() |
| 194 | << " since this Stage is already in use by another coil ('" << _c->nameString() << "')."); | ||
| 195 | 1 | return false; | |
| 196 | } | ||
| 197 | 34 | } | |
| 198 |
3/3✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
✓ Branch 7 taken 33 times.
|
33 | auto group = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); |
| 199 |
3/3✓ Branch 1 taken 33 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 31 times.
|
33 | if (group.empty()) { |
| 200 |
11/11✓ 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.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
✓ Branch 22 taken 2 times.
✓ Branch 26 taken 2 times.
✓ Branch 29 taken 2 times.
✓ Branch 32 taken 2 times.
|
2 | LOG(Error, "You have reached the maximum number of stages (=" << numberOfStages() << "), occurred for " << briefDescription() << "."); |
| 201 | 2 | return false; | |
| 202 | } | ||
| 203 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | bool result = group.setPointer(OS_Coil_Heating_Electric_MultiStageExtensibleFields::Stage, stage.handle()); |
| 204 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 30 times.
|
31 | if (!result) { |
| 205 | // Something went wrong, so erase the new extensible group | ||
| 206 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | getObject<ModelObject>().eraseExtensibleGroup(group.groupIndex()); |
| 207 | } | ||
| 208 | 31 | return result; | |
| 209 | 33 | } | |
| 210 | |||
| 211 | 1 | bool CoilHeatingElectricMultiStage_Impl::setStageIndex(const CoilHeatingElectricMultiStageStageData& stage, unsigned index) { | |
| 212 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<unsigned> idx = stageIndex(stage); |
| 213 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!idx) { |
| 214 | ✗ | LOG(Warn, "For " << briefDescription() << " cannot set the index of stage " << stage.briefDescription() << " since it is not part of it."); | |
| 215 | ✗ | return false; | |
| 216 | } | ||
| 217 | |||
| 218 | // TODO: we could just set via string instead of doing a ton of typechecking below... | ||
| 219 | |||
| 220 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::vector<CoilHeatingElectricMultiStageStageData> stageVector = stages(); |
| 221 | |||
| 222 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (index > stageVector.size()) { |
| 223 | ✗ | LOG(Warn, "Requested a stage index of " << index << " to be assigned to " << stage.briefDescription() << ", but " << briefDescription() | |
| 224 | << " only has " << stageVector.size() << " stages, resetting to that."); | ||
| 225 | ✗ | index = stageVector.size(); | |
| 226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | } else if (index < 1) { |
| 227 | ✗ | LOG(Warn, "Requested a stage index of " << index << " < 1 to be assigned to " << stage.briefDescription() << ", resetting to 1"); | |
| 228 | ✗ | index = 1; | |
| 229 | } | ||
| 230 | |||
| 231 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 8 taken 1 time.
|
1 | stageVector.erase(stageVector.begin() + idx.get() - 1); // stageIndex is 1-indexed, and vector is 0-indexed |
| 232 | |||
| 233 |
1/1✓ Branch 4 taken 1 time.
|
1 | stageVector.insert(stageVector.begin() + (index - 1), stage); |
| 234 | |||
| 235 |
1/1✓ Branch 1 taken 1 time.
|
1 | return setStages(stageVector); |
| 236 | 1 | } | |
| 237 | |||
| 238 | ✗ | bool CoilHeatingElectricMultiStage_Impl::addStage(const CoilHeatingElectricMultiStageStageData& stage, unsigned index) { | |
| 239 | ✗ | bool ok = addStage(stage); | |
| 240 | ✗ | if (!ok) { | |
| 241 | ✗ | return false; | |
| 242 | } | ||
| 243 | ✗ | ok = setStageIndex(stage, index); | |
| 244 | ✗ | return ok; | |
| 245 | } | ||
| 246 | |||
| 247 | 4 | bool CoilHeatingElectricMultiStage_Impl::setStages(const std::vector<CoilHeatingElectricMultiStageStageData>& stages) { | |
| 248 | // Clear the extensible groups, and redo them | ||
| 249 | 4 | bool ok = true; | |
| 250 |
1/1✓ Branch 1 taken 4 times.
|
4 | clearExtensibleGroups(); |
| 251 |
2/2✓ Branch 4 taken 13 times.
✓ Branch 5 taken 4 times.
|
17 | for (const CoilHeatingElectricMultiStageStageData& s : stages) { |
| 252 |
1/1✓ Branch 1 taken 13 times.
|
13 | ok &= addStage(s); |
| 253 | } | ||
| 254 | 4 | return ok; | |
| 255 | } | ||
| 256 | |||
| 257 | 6 | void CoilHeatingElectricMultiStage_Impl::removeAllStages() { | |
| 258 |
1/1✓ Branch 1 taken 6 times.
|
6 | clearExtensibleGroups(); |
| 259 | 6 | } | |
| 260 | |||
| 261 | 3 | bool CoilHeatingElectricMultiStage_Impl::removeStage(const CoilHeatingElectricMultiStageStageData& stage) { | |
| 262 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<unsigned> idx = stageIndex(stage); |
| 263 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 2 times.
|
3 | if (!idx) { |
| 264 |
11/11✓ 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.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 27 taken 1 time.
✓ Branch 30 taken 1 time.
✓ Branch 33 taken 1 time.
|
1 | LOG(Warn, "For " << briefDescription() << " cannot remove stage " << stage.briefDescription() << " since it is not part of it."); |
| 265 | 1 | return false; | |
| 266 | } | ||
| 267 | |||
| 268 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | return removeStage(idx.get()); |
| 269 | } | ||
| 270 | |||
| 271 | 3 | bool CoilHeatingElectricMultiStage_Impl::removeStage(unsigned index) { | |
| 272 | 3 | bool result = false; | |
| 273 |
3/6✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
|
3 | if ((index > 0) && (index <= numberOfStages())) { |
| 274 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | getObject<ModelObject>().eraseExtensibleGroup(index - 1); |
| 275 | 3 | result = true; | |
| 276 | } | ||
| 277 | 3 | return result; | |
| 278 | } | ||
| 279 | |||
| 280 | ✗ | ComponentType CoilHeatingElectricMultiStage_Impl::componentType() const { | |
| 281 | ✗ | return ComponentType::Heating; | |
| 282 | } | ||
| 283 | |||
| 284 | ✗ | std::vector<FuelType> CoilHeatingElectricMultiStage_Impl::coolingFuelTypes() const { | |
| 285 | ✗ | return {}; | |
| 286 | } | ||
| 287 | |||
| 288 | ✗ | std::vector<FuelType> CoilHeatingElectricMultiStage_Impl::heatingFuelTypes() const { | |
| 289 | ✗ | return {FuelType::Electricity}; | |
| 290 | } | ||
| 291 | |||
| 292 | ✗ | std::vector<AppGFuelType> CoilHeatingElectricMultiStage_Impl::appGHeatingFuelTypes() const { | |
| 293 | ✗ | return {AppGFuelType::Electric}; | |
| 294 | } | ||
| 295 | |||
| 296 | } // namespace detail | ||
| 297 | |||
| 298 | 18 | CoilHeatingElectricMultiStage::CoilHeatingElectricMultiStage(const Model& model) | |
| 299 | 18 | : StraightComponent(CoilHeatingElectricMultiStage::iddObjectType(), model) { | |
| 300 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
✗ Branch 5 not taken.
|
18 | OS_ASSERT(getImpl<detail::CoilHeatingElectricMultiStage_Impl>()); |
| 301 | |||
| 302 |
1/1✓ Branch 1 taken 18 times.
|
18 | auto always_on = model.alwaysOnDiscreteSchedule(); |
| 303 |
1/1✓ Branch 1 taken 18 times.
|
18 | bool ok = setAvailabilitySchedule(always_on); |
| 304 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 3 not taken.
|
18 | OS_ASSERT(ok); |
| 305 | 18 | } | |
| 306 | |||
| 307 | 7692 | IddObjectType CoilHeatingElectricMultiStage::iddObjectType() { | |
| 308 |
1/1✓ Branch 1 taken 7692 times.
|
7692 | return IddObjectType(IddObjectType::OS_Coil_Heating_Electric_MultiStage); |
| 309 | } | ||
| 310 | |||
| 311 | 8 | Schedule CoilHeatingElectricMultiStage::availabilitySchedule() const { | |
| 312 |
1/1✓ Branch 3 taken 8 times.
|
8 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->availabilitySchedule(); |
| 313 | } | ||
| 314 | |||
| 315 | 22 | bool CoilHeatingElectricMultiStage::setAvailabilitySchedule(Schedule& schedule) { | |
| 316 |
1/1✓ Branch 3 taken 22 times.
|
22 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->setAvailabilitySchedule(schedule); |
| 317 | } | ||
| 318 | |||
| 319 | 25 | unsigned CoilHeatingElectricMultiStage::numberOfStages() const { | |
| 320 |
1/1✓ Branch 3 taken 25 times.
|
25 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->numberOfStages(); |
| 321 | } | ||
| 322 | |||
| 323 | 4 | boost::optional<unsigned> CoilHeatingElectricMultiStage::stageIndex(const CoilHeatingElectricMultiStageStageData& stage) const { | |
| 324 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->stageIndex(stage); |
| 325 | } | ||
| 326 | |||
| 327 | 40 | std::vector<CoilHeatingElectricMultiStageStageData> CoilHeatingElectricMultiStage::stages() const { | |
| 328 |
1/1✓ Branch 3 taken 40 times.
|
40 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->stages(); |
| 329 | } | ||
| 330 | |||
| 331 | 21 | bool CoilHeatingElectricMultiStage::addStage(const CoilHeatingElectricMultiStageStageData& stage) { | |
| 332 |
1/1✓ Branch 3 taken 21 times.
|
21 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->addStage(stage); |
| 333 | } | ||
| 334 | |||
| 335 | ✗ | bool CoilHeatingElectricMultiStage::addStage(const CoilHeatingElectricMultiStageStageData& stage, unsigned index) { | |
| 336 | ✗ | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->addStage(stage, index); | |
| 337 | } | ||
| 338 | |||
| 339 | 1 | bool CoilHeatingElectricMultiStage::setStageIndex(const CoilHeatingElectricMultiStageStageData& stage, unsigned index) { | |
| 340 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->setStageIndex(stage, index); |
| 341 | } | ||
| 342 | |||
| 343 | 3 | bool CoilHeatingElectricMultiStage::setStages(const std::vector<CoilHeatingElectricMultiStageStageData>& stages) { | |
| 344 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->setStages(stages); |
| 345 | } | ||
| 346 | |||
| 347 | 6 | void CoilHeatingElectricMultiStage::removeAllStages() { | |
| 348 |
1/1✓ Branch 3 taken 6 times.
|
6 | getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->removeAllStages(); |
| 349 | 6 | } | |
| 350 | |||
| 351 | 3 | bool CoilHeatingElectricMultiStage::removeStage(const CoilHeatingElectricMultiStageStageData& stage) { | |
| 352 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->removeStage(stage); |
| 353 | } | ||
| 354 | |||
| 355 | 1 | bool CoilHeatingElectricMultiStage::removeStage(unsigned index) { | |
| 356 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::CoilHeatingElectricMultiStage_Impl>()->removeStage(index); |
| 357 | } | ||
| 358 | |||
| 359 | /// @cond | ||
| 360 | 22 | CoilHeatingElectricMultiStage::CoilHeatingElectricMultiStage(std::shared_ptr<detail::CoilHeatingElectricMultiStage_Impl> impl) | |
| 361 |
1/1✓ Branch 3 taken 22 times.
|
22 | : StraightComponent(std::move(impl)) {} |
| 362 | /// @endcond | ||
| 363 | |||
| 364 | } // namespace model | ||
| 365 | } // namespace openstudio | ||
| 366 |