-
Notifications
You must be signed in to change notification settings - Fork 193
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
Fix #4692 - Modify Model::load to use the VersionTranslator #4923
Conversation
@@ -21,8 +21,11 @@ | |||
#include <utilities/idd/IddEnums.hxx> | |||
#include <utilities/idd/OS_Version_FieldEnums.hxx> | |||
|
|||
#include "../osversion/VersionTranslator.hpp" |
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.
So, there's one thing I'm not sure about here. This ends up referencing the osversion::VersionTranslator, when the osversion::VersionTranslator itself references the model/Schedule.hpp (for some 0.8.x translation). osversion depends on model at the model. But all of them are OBJECT libraries anyways, so that looks to link just fine in the end (locally at least, we'll see on CI)... @kbenne thoughts please?
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.
Yeah I actually mentioned this circular thing at our last iteration meeting. I said I thought this feature was straightforward except for this little ciruclar wrinkle, but I think it is fine. So I say if we don't have any linking issues then great, it works for me.
if (!openstudio::filesystem::is_regular_file(osmPath)) { | ||
LOG(Warn, "Path is not a valid file: " << osmPath); | ||
return boost::none; | ||
} | ||
openstudio::osversion::VersionTranslator vt; | ||
boost::optional<openstudio::model::Model> model_ = vt.loadModel(osmPath); | ||
if (!model_) { | ||
LOG(Warn, "Failed to load model at " << osmPath); | ||
return boost::none; | ||
} | ||
// Load the workflow.osw in the model's companion folder | ||
const openstudio::path workflowJSONPath = getCompanionFolder(osmPath) / toPath("workflow.osw"); | ||
if (exists(workflowJSONPath)) { | ||
if (boost::optional<WorkflowJSON> workflowJSON_ = WorkflowJSON::load(workflowJSONPath)) { | ||
model_->setWorkflowJSON(*workflowJSON_); | ||
} | ||
} | ||
|
||
return result; | ||
return model_; |
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 load method using the VersionTranslator.
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.
It sure was annoying to not have this feature all of these years. Thank you for fixing it!
CI Results for 0e36453:
|
@@ -21,8 +21,11 @@ | |||
#include <utilities/idd/IddEnums.hxx> | |||
#include <utilities/idd/OS_Version_FieldEnums.hxx> | |||
|
|||
#include "../osversion/VersionTranslator.hpp" |
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.
Yeah I actually mentioned this circular thing at our last iteration meeting. I said I thought this feature was straightforward except for this little ciruclar wrinkle, but I think it is fine. So I say if we don't have any linking issues then great, it works for me.
if (!openstudio::filesystem::is_regular_file(osmPath)) { | ||
LOG(Warn, "Path is not a valid file: " << osmPath); | ||
return boost::none; | ||
} | ||
openstudio::osversion::VersionTranslator vt; | ||
boost::optional<openstudio::model::Model> model_ = vt.loadModel(osmPath); | ||
if (!model_) { | ||
LOG(Warn, "Failed to load model at " << osmPath); | ||
return boost::none; | ||
} | ||
// Load the workflow.osw in the model's companion folder | ||
const openstudio::path workflowJSONPath = getCompanionFolder(osmPath) / toPath("workflow.osw"); | ||
if (exists(workflowJSONPath)) { | ||
if (boost::optional<WorkflowJSON> workflowJSON_ = WorkflowJSON::load(workflowJSONPath)) { | ||
model_->setWorkflowJSON(*workflowJSON_); | ||
} | ||
} | ||
|
||
return result; | ||
return model_; |
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.
It sure was annoying to not have this feature all of these years. Thank you for fixing it!
Pull request overview
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.