src/energyplus/ReverseTranslator/ReverseTranslateCoilCoolingDXCurveFitOperatingMode.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/CoilCoolingDXCurveFitOperatingMode.hpp" | ||
| 9 | #include "../../model/CoilCoolingDXCurveFitOperatingMode_Impl.hpp" | ||
| 10 | #include "../../model/CoilCoolingDXCurveFitSpeed.hpp" | ||
| 11 | #include "../../model/CoilCoolingDXCurveFitSpeed_Impl.hpp" | ||
| 12 | |||
| 13 | #include "../../utilities/idf/WorkspaceExtensibleGroup.hpp" | ||
| 14 | |||
| 15 | #include <utilities/idd/Coil_Cooling_DX_CurveFit_OperatingMode_FieldEnums.hxx> | ||
| 16 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 17 | #include <utilities/idd/IddEnums.hxx> | ||
| 18 | |||
| 19 | #include "../../utilities/core/Assert.hpp" | ||
| 20 | |||
| 21 | using namespace openstudio::model; | ||
| 22 | |||
| 23 | namespace openstudio { | ||
| 24 | |||
| 25 | namespace energyplus { | ||
| 26 | |||
| 27 | 2 | OptionalModelObject ReverseTranslator::translateCoilCoolingDXCurveFitOperatingMode(const WorkspaceObject& workspaceObject) { | |
| 28 |
4/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
|
2 | if (workspaceObject.iddObject().type() != IddObjectType::Coil_Cooling_DX_CurveFit_OperatingMode) { |
| 29 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: CoilCoolingDXCurveFitOperatingMode"); | |
| 30 | ✗ | return boost::none; | |
| 31 | } | ||
| 32 | |||
| 33 | 2 | OptionalString s; | |
| 34 | 2 | OptionalDouble d; | |
| 35 | 2 | OptionalInt i; | |
| 36 | 2 | OptionalWorkspaceObject target; | |
| 37 | |||
| 38 |
1/1✓ Branch 1 taken 2 times.
|
2 | openstudio::model::CoilCoolingDXCurveFitOperatingMode operatingMode(m_model); |
| 39 | |||
| 40 |
1/1✓ Branch 1 taken 2 times.
|
2 | s = workspaceObject.name(); |
| 41 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (s) { |
| 42 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | operatingMode.setName(*s); |
| 43 | } | ||
| 44 | |||
| 45 |
1/1✓ Branch 1 taken 2 times.
|
2 | d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_OperatingModeFields::RatedGrossTotalCoolingCapacity); |
| 46 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (d) { |
| 47 | ✗ | operatingMode.setRatedGrossTotalCoolingCapacity(*d); | |
| 48 | } else { | ||
| 49 |
1/1✓ Branch 1 taken 2 times.
|
2 | operatingMode.autosizeRatedGrossTotalCoolingCapacity(); |
| 50 | } | ||
| 51 | |||
| 52 |
1/1✓ Branch 1 taken 2 times.
|
2 | d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_OperatingModeFields::RatedEvaporatorAirFlowRate); |
| 53 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (d) { |
| 54 | ✗ | operatingMode.setRatedEvaporatorAirFlowRate(*d); | |
| 55 | } else { | ||
| 56 |
1/1✓ Branch 1 taken 2 times.
|
2 | operatingMode.autosizeRatedEvaporatorAirFlowRate(); |
| 57 | } | ||
| 58 | |||
| 59 |
1/1✓ Branch 1 taken 2 times.
|
2 | d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_OperatingModeFields::RatedCondenserAirFlowRate); |
| 60 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (d) { |
| 61 | ✗ | operatingMode.setRatedCondenserAirFlowRate(*d); | |
| 62 | } else { | ||
| 63 |
1/1✓ Branch 1 taken 2 times.
|
2 | operatingMode.autosizeRatedCondenserAirFlowRate(); |
| 64 | } | ||
| 65 | |||
| 66 |
1/1✓ Branch 1 taken 2 times.
|
2 | d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_OperatingModeFields::MaximumCyclingRate); |
| 67 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (d) { |
| 68 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | operatingMode.setMaximumCyclingRate(*d); |
| 69 | } | ||
| 70 | |||
| 71 |
1/1✓ Branch 1 taken 2 times.
|
2 | d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_OperatingModeFields::RatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity); |
| 72 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (d) { |
| 73 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | operatingMode.setRatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity(*d); |
| 74 | } | ||
| 75 | |||
| 76 |
1/1✓ Branch 1 taken 2 times.
|
2 | d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_OperatingModeFields::LatentCapacityTimeConstant); |
| 77 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (d) { |
| 78 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | operatingMode.setLatentCapacityTimeConstant(*d); |
| 79 | } | ||
| 80 | |||
| 81 |
1/1✓ Branch 1 taken 2 times.
|
2 | d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_OperatingModeFields::NominalTimeforCondensateRemovaltoBegin); |
| 82 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (d) { |
| 83 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | operatingMode.setNominalTimeforCondensateRemovaltoBegin(*d); |
| 84 | } | ||
| 85 | |||
| 86 |
1/1✓ Branch 1 taken 2 times.
|
2 | s = workspaceObject.getString(Coil_Cooling_DX_CurveFit_OperatingModeFields::ApplyPartLoadFractiontoSpeedsGreaterthan1); |
| 87 |
8/17✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✓ Branch 14 taken 2 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 2 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 2 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
8 | if (s && istringEqual(s.get(), "Yes")) { |
| 88 | ✗ | operatingMode.setApplyPartLoadFractiontoSpeedsGreaterthan1(true); | |
| 89 | } else { | ||
| 90 |
1/1✓ Branch 1 taken 2 times.
|
2 | operatingMode.setApplyPartLoadFractiontoSpeedsGreaterthan1(false); |
| 91 | } | ||
| 92 | |||
| 93 |
1/1✓ Branch 1 taken 2 times.
|
2 | s = workspaceObject.getString(Coil_Cooling_DX_CurveFit_OperatingModeFields::ApplyLatentDegradationtoSpeedsGreaterthan1); |
| 94 |
8/17✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✓ Branch 14 taken 2 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 2 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 2 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
8 | if (s && istringEqual(s.get(), "Yes")) { |
| 95 | ✗ | operatingMode.setApplyLatentDegradationtoSpeedsGreaterthan1(true); | |
| 96 | } else { | ||
| 97 |
1/1✓ Branch 1 taken 2 times.
|
2 | operatingMode.setApplyLatentDegradationtoSpeedsGreaterthan1(false); |
| 98 | } | ||
| 99 | |||
| 100 |
1/1✓ Branch 1 taken 2 times.
|
2 | s = workspaceObject.getString(Coil_Cooling_DX_CurveFit_OperatingModeFields::CondenserType); |
| 101 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (s) { |
| 102 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | operatingMode.setCondenserType(*s); |
| 103 | } | ||
| 104 | |||
| 105 |
1/1✓ Branch 1 taken 2 times.
|
2 | d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_OperatingModeFields::NominalEvaporativeCondenserPumpPower); |
| 106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (d) { |
| 107 | ✗ | operatingMode.setNominalEvaporativeCondenserPumpPower(*d); | |
| 108 | } else { | ||
| 109 |
1/1✓ Branch 1 taken 2 times.
|
2 | operatingMode.autosizeNominalEvaporativeCondenserPumpPower(); |
| 110 | } | ||
| 111 | |||
| 112 |
1/1✓ Branch 1 taken 2 times.
|
2 | i = workspaceObject.getInt(Coil_Cooling_DX_CurveFit_OperatingModeFields::NominalSpeedNumber); |
| 113 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (i) { |
| 114 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | operatingMode.setNominalSpeedNumber(*i); |
| 115 | } | ||
| 116 | |||
| 117 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 2 times.
|
4 | for (const IdfExtensibleGroup& idfGroup : workspaceObject.extensibleGroups()) { |
| 118 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto workspaceGroup = idfGroup.cast<WorkspaceExtensibleGroup>(); |
| 119 |
1/1✓ Branch 1 taken 2 times.
|
2 | OptionalWorkspaceObject target = workspaceGroup.getTarget(Coil_Cooling_DX_CurveFit_OperatingModeExtensibleFields::SpeedName); |
| 120 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); |
| 121 | |||
| 122 | // add the speed | ||
| 123 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | operatingMode.addSpeed(modelObject->cast<CoilCoolingDXCurveFitSpeed>()); |
| 124 | 4 | } | |
| 125 | |||
| 126 |
1/1✓ Branch 1 taken 2 times.
|
2 | return operatingMode; |
| 127 | 2 | } // End of translate function | |
| 128 | |||
| 129 | } // end namespace energyplus | ||
| 130 | } // end namespace openstudio | ||
| 131 |