-
Notifications
You must be signed in to change notification settings - Fork 192
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
V23.2.0-IOFreeze - wrap DistrictHeating:Steam
and rename DistrictHeating
to DistrictHeatingWater
#4972
V23.2.0-IOFreeze - wrap DistrictHeating:Steam
and rename DistrictHeating
to DistrictHeatingWater
#4972
Conversation
….2.0-IOFreeze-RenameDistrictHeating Resolve conflicts manually
Add python docstrings for methods we dynamically add use a helper macro to define an alias with a deprecation warning for a class, mapping to old one
DistrictHeating:Steam
and rename DistrictHeating
to DistrictHeatingWater
```ruby w = OpenStudio::Workspace.load('in.idf').get() w.save('in.idf', true) ```
```shell $os_build_rel2/Products/openstudio generate.rb ```
* [#4972](https://github.com/NREL/OpenStudio/pull/4972) - V23.2.0-IOFreeze - wrap `DistrictHeating:Steam` and rename `DistrictHeating` to `DistrictHeatingWater` | ||
* The `DistrictHeating` class (and related Model getters such as `Model::getDistrictHeatings`) are deprecated but kept for backward Compatibility for now. |
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.
Add to release notes
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.
Update deprecated_methods.csv, including stuff already done on other branches / PRs
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.
Re-regenerate allFuelTypes/in.idf. I did this in two commits: reformat, then re-regeneate. See the actual changes in 6a402c4
|
||
OS:DistrictHeating, | ||
OS:DistrictHeating:Water, |
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.
Renamed IDD object
%define MODELOBJECT_ALIAS_CLASS_DEPRECATED_AT(_oldName, _newName, _deprecatedAtVersionMajor, _deprecatedAtVersionMinor, _deprecatedAtVersionPatch) | ||
#if defined SWIGRUBY | ||
MODELOBJECT_ALIAS_CLASS_DEPRECATED_AT_EXTENSION(_oldName, _newName, _deprecatedAtVersionMajor, _deprecatedAtVersionMinor, _deprecatedAtVersionPatch) | ||
#endif | ||
|
||
#if defined SWIGPYTHON | ||
MODELOBJECT_ALIAS_CLASS_DEPRECATED_AT_EXTENSION(_oldName, _newName, _deprecatedAtVersionMajor, _deprecatedAtVersionMinor, _deprecatedAtVersionPatch) | ||
#endif | ||
%enddef |
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.
New macro. Uses two extensions: one for ruby, one for python.
case openstudio::IddObjectType::OS_DistrictHeating_Water: { | ||
return PlantSizingType::HOTWATER; | ||
} | ||
case openstudio::IddObjectType::OS_DistrictHeating_Steam: { |
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.
That was missing from #4954. Same in FTPlantEquipmentOperationSchemes
// Name | ||
IdfObject idfObject = createRegisterAndNameIdfObject(IddObjectType::DistrictHeating_Water, modelObject); | ||
|
||
// Inlet Node Name | ||
if (auto node_ = modelObject.inletModelObject()) { | ||
idfObject.setString(DistrictHeating_WaterFields::HotWaterInletNodeName, node_->nameString()); | ||
} | ||
|
||
// Outlet Node Name | ||
if (auto node_ = modelObject.outletModelObject()) { | ||
idfObject.setString(DistrictHeating_WaterFields::HotWaterOutletNodeName, node_->nameString()); | ||
} | ||
|
||
// Nominal Capacity | ||
if (modelObject.isNominalCapacityAutosized()) { | ||
idfObject.setString(DistrictHeating_WaterFields::NominalCapacity, "Autosize"); | ||
} else if (auto value_ = modelObject.nominalCapacity()) { | ||
idfObject.setDouble(DistrictHeating_WaterFields::NominalCapacity, *value_); | ||
} | ||
|
||
// Capacity Fraction Schedule Name | ||
if (auto capacityFractionSchedule_ = modelObject.capacityFractionSchedule()) { | ||
if (auto sch_ = translateAndMapModelObject(*capacityFractionSchedule_)) { | ||
idfObject.setString(DistrictHeating_WaterFields::CapacityFractionScheduleName, sch_->nameString()); | ||
} | ||
} | ||
|
||
return idfObject; |
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 cleaned up the FTs too
include OpenStudio::Model | ||
|
||
m = Model.new | ||
|
||
dh = DistrictHeating.new(m) | ||
dh.setName("My DistrictHeating") | ||
p = PlantLoop.new(m) | ||
p.addSupplyBranchForComponent(dh) | ||
dh.inletModelObject.get.setName("DH Inlet") | ||
dh.outletModelObject.get.setName("DH Outlet") | ||
dh.setNominalCapacity(1000.0) |
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.
VT test file
TEST_F(OSVersionFixture, update_3_6_1_to_3_7_0_DistrictHeating) { | ||
openstudio::path osmPath = resourcesPath() / toPath("osversion/3_7_0/test_vt_RenameDistrictHeating.osm"); | ||
osversion::VersionTranslator vt; | ||
boost::optional<model::Model> model_ = vt.loadModel(osmPath); | ||
ASSERT_TRUE(model_) << "Failed to load " << osmPath; | ||
|
||
openstudio::path outPath = osmPath.parent_path() / toPath(osmPath.stem().string() + "_updated" + osmPath.extension().string()); | ||
model_->save(outPath, true); | ||
|
||
std::vector<WorkspaceObject> dhs = model_->getObjectsByType("OS:DistrictHeating:Water"); | ||
ASSERT_EQ(1u, dhs.size()); | ||
const auto& dh = dhs.front(); | ||
|
||
EXPECT_EQ("My DistrictHeating", dh.nameString()); | ||
ASSERT_TRUE(dh.getTarget(2)); | ||
EXPECT_EQ("DH Inlet", dh.getTarget(2)->getTarget(OS_ConnectionFields::SourceObject)->nameString()); | ||
ASSERT_TRUE(dh.getTarget(3)); | ||
EXPECT_EQ("DH Outlet", dh.getTarget(3)->getTarget(OS_ConnectionFields::TargetObject)->nameString()); | ||
EXPECT_EQ(1000.0, dh.getDouble(4).get()); |
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.
VT test
if (energyPlusBuildSHA() == "c854ba6bfe") { | ||
GTEST_SKIP() << "\nFIXME: Skip the checks for DistrictHeatingSteam pending new E+ package after https://github.com/NREL/EnergyPlus/pull/10212\n"; | ||
} else { | ||
EXPECT_TRUE(false) << "Please come remove the special check now that a new E+ package is out"; | ||
EXPECT_NEAR(346.90, *(sqlFile3.districtHeatingSteamExteriorEquipment()), 2); | ||
EXPECT_NEAR(346.90, *(sqlFile3.districtHeatingSteamTotalEndUses()), 2); | ||
EXPECT_NEAR(725.33, *(sqlFile3.districtHeatingExteriorEquipment()), 2); | ||
EXPECT_NEAR(725.33, *(sqlFile3.districtHeatingTotalEndUses()), 2); | ||
} |
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.
Skip a portion of the test. With a check that will fail as soon as a new E+ package is out, so we don't forget to remove the special check here.
…edule) The grand protector of the API has spoken! cf @kbenne 's comment here: #4954 (comment)
I got pwned by making the `discreteSchHandleStr` a static string inside the lambda: try to VT two models with the same VersionTranslator instance and you're screwed. Thanks tests!
…OFreeze-RenameDistrictHeating
4c61f9e
to
57fea8f
Compare
CI Results for 57fea8f:
|
@kbenne @joseph-robertson I'm going to merge this one to the V23-2-0IOFreeze branch now, but would still welcome a review, any problems can be fixed on the main IOFreeze branch. Why merging now?
|
Pull request overview
Supersedes #4954
DistrictCooling
DistrictHeating:Water
DistrictHeating:Steam
Additionally, rename the class
DistrictHeating
toDistrictHeatingWater
(and IDD too) and provide an alias and model getters for backward compat, issuing a deprecation warning.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.