Skip to content
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 ZoneProperty:UserViewFactors:bySurfaceName object #3671

Closed
wants to merge 18 commits into from

Conversation

joseph-robertson
Copy link
Collaborator

@joseph-robertson joseph-robertson commented Sep 9, 2019

Addresses #3664.

Design doc: https://docs.google.com/document/d/1P8O6GRQAZda5kK_2Qu2CJRkBGUxTIhJwvJ0-JNpTU1A/edit#heading=h.c285d1mdhew5

TODO:

  • Update OpenStudio.idd
  • Create source code files
  • Update all cmakelists
  • Create FT
  • Create RT
  • Check ostream on view factor
  • Create test for RT
  • Check RT in app
  • Create unit tests
  • Create regression tests
  • Check FT
  • Check simulation runs successfully

@joseph-robertson joseph-robertson self-assigned this Sep 9, 2019
@joseph-robertson
Copy link
Collaborator Author

joseph-robertson commented Sep 10, 2019

@jmarrec I tried testing RT in the app, and it didn't appear to be working. I'm currently writing a test for RT, but perhaps in the meantime you could take a look at the RT cpp file for this?

@joseph-robertson joseph-robertson added this to the OpenStudio 2.9.0 milestone Sep 11, 2019
@joseph-robertson joseph-robertson added the Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. label Sep 11, 2019
@jmarrec
Copy link
Collaborator

jmarrec commented Sep 11, 2019

@joseph-robertson I can work on this tomorrow morning. What in the RT isnt working? Is it not translating the object at all or it's failing?

@joseph-robertson
Copy link
Collaborator Author

@jmarrec I got the RT working, so don't worry about that. This is ready for your review.

Copy link
Collaborator

@jmarrec jmarrec left a comment

Choose a reason for hiding this comment

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

This is great work @joseph-robertson, very thorough. I've made a few changes that I explained in the code as comments (some might be considered pedantic probably!), hopefully they make sense. I clicked "Resolved" on the ones I did address directly, so you'll have to expand them.

The only thing worth considering anymore is in this comment: #3671 (diff), especially the naming convention part. I am fine you just say it's better this way (hence why I set the status to "Approve")

(Out of curiosity: I have been wondering one thing: why was this chosen to be placed at the ThermalZone level and not the Space level? I honestly didn't take the time to carefully evaluate both options, and I assume you guys have)

ViewFactor(const InternalMass& fromInternalMass, const Surface& toSurface, double viewFactor);
ViewFactor(const InternalMass& fromInternalMass, const SubSurface& toSubSurface, double viewFactor);

boost::optional<Surface> fromSurface() const;
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Perhaps we should also add a ModelObject toSurfaceAsModelObject() const and a ModelObject fromSurfaceAsModelObject() const. You could then use that in the ostream overload to avoid testing all cases too, as well as in the addViewFactor(const ViewFactor&) and make your code dryer.
    You'd probably also change the logic though, and use a single ModelObject m_fromSurface and ModelObject m_toSurface as members of the ViewFactor class.
    (I do not feel very strongly about either design choice)

  1. The naming conventions do not match the similar object SurfacePropertyConvectionCoefficients which uses:
  ModelObject surfaceAsModelObject() const;
  boost::optional<Surface> surfaceAsSurface() const;
  boost::optional<SubSurface> surfaceAsSubSurface() const;
  boost::optional<InternalMass> surfaceAsInternalMass() const;

I think it might be beneficial to match this naming convention so our API is more predictable.

@joseph-robertson @shorowit Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with #2.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So we want

boost::optional<Surface> fromSurfaceAsSurface() const;
boost::optional<SubSurface> fromSurfaceAsSubSurface() const;

boost::optional<Surface> toSurfaceAsSurface() const;
boost::optional<SubSurface> toSurfaceAsSubSurface() const;

etc?

Copy link
Contributor

Choose a reason for hiding this comment

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

Works for me.

openstudiocore/resources/model/OpenStudio.idd Show resolved Hide resolved
@@ -135,6 +135,15 @@ class ExteriorLoadInstance;
}
};

%extend openstudio::model::ViewFactor {
// Use the overloaded operator<< for string representation
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@shorowit
Copy link
Contributor

shorowit commented Sep 12, 2019

(Out of curiosity: I have been wondering one thing: why was this chosen to be placed at the ThermalZone level and not the Space level? I honestly didn't take the time to carefully evaluate both options, and I assume you guys have)

In EnergyPlus, ultimately every combination of surfaces in a thermal zone needs a view factor. If you set view factors on a space level, you wouldn't be able to define view factors between two surfaces of different spaces within a given thermal zone. Granted these view factors would probably often be zero, but I'd hate to make OpenStudio more constrained than EnergyPlus for situations where the extra flexibility is desired.

@jmarrec
Copy link
Collaborator

jmarrec commented Sep 12, 2019

(Out of curiosity: I have been wondering one thing: why was this chosen to be placed at the ThermalZone level and not the Space level? I honestly didn't take the time to carefully evaluate both options, and I assume you guys have)

In EnergyPlus, ultimately every combination of surface in a thermal zone needs a view factor. If you set view factors on a space level, you wouldn't be able to define view factors between two surfaces of different spaces within a given thermal zone. Granted these view factors would probably often be zero, but I'd hate to make OpenStudio more constrained than EnergyPlus for situations where the extra flexibility is desired.

That was one thing I noticed, right now there's no checks whatsoever that are done to ensure that the to/from objects are actually part of the thermal zone referenced. I didn't bring it up because it's probably not going to be used much by lambda users.

@shorowit
Copy link
Contributor

That really ought to be added -- checks in the addViewFactor methods that both the from/to surfaces are in the thermal zone that the view factors are being added for.

@shorowit
Copy link
Contributor

Are there checks if someone adds two view factors for the same combination of surfaces?

@joseph-robertson
Copy link
Collaborator Author

Sure aren't. I'll see if I can add.

jmarrec added a commit to NREL/OpenStudio-resources that referenced this pull request Sep 13, 2019
…dd ALL combinations (numSurfaces^2)

Follow up #79
@jmarrec
Copy link
Collaborator

jmarrec commented Sep 13, 2019

Closing this PR as superseded by #3675 (we diverged at some point and I wanted to avoid force pushing)

@jmarrec jmarrec closed this Sep 13, 2019
@jmarrec jmarrec deleted the user-view-factors branch September 16, 2019 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - Model 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.

3 participants