Skip to content

Conversation

@jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Oct 9, 2025

Pull request overview

This wraps HeatPump:AirToWater into OpenStudio SDK, and it's a major effort.

  • This object is broken into 5 classes:

    • HeatPump:AirToWater (A StraightComponent, though addToNode always return false) which keeps only the top level fields
    • HeatPump:AirToWater:Cooling (StraightComponent) and HeatPump:AirToWater:Cooling:SpeedData (ResourceObject)
    • HeatPump:AirToWater:Heating (StraightComponent) and HeatPump:AirToWater:Heating:SpeedData (ResourceObject)
  • There are still a few missing pieces here:

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: #5490 - E+ 25.2.0: Wrap HeatPump:AirToWater OpenStudio-resources#225
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@joseph-robertson
Copy link
Collaborator

@jmarrec Per NREL/EnergyPlus#11001, I expected there to be updates in this PR related to the new "Water Loop Type" field on the PlantLoop object. Do we not need that here? Should we still make the field available outside of the context of HeatPump:AirToWater?

@yujiex
Copy link

yujiex commented Oct 10, 2025

@jmarrec Per NREL/EnergyPlus#11001, I expected there to be updates in this PR related to the new "Water Loop Type" field on the PlantLoop object. Do we not need that here? Should we still make the field available outside of the context of HeatPump:AirToWater?

Hi @joseph-robertson this "Water Loop Type" field was used to assign whether the air to water heat pump component is heating or cooling. For the HeatPump:PlantLoop:EIR:Heating and HeatPump:PlantLoop:EIR:Cooling ones, they can know this by the :Heating and :Cooling. But for this object, it has to know from what type of loop it's connected to thus the field is added. It's not used in other objects.

if (state.dataPlnt->PlantLoop(LoopNum).TypeOfWaterLoop == DataPlant::WaterLoopType::HotWater) {
    this_comp.compPtr = EIRPlantLoopHeatPumps::HeatPumpAirToWater::factory(
        state, PlantEquipmentType::HeatPumpAirToWaterHeating, CompNames(CompNum));
    this_comp.Type = PlantEquipmentType::HeatPumpAirToWaterHeating;
    this_comp.TypeOf = "HeatPumpAirToWaterHeating";
} else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfWaterLoop == DataPlant::WaterLoopType::ChilledWater) {
    this_comp.compPtr = EIRPlantLoopHeatPumps::HeatPumpAirToWater::factory(
        state, PlantEquipmentType::HeatPumpAirToWaterCooling, CompNames(CompNum));
    this_comp.Type = PlantEquipmentType::HeatPumpAirToWaterCooling;
    this_comp.TypeOf = "HeatPumpAirToWaterCooling";
}

Base automatically changed from v25.2.0-IOFreeze to develop October 20, 2025 12:08
I'm considering breaking it further into subobjects, but I need to start somewhere while I wait on stakeholder feedback
Some notes:
* I'm considering skipping the ModelObjectList and use extensible groups directly
* I'm not sure if I want the SpeedData objects to be unique or shared (I need to switch to ResourceObject in that case I think)
* The clone/remove/children need some work
Copy link
Collaborator

@joseph-robertson joseph-robertson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we write a new functional test on OS-resources before merging this?

jmarrec added a commit to NREL/OpenStudio-resources that referenced this pull request Nov 13, 2025
@jmarrec jmarrec added the Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. label Nov 13, 2025
@jmarrec jmarrec force-pushed the v25.2.0-IOFreeze-5490_HeatPumpAirToWater branch from 00ea1c6 to 42fe449 Compare November 13, 2025 16:44
…plement top-level autosizedRatedHeating/CoolingCapacity
…apacity: grab it from SQL only if it's the last speed (highest)
…ts the LAST speed too

The way Model::autosize/applySizingValues works is that it does it for HVACComponent, and the speed data is not one and we do not want to add an explicit case because none of the speeds should be autosized except the last (highest) one
…ll be gone by 25.2.0 release (will revert then)
@jmarrec jmarrec force-pushed the v25.2.0-IOFreeze-5490_HeatPumpAirToWater branch from 42fe449 to 71a7c62 Compare November 13, 2025 23:54
jmarrec added a commit to NREL/OpenStudio-resources that referenced this pull request Nov 13, 2025
@jmarrec
Copy link
Collaborator Author

jmarrec commented Nov 13, 2025

Comment on lines 588 to 605
// Water Loop Type
// TODO JM 2025-11-13: This field should never have been added to 25.2.0, so it is purposefully NOT wrapped in the model namespace
// MJW is looking into removing it today, will assess later
ComponentType waterLoopType = plantLoop.componentType();
if (waterLoopType == ComponentType::Heating) {
idfObject.setString(PlantLoopFields::WaterLoopType, "HotWater");
} else if (waterLoopType == ComponentType::Cooling) {
idfObject.setString(PlantLoopFields::WaterLoopType, "ChilledWater");
} else if (waterLoopType == ComponentType::None) {
idfObject.setString(PlantLoopFields::WaterLoopType, "None");
} else if (waterLoopType == ComponentType::Both) {
if (!plantLoop.supplyComponents(IddObjectType::OS_HeatPump_AirToWater_Cooling).empty()) {
idfObject.setString(PlantLoopFields::WaterLoopType, "ChilledWater");
} else if (!plantLoop.supplyComponents(IddObjectType::OS_HeatPump_AirToWater_Heating).empty()) {
idfObject.setString(PlantLoopFields::WaterLoopType, "HotWater");
}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove/revert depending on:

Comment on lines +1961 to +1970
case openstudio::IddObjectType::OS_HeatPump_AirToWater_Cooling: {
// no-op, just Log a Trace message
LOG(Trace, "HeatPumpAirToWaterCooling is not translated by itself but in the parent HeatPumpAirToWater");
break;
}
case openstudio::IddObjectType::OS_HeatPump_AirToWater_Heating: {
// no-op, just Log a Trace message
LOG(Trace, "HeatPumpAirToWaterHeating is not translated by itself but in the parent HeatPumpAirToWater");
break;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid "Unknown IddObjectType" warning

Comment on lines 473 to 493
return getAutosizedValue("Design Size Rated Air Volume Flow Rate in Heating Mode", "m3/s");
}

boost::optional<double> HeatPumpAirToWater_Impl::autosizedRatedWaterFlowRateinHeatingMode() const {
return getAutosizedValue("Design Size Load Side Volume Flow Rate", "m3/s", "HeatPump:AirToWater:Heating");
return getAutosizedValue("Design Size Rated Water Volume Flow Rate in Heating Mode", "m3/s");
}

boost::optional<double> HeatPumpAirToWater_Impl::autosizedRatedAirFlowRateinCoolingMode() const {
return getAutosizedValue("Design Size Source Side Volume Flow Rate", "m3/s", "HeatPump:AirToWater:Cooling");
return getAutosizedValue("Design Size Rated Air Volume Flow Rate in Cooling Mode", "m3/s");
}

boost::optional<double> HeatPumpAirToWater_Impl::autosizedRatedWaterFlowRateinCoolingMode() const {
return getAutosizedValue("Design Size Load Side Volume Flow Rate", "m3/s", "HeatPump:AirToWater:Cooling");
return getAutosizedValue("Design Size Rated Water Volume Flow Rate in Cooling Mode", "m3/s");
}

boost::optional<double> HeatPumpAirToWater_Impl::autosizedRatedHeatingCapacity() const {
return getAutosizedValue("Design Size Rated Heating Capacity", "W");
}

boost::optional<double> HeatPumpAirToWater_Impl::autosizedRatedCoolingCapacity() const {
return getAutosizedValue("Design Size Rated Cooling Capacity", "W");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update SQL queries

Comment on lines +351 to +357
boost::optional<double> HeatPumpAirToWaterCooling_Impl::autosizedRatedCoolingCapacity() const {
boost::optional<double> result;
if (auto awhp_ = heatPumpAirToWater()) {
result = awhp_->autosizedRatedCoolingCapacity();
}
return result;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Cooling (/Heating) component queries the AWHP to get the SQL value

Comment on lines +362 to +365
auto speeds = this->speeds();
if (!speeds.empty()) {
speeds.back().autosize(); // Only need/can autosize the last (highest) speed
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in autosize, this is weird, but I autosize the last speed.

The way Model::autosize/applySizingValues works is that it does it for HVACComponent, and the speed data is not one and we do not want to add an explicit case because none of the speeds should be autosized except the last (highest) one

Comment on lines +377 to +382
if (boost::optional<double> val_ = autosizedRatedCoolingCapacity()) {
auto speeds = this->speeds();
if (!speeds.empty()) {
speeds.back().setRatedCoolingCapacity(*val_); // Only need/can autosize the last (highest) speed
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same in applySizingValue

Comment on lines +91 to +117
boost::optional<double> result;
auto awhp_ccs = heatPumpAirToWaterCoolings();
if (awhp_ccs.empty()) {
return result;
}
size_t n_found = 0;
for (const auto& awhp_cc : awhp_ccs) {
// Check needed because could be the booster speed
if (awhp_cc.speeds().empty()) {
continue;
}
// It has to be the last speed
if (awhp_cc.speeds().back().handle() != this->handle()) {
continue;
}
if (n_found == 0) {
// Setting the first one only
result = awhp_cc.autosizedRatedCoolingCapacity();
}
++n_found;
}
if (n_found > 1) {
LOG(Warn, briefDescription() << " is used as the highest speed in multiple HeatPumpAirToWaterCooling objects, "
"returning the autosized value from the first one only.");
}

return result;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HeatPumpAirToWaterCoolingSpeedData_Impl::autosizedRatedCoolingCapacity

We only grab it from sql if it's the LAST speed

@jmarrec
Copy link
Collaborator Author

jmarrec commented Nov 14, 2025

This is pretty much ready, except there are moving pieces on E+ side:

But I got the OpenStudio-resources tests ready (new rb + python tests, and add it to autosize_hvac)

jmarrec added a commit to NREL/OpenStudio-resources that referenced this pull request Nov 14, 2025
@jmarrec jmarrec merged commit 1384a7d into develop Nov 14, 2025
3 of 6 checks passed
@jmarrec jmarrec deleted the v25.2.0-IOFreeze-5490_HeatPumpAirToWater branch November 14, 2025 15:48
@joseph-robertson joseph-robertson mentioned this pull request Dec 18, 2025
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component - HVAC component - IDF Translation component - Model Enhancement Request Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E+ 25.2.0: Wrap HeatPump:AirToWater

5 participants