Skip to content

Commit 154b8ae

Browse files
committed
Merge branch 'readvars-python' of ssh://ssh.github.com:443/NatLabRockies/EnergyPlus into readvars-python
2 parents f010389 + 03d3e5b commit 154b8ae

1 file changed

Lines changed: 34 additions & 14 deletions

File tree

design/FY2026/NFP-ReadVars-Python-Replacement.md

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,75 @@
1-
Replace Fortran ReadVars with Python ReadVarsESO
1+
Replace Fortran ReadVarsESO with a Python Equivalent
22
================
33

4-
**EnergyPlus Development Team**
4+
Jason W. DeGraw, ORNL
55

66
- Original Date: 06/18/2026
7-
- Revision Date: 06/18/2026
8-
7+
- Revision Date: N/A
98

109
## Justification for New Feature ##
1110

12-
ReadVarsESO is a post-processing utility used to convert EnergyPlus ESO and MTR output files into delimited tabular output. The current implementation is written in modern Fortran, which keeps a Fortran build dependency alive for a small utility that is otherwise independent of the simulation engine.
11+
ReadVarsESO is a post-processing utility used to convert EnergyPlus ESO and MTR output files into delimited tabular output (primarily into comma-separated value or CSV form). The current implementation is written in modern Fortran, requiring a Fortran build dependency for a utility that is somewhat independent of the simulation engine. The utility is invoked by the engine if the `-r` flag is passed on the command line, so there is a limited relationship between the engine and the utility. Python has been a requirement for EnergyPlus development for some time now and is a somewhat easier dependency to manage.
1312

14-
This proposal replaces the Fortran ReadVarsESO program with a vanilla Python implementation. The goal is to preserve the existing command-line behavior for current workflows while making the tool easier to maintain, test, package, and extend.
13+
This proposal replaces the Fortran ReadVarsESO program with a vanilla Python implementation, where "vanilla" means that there are no dependencies outside of what comes with standard Python. The goal is to preserve the existing command-line behavior for current workflows while making the tool easier to maintain, test, package, and extend. The script has outperformed the Fortran executable in all testing thus far.
1514

1615
## E-mail and Conference Call Conclusions ##
1716

1817
N/A
1918

2019
## Overview ##
2120

22-
The new ReadVarsESO implementation will be a Python script distributed with EnergyPlus and wrapped by platform-appropriate launcher scripts. Existing RVI/MVI based conversion workflows should continue to work, including frequency filters, unlimited column handling, and fixed header behavior.
21+
The new ReadVarsESO implementation is a Python script distributed with EnergyPlus and wrapped by platform-appropriate launcher scripts. Existing RVI/MVI based conversion workflows should continue to work, including frequency filters, unlimited column handling, and fixed header behavior.
2322

24-
The Python version will also provide a modern subcommand-based interface for direct inspection and conversion of ESO/MTR files. Initial modern commands include listing available output variables and reading data directly to CSV without requiring a separate RVI/MVI file.
23+
The Python version provides a modern subcommand-based interface for direct inspection and conversion of ESO/MTR files. Initial modern commands include listing available output variables and reading data directly to CSV without requiring a separate RVI/MVI file.
2524

26-
### Legacy behavior to preserve ###
25+
### Legacy Behavior ###
2726

28-
The historical ReadVarsESO interface is positional and file-oriented. When called with no arguments, it reads `eplusout.eso`, selects all available variables from the ESO data dictionary, and writes `eplusout.csv`. When called with an RVI/MVI file, the control file identifies the input ESO/MTR file, the output file, and the requested variables.
27+
The historical ReadVarsESO interface is primarily file-oriented. When called with no arguments, it reads `eplusout.eso`, selects all available variables from the ESO data dictionary, and writes `eplusout.csv`. When called with an RVI/MVI file, the control file identifies the input ESO/MTR file, the output file, and the requested variables.
2928

3029
Legacy variable requests may be made by report number or by matching variable names from the data dictionary. The RVI/MVI file can also exclude variables by prefixing report numbers or variable requests with `~`. Command-line options select broad output frequencies such as detailed/timestep, hourly, daily, monthly, and annual/run-period output. Existing options also include limited versus unlimited column handling and `fixheader` behavior.
3130

3231
The legacy converter writes delimited output using the output file extension to determine the delimiter: comma-separated output for CSV, tab-separated output for TAB files, and space-separated output for TXT files. It also writes a `readvars.audit` file and preserves the long-standing header, timestamp, and row formatting used by existing workflows.
3332

3433
### Enhancements in the Python version ###
3534

36-
The Python replacement adds a modern subcommand interface while retaining the legacy interface. The `list` command, also available as `variables`, inspects an ESO/MTR data dictionary and reports the available report number, frequency, key, variable name, units, and legacy label. It supports table, CSV, and JSON output, plus filtering by reporting frequency and search text. Internal timestamp dictionary records, such as annual calendar-year records used only to label report periods, are omitted from the modern list output.
35+
The Python replacement adds a modern subcommand interface while retaining the legacy interface. The new `list` command inspects an ESO/MTR data dictionary and reports the available report number, frequency, key, variable name, units, and legacy label. It supports table, CSV, and JSON output, plus filtering by reporting frequency and search text. Internal timestamp dictionary records, such as annual calendar-year records used only to label report periods, are omitted from the modern list output.
3736

3837
The new `read` command converts an ESO/MTR file directly to CSV without requiring an RVI/MVI file. Calling `ReadVarsESO read <input-file>` selects all user-reportable variables and writes a CSV file next to the input using the same base file name. The output file can be configured with `--output`, and conversion can be narrowed with the same frequency and search filters used by `list`.
3938

4039
The modern commands are intended to be easier to script and discover. They avoid legacy audit-file side effects where practical, provide structured output for tooling, and make it possible for users to inspect available variables before selecting data to convert.
4140

41+
### Performance of the Python version ###
42+
43+
To investigate the performance of the Python version, a test file with an existing RVI file was selected: 5ZoneDetailedIceStorage.idf. This model includes 35 output variables and the RVI has 34 entries, and an annual simulation of the model results in an ESO file that is approximately 7.3 MB in size. The Python and Fortran versions were each run ten times on an small Windows desktop system running on a Intel Core i7-8700 @ 3.20GHz processor, resulting in the following timings:
44+
45+
| | Fortran (ms) | Python (ms) |
46+
|:-------:|:------------:|:-----------:|
47+
| 1 | 4720.9429 | 924.1084 |
48+
| 2 | 4649.1618 | 832.2611 |
49+
| 3 | 4635.4731 | 831.3671 |
50+
| 4 | 4647.0617 | 885.8676 |
51+
| 5 | 5082.1201 | 840.9368 |
52+
| 6 | 4631.1113 | 843.4879 |
53+
| 7 | 4633.1652 | 835.8188 |
54+
| 8 | 4719.2226 | 844.0984 |
55+
| 9 | 4794.5117 | 843.9699 |
56+
| 10 | 4707.4851 | 839.8434 |
57+
| Average | 4722.02555 | 852.1759 |
58+
| Std Dev | 137.3253939 | 29.61428 |
59+
60+
The Python script is roughly five times faster than the Fortran executable for this test case.
61+
4262
## Approach ##
4363

44-
The implementation will port the existing ReadVarsESO behavior to a Python script with no third-party package dependencies. CMake will copy the Python script and wrapper into the EnergyPlus runtime and install locations in place of building a Fortran executable.
64+
The implementation ports the existing ReadVarsESO behavior to a Python script with no third-party package dependencies. CMake copies the Python script and wrapper into the EnergyPlus runtime and install locations in place of building a Fortran executable.
4565

4666
The legacy interface will remain available for compatibility. A modern interface will be added alongside it, including:
4767

48-
- `list` or `variables` to inspect available report variables, keys, units, and reporting frequencies.
68+
- `list` to inspect available report variables, keys, units, and reporting frequencies.
4969
- `read` to convert an ESO/MTR file directly to CSV.
5070
- Command options for output file selection and basic filtering by frequency or search text.
5171

52-
The modern commands will avoid legacy audit-file side effects where practical and will omit internal timestamp dictionary records that are not user-reportable output variables. Shared parsing and conversion routines will be used where possible so that legacy and modern behavior stay aligned.
72+
The modern commands avoid legacy audit-file side effects where practical and omits internal timestamp dictionary records that are not user-reportable output variables. Shared parsing and conversion routines will be used where possible so that legacy and modern behavior stay aligned.
5373

5474
## Testing/Validation/Data Sources ##
5575

0 commit comments

Comments
 (0)