-
Notifications
You must be signed in to change notification settings - Fork 4
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
Resolves #135 Add in option to support epJSON workflows #136
Conversation
Converted to draft as need to add test cases. |
Added test for epJSON. Most of these will fail until NREL/OpenStudio#4419 is resolved. |
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.
look great! 🔥
# before this can be changed. | ||
if @options[:epjson] | ||
@logger.info 'Beginning the translation to epJSON' | ||
@registry[:time_logger]&.start('Translating to EnergyPlus epJSON') |
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.
nice use of the &.
operator!
|
||
# Run using epJSON if @options[:epjson] true, otherwise use ID | ||
if @options[:epjson] | ||
command = popen_command("\"#{energyplus_exe}\" in.epJSON 2>&1") |
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.
is the extension really named epJSON
?
logger ||= ::Logger.new($stdout) | ||
logger.info 'Translate IDF to epJSON in preparation for EnergyPlus' | ||
a = ::Time.now | ||
model_epjson = OpenStudio::EPJSON::toJSONString(model_idf) |
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.
nice to see EPJSON in OpenStudio natively.
Resolves #135
This PR adds support to pass in an argument to use epJSON file format to run EnergyPlus. Currently, IDF is still the default if this option is not set. The option menu on OpenStudio would look like the below menu where
--epjson
is a flag to pass into the workflow gem.As an example, to run a workflow using
--epJSON
you would invoke cli by running:openstudio run -e -w compact.osw
Currently, the workflow passes around the
@registry[:model_idf]
to various steps in the workflow and manipulates this in various steps and then calls energyplus as subprocess with the final IDF file. This PR maintains this logic and only converts the final IDF to epJSON if@options[:epjson]
is set to True.I think it would be preferable to work directly with epJSON, but I don't think all the workflow steps can support this as of now. Plus, the entire workflow process is likely to converted into C++ to support Python so it's probably not worth the effort to do that. This at least allows the usage of epJSON that is available in OpenStudio.