src/energyplus/ForwardTranslator/ForwardTranslateElectricEquipmentITEAirCooled.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "../ForwardTranslator.hpp" | ||
| 7 | |||
| 8 | #include "../../model/Model.hpp" | ||
| 9 | #include "../../model/ElectricEquipmentITEAirCooled.hpp" | ||
| 10 | #include "../../model/ElectricEquipmentITEAirCooled_Impl.hpp" | ||
| 11 | #include "../../model/ElectricEquipmentITEAirCooledDefinition.hpp" | ||
| 12 | #include "../../model/ElectricEquipmentITEAirCooledDefinition_Impl.hpp" | ||
| 13 | #include "../../model/Space.hpp" | ||
| 14 | #include "../../model/Space_Impl.hpp" | ||
| 15 | #include "../../model/SpaceType.hpp" | ||
| 16 | #include "../../model/SpaceType_Impl.hpp" | ||
| 17 | #include "../../model/ThermalZone.hpp" | ||
| 18 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 19 | #include "../../model/Schedule.hpp" | ||
| 20 | #include "../../model/Schedule_Impl.hpp" | ||
| 21 | #include "../../model/Curve.hpp" | ||
| 22 | #include "../../model/Curve_Impl.hpp" | ||
| 23 | #include "../../model/CurveBiquadratic.hpp" | ||
| 24 | #include "../../model/CurveBiquadratic_Impl.hpp" | ||
| 25 | #include "../../model/CurveQuadratic.hpp" | ||
| 26 | #include "../../model/CurveQuadratic_Impl.hpp" | ||
| 27 | #include "../../model/Node.hpp" | ||
| 28 | #include "../../model/Node_Impl.hpp" | ||
| 29 | #include "../../model/PortList.hpp" | ||
| 30 | #include "../../model/PortList_Impl.hpp" | ||
| 31 | #include "../../model/AirTerminalSingleDuctVAVNoReheat.hpp" | ||
| 32 | #include "../../model/AirTerminalSingleDuctVAVNoReheat_Impl.hpp" | ||
| 33 | #include "../../model/AirTerminalSingleDuctVAVReheat.hpp" | ||
| 34 | #include "../../model/AirTerminalSingleDuctVAVReheat_Impl.hpp" | ||
| 35 | #include "../../model/HVACComponent.hpp" | ||
| 36 | #include "../../model/LifeCycleCost.hpp" | ||
| 37 | |||
| 38 | #include <utilities/idd/ElectricEquipment_ITE_AirCooled_FieldEnums.hxx> | ||
| 39 | #include <utilities/idd/ElectricEquipment_ITE_AirCooled_Instance_FieldEnums.hxx> | ||
| 40 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 41 | #include "../../utilities/core/ASCIIStrings.hpp" | ||
| 42 | #include <utilities/idd/IddEnums.hxx> | ||
| 43 | |||
| 44 | #include <algorithm> | ||
| 45 | #include <iterator> | ||
| 46 | |||
| 47 | using namespace openstudio::model; | ||
| 48 | |||
| 49 | namespace openstudio { | ||
| 50 | |||
| 51 | namespace energyplus { | ||
| 52 | |||
| 53 | 33 | boost::optional<IdfObject> ForwardTranslator::translateElectricEquipmentITEAirCooled(ElectricEquipmentITEAirCooled& modelObject) { | |
| 54 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 2 taken 1 time.
|
33 | if (m_forwardTranslatorOptions.excludeSpaceLoadInstances()) { |
| 55 | 32 | return translateElectricEquipmentITEAirCooledLegacy(modelObject); | |
| 56 | } | ||
| 57 | 1 | return translateElectricEquipmentITEAirCooledInstance(modelObject); | |
| 58 | } | ||
| 59 | |||
| 60 | 32 | boost::optional<IdfObject> ForwardTranslator::translateElectricEquipmentITEAirCooledLegacy(ElectricEquipmentITEAirCooled& modelObject) { | |
| 61 | |||
| 62 |
1/1✓ Branch 1 taken 32 times.
|
32 | boost::optional<Space> space_ = modelObject.space(); |
| 63 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
32 | if (!space_) { |
| 64 | // This shouldn't happen | ||
| 65 | ✗ | LOG(Warn, modelObject.briefDescription() << " not assigned to a valid space."); | |
| 66 | ✗ | return boost::none; | |
| 67 | } | ||
| 68 | |||
| 69 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | auto space = space_.get(); |
| 70 | |||
| 71 |
1/1✓ Branch 1 taken 32 times.
|
32 | boost::optional<ThermalZone> thermalZone_ = space.thermalZone(); |
| 72 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
32 | if (!thermalZone_) { |
| 73 | // This shouldn't happen | ||
| 74 | ✗ | LOG(Warn, modelObject.briefDescription() << " not assigned to a valid thermal Zone."); | |
| 75 | ✗ | return boost::none; | |
| 76 | } | ||
| 77 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | auto thermalZone = thermalZone_.get(); |
| 78 | |||
| 79 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | IdfObject idfObject(openstudio::IddObjectType::ElectricEquipment_ITE_AirCooled); |
| 80 | |||
| 81 |
2/4✓ Branch 1 taken 32 times.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 32 times.
|
32 | for (LifeCycleCost lifeCycleCost : modelObject.lifeCycleCosts()) { |
| 82 | ✗ | translateAndMapModelObject(lifeCycleCost); | |
| 83 | 32 | } | |
| 84 | |||
| 85 |
1/1✓ Branch 1 taken 32 times.
|
32 | ElectricEquipmentITEAirCooledDefinition definition = modelObject.electricEquipmentITEAirCooledDefinition(); |
| 86 | |||
| 87 | // Pre-process: | ||
| 88 | // (1) assign to zone; (2) connect the supply air node (3) apply contraints | ||
| 89 | // ITE object that is assigned to space type in OS has been switched to separate spaces in ForwardTranslator | ||
| 90 | |||
| 91 | // TODO: There might be work to be done in the case we translate to E+ Spaces (m_forwardTranslatorOptions.excludeSpaceTranslation() = false) | ||
| 92 | // Per IDD for this ITE object: ZoneList and SpaceList names are not allowed. | ||
| 93 | // But Spaces are allowed. Currently in the ForwardTranslator::translateModelPrivate we have rules to "hard-apply" ITE equipment assigned at | ||
| 94 | // spacetype-level to each spaces (clone for each space, then remove the SpaceType one) | ||
| 95 | // cf https://github.com/NREL/OpenStudio/blob/bf4ffc49d5947f74b139efa5fb1dffec9b1fb013/src/energyplus/ForwardTranslator.cpp#L323-L341 | ||
| 96 | |||
| 97 | // Assign object to Zone/Space | ||
| 98 |
1/1✓ Branch 1 taken 32 times.
|
32 | IdfObject parentIdfObject = getSpaceLoadParent(modelObject, false); // We do not allow spaceType! |
| 99 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::ZoneorSpaceName, parentIdfObject.nameString()); |
| 100 | |||
| 101 | // attach the supply air node to zone if there is an available supply air node | ||
| 102 | // search airloop first | ||
| 103 |
4/4✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
✓ Branch 8 taken 19 times.
✓ Branch 9 taken 13 times.
|
64 | if (auto mo = thermalZone.inletPortList().airLoopHVACModelObject()) { |
| 104 |
3/4✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
✓ Branch 6 taken 19 times.
✗ Branch 7 not taken.
|
38 | if (auto node = mo->optionalCast<Node>()) { |
| 105 |
4/4✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
✓ Branch 7 taken 19 times.
✓ Branch 10 taken 19 times.
|
19 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::SupplyAirNodeName, node->name().get()); |
| 106 | 19 | } | |
| 107 | } else { | ||
| 108 | // if no airloop, just get a supply node of the thermal zone (could be zoneHVAC) | ||
| 109 |
4/4✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 9 taken 3 times.
✓ Branch 10 taken 10 times.
|
13 | if (!thermalZone.inletPortList().modelObjects().empty()) { |
| 110 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | std::vector<ModelObject> objects = thermalZone.inletPortList().modelObjects(); |
| 111 |
2/2✓ Branch 5 taken 3 times.
✓ Branch 6 taken 3 times.
|
6 | for (const auto& elem : objects) { |
| 112 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (auto node = elem.optionalCast<Node>()) { |
| 113 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::SupplyAirNodeName, node->name().get()); |
| 114 | 3 | } | |
| 115 | } | ||
| 116 | 3 | } | |
| 117 | 32 | } | |
| 118 | |||
| 119 | // (Note: I like the idea of having put the logic here, but it would be more efficient to do that in ForwardTranslateThermalZone (or | ||
| 120 | // translateModelPrivate) to avoid doing it on every instance of a zone) | ||
| 121 | // apply constraint #1: For multiple ITE objects defined for one zone, the same calculation method should apply. | ||
| 122 | 32 | std::set<std::string> methods; | |
| 123 | |||
| 124 | 98 | auto caseInsensitiveMethodForITE = [](const ElectricEquipmentITEAirCooled& ite) { | |
| 125 |
3/3✓ Branch 1 taken 98 times.
✓ Branch 4 taken 98 times.
✓ Branch 8 taken 98 times.
|
98 | return openstudio::ascii_to_lower_copy(ite.electricEquipmentITEAirCooledDefinition().airFlowCalculationMethod()); |
| 126 | }; | ||
| 127 | |||
| 128 |
3/3✓ Branch 1 taken 32 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 17 times.
|
32 | if (m_forwardTranslatorOptions.excludeSpaceTranslation()) { |
| 129 | // One Zone = One Space at this point | ||
| 130 |
1/1✓ Branch 1 taken 15 times.
|
15 | auto ites = space.electricEquipmentITEAirCooled(); |
| 131 |
2/2✓ Branch 2 taken 15 times.
✓ Branch 7 taken 15 times.
|
15 | std::transform(ites.begin(), ites.end(), std::inserter(methods, methods.begin()), caseInsensitiveMethodForITE); |
| 132 | 15 | } else { | |
| 133 | // Does this constraint apply per Space? Per the I/O ref I think it applies for the entire zone. | ||
| 134 | // I/O 9.6.0: "For multiple ITE objects defined for one zone, the same calculation method should apply." | ||
| 135 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 8 taken 37 times.
✓ Branch 9 taken 17 times.
|
54 | for (const auto& s : thermalZone.spaces()) { |
| 136 |
1/1✓ Branch 1 taken 37 times.
|
37 | auto ites = s.electricEquipmentITEAirCooled(); |
| 137 |
2/2✓ Branch 2 taken 37 times.
✓ Branch 7 taken 37 times.
|
37 | std::transform(ites.begin(), ites.end(), std::inserter(methods, methods.begin()), caseInsensitiveMethodForITE); |
| 138 | 54 | } | |
| 139 | } | ||
| 140 | |||
| 141 |
1/1✓ Branch 1 taken 32 times.
|
32 | std::string thisMethod = definition.airFlowCalculationMethod(); |
| 142 |
12/16✓ Branch 1 taken 2 times.
✓ Branch 2 taken 30 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 9 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 2 times.
✓ Branch 12 taken 30 times.
✓ Branch 14 taken 2 times.
✓ Branch 15 taken 30 times.
✓ Branch 16 taken 1 time.
✓ Branch 17 taken 31 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
|
36 | if ((methods.size() > 1) && !openstudio::istringEqual(thisMethod, "FlowControlWithApproachTemperatures")) { |
| 143 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | definition.setAirFlowCalculationMethod("FlowControlWithApproachTemperatures"); |
| 144 |
1/1✓ Branch 1 taken 1 time.
|
1 | thisMethod = "FlowControlWithApproachTemperatures"; |
| 145 |
10/10✓ 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 24 taken 1 time.
✓ Branch 27 taken 1 time.
✓ Branch 30 taken 1 time.
|
1 | LOG(Warn, parentIdfObject.briefDescription() << " has multiple IT equipment with different air flow calculation methods, " |
| 146 | << modelObject.briefDescription() << " is re-assigned to 'FlowControlWithApproachTemperatures'"); | ||
| 147 | } | ||
| 148 | |||
| 149 | // Constraint #2:The FlowControlWithApproachTemperatures only applies to ITE zones with single duct VAV terminal unit. | ||
| 150 |
4/4✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
✓ Branch 7 taken 9 times.
✓ Branch 8 taken 23 times.
|
64 | if (istringEqual(thisMethod, "FlowControlWithApproachTemperatures")) { |
| 151 |
1/1✓ Branch 1 taken 9 times.
|
9 | auto terminal = thermalZone.airLoopHVACTerminal(); |
| 152 | bool isTerminalOk = | ||
| 153 |
13/18✓ Branch 1 taken 6 times.
✓ Branch 2 taken 3 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 3 times.
✓ Branch 21 taken 3 times.
✓ Branch 22 taken 6 times.
✓ Branch 24 taken 6 times.
✓ Branch 25 taken 3 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
27 | (terminal && (terminal->optionalCast<AirTerminalSingleDuctVAVReheat>() || terminal->optionalCast<AirTerminalSingleDuctVAVNoReheat>())); |
| 154 | |||
| 155 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
|
9 | if (!isTerminalOk) { |
| 156 |
7/7✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 14 taken 6 times.
✓ Branch 17 taken 6 times.
✓ Branch 20 taken 6 times.
|
6 | LOG( |
| 157 | Error, | ||
| 158 | modelObject.briefDescription() << " will not be translated. " | ||
| 159 | " The FlowControlWithApproachTemperatures only applies to ITE zones with single duct VAV terminal unit."); | ||
| 160 | 6 | return boost::none; | |
| 161 | } | ||
| 162 | 9 | } | |
| 163 | |||
| 164 | // After pre-checking gets through, add the object to the translation list | ||
| 165 |
1/1✓ Branch 1 taken 26 times.
|
26 | m_idfObjects.push_back(idfObject); |
| 166 | |||
| 167 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::Name, modelObject.name().get()); |
| 168 | |||
| 169 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::AirFlowCalculationMethod, definition.airFlowCalculationMethod()); |
| 170 | |||
| 171 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::DesignPowerInputCalculationMethod, definition.designPowerInputCalculationMethod()); |
| 172 | |||
| 173 | // To match other equipment objects, the Number of Units field was dropped. Users can just use multiplier for both Watts/Area and Watts/Unit definitions | ||
| 174 | // this is to get rid of the warning message for leaving the Number of Units field blank. | ||
| 175 |
1/1✓ Branch 1 taken 26 times.
|
26 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::NumberofUnits, 1.0); |
| 176 | |||
| 177 |
1/1✓ Branch 1 taken 26 times.
|
26 | const double multiplier = modelObject.multiplier(); |
| 178 | |||
| 179 |
1/1✓ Branch 1 taken 26 times.
|
26 | OptionalDouble d = definition.designLevel(); |
| 180 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 6 times.
|
26 | if (d) { |
| 181 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::WattsperUnit, (*d) * multiplier); |
| 182 | } | ||
| 183 | |||
| 184 |
1/1✓ Branch 1 taken 26 times.
|
26 | d = definition.wattsperSpaceFloorArea(); |
| 185 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 20 times.
|
26 | if (d) { |
| 186 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::WattsperFloorArea, (*d) * multiplier); |
| 187 | } | ||
| 188 | |||
| 189 |
1/1✓ Branch 1 taken 26 times.
|
26 | boost::optional<Schedule> designPowerInputSchedule = modelObject.designPowerInputSchedule(); |
| 190 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
26 | if (designPowerInputSchedule) { |
| 191 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::DesignPowerInputScheduleName, designPowerInputSchedule->name().get()); | |
| 192 | } | ||
| 193 | |||
| 194 |
1/1✓ Branch 1 taken 26 times.
|
26 | boost::optional<Schedule> cPULoadingSchedule = modelObject.cPULoadingSchedule(); |
| 195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
26 | if (cPULoadingSchedule) { |
| 196 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::CPULoadingScheduleName, cPULoadingSchedule->name().get()); | |
| 197 | } | ||
| 198 | |||
| 199 | 26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::CPUPowerInputFunctionofLoadingandAirTemperatureCurveName, | |
| 200 |
4/4✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
|
26 | definition.cPUPowerInputFunctionofLoadingandAirTemperatureCurve().name().get()); |
| 201 | |||
| 202 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::DesignFanPowerInputFraction, definition.designFanPowerInputFraction()); |
| 203 | |||
| 204 |
1/1✓ Branch 1 taken 26 times.
|
26 | d = definition.designFanAirFlowRateperPowerInput(); |
| 205 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
26 | if (d) { |
| 206 | ✗ | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::DesignFanAirFlowRateperPowerInput, *d); | |
| 207 | } | ||
| 208 | |||
| 209 | 26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::AirFlowFunctionofLoadingandAirTemperatureCurveName, | |
| 210 |
4/4✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
|
26 | definition.airFlowFunctionofLoadingandAirTemperatureCurve().name().get()); |
| 211 | |||
| 212 | 26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::FanPowerInputFunctionofFlowCurveName, | |
| 213 |
4/4✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
|
26 | definition.fanPowerInputFunctionofFlowCurve().name().get()); |
| 214 | |||
| 215 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::DesignEnteringAirTemperature, definition.designEnteringAirTemperature()); |
| 216 | |||
| 217 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::EnvironmentalClass, definition.environmentalClass()); |
| 218 | |||
| 219 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::AirInletConnectionType, definition.airInletConnectionType()); |
| 220 | |||
| 221 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::DesignRecirculationFraction, definition.designRecirculationFraction()); |
| 222 | |||
| 223 | boost::optional<Curve> recirculationFunctionofLoadingandSupplyTemperatureCurve = | ||
| 224 |
1/1✓ Branch 1 taken 26 times.
|
26 | definition.recirculationFunctionofLoadingandSupplyTemperatureCurve(); |
| 225 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
26 | if (recirculationFunctionofLoadingandSupplyTemperatureCurve) { |
| 226 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::RecirculationFunctionofLoadingandSupplyTemperatureCurveName, | |
| 227 | ✗ | recirculationFunctionofLoadingandSupplyTemperatureCurve->name().get()); | |
| 228 | } | ||
| 229 | |||
| 230 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::DesignElectricPowerSupplyEfficiency, definition.designElectricPowerSupplyEfficiency()); |
| 231 | |||
| 232 | boost::optional<Curve> electricPowerSupplyEfficiencyFunctionofPartLoadRatioCurve = | ||
| 233 |
1/1✓ Branch 1 taken 26 times.
|
26 | definition.electricPowerSupplyEfficiencyFunctionofPartLoadRatioCurve(); |
| 234 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
26 | if (electricPowerSupplyEfficiencyFunctionofPartLoadRatioCurve) { |
| 235 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::ElectricPowerSupplyEfficiencyFunctionofPartLoadRatioCurveName, | |
| 236 | ✗ | electricPowerSupplyEfficiencyFunctionofPartLoadRatioCurve->name().get()); | |
| 237 | } | ||
| 238 | |||
| 239 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::FractionofElectricPowerSupplyLossestoZone, |
| 240 | definition.fractionofElectricPowerSupplyLossestoZone()); | ||
| 241 | |||
| 242 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | OptionalString s = modelObject.cPUEndUseSubcategory(); |
| 243 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if (s) { |
| 244 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::CPUEndUseSubcategory, modelObject.cPUEndUseSubcategory()); |
| 245 | } | ||
| 246 | |||
| 247 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | s = modelObject.fanEndUseSubcategory(); |
| 248 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if (s) { |
| 249 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::FanEndUseSubcategory, modelObject.fanEndUseSubcategory()); |
| 250 | } | ||
| 251 | |||
| 252 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | s = modelObject.electricPowerSupplyEndUseSubcategory(); |
| 253 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if (s) { |
| 254 |
1/1✓ Branch 1 taken 26 times.
|
26 | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::ElectricPowerSupplyEndUseSubcategory, |
| 255 |
1/1✓ Branch 1 taken 26 times.
|
52 | modelObject.electricPowerSupplyEndUseSubcategory()); |
| 256 | } | ||
| 257 | |||
| 258 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::SupplyTemperatureDifference, definition.supplyTemperatureDifference()); |
| 259 | |||
| 260 |
1/1✓ Branch 1 taken 26 times.
|
26 | boost::optional<Schedule> supplyTemperatureDifferenceSchedule = definition.supplyTemperatureDifferenceSchedule(); |
| 261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
26 | if (supplyTemperatureDifferenceSchedule) { |
| 262 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::SupplyTemperatureDifferenceSchedule, | |
| 263 | ✗ | supplyTemperatureDifferenceSchedule->name().get()); | |
| 264 | } | ||
| 265 | |||
| 266 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | idfObject.setDouble(ElectricEquipment_ITE_AirCooledFields::ReturnTemperatureDifference, definition.returnTemperatureDifference()); |
| 267 | |||
| 268 |
1/1✓ Branch 1 taken 26 times.
|
26 | boost::optional<Schedule> returnTemperatureDifferenceSchedule = definition.returnTemperatureDifferenceSchedule(); |
| 269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
26 | if (returnTemperatureDifferenceSchedule) { |
| 270 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooledFields::ReturnTemperatureDifferenceSchedule, | |
| 271 | ✗ | returnTemperatureDifferenceSchedule->name().get()); | |
| 272 | } | ||
| 273 | |||
| 274 |
1/1✓ Branch 1 taken 26 times.
|
26 | return idfObject; |
| 275 | 32 | } | |
| 276 | |||
| 277 | 1 | boost::optional<IdfObject> ForwardTranslator::translateElectricEquipmentITEAirCooledInstance(ElectricEquipmentITEAirCooled& modelObject) { | |
| 278 | |||
| 279 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<Space> space_ = modelObject.space(); |
| 280 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!space_) { |
| 281 | // This shouldn't happen | ||
| 282 | ✗ | LOG(Warn, modelObject.briefDescription() << " not assigned to a valid space."); | |
| 283 | ✗ | return boost::none; | |
| 284 | } | ||
| 285 | |||
| 286 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto space = space_.get(); |
| 287 | |||
| 288 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<ThermalZone> thermalZone_ = space.thermalZone(); |
| 289 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!thermalZone_) { |
| 290 | // This shouldn't happen | ||
| 291 | ✗ | LOG(Warn, modelObject.briefDescription() << " not assigned to a valid thermal Zone."); | |
| 292 | ✗ | return boost::none; | |
| 293 | } | ||
| 294 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto thermalZone = thermalZone_.get(); |
| 295 | |||
| 296 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(openstudio::IddObjectType::ElectricEquipment_ITE_AirCooled_Instance); |
| 297 | |||
| 298 |
2/4✓ Branch 1 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
|
1 | for (LifeCycleCost lifeCycleCost : modelObject.lifeCycleCosts()) { |
| 299 | ✗ | translateAndMapModelObject(lifeCycleCost); | |
| 300 | 1 | } | |
| 301 | |||
| 302 |
1/1✓ Branch 1 taken 1 time.
|
1 | ElectricEquipmentITEAirCooledDefinition definition = modelObject.electricEquipmentITEAirCooledDefinition(); |
| 303 | |||
| 304 | // Assign object to Zone/Space | ||
| 305 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject parentIdfObject = getSpaceLoadParent(modelObject, false); // We do not allow spaceType! |
| 306 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::ZoneorSpaceName, parentIdfObject.nameString()); |
| 307 | |||
| 308 | // attach the supply air node to zone if there is an available supply air node | ||
| 309 | // search airloop first | ||
| 310 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 time.
|
2 | if (auto mo = thermalZone.inletPortList().airLoopHVACModelObject()) { |
| 311 | ✗ | if (auto node = mo->optionalCast<Node>()) { | |
| 312 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::SupplyAirNodeName, node->name().get()); | |
| 313 | ✗ | } | |
| 314 | } else { | ||
| 315 | // if no airloop, just get a supply node of the thermal zone (could be zoneHVAC) | ||
| 316 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 time.
|
1 | if (!thermalZone.inletPortList().modelObjects().empty()) { |
| 317 | ✗ | std::vector<ModelObject> objects = thermalZone.inletPortList().modelObjects(); | |
| 318 | ✗ | for (const auto& elem : objects) { | |
| 319 | ✗ | if (auto node = elem.optionalCast<Node>()) { | |
| 320 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::SupplyAirNodeName, node->name().get()); | |
| 321 | ✗ | } | |
| 322 | } | ||
| 323 | ✗ | } | |
| 324 | 1 | } | |
| 325 | |||
| 326 | // apply constraint #1: For multiple ITE objects defined for one zone, the same calculation method should apply. | ||
| 327 | // Note: since the Definition is now shared/deduped across Instances, only the first Instance translated for a | ||
| 328 | // given Definition can effectively drive this correction on the shared ElectricEquipment:ITE:AirCooled:Definition. | ||
| 329 | 1 | std::set<std::string> methods; | |
| 330 | |||
| 331 | 1 | auto caseInsensitiveMethodForITE = [](const ElectricEquipmentITEAirCooled& ite) { | |
| 332 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
|
1 | return openstudio::ascii_to_lower_copy(ite.electricEquipmentITEAirCooledDefinition().airFlowCalculationMethod()); |
| 333 | }; | ||
| 334 | |||
| 335 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (m_forwardTranslatorOptions.excludeSpaceTranslation()) { |
| 336 | // One Zone = One Space at this point | ||
| 337 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto ites = space.electricEquipmentITEAirCooled(); |
| 338 |
2/2✓ Branch 2 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::transform(ites.begin(), ites.end(), std::inserter(methods, methods.begin()), caseInsensitiveMethodForITE); |
| 339 | 1 | } else { | |
| 340 | // Does this constraint apply per Space? Per the I/O ref I think it applies for the entire zone. | ||
| 341 | // I/O 9.6.0: "For multiple ITE objects defined for one zone, the same calculation method should apply." | ||
| 342 | ✗ | for (const auto& s : thermalZone.spaces()) { | |
| 343 | ✗ | auto ites = s.electricEquipmentITEAirCooled(); | |
| 344 | ✗ | std::transform(ites.begin(), ites.end(), std::inserter(methods, methods.begin()), caseInsensitiveMethodForITE); | |
| 345 | ✗ | } | |
| 346 | } | ||
| 347 | |||
| 348 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::string thisMethod = definition.airFlowCalculationMethod(); |
| 349 |
4/16✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 time.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
|
1 | if ((methods.size() > 1) && !openstudio::istringEqual(thisMethod, "FlowControlWithApproachTemperatures")) { |
| 350 | ✗ | definition.setAirFlowCalculationMethod("FlowControlWithApproachTemperatures"); | |
| 351 | ✗ | thisMethod = "FlowControlWithApproachTemperatures"; | |
| 352 | ✗ | LOG(Warn, parentIdfObject.briefDescription() << " has multiple IT equipment with different air flow calculation methods, " | |
| 353 | << modelObject.briefDescription() << " is re-assigned to 'FlowControlWithApproachTemperatures'"); | ||
| 354 | } | ||
| 355 | |||
| 356 | // Constraint #2:The FlowControlWithApproachTemperatures only applies to ITE zones with single duct VAV terminal unit. | ||
| 357 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
|
2 | if (istringEqual(thisMethod, "FlowControlWithApproachTemperatures")) { |
| 358 | ✗ | auto terminal = thermalZone.airLoopHVACTerminal(); | |
| 359 | bool isTerminalOk = | ||
| 360 | ✗ | (terminal && (terminal->optionalCast<AirTerminalSingleDuctVAVReheat>() || terminal->optionalCast<AirTerminalSingleDuctVAVNoReheat>())); | |
| 361 | |||
| 362 | ✗ | if (!isTerminalOk) { | |
| 363 | ✗ | LOG( | |
| 364 | Error, | ||
| 365 | modelObject.briefDescription() << " will not be translated. " | ||
| 366 | " The FlowControlWithApproachTemperatures only applies to ITE zones with single duct VAV terminal unit."); | ||
| 367 | ✗ | return boost::none; | |
| 368 | } | ||
| 369 | ✗ | } | |
| 370 | |||
| 371 | // After pre-checking gets through, add the object to the translation list | ||
| 372 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 373 | |||
| 374 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setName(modelObject.nameString()); |
| 375 | |||
| 376 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto definitionIdfObject_ = translateAndMapModelObject(definition); |
| 377 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(definitionIdfObject_); |
| 378 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::ElectricEquipmentITEAirCooledDefinitionName, |
| 379 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | definitionIdfObject_->nameString()); |
| 380 | |||
| 381 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(ElectricEquipment_ITE_AirCooled_InstanceFields::Multiplier, modelObject.multiplier()); |
| 382 | |||
| 383 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<Schedule> designPowerInputSchedule = modelObject.designPowerInputSchedule(); |
| 384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (designPowerInputSchedule) { |
| 385 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::DesignPowerInputScheduleName, designPowerInputSchedule->name().get()); | |
| 386 | } | ||
| 387 | |||
| 388 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<Schedule> cPULoadingSchedule = modelObject.cPULoadingSchedule(); |
| 389 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (cPULoadingSchedule) { |
| 390 | ✗ | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::CPULoadingScheduleName, cPULoadingSchedule->name().get()); | |
| 391 | } | ||
| 392 | |||
| 393 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | OptionalString s = modelObject.cPUEndUseSubcategory(); |
| 394 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 395 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::CPUEndUseSubcategory, modelObject.cPUEndUseSubcategory()); |
| 396 | } | ||
| 397 | |||
| 398 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | s = modelObject.fanEndUseSubcategory(); |
| 399 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 400 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::FanEndUseSubcategory, modelObject.fanEndUseSubcategory()); |
| 401 | } | ||
| 402 | |||
| 403 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | s = modelObject.electricPowerSupplyEndUseSubcategory(); |
| 404 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 405 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(ElectricEquipment_ITE_AirCooled_InstanceFields::ElectricPowerSupplyEndUseSubcategory, |
| 406 |
1/1✓ Branch 1 taken 1 time.
|
2 | modelObject.electricPowerSupplyEndUseSubcategory()); |
| 407 | } | ||
| 408 | |||
| 409 |
1/1✓ Branch 1 taken 1 time.
|
1 | return idfObject; |
| 410 | 1 | } | |
| 411 | |||
| 412 | } // namespace energyplus | ||
| 413 | |||
| 414 | } // namespace openstudio | ||
| 415 |