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

Design conditions in OS:EpwFile #3086

Merged
merged 7 commits into from
May 21, 2018
Merged

Design conditions in OS:EpwFile #3086

merged 7 commits into from
May 21, 2018

Conversation

joseph-robertson
Copy link
Collaborator

No description provided.

@macumber
Copy link
Contributor

macumber commented Apr 4, 2018

@jasondegraw FYI

@joseph-robertson and @shorowit what are you planning to do with these methods? Simply avoid having to read the DDY file? Is data in the DDY file duplicated in the EPW file?

@shorowit
Copy link
Contributor

shorowit commented Apr 4, 2018

Yes, we'd like to avoid having to read the DDY (so that our users don't have to supply it alongside the EPW). I don't know if all the data in the DYY is duplicated in the EPW header, but it has everything we need.

@macumber
Copy link
Contributor

macumber commented Apr 4, 2018

And you will be making some method to take these values and create SizingPeriod:WeatherFileDays or SizingPeriod:WeatherFileConditionType objects with them? I have not used these objects very much, I don't know if they are even wrapped.

Or is there enough info for you to make SizingPeriod:DesignDay objects directly? Should we add helper methods to the Model API or are you planning to just do this in a measure?

@shorowit
Copy link
Contributor

shorowit commented Apr 4, 2018

No, we use the values in our own Manual J sizing calculations to hardsize coil objects, etc. We're not using E+ autosizing or sizing objects.

@joseph-robertson joseph-robertson changed the title Design conditions in OS:EpwFile. Design conditions in OS:EpwFile Apr 4, 2018
@macumber
Copy link
Contributor

Is this done @joseph-robertson ?

@joseph-robertson
Copy link
Collaborator Author

joseph-robertson commented Apr 11, 2018

Yes @macumber. But I've only functionally tested using one epw file (vs all of them per your suggestion- ideas on how/where to do that?).

@jasondegraw jasondegraw self-requested a review April 27, 2018 15:07
Copy link
Member

@jasondegraw jasondegraw left a comment

Choose a reason for hiding this comment

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

I am concerned about precision issues cropping up in some potential uses. If this object is used to directly create other objects, it could end up being a string to double to string situation. So we will need to be careful about that. With that said, the API looks pretty good, so it's good to merge.

@macumber macumber added the Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. label May 1, 2018
// Could do a warning message here
return boost::none;
}
return boost::optional<std::string>(getUnits(id));
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just return getUnits(id).

Copy link
Collaborator Author

@joseph-robertson joseph-robertson May 8, 2018

Choose a reason for hiding this comment

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

@macumber I'm confused why this wouldn't be an optional. Why does EpwDataPoint::getUnitsByName(...) return an optional then?

Copy link
Contributor

Choose a reason for hiding this comment

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

The result is an optional, you just don't need to explicitly construct one like this. If you return a string, the compiler can implicitly convert that to an optional string.

@@ -893,6 +1344,219 @@ namespace openstudio{
return boost::none;
}

boost::optional<double> EpwDesignCondition::getFieldByName(const std::string &name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be getFieldValueByName? getFieldByName seems like it would be returning EpwDesignField(name);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again, mimicking what EpwDataPoint does.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, to me getFieldByName would return a "field" which is basically an index. This is returning a "field value" so would be better as getFieldValueByName. If that is the naming convention in place we can stick with it, just trying to give you my feedback.

/** Create an EpwDesignCondition from an EPW-formatted string */
static boost::optional<EpwDesignCondition> fromDesignConditionsString(const std::string &line);
/** Create an EpwDesignCondition from a list of EPW designs as strings */
static boost::optional<EpwDesignCondition> fromDesignConditionsStrings(const std::vector<std::string> &list);
Copy link
Contributor

Choose a reason for hiding this comment

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

Need a toDesignConditionsString() method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No

LOG(Error, "Expected at least 70 design condition fields rather than the " << split.size() << " fields in the EPW file '" << m_path << "'");
return false;
}
else if (split.size() > 70) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you check that nDesignConditions and split.size agree?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes you should check them otherwise you'll get out of index errors below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will implement a check for making sure that nDesignConditions agrees with the expected length of the split array.

return boost::none;
}

bool EpwFile::translateToWth(openstudio::path path, std::string description)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not me.

return false;
}

fp << "WeatherFile ContamW 2.0\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this from @joseph-robertson or @jasondegraw ?

Copy link
Member

Choose a reason for hiding this comment

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

That's from me... some years ago.

openstudio::DateTime dateTime = data()[0].dateTime();
openstudio::Time dt = timeStep();
dateTime -= dt;
epwstrings[0] = std::to_string(dateTime.date().year());
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to check size before writing to index

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants