Skip to content

Commit

Permalink
#3976 - Coil:Cooling:DX:TwoSpeed code changes for two new fields
Browse files Browse the repository at this point in the history
* Added double getter, isDefaulted, setter and resetter
* Added to Model Test
* Added VersionTranslation for inserted field
* Added VersionTranslation test
* Added new field to the FT
* Added a FT test
* RT doesn't exist at all
  • Loading branch information
jmarrec committed May 13, 2020
1 parent c330e53 commit d7fc99b
Show file tree
Hide file tree
Showing 10 changed files with 673 additions and 55 deletions.
1 change: 1 addition & 0 deletions src/energyplus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ set(${target_name}_test_src
Test/CoilHeatingGas_GTest.cpp
Test/CoilCoolingDXSingleSpeed_GTest.cpp
Test/CoilCoolingDXMultiSpeed_GTest.cpp
Test/CoilCoolingDXTwoSpeed_GTest.cpp
Test/CoilCoolingDXTwoStageWithHumidityControlMode_GTest.cpp
Test/CoilCoolingDXVariableSpeed_GTest.cpp
Test/Construction_GTest.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXTwoSpeedWith
idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::HighSpeedRatedAirFlowRate,"Autosize");
}

// Unit Internal Static Air Pressure
if ( (d = modelObject.unitInternalStaticAirPressure()) ) {
idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::UnitInternalStaticAirPressure, *d);
}

//A3 , \field Air Inlet Node Name
OptionalModelObject omo = modelObject.inletModelObject();
if( omo )
Expand Down Expand Up @@ -230,6 +235,12 @@ boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXTwoSpeedWith
// A13, \field Condenser Type
idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::CondenserType,modelObject.getCondenserType());

// Minimum Outdoor Dry-Bulb Temperature for Compressor Operation
{
auto value = modelObject.minimumOutdoorDryBulbTemperatureforCompressorOperation();
idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation,value);
}

// N9, \field High Speed Evaporative Condenser Effectiveness
d=modelObject.getHighSpeedEvaporativeCondenserEffectiveness();
if(d)
Expand Down
88 changes: 88 additions & 0 deletions src/energyplus/Test/CoilCoolingDXTwoSpeed_GTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/***********************************************************************************************************************
* OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
*
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
* derived from this software without specific prior written permission from the respective party.
*
* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
* written permission from Alliance for Sustainable Energy, LLC.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

#include <gtest/gtest.h>
#include "EnergyPlusFixture.hpp"

#include "../ForwardTranslator.hpp"

#include "../../model/Model.hpp"
#include "../../model/CoilCoolingDXTwoSpeed.hpp"
#include "../../model/CoilCoolingDXTwoSpeed_Impl.hpp"

#include <utilities/idd/Coil_Cooling_DX_TwoSpeed_FieldEnums.hxx>
#include <utilities/idd/IddEnums.hxx>

using namespace openstudio::energyplus;
using namespace openstudio::model;
using namespace openstudio;

TEST_F(EnergyPlusFixture, ForwardTranslator_CoilCoolingDXTwoSpeed_MinOATCompressor) {
Model m;

CoilCoolingDXTwoSpeed coil(m);
coil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(-7.5);

ForwardTranslator ft;

{
Workspace w = ft.translateModel(m);

// Note JM 2020-05-13: I find it weird that the coil gets translated when it's not even used by anything, but trying to fix #3976 only here
WorkspaceObjectVector idf_coils(w.getObjectsByType(IddObjectType::Coil_Cooling_DX_TwoSpeed));
ASSERT_EQ(1u, idf_coils.size());
WorkspaceObject idf_coil(idf_coils[0]);

auto _d = idf_coil.getDouble(Coil_Cooling_DX_TwoSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation);
ASSERT_TRUE(_d);
EXPECT_DOUBLE_EQ(-7.5, _d.get());

EXPECT_FALSE(idf_coil.getDouble(Coil_Cooling_DX_TwoSpeedFields::UnitInternalStaticAirPressure));

}

coil.setUnitInternalStaticAirPressure(773.3);
{
Workspace w = ft.translateModel(m);

// Note JM 2020-05-13: I find it weird that the coil gets translated when it's not even used by anything, but trying to fix #3976 only here
WorkspaceObjectVector idf_coils(w.getObjectsByType(IddObjectType::Coil_Cooling_DX_TwoSpeed));
ASSERT_EQ(1u, idf_coils.size());
WorkspaceObject idf_coil(idf_coils[0]);

auto _d = idf_coil.getDouble(Coil_Cooling_DX_TwoSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation);
ASSERT_TRUE(_d);
EXPECT_DOUBLE_EQ(-7.5, _d.get());

_d = idf_coil.getDouble(Coil_Cooling_DX_TwoSpeedFields::UnitInternalStaticAirPressure);
ASSERT_TRUE(_d);
EXPECT_DOUBLE_EQ(773.3, _d.get());

}
}
125 changes: 95 additions & 30 deletions src/model/CoilCoolingDXTwoSpeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,43 @@ namespace detail{
return true;
}


double CoilCoolingDXTwoSpeed_Impl::minimumOutdoorDryBulbTemperatureforCompressorOperation() const {
boost::optional<double> value = getDouble(OS_Coil_Cooling_DX_TwoSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation,true);
OS_ASSERT(value);
return value.get();
}

bool CoilCoolingDXTwoSpeed_Impl::isMinimumOutdoorDryBulbTemperatureforCompressorOperationDefaulted() const {
return isEmpty(OS_Coil_Cooling_DX_TwoSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation);
}

bool CoilCoolingDXTwoSpeed_Impl::setMinimumOutdoorDryBulbTemperatureforCompressorOperation(double minimumOutdoorDryBulbTemperatureforCompressorOperation) {
bool result = setDouble(OS_Coil_Cooling_DX_TwoSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation,
minimumOutdoorDryBulbTemperatureforCompressorOperation);
return result;
}

void CoilCoolingDXTwoSpeed_Impl::resetMinimumOutdoorDryBulbTemperatureforCompressorOperation() {
bool result = setString(OS_Coil_Cooling_DX_TwoSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation, "");
OS_ASSERT(result);
}

boost::optional<double> CoilCoolingDXTwoSpeed_Impl::unitInternalStaticAirPressure() const {
return getDouble(OS_Coil_Cooling_DX_TwoSpeedFields::UnitInternalStaticAirPressure,true);
}

bool CoilCoolingDXTwoSpeed_Impl::setUnitInternalStaticAirPressure(double unitInternalStaticAirPressure) {
bool result = setDouble(OS_Coil_Cooling_DX_TwoSpeedFields::UnitInternalStaticAirPressure,
unitInternalStaticAirPressure);
return result;
}

void CoilCoolingDXTwoSpeed_Impl::resetUnitInternalStaticAirPressure() {
bool result = setString(OS_Coil_Cooling_DX_TwoSpeedFields::UnitInternalStaticAirPressure, "");
OS_ASSERT(result);
}

bool CoilCoolingDXTwoSpeed_Impl::addToNode(Node & node)
{
if( boost::optional<AirLoopHVAC> airLoop = node.airLoopHVAC() )
Expand Down Expand Up @@ -1602,45 +1639,73 @@ IddObjectType CoilCoolingDXTwoSpeed::iddObjectType() {
return result;
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedHighSpeedTotalCoolingCapacity() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedHighSpeedTotalCoolingCapacity();
}
double CoilCoolingDXTwoSpeed::minimumOutdoorDryBulbTemperatureforCompressorOperation() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->minimumOutdoorDryBulbTemperatureforCompressorOperation();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedHighSpeedSensibleHeatRatio() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedHighSpeedSensibleHeatRatio();
}
bool CoilCoolingDXTwoSpeed::isMinimumOutdoorDryBulbTemperatureforCompressorOperationDefaulted() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->isMinimumOutdoorDryBulbTemperatureforCompressorOperationDefaulted();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedHighSpeedAirFlowRate() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedHighSpeedAirFlowRate();
}
bool CoilCoolingDXTwoSpeed::setMinimumOutdoorDryBulbTemperatureforCompressorOperation(double minimumOutdoorDryBulbTemperatureforCompressorOperation) {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->setMinimumOutdoorDryBulbTemperatureforCompressorOperation(minimumOutdoorDryBulbTemperatureforCompressorOperation);
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedLowSpeedTotalCoolingCapacity() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedLowSpeedTotalCoolingCapacity();
}
void CoilCoolingDXTwoSpeed::resetMinimumOutdoorDryBulbTemperatureforCompressorOperation() {
getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->resetMinimumOutdoorDryBulbTemperatureforCompressorOperation();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedLowSpeedSensibleHeatRatio() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedLowSpeedSensibleHeatRatio();
}
boost::optional<double> CoilCoolingDXTwoSpeed::unitInternalStaticAirPressure() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->unitInternalStaticAirPressure();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedLowSpeedAirFlowRate() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedLowSpeedAirFlowRate();
}
bool CoilCoolingDXTwoSpeed::setUnitInternalStaticAirPressure(double unitInternalStaticAirPressure) {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->setUnitInternalStaticAirPressure(unitInternalStaticAirPressure);
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedHighSpeedEvaporativeCondenserAirFlowRate() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedHighSpeedEvaporativeCondenserAirFlowRate();
}
void CoilCoolingDXTwoSpeed::resetUnitInternalStaticAirPressure() {
getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->resetUnitInternalStaticAirPressure();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedHighSpeedEvaporativeCondenserPumpRatedPowerConsumption() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedHighSpeedEvaporativeCondenserPumpRatedPowerConsumption();
}
boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedHighSpeedTotalCoolingCapacity() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedHighSpeedTotalCoolingCapacity();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedLowSpeedEvaporativeCondenserAirFlowRate() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedLowSpeedEvaporativeCondenserAirFlowRate();
}
boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedHighSpeedSensibleHeatRatio() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedHighSpeedSensibleHeatRatio();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedLowSpeedEvaporativeCondenserPumpRatedPowerConsumption() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedLowSpeedEvaporativeCondenserPumpRatedPowerConsumption();
}
boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedHighSpeedAirFlowRate() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedHighSpeedAirFlowRate();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedLowSpeedTotalCoolingCapacity() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedLowSpeedTotalCoolingCapacity();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedLowSpeedSensibleHeatRatio() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedLowSpeedSensibleHeatRatio();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedRatedLowSpeedAirFlowRate() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedRatedLowSpeedAirFlowRate();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedHighSpeedEvaporativeCondenserAirFlowRate() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedHighSpeedEvaporativeCondenserAirFlowRate();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedHighSpeedEvaporativeCondenserPumpRatedPowerConsumption() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedHighSpeedEvaporativeCondenserPumpRatedPowerConsumption();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedLowSpeedEvaporativeCondenserAirFlowRate() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedLowSpeedEvaporativeCondenserAirFlowRate();
}

boost::optional<double> CoilCoolingDXTwoSpeed::autosizedLowSpeedEvaporativeCondenserPumpRatedPowerConsumption() const {
return getImpl<detail::CoilCoolingDXTwoSpeed_Impl>()->autosizedLowSpeedEvaporativeCondenserPumpRatedPowerConsumption();
}

} // model
} // openstudio
Expand Down
20 changes: 18 additions & 2 deletions src/model/CoilCoolingDXTwoSpeed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ class MODEL_API CoilCoolingDXTwoSpeed : public StraightComponent {
/** \deprecated */
boost::optional<Schedule> getBasinHeaterOperatingSchedule() const;

double minimumOutdoorDryBulbTemperatureforCompressorOperation() const;

bool isMinimumOutdoorDryBulbTemperatureforCompressorOperationDefaulted() const;

boost::optional<double> unitInternalStaticAirPressure() const;

//@}
/** @name Setters */
//@{
Expand Down Expand Up @@ -395,6 +401,18 @@ class MODEL_API CoilCoolingDXTwoSpeed : public StraightComponent {

void resetBasinHeaterOperatingSchedule();

bool setMinimumOutdoorDryBulbTemperatureforCompressorOperation(double minimumOutdoorDryBulbTemperatureforCompressorOperation);

void resetMinimumOutdoorDryBulbTemperatureforCompressorOperation();

bool setUnitInternalStaticAirPressure(double unitInternalStaticAirPressure);

void resetUnitInternalStaticAirPressure();

//@}
/** @name Other */
//@{

boost::optional<double> autosizedRatedHighSpeedTotalCoolingCapacity() const ;

boost::optional<double> autosizedRatedHighSpeedSensibleHeatRatio() const ;
Expand All @@ -415,8 +433,6 @@ class MODEL_API CoilCoolingDXTwoSpeed : public StraightComponent {

boost::optional<double> autosizedLowSpeedEvaporativeCondenserPumpRatedPowerConsumption() const ;



//@}
protected:

Expand Down
Loading

0 comments on commit d7fc99b

Please sign in to comment.