-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap ZoneHVAC:EvaporativeCoolerUnit #5326
base: develop
Are you sure you want to change the base?
Conversation
resources/model/OpenStudio.idd
Outdated
A5, \field Outdoor Air Inlet Node Name | ||
\required-field | ||
\type object-list | ||
\object-list ConnectionNames | ||
\note this is an outdoor air node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you may want to not add it?
resources/model/OpenStudio.idd
Outdated
A11, \field First Evaporative Cooler Object Name | ||
\required-field | ||
\type object-list | ||
\object-list EvapCoolerNames | ||
A12, \field Second Evaporative Cooler Name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is just E+. still bothers me that the second doesn't have "Object" in it.
In any case, beware here because GenerateClass.rb will name the getters/setters differently and we don't want that.
I'd remove both "Object Name" from it, so that the getters are firstEvaporativeCooler
and secondEvaporativeCooler
CI Results for 9265da3:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty minor comments (mostly: tests), this is looking very good otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add tests for:
- Nodes/Connections:
- addToThermalZone (are the inlet/outlet nodes set correctly)
- addToNode.
- Not familiar with this object, but at least it should be rejected on a PlantLoop, Not sure about AirLoopHVAC (
ZoneHVACComponent
will allow a connection with anAirTerminalSingleDuctInletSideMixer
). Bottom line: are the addToThermalZone & addToNode from ZoneHVACComponent doing the right thing for this object?
- clone: same model, and another model. And remove.
OpenStudio/src/model/ZoneHVACComponent.cpp
Lines 320 to 336 in 0314c3e
bool ZoneHVACComponent_Impl::addToNode(Node& node) { | |
bool result = false; | |
boost::optional<ThermalZone> thermalZone; | |
boost::optional<AirTerminalSingleDuctInletSideMixer> terminal; | |
if (boost::optional<ModelObject> outlet = node.outletModelObject()) { | |
if (boost::optional<PortList> pl = outlet->optionalCast<PortList>()) { | |
thermalZone = pl->thermalZone(); | |
} | |
} | |
if (boost::optional<ModelObject> inlet = node.inletModelObject()) { | |
terminal = inlet->optionalCast<AirTerminalSingleDuctInletSideMixer>(); | |
} | |
if (thermalZone && terminal) { |
return std::move(evaporativeCoolUnitClone); | ||
} | ||
|
||
std::vector<IdfObject> ZoneHVACEvaporativeCoolerUnit_Impl::remove() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could consider using #include "../utilities/core/ContainersMove.hpp"
, eg
OpenStudio/src/model/Building.cpp
Line 122 in 0314c3e
openstudio::detail::concat_helper(result, ParentObject_Impl::remove()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, given the way you wrote the children()
method, I'm not sure explicitly cloning the children is necessary, but I could be wrong. In the end, I only care if the (future) test shows everything works as expected.
ok = setAvailabilitySchedule(availabilitySchedule); | ||
OS_ASSERT(ok); | ||
ok = setSupplyAirFan(supplyAirFan); | ||
OS_ASSERT(ok); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically these can fail, and should be caught with a remove() because LOG_AND_THROW. Especially the supplyAirFan. I could pass any children of HVACComponent, such as a CoilCoolingDXSingleSpeed.
OS_ASSERT(ok); | ||
ok = setCoolingLoadControlThresholdHeatTransferRate(100.0); | ||
OS_ASSERT(ok); | ||
ok = setFirstEvaporativeCooler(firstEvaporativeCooler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a (clang-format) diff here?
// Outdoor Air Inlet Node Name: Required Node | ||
if (boost::optional<Node> node = modelObject.inletNode()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do/should we catch the case where it's somehow not set?
boost::optional<IdfObject> fan_; | ||
if (boost::optional<HVACComponent> supplyAirFan = modelObject.supplyAirFan()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supplyAirFan is not an optional either
// Design Supply Air Flow Rate: boost::optional<double> | ||
if (boost::optional<double> designSupplyAirFlowRate_ = modelObject.designSupplyAirFlowRate()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically you can just go ahead and call .get() on it if you've checked it's not autosized.
// Fan Placement: Required String | ||
const std::string fanPlacement = modelObject.fanPlacement(); | ||
idfObject.setString(ZoneHVAC_EvaporativeCoolerUnitFields::FanPlacement, fanPlacement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nitpick: my preference is to not create an intermediate variable. That way there's no risk to reuse it later in the scope. Or at least do that inside "{}" to scope it)
boost::optional<IdfObject> firstEvaporativeCooler_ = translateAndMapModelObject(firstEvaporativeCooler); | ||
if (firstEvaporativeCooler_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assign in the if.
Also, should we LOG_AND_THROW if /somehow/ the translateAndMapModelObject failed?
Pull request overview
Pull Request Author
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.