src/model/SolarCollectorPerformancePhotovoltaicThermalSimple.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 "SolarCollectorPerformancePhotovoltaicThermalSimple.hpp" | ||
| 7 | #include "SolarCollectorPerformancePhotovoltaicThermalSimple_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Schedule.hpp" | ||
| 10 | #include "Schedule_Impl.hpp" | ||
| 11 | #include "ScheduleTypeLimits.hpp" | ||
| 12 | #include "ScheduleTypeRegistry.hpp" | ||
| 13 | |||
| 14 | #include <utilities/idd/IddFactory.hxx> | ||
| 15 | #include <utilities/idd/OS_SolarCollectorPerformance_PhotovoltaicThermal_Simple_FieldEnums.hxx> | ||
| 16 | |||
| 17 | #include "../utilities/units/Unit.hpp" | ||
| 18 | |||
| 19 | #include "../utilities/core/Assert.hpp" | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | namespace model { | ||
| 23 | |||
| 24 | namespace detail { | ||
| 25 | |||
| 26 | 11 | SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl(const IdfObject& idfObject, | |
| 27 | Model_Impl* model, | ||
| 28 | 11 | bool keepHandle) | |
| 29 | 11 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 30 |
4/6✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 11 times.
✗ Branch 13 not taken.
|
11 | OS_ASSERT(idfObject.iddObject().type() == SolarCollectorPerformancePhotovoltaicThermalSimple::iddObjectType()); |
| 31 | 11 | } | |
| 32 | |||
| 33 | ✗ | SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl( | |
| 34 | ✗ | const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 35 | ✗ | : ModelObject_Impl(other, model, keepHandle) { | |
| 36 | ✗ | OS_ASSERT(other.iddObject().type() == SolarCollectorPerformancePhotovoltaicThermalSimple::iddObjectType()); | |
| 37 | ✗ | } | |
| 38 | |||
| 39 | 7 | SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl( | |
| 40 | 7 | const SolarCollectorPerformancePhotovoltaicThermalSimple_Impl& other, Model_Impl* model, bool keepHandle) | |
| 41 | 7 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 42 | |||
| 43 | ✗ | const std::vector<std::string>& SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::outputVariableNames() const { | |
| 44 | ✗ | static const std::vector<std::string> result; | |
| 45 | ✗ | return result; | |
| 46 | } | ||
| 47 | |||
| 48 | ✗ | IddObjectType SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::iddObjectType() const { | |
| 49 | ✗ | return SolarCollectorPerformancePhotovoltaicThermalSimple::iddObjectType(); | |
| 50 | } | ||
| 51 | |||
| 52 | ✗ | std::vector<ScheduleTypeKey> SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::getScheduleTypeKeys(const Schedule& schedule) const { | |
| 53 | ✗ | std::vector<ScheduleTypeKey> result; | |
| 54 | ✗ | UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); | |
| 55 | ✗ | UnsignedVector::const_iterator b(fieldIndices.begin()); | |
| 56 | ✗ | UnsignedVector::const_iterator e(fieldIndices.end()); | |
| 57 | ✗ | if (std::find(b, e, OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ThermalConversionEfficiencyScheduleName) != e) { | |
| 58 | ✗ | result.push_back(ScheduleTypeKey("SolarCollectorPerformancePhotovoltaicThermalSimple", "Thermal Conversion Efficiency")); | |
| 59 | } | ||
| 60 | ✗ | return result; | |
| 61 | ✗ | } | |
| 62 | |||
| 63 | 1 | double SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::fractionOfSurfaceAreaWithActiveThermalCollector() const { | |
| 64 | boost::optional<double> value = | ||
| 65 |
1/1✓ Branch 1 taken 1 time.
|
1 | getDouble(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::FractionofSurfaceAreawithActiveThermalCollector, true); |
| 66 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(value); |
| 67 |
1/1✓ Branch 1 taken 1 time.
|
2 | return value.get(); |
| 68 | } | ||
| 69 | |||
| 70 | 2 | std::string SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::thermalConversionEfficiencyInputModeType() const { | |
| 71 | boost::optional<std::string> result = | ||
| 72 |
1/1✓ Branch 1 taken 2 times.
|
2 | getString(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ThermalConversionEfficiencyInputModeType, true); |
| 73 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
|
2 | OS_ASSERT(result); |
| 74 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | return *result; |
| 75 | 2 | } | |
| 76 | |||
| 77 | 1 | boost::optional<double> SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::thermalConversionEfficiency() const { | |
| 78 | 1 | boost::optional<double> result; | |
| 79 |
4/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 11 taken 1 time.
✗ Branch 12 not taken.
|
3 | if (istringEqual("Fixed", thermalConversionEfficiencyInputModeType())) { |
| 80 |
1/1✓ Branch 1 taken 1 time.
|
1 | result = getDouble(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ValueforThermalConversionEfficiencyifFixed, true); |
| 81 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!result) { |
| 82 | ✗ | result = 0.3; | |
| 83 | } | ||
| 84 | } | ||
| 85 | 1 | return result; | |
| 86 | } | ||
| 87 | |||
| 88 | ✗ | boost::optional<Schedule> SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::thermalConversionEfficiencySchedule() const { | |
| 89 | ✗ | boost::optional<Schedule> result; | |
| 90 | ✗ | if (istringEqual("Scheduled", thermalConversionEfficiencyInputModeType())) { | |
| 91 | ✗ | result = getObject<ModelObject>().getModelObjectTarget<Schedule>( | |
| 92 | ✗ | OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ThermalConversionEfficiencyScheduleName); | |
| 93 | } | ||
| 94 | ✗ | return result; | |
| 95 | ✗ | } | |
| 96 | |||
| 97 | 1 | double SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::frontSurfaceEmittance() const { | |
| 98 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> value = getDouble(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::FrontSurfaceEmittance, true); |
| 99 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(value); |
| 100 |
1/1✓ Branch 1 taken 1 time.
|
2 | return value.get(); |
| 101 | } | ||
| 102 | |||
| 103 | ✗ | bool SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::isFrontSurfaceEmittanceDefaulted() const { | |
| 104 | ✗ | return isEmpty(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::FrontSurfaceEmittance); | |
| 105 | } | ||
| 106 | |||
| 107 | ✗ | bool SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::setFractionOfSurfaceAreaWithActiveThermalCollector( | |
| 108 | double fractionofSurfaceAreawithActiveThermalCollector) { | ||
| 109 | ✗ | bool result = setDouble(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::FractionofSurfaceAreawithActiveThermalCollector, | |
| 110 | fractionofSurfaceAreawithActiveThermalCollector); | ||
| 111 | ✗ | return result; | |
| 112 | } | ||
| 113 | |||
| 114 | 11 | bool SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::setThermalConversionEfficiency(double fixedThermalConversionEfficiency) { | |
| 115 | |||
| 116 | 11 | bool result = setDouble(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ValueforThermalConversionEfficiencyifFixed, | |
| 117 | fixedThermalConversionEfficiency); | ||
| 118 |
1/2✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
|
11 | if (result) { |
| 119 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
22 | result = setString(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ThermalConversionEfficiencyInputModeType, "Fixed"); |
| 120 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | OS_ASSERT(result); |
| 121 | 11 | resetThermalConversionEfficiencySchedule(); | |
| 122 | } | ||
| 123 | 11 | return result; | |
| 124 | } | ||
| 125 | |||
| 126 | ✗ | void SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::resetThermalConversionEfficiency() { | |
| 127 | ✗ | bool result = setString(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ValueforThermalConversionEfficiencyifFixed, ""); | |
| 128 | ✗ | OS_ASSERT(result); | |
| 129 | ✗ | } | |
| 130 | |||
| 131 | ✗ | bool SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::setThermalConversionEfficiencySchedule(Schedule& schedule) { | |
| 132 | ✗ | bool result = setSchedule(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ThermalConversionEfficiencyScheduleName, | |
| 133 | "SolarCollectorPerformancePhotovoltaicThermalSimple", "Thermal Conversion Efficiency", schedule); | ||
| 134 | ✗ | if (result) { | |
| 135 | ✗ | result = setString(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ThermalConversionEfficiencyInputModeType, "Scheduled"); | |
| 136 | ✗ | OS_ASSERT(result); | |
| 137 | ✗ | resetThermalConversionEfficiency(); | |
| 138 | } | ||
| 139 | ✗ | return result; | |
| 140 | } | ||
| 141 | |||
| 142 | 11 | void SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::resetThermalConversionEfficiencySchedule() { | |
| 143 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
22 | bool result = setString(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ThermalConversionEfficiencyScheduleName, ""); |
| 144 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | OS_ASSERT(result); |
| 145 | 11 | } | |
| 146 | |||
| 147 | ✗ | bool SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::setFrontSurfaceEmittance(double frontSurfaceEmittance) { | |
| 148 | ✗ | bool result = setDouble(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::FrontSurfaceEmittance, frontSurfaceEmittance); | |
| 149 | ✗ | return result; | |
| 150 | } | ||
| 151 | |||
| 152 | ✗ | void SolarCollectorPerformancePhotovoltaicThermalSimple_Impl::resetFrontSurfaceEmittance() { | |
| 153 | ✗ | bool result = setString(OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::FrontSurfaceEmittance, ""); | |
| 154 | ✗ | OS_ASSERT(result); | |
| 155 | ✗ | } | |
| 156 | |||
| 157 | } // namespace detail | ||
| 158 | |||
| 159 | 11 | SolarCollectorPerformancePhotovoltaicThermalSimple::SolarCollectorPerformancePhotovoltaicThermalSimple(const Model& model) | |
| 160 | 11 | : ModelObject(SolarCollectorPerformancePhotovoltaicThermalSimple::iddObjectType(), model) { | |
| 161 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 11 times.
✗ Branch 5 not taken.
|
11 | OS_ASSERT(getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()); |
| 162 | |||
| 163 | // defaults from \EnergyPlusV8-3-0\ExampleFiles\ShopWithSimplePVT.idf | ||
| 164 | |||
| 165 | 11 | bool ok = true; | |
| 166 |
1/1✓ Branch 1 taken 11 times.
|
11 | ok = setThermalConversionEfficiency(0.3); |
| 167 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
|
11 | OS_ASSERT(ok); |
| 168 | 11 | } | |
| 169 | |||
| 170 | 7630 | IddObjectType SolarCollectorPerformancePhotovoltaicThermalSimple::iddObjectType() { | |
| 171 |
1/1✓ Branch 1 taken 7630 times.
|
7630 | return {IddObjectType::OS_SolarCollectorPerformance_PhotovoltaicThermal_Simple}; |
| 172 | } | ||
| 173 | |||
| 174 | ✗ | std::vector<std::string> SolarCollectorPerformancePhotovoltaicThermalSimple::thermalConversionEfficiencyInputModeTypeValues() { | |
| 175 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), | |
| 176 | ✗ | OS_SolarCollectorPerformance_PhotovoltaicThermal_SimpleFields::ThermalConversionEfficiencyInputModeType); | |
| 177 | } | ||
| 178 | |||
| 179 | 1 | double SolarCollectorPerformancePhotovoltaicThermalSimple::fractionOfSurfaceAreaWithActiveThermalCollector() const { | |
| 180 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->fractionOfSurfaceAreaWithActiveThermalCollector(); |
| 181 | } | ||
| 182 | |||
| 183 | 1 | std::string SolarCollectorPerformancePhotovoltaicThermalSimple::thermalConversionEfficiencyInputModeType() const { | |
| 184 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->thermalConversionEfficiencyInputModeType(); |
| 185 | } | ||
| 186 | |||
| 187 | 1 | boost::optional<double> SolarCollectorPerformancePhotovoltaicThermalSimple::thermalConversionEfficiency() const { | |
| 188 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->thermalConversionEfficiency(); |
| 189 | } | ||
| 190 | |||
| 191 | ✗ | boost::optional<Schedule> SolarCollectorPerformancePhotovoltaicThermalSimple::thermalConversionEfficiencySchedule() const { | |
| 192 | ✗ | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->thermalConversionEfficiencySchedule(); | |
| 193 | } | ||
| 194 | |||
| 195 | 1 | double SolarCollectorPerformancePhotovoltaicThermalSimple::frontSurfaceEmittance() const { | |
| 196 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->frontSurfaceEmittance(); |
| 197 | } | ||
| 198 | |||
| 199 | ✗ | bool SolarCollectorPerformancePhotovoltaicThermalSimple::isFrontSurfaceEmittanceDefaulted() const { | |
| 200 | ✗ | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->isFrontSurfaceEmittanceDefaulted(); | |
| 201 | } | ||
| 202 | |||
| 203 | ✗ | bool SolarCollectorPerformancePhotovoltaicThermalSimple::setFractionOfSurfaceAreaWithActiveThermalCollector( | |
| 204 | double fractionofSurfaceAreawithActiveThermalCollector) { | ||
| 205 | ✗ | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->setFractionOfSurfaceAreaWithActiveThermalCollector( | |
| 206 | ✗ | fractionofSurfaceAreawithActiveThermalCollector); | |
| 207 | } | ||
| 208 | |||
| 209 | 11 | bool SolarCollectorPerformancePhotovoltaicThermalSimple::setThermalConversionEfficiency(double valueforThermalConversionEfficiencyifFixed) { | |
| 210 |
1/1✓ Branch 3 taken 11 times.
|
22 | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->setThermalConversionEfficiency( |
| 211 | 22 | valueforThermalConversionEfficiencyifFixed); | |
| 212 | } | ||
| 213 | |||
| 214 | ✗ | void SolarCollectorPerformancePhotovoltaicThermalSimple::resetThermalConversionEfficiency() { | |
| 215 | ✗ | getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->resetThermalConversionEfficiency(); | |
| 216 | ✗ | } | |
| 217 | |||
| 218 | ✗ | bool SolarCollectorPerformancePhotovoltaicThermalSimple::setThermalConversionEfficiencySchedule(Schedule& schedule) { | |
| 219 | ✗ | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->setThermalConversionEfficiencySchedule(schedule); | |
| 220 | } | ||
| 221 | |||
| 222 | ✗ | void SolarCollectorPerformancePhotovoltaicThermalSimple::resetThermalConversionEfficiencySchedule() { | |
| 223 | ✗ | getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->resetThermalConversionEfficiencySchedule(); | |
| 224 | ✗ | } | |
| 225 | |||
| 226 | ✗ | bool SolarCollectorPerformancePhotovoltaicThermalSimple::setFrontSurfaceEmittance(double frontSurfaceEmittance) { | |
| 227 | ✗ | return getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->setFrontSurfaceEmittance(frontSurfaceEmittance); | |
| 228 | } | ||
| 229 | |||
| 230 | ✗ | void SolarCollectorPerformancePhotovoltaicThermalSimple::resetFrontSurfaceEmittance() { | |
| 231 | ✗ | getImpl<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl>()->resetFrontSurfaceEmittance(); | |
| 232 | ✗ | } | |
| 233 | |||
| 234 | /// @cond | ||
| 235 | 7 | SolarCollectorPerformancePhotovoltaicThermalSimple::SolarCollectorPerformancePhotovoltaicThermalSimple( | |
| 236 | 7 | std::shared_ptr<detail::SolarCollectorPerformancePhotovoltaicThermalSimple_Impl> impl) | |
| 237 |
1/1✓ Branch 3 taken 7 times.
|
7 | : ModelObject(std::move(impl)) {} |
| 238 | /// @endcond | ||
| 239 | |||
| 240 | } // namespace model | ||
| 241 | } // namespace openstudio | ||
| 242 |