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

Implement new slinky ground heat exchanger simulation model #4692

Merged
merged 36 commits into from
Mar 3, 2015

Conversation

Myoldmopar
Copy link
Member

Making this a PR for convenience for conversation.

Matt Mitchell added 4 commits January 20, 2015 14:37
@DeadParrot
Copy link
Contributor

@mmAtTs Good stuff but why the this->member usage? It is normally not needed within methods to disambiguate and just adds visual clutter. Where you have local variables with the same name as members it would be best to rename the locals to avoid silently hiding the members and confusing future developers.

@Myoldmopar
Copy link
Member Author

That was my doing @DeadParrot. Although some of the devs have an understanding of what an instance is, some don't. Putting the this pointer in there was my way of being clear when referencing a class instance variable or method. I'm sure the compiler doesn't care and creates the same assembly either way, so it shouldn't make any difference on performance. I won't take any hard stand on the issue, just keep in mind the status of the development team when discussing it.

@DeadParrot
Copy link
Contributor

@Myoldmopar OK. I agree that it makes no difference to the compiled code: this issue is whether it helps users more than it hinders them. I can see some points in its favor. The factors I see are:

  • Visual clutter that makes it harder to see what is going on (and could push lines to be wider than screen)
  • Didn't have an analog of this-> in Fortran so it shouldn't be needed as a transitional crutch
  • It helps Intellisense work better so that is something
  • Other than that good IDEs should know a variable is the local class member without this->
  • If you refactor a function into a different class or to a non-class function (happens fairly often) you have to go remove all the old this-> stuff.
  • Using this-> is probably more comfortable for Python-istas (but the self use in Python is considered a language flaw by many).
  • If you have a naming ambiguity that requires this-> then renaming the non-member variable is probably a good idea.
  • I believe using this-> when not needed is not as common but certainly there are those who like it: http://stackoverflow.com/questions/6779645/use-of-this-keyword-in-c

It would be a good idea to set up some standards before the code becomes a mish-mosh of different styles. C++ offers too much stylistic freedom to let everyone do their own thing.

Matt Mitchell added 3 commits January 29, 2015 16:12
Still has issue where QGLHE is not initialized at the beginning of each environment. I haven't been able to track this bug down yet.
@nrel-bot
Copy link

nrel-bot commented Feb 2, 2015

@Myoldmopar @lgentile it has been 7 days since this pull request was last updated.

Matt Mitchell added 4 commits February 4, 2015 11:58
…roundHeatExchanger into calcGroundHeatExchanger because a separate function to update the object was no longer needed.
Conflicts:
	src/EnergyPlus/GroundHeatExchangers.cc
Modifying idd/Energy+.idd.in
Adding GSHP:Slinky to the DataPlant.cc and PlantManger.cc, among others.
Some cleanup related to merging with develop that was missed earlier.
@nrel-bot
Copy link

@mmAtTs @Myoldmopar @lgentile it has been 7 days since this pull request was last updated.

@mitchute
Copy link
Collaborator

@Myoldmopar could you look at this briefly and let me know if I'm headed in a good direction WRT unit testing. I'm pretty much done implementing the g-function generation code and am planning to move on to GLHESlinky::calcGroundHeatExchanger tomorrow.


Real64
GLHESlinky::distance(
int const m,
Copy link
Member Author

Choose a reason for hiding this comment

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

Random note; some of these function signatures should have indented arguments. Others already do. Just noting.

@Myoldmopar
Copy link
Member Author

@mmAtTs Holy shoot this is looking so good, it's exciting.

With the performance PR merged in, you are now out of date with develop -- again -- sorry -- but it had to happen sometime. Anyway, I can assist with resolving conflicts. OK, I resolved them and pushed with beef0f7. The conflicts were pretty minor so just take a quick pass at the updated Files Changed tab and make sure nothing looks goofy.

As for your comment, you were saying you were still passing indices into functions? Could you give an example?

sqrtAlphaT = std::sqrt( diffusivityGround * t );

distance = distToCenter( m, n, m1, n1 );
sqrtDistDepth = std::sqrt( std::pow( distance, 2.0 ) + 4 * std::pow( coilDepth, 2.0 ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Performance note: pow_2( x ) is faster than std::pow( x, 2 ) and should be preferred. Yes, these really add up to matter in some of our profiles. We have pow_2 through pow_9 and a few others in ObjexxFCL/Fmath.hh.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @DeadParrot, your eagle eyes are very helpful! I do have a performance sub-checklist on my review checklist, so I've added this as another thing to watch for in PRs.

@mitchute
Copy link
Collaborator

@Myoldmopar @DeadParrot thanks for the tips. I will get it cleaned up.

@mitchute
Copy link
Collaborator

@Myoldmopar Currently the arrays holding the (X,Y,Z) coordinates for each ring live here at the object level. We're looping through all possible combinations of rings here and then within that, to get the distances between any pair of rings, I just pass the correct indices through several functions to the distance function. Would it be easier for unit testing purposes to just pass the (X,Y,Z) center values for each pair of rings through, or can we make this work.

@DeadParrot
Copy link
Contributor

@Myoldmopar to clarify how the "member array" hack works in ObjexxFCL, because name() is already set up as a member for all 1D arrays verticalGLHE.name() should work fine without any customization required specific to verticalGLHE, as long as its elements have a name std::string member.

We may want to discourage new use of member array syntax but for common usage such as name() it should work "out of the box". When someone wants to expose a member with a name not already set up then it would require the (discouraged) addition to the appropriate *.Projects.MArray.hh file.

@Myoldmopar Myoldmopar added the NewFeature Includes code to add a new feature to EnergyPlus label Feb 22, 2015
Matt Mitchell added 2 commits February 23, 2015 11:11
… platforms.

Still needed:
-Final g-function validation
-Final slinky model validation.
-Current relative diffs for the vertical borehole models are around 10^-3. One final pass to track those down, if possible.
-Potentially the most important issue of all: resolving why "DisplayString" is not printing "Calculating g-Functions" to the terminal.
@Myoldmopar
Copy link
Member Author

Looks like it might still be having trouble with Name. I will look tomorrow morning, but it might be that the .Name() is still being used inside the sim routine. Maybe. Just guessing while on my phone...

@Myoldmopar
Copy link
Member Author

@mmAtTs OK, I got it building with commit beef740. I also cleanup up some unneeded trailing semicolons. I didn't actually run it, but it should at least build now. It is very interesting that Windows seemed to build that just fine.

One thing to note is that in the Sim function, we won't be able to do the string comparison to check which type we have; it will be too slow. I think it's probably time to bite the bullet and store pointers to the base class in a single array rather than two separate arrays, one per type. Let's chat today about it.

@nrel-bot
Copy link

nrel-bot commented Mar 3, 2015

@mmAtTs @Myoldmopar @lgentile it has been 7 days since this pull request was last updated.

@Myoldmopar
Copy link
Member Author

@mmAtTs the test results look good, just tiny diff's in a few files, I'm guessing similar to what you were seeing locally. I think this is ready to merge, let me know if you were all doing anything else.

@mitchute
Copy link
Collaborator

mitchute commented Mar 3, 2015

@Myoldmopar let's hold off for a little bit. I just tracked down the source of the tiny diffs. I'm going to push that right now. Pending CI and any recommendations from you or others on the unit tests, it should be good.

Matt Mitchell added 4 commits March 3, 2015 07:01
@Myoldmopar
Copy link
Member Author

@mmAtTs Yay! 100% passed! 👍

I'll let CI make a pass at 10d0493 and this should drop in after. Great work.

@Myoldmopar
Copy link
Member Author

Oh, @mmAtTs the CI results might turn red due to diffs since develop has moved since your commit. I'll look over the results and deem whether we need to merge develop or not.

Myoldmopar added a commit that referenced this pull request Mar 3, 2015
The diffs are all the same from the commit earlier into develop; nothing to do with your branch.  Merging in now.  Thanks for this @mmAtTs.
@Myoldmopar Myoldmopar merged commit c2c2631 into develop Mar 3, 2015
@Myoldmopar Myoldmopar deleted the 1540218-SlinkyGroundHX branch March 3, 2015 20:11
@Myoldmopar Myoldmopar changed the title 1540218 slinky ground hx Implement new slinky ground heat exchanger simulation model Mar 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NewFeature Includes code to add a new feature to EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants