Skip to content

Commit

Permalink
Case typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-robertson committed Jan 15, 2025
1 parent 748a657 commit e98a855
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 83 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,17 +67,18 @@ 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: 4 additions & 3 deletions src/energyplus/Test/AirLoopHVACExhaustSystem_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ 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());

}
74 changes: 39 additions & 35 deletions src/model/AirloopHVACExhaustSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

#include "AirloopHVACExhaustSystem.hpp"
#include "AirloopHVACExhaustSystem_Impl.hpp"
#include "AirLoopHVACExhaustSystem.hpp"
#include "AirLoopHVACExhaustSystem_Impl.hpp"

// TODO: Check the following class names against object getters and setters.
#include "ZoneMixers.hpp"
Expand All @@ -47,90 +47,93 @@ 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());
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());
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 {
const std::vector<std::string>& AirLoopHVACExhaustSystem_Impl::outputVariableNames() const {
static std::vector<std::string> result;
if (result.empty()) {
if (result.empty()){
}
return result;
}

IddObjectType AirloopHVACExhaustSystem_Impl::iddObjectType() const {
return AirloopHVACExhaustSystem::iddObjectType();
IddObjectType AirLoopHVACExhaustSystem_Impl::iddObjectType() const {
return AirLoopHVACExhaustSystem::iddObjectType();
}

ComponentType AirloopHVACExhaustSystem_Impl::componentType() const {
ComponentType AirLoopHVACExhaustSystem_Impl::componentType() const {
// TODO
return ComponentType::None;
}

std::vector<FuelType> AirloopHVACExhaustSystem_Impl::coolingFuelTypes() const {
std::vector<FuelType> AirLoopHVACExhaustSystem_Impl::coolingFuelTypes() const {
// TODO
return {};
}

std::vector<FuelType> AirloopHVACExhaustSystem_Impl::heatingFuelTypes() const {
std::vector<FuelType> AirLoopHVACExhaustSystem_Impl::heatingFuelTypes() const {
// TODO
return {};
}

std::vector<AppGFuelType> AirloopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const {
std::vector<AppGFuelType> AirLoopHVACExhaustSystem_Impl::appGHeatingFuelTypes() const {

// TODO
return {};
}

ZoneMixers AirloopHVACExhaustSystem_Impl::zoneMixer() const {
ZoneMixers AirLoopHVACExhaustSystem_Impl::zoneMixer() const {
boost::optional<ZoneMixers> value = optionalZoneMixer();
if (!value) {
LOG_AND_THROW(briefDescription() << " does not have an Zone Mixer attached.");
}
return value.get();
}

FansSystemModel AirloopHVACExhaustSystem_Impl::fan() const {
FansSystemModel AirLoopHVACExhaustSystem_Impl::fan() const {
boost::optional<FansSystemModel> value = optionalFan();
if (!value) {
LOG_AND_THROW(briefDescription() << " does not have an Fan attached.");
}
return value.get();
}

bool AirloopHVACExhaustSystem_Impl::setZoneMixer(const ZoneMixers& zoneMixers) {
bool AirLoopHVACExhaustSystem_Impl::setZoneMixer(const ZoneMixers& zoneMixers) {
const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName, zoneMixers.handle());
return result;
}

bool AirloopHVACExhaustSystem_Impl::setFan(const FansSystemModel& fansSystemModel) {
bool AirLoopHVACExhaustSystem_Impl::setFan(const FansSystemModel& fansSystemModel) {
const bool result = setPointer(OS_AirLoopHVAC_ExhaustSystemFields::FanName, fansSystemModel.handle());
return result;
}

boost::optional<ZoneMixers> AirloopHVACExhaustSystem_Impl::optionalZoneMixer() const {
boost::optional<ZoneMixers> AirLoopHVACExhaustSystem_Impl::optionalZoneMixer() const {
return getObject<ModelObject>().getModelObjectTarget<ZoneMixers>(OS_AirLoopHVAC_ExhaustSystemFields::ZoneMixerName);
}

boost::optional<FansSystemModel> AirloopHVACExhaustSystem_Impl::optionalFan() const {
boost::optional<FansSystemModel> AirLoopHVACExhaustSystem_Impl::optionalFan() const {
return getObject<ModelObject>().getModelObjectTarget<FansSystemModel>(OS_AirLoopHVAC_ExhaustSystemFields::FanName);
}

} // namespace detail

AirloopHVACExhaustSystem::AirloopHVACExhaustSystem(const Model& model) : StraightComponent(AirloopHVACExhaustSystem::iddObjectType(), model) {
OS_ASSERT(getImpl<detail::AirloopHVACExhaustSystem_Impl>());
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 All @@ -144,28 +147,29 @@ namespace model {
OS_ASSERT(ok);
}

IddObjectType AirloopHVACExhaustSystem::iddObjectType() {
IddObjectType AirLoopHVACExhaustSystem::iddObjectType() {
return {IddObjectType::OS_AirLoopHVAC_ExhaustSystem};
}

ZoneMixers AirloopHVACExhaustSystem::zoneMixer() const {
return getImpl<detail::AirloopHVACExhaustSystem_Impl>()->zoneMixer();
ZoneMixers AirLoopHVACExhaustSystem::zoneMixer() const {
return getImpl<detail::AirLoopHVACExhaustSystem_Impl>()->zoneMixer();
}

FansSystemModel AirloopHVACExhaustSystem::fan() const {
return getImpl<detail::AirloopHVACExhaustSystem_Impl>()->fan();
FansSystemModel AirLoopHVACExhaustSystem::fan() const {
return getImpl<detail::AirLoopHVACExhaustSystem_Impl>()->fan();
}

bool AirloopHVACExhaustSystem::setZoneMixer(const ZoneMixers& zoneMixers) {
return getImpl<detail::AirloopHVACExhaustSystem_Impl>()->setZoneMixer(zoneMixers);
bool AirLoopHVACExhaustSystem::setZoneMixer(const ZoneMixers& zoneMixers) {
return getImpl<detail::AirLoopHVACExhaustSystem_Impl>()->setZoneMixer(zoneMixers);
}

bool AirloopHVACExhaustSystem::setFan(const FansSystemModel& fansSystemModel) {
return getImpl<detail::AirloopHVACExhaustSystem_Impl>()->setFan(fansSystemModel);
bool AirLoopHVACExhaustSystem::setFan(const FansSystemModel& fansSystemModel) {
return getImpl<detail::AirLoopHVACExhaustSystem_Impl>()->setFan(fansSystemModel);
}

/// @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
34 changes: 17 additions & 17 deletions src/model/AirloopHVACExhaustSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ namespace model {

namespace detail {

class AirloopHVACExhaustSystem_Impl;
class AirLoopHVACExhaustSystem_Impl;

} // namespace detail

/** AirloopHVACExhaustSystem is a StraightComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */
class MODEL_API AirloopHVACExhaustSystem : public StraightComponent
/** AirLoopHVACExhaustSystem is a StraightComponent that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:ExhaustSystem'. */
class MODEL_API AirLoopHVACExhaustSystem : public StraightComponent
{
public:
/** @name Constructors and Destructors */
//@{

explicit AirloopHVACExhaustSystem(const Model& model);
explicit AirLoopHVACExhaustSystem(const Model& model);

virtual ~AirloopHVACExhaustSystem() = default;
virtual ~AirLoopHVACExhaustSystem() = default;
// Default the copy and move operators because the virtual dtor is explicit
AirloopHVACExhaustSystem(const AirloopHVACExhaustSystem& other) = default;
AirloopHVACExhaustSystem(AirloopHVACExhaustSystem&& other) = default;
AirloopHVACExhaustSystem& operator=(const AirloopHVACExhaustSystem&) = default;
AirloopHVACExhaustSystem& operator=(AirloopHVACExhaustSystem&&) = default;
AirLoopHVACExhaustSystem(const AirLoopHVACExhaustSystem& other) = default;
AirLoopHVACExhaustSystem(AirLoopHVACExhaustSystem&& other) = default;
AirLoopHVACExhaustSystem& operator=(const AirLoopHVACExhaustSystem&) = default;
AirLoopHVACExhaustSystem& operator=(AirLoopHVACExhaustSystem&&) = default;

//@}

Expand Down Expand Up @@ -92,24 +92,24 @@ namespace model {
//@}
protected:
/// @cond
using ImplType = detail::AirloopHVACExhaustSystem_Impl;
using ImplType = detail::AirLoopHVACExhaustSystem_Impl;

explicit AirloopHVACExhaustSystem(std::shared_ptr<detail::AirloopHVACExhaustSystem_Impl> impl);
explicit AirLoopHVACExhaustSystem(std::shared_ptr<detail::AirLoopHVACExhaustSystem_Impl> impl);

friend class detail::AirloopHVACExhaustSystem_Impl;
friend class detail::AirLoopHVACExhaustSystem_Impl;
friend class Model;
friend class IdfObject;
friend class openstudio::detail::IdfObject_Impl;
/// @endcond
private:
REGISTER_LOGGER("openstudio.model.AirloopHVACExhaustSystem");
REGISTER_LOGGER("openstudio.model.AirLoopHVACExhaustSystem");
};

/** \relates AirloopHVACExhaustSystem*/
using OptionalAirloopHVACExhaustSystem = boost::optional<AirloopHVACExhaustSystem>;
/** \relates AirLoopHVACExhaustSystem*/
using OptionalAirLoopHVACExhaustSystem = boost::optional<AirLoopHVACExhaustSystem>;

/** \relates AirloopHVACExhaustSystem*/
using AirloopHVACExhaustSystemVector = std::vector<AirloopHVACExhaustSystem>;
/** \relates AirLoopHVACExhaustSystem*/
using AirLoopHVACExhaustSystemVector = std::vector<AirLoopHVACExhaustSystem>;

} // namespace model
} // namespace openstudio
Expand Down
22 changes: 14 additions & 8 deletions src/model/AirloopHVACExhaustSystem_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,26 @@ namespace model {

namespace detail {

/** AirloopHVACExhaustSystem_Impl is a StraightComponent_Impl that is the implementation class for AirloopHVACExhaustSystem.*/
class MODEL_API AirloopHVACExhaustSystem_Impl : public StraightComponent_Impl
/** 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;
virtual ~AirLoopHVACExhaustSystem_Impl() = default;

//@}
/** @name Virtual Methods */
Expand Down Expand Up @@ -97,8 +103,8 @@ namespace model {
//@}
protected:
private:
REGISTER_LOGGER("openstudio.model.AirloopHVACExhaustSystem");

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
35 changes: 18 additions & 17 deletions src/model/test/AirloopHVACExhaustSystem_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#include "ModelFixture.hpp"

#include "../AirloopHVACExhaustSystem.hpp"
#include "../AirloopHVACExhaustSystem_Impl.hpp"
#include "../AirLoopHVACExhaustSystem.hpp"
#include "../AirLoopHVACExhaustSystem_Impl.hpp"

// TODO: Check the following class names against object getters and setters.
#include "../ZoneMixers.hpp"
Expand All @@ -42,34 +42,35 @@
using namespace openstudio;
using namespace openstudio::model;

TEST_F(ModelFixture, AirloopHVACExhaustSystem_GettersSetters) {
TEST_F(ModelFixture, AirLoopHVACExhaustSystem_GettersSetters) {
Model m;
// TODO: Check regular Ctor arguments
AirloopHVACExhaustSystem airloopHVACExhaustSystem(m);
AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m);
// TODO: Or if a UniqueModelObject (and make sure _Impl is included)
// AirloopHVACExhaustSystem airloopHVACExhaustSystem = m.getUniqueModelObject<AirloopHVACExhaustSystem>();
// AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject<AirLoopHVACExhaustSystem>();

airloopHVACExhaustSystem.setName("My AirloopHVACExhaustSystem");
airLoopHVACExhaustSystem.setName("My AirLoopHVACExhaustSystem");

// Zone Mixer Name: Required Object
ZoneMixers zoneMixer(m);
EXPECT_TRUE(airloopHVACExhaustSystem.setZoneMixer(zoneMixer));
EXPECT_EQ(zoneMixer, airloopHVACExhaustSystem.zoneMixer());
EXPECT_TRUE(airLoopHVACExhaustSystem.setZoneMixer(zoneMixer));
EXPECT_EQ(zoneMixer, airLoopHVACExhaustSystem.zoneMixer());

// Fan Name: Required Object
FansSystemModel fan(m);
EXPECT_TRUE(airloopHVACExhaustSystem.setFan(fan));
EXPECT_EQ(fan, airloopHVACExhaustSystem.fan());
EXPECT_TRUE(airLoopHVACExhaustSystem.setFan(fan));
EXPECT_EQ(fan, airLoopHVACExhaustSystem.fan());

}
TEST_F(ModelFixture, AirloopHVACExhaustSystem_HeatCoolFuelTypes) {
TEST_F(ModelFixture, AirLoopHVACExhaustSystem_HeatCoolFuelTypes) {
Model m;
// TODO: Check regular Ctor arguments
AirloopHVACExhaustSystem airloopHVACExhaustSystem(m);
AirLoopHVACExhaustSystem airLoopHVACExhaustSystem(m);
// TODO: Or if a UniqueModelObject (and make sure _Impl is included)
// AirloopHVACExhaustSystem airloopHVACExhaustSystem = m.getUniqueModelObject<AirloopHVACExhaustSystem>();
// AirLoopHVACExhaustSystem airLoopHVACExhaustSystem = m.getUniqueModelObject<AirLoopHVACExhaustSystem>();

EXPECT_EQ(ComponentType(ComponentType::Both), airloopHVACExhaustSystem.componentType());
testFuelTypeEquality({FuelType::Electricity}, airloopHVACExhaustSystem.coolingFuelTypes());
testFuelTypeEquality({FuelType::Electricity, FuelType::Propane}, airloopHVACExhaustSystem.heatingFuelTypes());
testAppGFuelTypeEquality({AppGFuelType::Fuel, AppGFuelType::HeatPump}, airloopHVACExhaustSystem.appGHeatingFuelTypes());
EXPECT_EQ(ComponentType(ComponentType::Both), airLoopHVACExhaustSystem.componentType());
testFuelTypeEquality({FuelType::Electricity}, airLoopHVACExhaustSystem.coolingFuelTypes());
testFuelTypeEquality({FuelType::Electricity, FuelType::Propane}, airLoopHVACExhaustSystem.heatingFuelTypes());
testAppGFuelTypeEquality({AppGFuelType::Fuel, AppGFuelType::HeatPump}, airLoopHVACExhaustSystem.appGHeatingFuelTypes());
}

0 comments on commit e98a855

Please sign in to comment.