-
Notifications
You must be signed in to change notification settings - Fork 461
CSV Improvements: RVI/MVI and Units #9395
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
base: develop
Are you sure you want to change the base?
Changes from all commits
7993c4f
1c4cdc5
808bd9d
0d85f03
fc32259
4d13748
5584a52
4171287
05f47b2
692a1ef
69ab3bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| # EnergyPlus Output CSV Formatting (RVI/MVI) # | ||
|
|
||
| **Brett Bass, Mark Adams** | ||
|
|
||
| **Oak Ridge National Laboratory** | ||
|
|
||
| - Date: April 7, 2022 | ||
|
|
||
| ## Justification for new feature ## | ||
|
|
||
| --- | ||
| EnergyPlus output CSV format does not currently allow for ordering of reporting or meter variables or specification of variable units. | ||
|
|
||
| ## Overview ## | ||
|
|
||
| --- | ||
|
|
||
| The EnergyPlus native CSV output is a useful new feature but it eliminates the need for “ReadVarsESO”. “ReadVarsESO” previously had the capability to use “.rvi” or “.mvi” file types. The “.rvi” file was used to order and filter the reporting variables while the “.mvi” was used to order and filter meter variables. A need for unit conversions in the native CSV output has also been raised. This was previously possible using the convertESOMTR executable. | ||
| These new features will address these deficiencies in the native CSV output by adding “rvi”, “mvi”, “CSV:Style” objects which can be used to: | ||
|
|
||
| - Filter and order the output reporting (rvi) and meter variables (mvi) | ||
| - Convert output units (CSV:Style) | ||
|
|
||
| ## Approach ## | ||
|
|
||
| --- | ||
|
|
||
| This new feature will be added through and execution of these subtasks: | ||
|
|
||
| 1. Create three new EnergyPlus input objects (rvi, mvi, ouput units) | ||
| 2. Properly read and integrate new EnergyPlus input objects | ||
| 3. Add filtering and sorting mechanism based on rvi and mvi input object | ||
| 4. Add ability to convert units between SI and imperial units to “CSVWriter::parseTSOutputs” based on output unit input object | ||
| 5. Create unit tests to ensure that column order and unit conversions are correct | ||
| 6. Document changes | ||
|
|
||
| ## Testing/Validation/Data Sources ## | ||
|
|
||
| --- | ||
| Additions will be made to the Input Output Reference for the mvi, rvi, and output unit objects. | ||
|
|
||
| ## Input Description ## | ||
|
|
||
| --- | ||
|
|
||
| ``` | ||
| OutputControl:RVI, | ||
| \extensible:1 | ||
| \memo Determine order of CSV output reporting variables | ||
| \unique-object | ||
| A1, \field Key Name 1 | ||
| \begin-extensible | ||
| A2, \field Key Name 2 | ||
| A3, \field Key Name 3 | ||
| A4, \field Key Name 4 | ||
| A5, \field Key Name 5 | ||
| A6, \field Key Name 6 | ||
| A7, \field Key Name 7 | ||
| A8, \field Key Name 8 | ||
| A9, \field Key Name 9 | ||
| A10; \field Key Name 10 | ||
|
|
||
| OutputControl:MVI, | ||
| \extensible:1 | ||
| \memo Determine order of CSV output meter variables | ||
| \unique-object | ||
| A1, \field Key Name 1 | ||
| \begin-extensible | ||
| A2, \field Key Name 2 | ||
| A3, \field Key Name 3 | ||
| A4, \field Key Name 4 | ||
| A5, \field Key Name 5 | ||
| A6, \field Key Name 6 | ||
| A7, \field Key Name 7 | ||
| A8, \field Key Name 8 | ||
| A9, \field Key Name 9 | ||
| A10; \field Key Name 10 | ||
|
|
||
| OutputControl:CSV:Style, | ||
| \memo Unit conversions on reporting and meter variables | ||
| \unique-object | ||
| A1; \field Unit Conversion | ||
| \type choice | ||
| \key None | ||
| \key JtoKWH | ||
| \key JtoMJ | ||
| \key JtoGJ | ||
| \key InchPound | ||
| \default None | ||
| ``` | ||
|
|
||
| ## Outputs Description ## | ||
|
|
||
| --- | ||
| The order of output reporting and meter variables in the CSV output and the units of the CSV output may change based on the rvi, mvi, and output unit input objects. | ||
|
|
||
| ## Engineering Reference ## | ||
|
|
||
| --- | ||
| There will be no change to the Engineering Reference as only column order and units will be changed with this new feature. | ||
|
|
||
| ## Example File and Transition Changes ## | ||
|
|
||
| --- | ||
| Suitable example file will be generated to demonstrate the ability to change output CSV column order and units | ||
|
|
||
| ## References ## | ||
|
|
||
| --- | ||
|
|
||
| NA | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105095,6 +105095,55 @@ Meter:CustomDecrement, | |
| A47; \field Output Variable or Meter Name 22 | ||
|
|
||
|
|
||
| OutputControl:RVI, | ||
| \extensible:1 | ||
| \memo Determine order of CSV output reporting variables | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know you indicated docs will come later, but for now, a couple of lines in the memos would be helpful to indicate that the Key Names can be generic or specific variable names. |
||
| \unique-object | ||
| A1, \field Key Name 1 | ||
| \begin-extensible | ||
| A2, \field Key Name 2 | ||
| A3, \field Key Name 3 | ||
| A4, \field Key Name 4 | ||
| A5, \field Key Name 5 | ||
| A6, \field Key Name 6 | ||
| A7, \field Key Name 7 | ||
| A8, \field Key Name 8 | ||
| A9, \field Key Name 9 | ||
| A10; \field Key Name 10 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may already be doing this, but I think this should get additional field |
||
|
|
||
|
|
||
| OutputControl:MVI, | ||
| \extensible:1 | ||
| \memo Determine order of CSV output meter variables | ||
| \unique-object | ||
| A1, \field Key Name 1 | ||
| \begin-extensible | ||
| A2, \field Key Name 2 | ||
| A3, \field Key Name 3 | ||
| A4, \field Key Name 4 | ||
| A5, \field Key Name 5 | ||
| A6, \field Key Name 6 | ||
| A7, \field Key Name 7 | ||
| A8, \field Key Name 8 | ||
| A9, \field Key Name 9 | ||
| A10; \field Key Name 10 | ||
|
|
||
| OutputControl:Timestamp, | ||
| \memo Control timestamp format, currently applies only to JSON and CSV | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if a clarification would be helpful. Some users may not understand that there is a difference between "E+ w/ ReadVars -> CSV" and "E+ Native CSV". |
||
| \unique-object | ||
| A1, \field ISO 8601 Format | ||
| \note Use the ISO 8601 format YYYY-MM-DDThh:mm:ss | ||
| \type choice | ||
| \key Yes | ||
| \key No | ||
| \default No | ||
| A2; \field Timestamp at end of interval | ||
| \note Determines where the timestamp is produced, either at the beginning (No) or end (Yes) of the interval | ||
| \type choice | ||
| \key Yes | ||
| \key No | ||
| \default Yes | ||
|
|
||
| OutputControl:Files, | ||
| \memo Conditionally turn on/off output from EnergyPlus. | ||
| \unique-object | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ | |
| #include "FileSystem.hh" | ||
| #include "InputProcessing/EmbeddedEpJSONSchema.hh" | ||
| #include "InputProcessing/InputProcessor.hh" | ||
| #include "ResultsFramework.hh" | ||
| #include "UtilityRoutines.hh" | ||
|
|
||
| #include <algorithm> | ||
|
|
@@ -442,6 +443,67 @@ void IOFiles::OutputControl::getInput(EnergyPlusData &state) | |
| } | ||
| } | ||
| } | ||
|
|
||
| auto &ip = state.dataInputProcessing->inputProcessor; | ||
| auto const rvi_instances = ip->epJSON.find("OutputControl:RVI"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know you are probably working on the object name changes from the comments, so I'll hold off on commenting much in here. The actual input processing code seems fine. |
||
| if (rvi_instances != ip->epJSON.end()) { | ||
| auto const &objectSchemaProps = ip->getObjectSchemaProps(state, "OutputControl:RVI"); | ||
| auto const &instancesValue = rvi_instances.value(); | ||
| for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { | ||
| auto const &fields = instance.value(); | ||
| ip->markObjectAsUsed("OutputControl:RVI", instance.key()); | ||
|
|
||
| auto extensibles = fields.find("output_variables"); | ||
| if (extensibles != fields.end()) { | ||
| auto const &extensionSchemaProps = objectSchemaProps["output_variables"]["items"]["properties"]; | ||
| auto const &extensiblesArray = extensibles.value(); | ||
| rviKeyNames.reserve(extensiblesArray.size()); | ||
| for (auto extensibleInstance = extensiblesArray.begin(); extensibleInstance != extensiblesArray.end(); ++extensibleInstance) { | ||
| rviKeyNames.emplace_back(ip->getAlphaFieldValue(extensibleInstance.value(), extensionSchemaProps, "key_name")); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| auto const mvi_instances = ip->epJSON.find("OutputControl:MVI"); | ||
| if (mvi_instances != ip->epJSON.end()) { | ||
| auto const &objectSchemaProps = ip->getObjectSchemaProps(state, "OutputControl:MVI"); | ||
| auto const &instancesValue = mvi_instances.value(); | ||
| for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { | ||
| auto const &fields = instance.value(); | ||
| ip->markObjectAsUsed("OutputControl:MVI", instance.key()); | ||
|
|
||
| auto extensibles = fields.find("output_meters"); | ||
| if (extensibles != fields.end()) { | ||
| auto const &extensionSchemaProps = objectSchemaProps["output_meters"]["items"]["properties"]; | ||
| auto const &extensiblesArray = extensibles.value(); | ||
| mviKeyNames.reserve(extensiblesArray.size()); | ||
| for (auto extensibleInstance = extensiblesArray.begin(); extensibleInstance != extensiblesArray.end(); ++extensibleInstance) { | ||
| mviKeyNames.emplace_back(ip->getAlphaFieldValue(extensibleInstance.value(), extensionSchemaProps, "key_name")); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| auto const timestamp_instances = ip->epJSON.find("OutputControl:Timestamp"); | ||
| if (timestamp_instances != ip->epJSON.end()) { | ||
| auto const &objectSchemaProps = ip->getObjectSchemaProps(state, "OutputControl:Timestamp"); | ||
| auto const &instancesValue = timestamp_instances.value(); | ||
| for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { | ||
mjwitte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| auto const &fields = instance.value(); | ||
| ip->markObjectAsUsed("OutputControl:Timestamp", instance.key()); | ||
|
|
||
| auto item = fields.find("iso_8601_format"); | ||
| if (item != fields.end()) { | ||
| state.dataResultsFramework->resultsFramework->setISO8601(item->get<std::string>() == "Yes"); | ||
| } | ||
|
|
||
| item = fields.find("timestamp_at_end_of_interval"); | ||
| if (item != fields.end()) { | ||
| state.dataResultsFramework->resultsFramework->setStartOfInterval(item->get<std::string>() == "Yes"); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| void IOFiles::flushAll() | ||
|
|
||
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.
This looks perfectly reasonable. I was thinking if the csv is not created/requested and these new objects are present in the input then the "unused objects" message will show up in the err file, and if the csv is created/requested those messages will not show up.