src/energyplus/ReverseTranslator/ReverseTranslateFanComponentModel.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 "../ReverseTranslator.hpp" | ||
| 7 | |||
| 8 | #include "../../model/FanComponentModel.hpp" | ||
| 9 | |||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | |||
| 13 | #include "../../model/Schedule.hpp" | ||
| 14 | #include "../../model/Schedule_Impl.hpp" | ||
| 15 | |||
| 16 | #include "../../model/Curve.hpp" | ||
| 17 | #include "../../model/Curve_Impl.hpp" | ||
| 18 | |||
| 19 | #include <utilities/idd/Fan_ComponentModel_FieldEnums.hxx> | ||
| 20 | #include <utilities/idd/IddEnums.hxx> | ||
| 21 | |||
| 22 | using namespace openstudio::model; | ||
| 23 | |||
| 24 | namespace openstudio { | ||
| 25 | |||
| 26 | namespace energyplus { | ||
| 27 | |||
| 28 | 2 | boost::optional<ModelObject> ReverseTranslator::translateFanComponentModel(const WorkspaceObject& workspaceObject) { | |
| 29 | 2 | boost::optional<ModelObject> result; | |
| 30 | 2 | boost::optional<WorkspaceObject> _wo; | |
| 31 | 2 | boost::optional<ModelObject> _mo; | |
| 32 | |||
| 33 | // Instantiate an object of the class to store the values, | ||
| 34 | // but we don't return it until we know it's ok | ||
| 35 | // TODO: check constructor, it might need other objects | ||
| 36 |
1/1✓ Branch 1 taken 2 times.
|
2 | openstudio::model::FanComponentModel modelObject(m_model); |
| 37 | |||
| 38 | // TODO: Note JM 2018-10-17 | ||
| 39 | // You are responsible for implementing any additional logic based on choice fields, etc. | ||
| 40 | // The ReverseTranslator generator script is meant to facilitate your work, not get you 100% of the way | ||
| 41 | |||
| 42 | // Name | ||
| 43 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<std::string> _name = workspaceObject.name()) { |
| 44 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setName(_name.get()); |
| 45 | 2 | } | |
| 46 | |||
| 47 | // Air Inlet Node Name: Required Node | ||
| 48 | |||
| 49 | // Air Outlet Node Name: Required Node | ||
| 50 | |||
| 51 | // Availability Schedule Name: Optional Object | ||
| 52 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::AvailabilityScheduleName))) { |
| 53 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 54 | // TODO: check return types | ||
| 55 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Schedule> _availabilitySchedule = _mo->optionalCast<Schedule>()) { |
| 56 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setAvailabilitySchedule(_availabilitySchedule.get()); |
| 57 | } else { | ||
| 58 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Availability Schedule Name'"); | |
| 59 | 2 | } | |
| 60 | } | ||
| 61 | } | ||
| 62 | // Maximum Flow Rate: Optional Double | ||
| 63 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _maximumFlowRate = workspaceObject.getDouble(Fan_ComponentModelFields::MaximumFlowRate)) { |
| 64 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMaximumFlowRate(_maximumFlowRate.get()); |
| 65 | } else { | ||
| 66 | ✗ | modelObject.autosizeMaximumFlowRate(); | |
| 67 | } | ||
| 68 | |||
| 69 | // Minimum Flow Rate: Optional Double | ||
| 70 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _minimumFlowRate = workspaceObject.getDouble(Fan_ComponentModelFields::MinimumFlowRate)) { |
| 71 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMinimumFlowRate(_minimumFlowRate.get()); |
| 72 | } else { | ||
| 73 | ✗ | modelObject.autosizeMinimumFlowRate(); | |
| 74 | } | ||
| 75 | |||
| 76 | // Fan Sizing Factor: Optional Double | ||
| 77 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _fanSizingFactor = workspaceObject.getDouble(Fan_ComponentModelFields::FanSizingFactor)) { |
| 78 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setFanSizingFactor(_fanSizingFactor.get()); |
| 79 | } | ||
| 80 | |||
| 81 | // Fan Wheel Diameter: Required Double | ||
| 82 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _fanWheelDiameter = workspaceObject.getDouble(Fan_ComponentModelFields::FanWheelDiameter)) { |
| 83 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setFanWheelDiameter(_fanWheelDiameter.get()); |
| 84 | } else { | ||
| 85 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Fan Wheel Diameter'"); | |
| 86 | ✗ | return result; | |
| 87 | } | ||
| 88 | |||
| 89 | // Fan Outlet Area: Required Double | ||
| 90 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _fanOutletArea = workspaceObject.getDouble(Fan_ComponentModelFields::FanOutletArea)) { |
| 91 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setFanOutletArea(_fanOutletArea.get()); |
| 92 | } else { | ||
| 93 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Fan Outlet Area'"); | |
| 94 | ✗ | return result; | |
| 95 | } | ||
| 96 | |||
| 97 | // Maximum Fan Static Efficiency: Required Double | ||
| 98 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _maximumFanStaticEfficiency = workspaceObject.getDouble(Fan_ComponentModelFields::MaximumFanStaticEfficiency)) { |
| 99 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMaximumFanStaticEfficiency(_maximumFanStaticEfficiency.get()); |
| 100 | } else { | ||
| 101 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Fan Static Efficiency'"); | |
| 102 | ✗ | return result; | |
| 103 | } | ||
| 104 | |||
| 105 | // Euler Number at Maximum Fan Static Efficiency: Required Double | ||
| 106 | 2 | if (boost::optional<double> _eulerNumberatMaximumFanStaticEfficiency = | |
| 107 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | workspaceObject.getDouble(Fan_ComponentModelFields::EulerNumberatMaximumFanStaticEfficiency)) { |
| 108 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setEulerNumberatMaximumFanStaticEfficiency(_eulerNumberatMaximumFanStaticEfficiency.get()); |
| 109 | } else { | ||
| 110 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Euler Number at Maximum Fan Static Efficiency'"); | |
| 111 | ✗ | return result; | |
| 112 | } | ||
| 113 | |||
| 114 | // Maximum Dimensionless Fan Airflow: Required Double | ||
| 115 | 2 | if (boost::optional<double> _maximumDimensionlessFanAirflow = | |
| 116 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | workspaceObject.getDouble(Fan_ComponentModelFields::MaximumDimensionlessFanAirflow)) { |
| 117 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMaximumDimensionlessFanAirflow(_maximumDimensionlessFanAirflow.get()); |
| 118 | } else { | ||
| 119 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Dimensionless Fan Airflow'"); | |
| 120 | ✗ | return result; | |
| 121 | } | ||
| 122 | |||
| 123 | // Motor Fan Pulley Ratio: Autosizable | ||
| 124 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _motorFanPulleyRatio = workspaceObject.getDouble(Fan_ComponentModelFields::MotorFanPulleyRatio)) { |
| 125 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMotorFanPulleyRatio(_motorFanPulleyRatio.get()); |
| 126 | } else { | ||
| 127 | ✗ | modelObject.autosizeMotorFanPulleyRatio(); | |
| 128 | } | ||
| 129 | |||
| 130 | // Belt Maximum Torque: Autosizable | ||
| 131 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _beltMaximumTorque = workspaceObject.getDouble(Fan_ComponentModelFields::BeltMaximumTorque)) { |
| 132 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setBeltMaximumTorque(_beltMaximumTorque.get()); |
| 133 | } else { | ||
| 134 | ✗ | modelObject.autosizeBeltMaximumTorque(); | |
| 135 | } | ||
| 136 | |||
| 137 | // Belt Sizing Factor: Optional Double | ||
| 138 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _beltSizingFactor = workspaceObject.getDouble(Fan_ComponentModelFields::BeltSizingFactor)) { |
| 139 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setBeltSizingFactor(_beltSizingFactor.get()); |
| 140 | } | ||
| 141 | |||
| 142 | // Belt Fractional Torque Transition: Optional Double | ||
| 143 | 2 | if (boost::optional<double> _beltFractionalTorqueTransition = | |
| 144 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | workspaceObject.getDouble(Fan_ComponentModelFields::BeltFractionalTorqueTransition)) { |
| 145 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setBeltFractionalTorqueTransition(_beltFractionalTorqueTransition.get()); |
| 146 | } | ||
| 147 | |||
| 148 | // Motor Maximum Speed: Required Double | ||
| 149 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _motorMaximumSpeed = workspaceObject.getDouble(Fan_ComponentModelFields::MotorMaximumSpeed)) { |
| 150 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMotorMaximumSpeed(_motorMaximumSpeed.get()); |
| 151 | } else { | ||
| 152 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Motor Maximum Speed'"); | |
| 153 | ✗ | return result; | |
| 154 | } | ||
| 155 | |||
| 156 | // Maximum Motor Output Power: Autosizable | ||
| 157 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _maximumMotorOutputPower = workspaceObject.getDouble(Fan_ComponentModelFields::MaximumMotorOutputPower)) { |
| 158 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMaximumMotorOutputPower(_maximumMotorOutputPower.get()); |
| 159 | } else { | ||
| 160 | ✗ | modelObject.autosizeMaximumMotorOutputPower(); | |
| 161 | } | ||
| 162 | |||
| 163 | // Motor Sizing Factor: Optional Double | ||
| 164 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _motorSizingFactor = workspaceObject.getDouble(Fan_ComponentModelFields::MotorSizingFactor)) { |
| 165 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMotorSizingFactor(_motorSizingFactor.get()); |
| 166 | } | ||
| 167 | |||
| 168 | // Motor In Airstream Fraction: Optional Double | ||
| 169 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _motorInAirstreamFraction = workspaceObject.getDouble(Fan_ComponentModelFields::MotorInAirstreamFraction)) { |
| 170 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMotorInAirstreamFraction(_motorInAirstreamFraction.get()); |
| 171 | } | ||
| 172 | |||
| 173 | // VFD Efficiency Type: Optional String | ||
| 174 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<std::string> _vFDEfficiencyType = workspaceObject.getString(Fan_ComponentModelFields::VFDEfficiencyType)) { |
| 175 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setVFDEfficiencyType(_vFDEfficiencyType.get()); |
| 176 | 2 | } | |
| 177 | |||
| 178 | // Maximum VFD Output Power: Autosizable | ||
| 179 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _maximumVFDOutputPower = workspaceObject.getDouble(Fan_ComponentModelFields::MaximumVFDOutputPower)) { |
| 180 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMaximumVFDOutputPower(_maximumVFDOutputPower.get()); |
| 181 | } else { | ||
| 182 | ✗ | modelObject.autosizeMaximumVFDOutputPower(); | |
| 183 | } | ||
| 184 | |||
| 185 | // VFD Sizing Factor: Optional Double | ||
| 186 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<double> _vFDSizingFactor = workspaceObject.getDouble(Fan_ComponentModelFields::VFDSizingFactor)) { |
| 187 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setVFDSizingFactor(_vFDSizingFactor.get()); |
| 188 | } | ||
| 189 | |||
| 190 | // Fan Pressure Rise Curve Name: Required Object | ||
| 191 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::FanPressureRiseCurveName))) { |
| 192 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 193 | // TODO: check return types | ||
| 194 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _fanPressureRiseCurve = _mo->optionalCast<Curve>()) { |
| 195 | // TODO: Should probably catch the case where the setter fails (wrong curve type...) | ||
| 196 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setFanPressureRiseCurve(_fanPressureRiseCurve.get()); |
| 197 | } else { | ||
| 198 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Fan Pressure Rise Curve Name'"); | |
| 199 | 2 | } | |
| 200 | } else { | ||
| 201 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot reverse translate required object 'Fan Pressure Rise Curve Name'"); | |
| 202 | ✗ | return result; | |
| 203 | } | ||
| 204 | } else { | ||
| 205 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required object 'Fan Pressure Rise Curve Name'"); | |
| 206 | ✗ | return result; | |
| 207 | } | ||
| 208 | // Duct Static Pressure Reset Curve Name: Required Object | ||
| 209 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::DuctStaticPressureResetCurveName))) { |
| 210 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 211 | // TODO: check return types | ||
| 212 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _ductStaticPressureResetCurve = _mo->optionalCast<Curve>()) { |
| 213 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setDuctStaticPressureResetCurve(_ductStaticPressureResetCurve.get()); |
| 214 | } else { | ||
| 215 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Duct Static Pressure Reset Curve Name'"); | |
| 216 | 2 | } | |
| 217 | } else { | ||
| 218 | ✗ | LOG(Error, | |
| 219 | "For " << workspaceObject.briefDescription() << ", cannot reverse translate required object 'Duct Static Pressure Reset Curve Name'"); | ||
| 220 | ✗ | return result; | |
| 221 | } | ||
| 222 | } else { | ||
| 223 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required object 'Duct Static Pressure Reset Curve Name'"); | |
| 224 | ✗ | return result; | |
| 225 | } | ||
| 226 | // Normalized Fan Static Efficiency Curve Name-Non-Stall Region: Required Object | ||
| 227 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::NormalizedFanStaticEfficiencyCurveNameNonStallRegion))) { |
| 228 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 229 | // TODO: check return types | ||
| 230 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _normalizedFanStaticEfficiencyCurveNonStallRegion = _mo->optionalCast<Curve>()) { |
| 231 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setNormalizedFanStaticEfficiencyCurveNonStallRegion(_normalizedFanStaticEfficiencyCurveNonStallRegion.get()); |
| 232 | } else { | ||
| 233 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Normalized Fan Static Efficiency Curve Name-Non-Stall Region'"); | |
| 234 | 2 | } | |
| 235 | } else { | ||
| 236 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() | |
| 237 | << ", cannot reverse translate required object 'Normalized Fan Static Efficiency Curve Name-Non-Stall Region'"); | ||
| 238 | ✗ | return result; | |
| 239 | } | ||
| 240 | } else { | ||
| 241 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() | |
| 242 | << ", cannot find required object 'Normalized Fan Static Efficiency Curve Name-Non-Stall Region'"); | ||
| 243 | ✗ | return result; | |
| 244 | } | ||
| 245 | // Normalized Fan Static Efficiency Curve Name-Stall Region: Required Object | ||
| 246 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::NormalizedFanStaticEfficiencyCurveNameStallRegion))) { |
| 247 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 248 | // TODO: check return types | ||
| 249 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _normalizedFanStaticEfficiencyCurveStallRegion = _mo->optionalCast<Curve>()) { |
| 250 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setNormalizedFanStaticEfficiencyCurveStallRegion(_normalizedFanStaticEfficiencyCurveStallRegion.get()); |
| 251 | } else { | ||
| 252 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Normalized Fan Static Efficiency Curve Name-Stall Region'"); | |
| 253 | 2 | } | |
| 254 | } else { | ||
| 255 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() | |
| 256 | << ", cannot reverse translate required object 'Normalized Fan Static Efficiency Curve Name-Stall Region'"); | ||
| 257 | ✗ | return result; | |
| 258 | } | ||
| 259 | } else { | ||
| 260 | ✗ | LOG(Error, | |
| 261 | "For " << workspaceObject.briefDescription() << ", cannot find required object 'Normalized Fan Static Efficiency Curve Name-Stall Region'"); | ||
| 262 | ✗ | return result; | |
| 263 | } | ||
| 264 | // Normalized Dimensionless Airflow Curve Name-Non-Stall Region: Required Object | ||
| 265 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::NormalizedDimensionlessAirflowCurveNameNonStallRegion))) { |
| 266 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 267 | // TODO: check return types | ||
| 268 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _normalizedDimensionlessAirflowCurveNonStallRegion = _mo->optionalCast<Curve>()) { |
| 269 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setNormalizedDimensionlessAirflowCurveNonStallRegion(_normalizedDimensionlessAirflowCurveNonStallRegion.get()); |
| 270 | } else { | ||
| 271 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Normalized Dimensionless Airflow Curve Name-Non-Stall Region'"); | |
| 272 | 2 | } | |
| 273 | } else { | ||
| 274 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() | |
| 275 | << ", cannot reverse translate required object 'Normalized Dimensionless Airflow Curve Name-Non-Stall Region'"); | ||
| 276 | ✗ | return result; | |
| 277 | } | ||
| 278 | } else { | ||
| 279 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() | |
| 280 | << ", cannot find required object 'Normalized Dimensionless Airflow Curve Name-Non-Stall Region'"); | ||
| 281 | ✗ | return result; | |
| 282 | } | ||
| 283 | // Normalized Dimensionless Airflow Curve Name-Stall Region: Required Object | ||
| 284 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::NormalizedDimensionlessAirflowCurveNameStallRegion))) { |
| 285 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 286 | // TODO: check return types | ||
| 287 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _normalizedDimensionlessAirflowCurveStallRegion = _mo->optionalCast<Curve>()) { |
| 288 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setNormalizedDimensionlessAirflowCurveStallRegion(_normalizedDimensionlessAirflowCurveStallRegion.get()); |
| 289 | } else { | ||
| 290 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Normalized Dimensionless Airflow Curve Name-Stall Region'"); | |
| 291 | 2 | } | |
| 292 | } else { | ||
| 293 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() | |
| 294 | << ", cannot reverse translate required object 'Normalized Dimensionless Airflow Curve Name-Stall Region'"); | ||
| 295 | ✗ | return result; | |
| 296 | } | ||
| 297 | } else { | ||
| 298 | ✗ | LOG(Error, | |
| 299 | "For " << workspaceObject.briefDescription() << ", cannot find required object 'Normalized Dimensionless Airflow Curve Name-Stall Region'"); | ||
| 300 | ✗ | return result; | |
| 301 | } | ||
| 302 | // Maximum Belt Efficiency Curve Name: Optional Object | ||
| 303 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::MaximumBeltEfficiencyCurveName))) { |
| 304 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 305 | // TODO: check return types | ||
| 306 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _maximumBeltEfficiencyCurve = _mo->optionalCast<Curve>()) { |
| 307 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMaximumBeltEfficiencyCurve(_maximumBeltEfficiencyCurve.get()); |
| 308 | } else { | ||
| 309 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Maximum Belt Efficiency Curve Name'"); | |
| 310 | 2 | } | |
| 311 | } | ||
| 312 | } | ||
| 313 | // Normalized Belt Efficiency Curve Name - Region 1: Optional Object | ||
| 314 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::NormalizedBeltEfficiencyCurveNameRegion1))) { |
| 315 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 316 | // TODO: check return types | ||
| 317 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _normalizedBeltEfficiencyCurveRegion1 = _mo->optionalCast<Curve>()) { |
| 318 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setNormalizedBeltEfficiencyCurveRegion1(_normalizedBeltEfficiencyCurveRegion1.get()); |
| 319 | } else { | ||
| 320 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Normalized Belt Efficiency Curve Name - Region 1'"); | |
| 321 | 2 | } | |
| 322 | } | ||
| 323 | } | ||
| 324 | // Normalized Belt Efficiency Curve Name - Region 2: Optional Object | ||
| 325 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::NormalizedBeltEfficiencyCurveNameRegion2))) { |
| 326 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 327 | // TODO: check return types | ||
| 328 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _normalizedBeltEfficiencyCurveRegion2 = _mo->optionalCast<Curve>()) { |
| 329 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setNormalizedBeltEfficiencyCurveRegion2(_normalizedBeltEfficiencyCurveRegion2.get()); |
| 330 | } else { | ||
| 331 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Normalized Belt Efficiency Curve Name - Region 2'"); | |
| 332 | 2 | } | |
| 333 | } | ||
| 334 | } | ||
| 335 | // Normalized Belt Efficiency Curve Name - Region 3: Optional Object | ||
| 336 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::NormalizedBeltEfficiencyCurveNameRegion3))) { |
| 337 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 338 | // TODO: check return types | ||
| 339 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _normalizedBeltEfficiencyCurveRegion3 = _mo->optionalCast<Curve>()) { |
| 340 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setNormalizedBeltEfficiencyCurveRegion3(_normalizedBeltEfficiencyCurveRegion3.get()); |
| 341 | } else { | ||
| 342 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Normalized Belt Efficiency Curve Name - Region 3'"); | |
| 343 | 2 | } | |
| 344 | } | ||
| 345 | } | ||
| 346 | // Maximum Motor Efficiency Curve Name: Optional Object | ||
| 347 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::MaximumMotorEfficiencyCurveName))) { |
| 348 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 349 | // TODO: check return types | ||
| 350 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _maximumMotorEfficiencyCurve = _mo->optionalCast<Curve>()) { |
| 351 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setMaximumMotorEfficiencyCurve(_maximumMotorEfficiencyCurve.get()); |
| 352 | } else { | ||
| 353 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Maximum Motor Efficiency Curve Name'"); | |
| 354 | 2 | } | |
| 355 | } | ||
| 356 | } | ||
| 357 | // Normalized Motor Efficiency Curve Name: Optional Object | ||
| 358 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::NormalizedMotorEfficiencyCurveName))) { |
| 359 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 360 | // TODO: check return types | ||
| 361 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _normalizedMotorEfficiencyCurve = _mo->optionalCast<Curve>()) { |
| 362 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setNormalizedMotorEfficiencyCurve(_normalizedMotorEfficiencyCurve.get()); |
| 363 | } else { | ||
| 364 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Normalized Motor Efficiency Curve Name'"); | |
| 365 | 2 | } | |
| 366 | } | ||
| 367 | } | ||
| 368 | // VFD Efficiency Curve Name: Optional Object | ||
| 369 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((_wo = workspaceObject.getTarget(Fan_ComponentModelFields::VFDEfficiencyCurveName))) { |
| 370 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if ((_mo = translateAndMapWorkspaceObject(_wo.get()))) { |
| 371 | // TODO: check return types | ||
| 372 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Curve> _vFDEfficiencyCurve = _mo->optionalCast<Curve>()) { |
| 373 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | modelObject.setVFDEfficiencyCurve(_vFDEfficiencyCurve.get()); |
| 374 | } else { | ||
| 375 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'VFD Efficiency Curve Name'"); | |
| 376 | 2 | } | |
| 377 | } | ||
| 378 | } | ||
| 379 | // End-Use Subcategory: Optional String | ||
| 380 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
|
4 | if (boost::optional<std::string> _endUseSubcategory = workspaceObject.getString(Fan_ComponentModelFields::EndUseSubcategory)) { |
| 381 | ✗ | modelObject.setEndUseSubcategory(_endUseSubcategory.get()); | |
| 382 | 2 | } | |
| 383 | |||
| 384 |
1/1✓ Branch 1 taken 2 times.
|
2 | result = modelObject; |
| 385 | 2 | return result; | |
| 386 | 2 | } // End of translate function | |
| 387 | |||
| 388 | } // end namespace energyplus | ||
| 389 | } // end namespace openstudio | ||
| 390 |