Skip to content

Commit

Permalink
Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-robertson committed Jan 15, 2025
1 parent c3474cb commit 1ca7ead
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace openstudio {

namespace energyplus {

boost::optional<IdfObject> ForwardTranslator::translateAirLoopHVACExhaustSystem( model::AirLoopHVACExhaustSystem& modelObject ) {
boost::optional<IdfObject> ForwardTranslator::translateAirLoopHVACExhaustSystem(model::AirLoopHVACExhaustSystem& modelObject) {

// Instantiate an IdfObject of the class to store the values
IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::AirLoopHVAC_ExhaustSystem, modelObject);
Expand All @@ -67,18 +67,17 @@ namespace energyplus {

// Zone Mixer Name: Required Object
ZoneMixers zoneMixer = modelObject.zoneMixer();
if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(zoneMixer)) {
if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(zoneMixer)) {
idfObject.setString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, wo_->nameString());
}

// Fan Object Type: Required String
const std::string fanObjectType = modelObject.fanObjectType();
idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanObjectType, fanObjectType);


// Fan Name: Required Object
FansSystemModel fan = modelObject.fan();
if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(fan)) {
if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(fan)) {
idfObject.setString(AirLoopHVAC_ExhaustSystemFields::FanName, wo_->nameString());
}

Expand Down
7 changes: 3 additions & 4 deletions src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACExhaustSystem) {
FansSystemModel fan(m);
EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan));


// TODO: you're responsible for creating all other objects needed so this object actually gets ForwardTranslated

const Workspace w = ft.translateModel(m);
const auto idfObjs = w.getObjectsByType(IddObjectType::AirLoopHVAC_ExhaustSystem);
ASSERT_EQ(1u, idfObjs.size());

const auto& idfObject = idfObjs.front();
EXPECT_EQ(zoneMixer.nameString(), idfObject.getString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName).get());
EXPECT_EQ("Fan:SystemModel", idfObject.getString(AirLoopHVAC_ExhaustSystemFields::FanObjectType).get()); EXPECT_EQ(fan.nameString(), idfObject.getString(AirLoopHVAC_ExhaustSystemFields::FanName).get());

EXPECT_EQ(zoneMixer.nameString(), idfObject.getString(AirLoopHVAC_ExhaustSystemFields::ZoneMixerName).get());
EXPECT_EQ("Fan:SystemModel", idfObject.getString(AirLoopHVAC_ExhaustSystemFields::FanObjectType).get());
EXPECT_EQ(fan.nameString(), idfObject.getString(AirLoopHVAC_ExhaustSystemFields::FanName).get());
}
20 changes: 8 additions & 12 deletions src/model/AirLoopHVACExhaustSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,23 @@ namespace model {

namespace detail {

AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject,
Model_Impl* model, bool keepHandle)
AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
: StraightComponent_Impl(idfObject, model, keepHandle) {
OS_ASSERT(idfObject.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType());
}

AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
Model_Impl* model, bool keepHandle)
AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model,
bool keepHandle)
: StraightComponent_Impl(other, model, keepHandle) {
OS_ASSERT(other.iddObject().type() == AirLoopHVACExhaustSystem::iddObjectType());
}

AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other,
Model_Impl* model, bool keepHandle)
: StraightComponent_Impl(other, model, keepHandle) {}
AirLoopHVACExhaustSystem_Impl::AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle)
: StraightComponent_Impl(other, model, keepHandle) {}

const std::vector<std::string>& AirLoopHVACExhaustSystem_Impl::outputVariableNames() const {
static std::vector<std::string> result;
if (result.empty()){
if (result.empty()) {
}
return result;
}
Expand Down Expand Up @@ -131,8 +129,7 @@ namespace model {

} // namespace detail

AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model)
: StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) {
AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(const Model& model) : StraightComponent(AirLoopHVACExhaustSystem::iddObjectType(), model) {
OS_ASSERT(getImpl<detail::AirLoopHVACExhaustSystem_Impl>());

// TODO: consider adding (overloaded or not) explicit ctors taking required objects as argument
Expand Down Expand Up @@ -168,8 +165,7 @@ namespace model {
}

/// @cond
AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(
std::shared_ptr<detail::AirLoopHVACExhaustSystem_Impl> impl)
AirLoopHVACExhaustSystem::AirLoopHVACExhaustSystem(std::shared_ptr<detail::AirLoopHVACExhaustSystem_Impl> impl)
: StraightComponent(std::move(impl)) {}
/// @endcond

Expand Down
16 changes: 5 additions & 11 deletions src/model/AirLoopHVACExhaustSystem_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,18 @@ namespace model {

namespace detail {

/** AirLoopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/
/** AirLoopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirLoopHVACExhaustSystem.*/
class MODEL_API AirLoopHVACExhaustSystem_Impl : public StraightComponent_Impl
{
public:
/** @name Constructors and Destructors */
//@{

AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject,
Model_Impl* model,
bool keepHandle);
AirLoopHVACExhaustSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle);

AirLoopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
Model_Impl* model,
bool keepHandle);
AirLoopHVACExhaustSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle);

AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other,
Model_Impl* model,
bool keepHandle);
AirLoopHVACExhaustSystem_Impl(const AirLoopHVACExhaustSystem_Impl& other, Model_Impl* model, bool keepHandle);

virtual ~AirLoopHVACExhaustSystem_Impl() = default;

Expand Down Expand Up @@ -104,7 +98,7 @@ namespace model {
protected:
private:
REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem");

// TODO: Check the return types of these methods.
// Optional getters for use by methods like children() so can remove() if the constructor fails.
// There are other ways for the public versions of these getters to fail--perhaps all required
Expand Down
1 change: 0 additions & 1 deletion src/model/test/AirLoopHVACExhaustSystem_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ TEST_F(ModelFixture, AirLoopHVACExhaustSystem_GettersSetters) {
FansSystemModel fan(m);
EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan));
EXPECT_EQ(fan, airLoopHVACExhaustSystem.fan());

}
TEST_F(ModelFixture, AirLoopHVACExhaustSystem_HeatCoolFuelTypes) {
Model m;
Expand Down

0 comments on commit 1ca7ead

Please sign in to comment.