Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

#4077 Remove name field from common HVAC data objects that are not visible to user #4081

Merged
merged 11 commits into from
Apr 6, 2021

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Sep 18, 2020

Pull request overview

First pass as #4077 for some benchmarking and co.

Please see timings on #4077 directly, but here are the sum by test type / timing type:

image

So this is not exactly faster. My implementation can probably be improved though.

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • 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: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Checked behavior in OpenStudioApplication, adjusted policies as needed (src/openstudio_lib/library/OpenStudioPolicy.xml)
  • 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

@jmarrec jmarrec requested a review from kbenne September 18, 2020 13:22
@jmarrec jmarrec self-assigned this Sep 18, 2020
@jmarrec jmarrec added component - HVAC component - Model Enhancement Request Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Sep 18, 2020
Comment on lines +316 to +323
} else {
std::string n = name();
if (n == "OS:PortList") {
result.push_back("ConnectionObject");
result.push_back("PortLists");
} else if (n == "OS:Connection") {
result.push_back("ConnectionNames");
}
Copy link
Collaborator Author

@jmarrec jmarrec Sep 18, 2020

Choose a reason for hiding this comment

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

Hardcoded references in IddObject instead of on the name field in the OpenStudio.idd

Comment on lines 1240 to 1243
if ((candidate.iddObject().type() == openstudio::IddObjectType::OS_Connection) ||
(candidate.iddObject().type() == openstudio::IddObjectType::OS_PortList)) {
continue;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

First workaround I had to do that I didn't anticipate. WorkspaceObject_Impl::uniquelyIdentifiableByName would crash at OS_ASSERT(candidateName)

Comment on lines +215 to +220
if (auto s = oTarget->name()) {
return s.get();
} else {
// Fall back to handle if it doesn't have a name
return openstudio::toString(oTarget->handle());
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Second workaround I had to do that I didn't anticipate. IdfExtensibleGroup::fields() would call this one and crash because it doesn't have a name.

Comment on lines 6287 to 6304
} else if ((iddname == "OS:Connection") || (iddname == "OS:PortList")) {
// Deleted the 'Name' field
auto iddObject = idd_3_1_0.getObject(iddname);
IdfObject newObject(iddObject.get());
for (size_t i = 0; i < object.numFields(); ++i) {
if ((value = object.getString(i))) {
if (i < 1) {
newObject.setString(i, value.get());
} else if ( i == 1 ) {
// Deleted the name: no-op
} else {
newObject.setString(i-1, value.get());
}
}
}
m_refactored.push_back(RefactoredObjectData(object, newObject));
ss << newObject;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

VersionTranslation, straightforward

Comment on lines 18432 to 18435
A2, \field Name
\type alpha
\reference ConnectionNames
A3, \field Source Object
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed name field in IDD

@kbenne
Copy link
Contributor

kbenne commented Mar 1, 2021

@jmarrec what would you like to do with this? If think the changes are good, but I guess we didn't get the performance bump we were hoping for. Still I think if the conflicts are resolved I think this could be merged.

jmarrec added 2 commits March 2, 2021 10:44
Conflicts:
	src/model/Connection.cpp
	src/model/PortList.cpp
	src/osversion/VersionTranslator.cpp
@jmarrec
Copy link
Collaborator Author

jmarrec commented Mar 2, 2021

@kbenne I resolved conflicts. Let's see if CI has a problem with it or not.

@jmarrec jmarrec marked this pull request as ready for review March 4, 2021 17:43
@jmarrec jmarrec added this to the OpenStudio SDK 3.2.0 milestone Mar 4, 2021
@kbenne
Copy link
Contributor

kbenne commented Mar 5, 2021

sorry. @jmarrec can you resolve conflicts again?

@jmarrec
Copy link
Collaborator Author

jmarrec commented Mar 5, 2021

@kbenne Resolvee, from github on web, so hopefully I didn't mess it up.

Edit: Diff Looks fine I think it should be ok.

@tijcolem tijcolem merged commit ddfa987 into develop Apr 6, 2021
@tijcolem tijcolem deleted the 4077_RemoveNameFromHVACConnections branch April 6, 2021 01:38
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
component - HVAC 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.

Remove name field from common HVAC data objects that are not visible to user
4 participants