Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions design/FY2022/NFP-Python-HVAC-Diagram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Python HVAC Diagram #

Jason DeGraw, Piljae Im, and Niraj Kunwar

Oak Ridge National Laboratory

Original Date: November 18, 2021

## Justification for New Feature ##

The HVAC-Diagram program is a Fortran utility that can be used to generate
an SVG representation of the HVAC system in a model based on the BND file
generated by EnergyPlus. The program has limited flexibility and the SVG
output is not correctly rendered by all SVG rendering libraries. The SVG format
Copy link
Contributor

Choose a reason for hiding this comment

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

What SVG rendering libraries do not work with the current HVAC-Diagram program?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is #6384. Internet Explorer still works, but Chrome and Edge are putting the labels are in the upper left corner. Presumably that's because Edge now uses the same thing that Chrome does.

[1] is a large and complex format with many capabilities but is somewhat
overpowered for this application.

## Overview ##

A Python replacement for the utility will be developed to produce output similar
to the functionality of the original utility. While SVG output will be considered,
prioirity will be placed on production of output that conveys the same information
in a more reliable manner.

## Approach ##

The BND output from EnergyPlus will be used to generate several forms of output:

* One or more DOT language [2] files. This format is used by the
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if the diagram appears in multiple output files that correspond to multiple DOT files that it will be as useful to the user. Users are looking for a single diagram that explains all the HVAC connections.

Copy link
Member Author

Choose a reason for hiding this comment

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

Some of the programs that I have seen that can read DOT don't do great with multiple graphs in a single file, so adding some ability to control how much is in one file could be helpful, but not necessarily required.

open source Graphviz package to display and manipulate graphs. Other formats
will be considered depending on development team feedback.
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the DOT approach but I am concerned that the resulting diagram will be too jumbled. Is their some way with the DOT format to specify the structure of the diagrams such that airloops are shown in one area and water loops in another with links between them?

BTW, I just used a similar approach of a Python script creating a DOT file here:

https://github.com/JasonGlazer/jsonSchemaToDot

and you can see that the result (in the PDF) can be a little jumbled.

Copy link
Member Author

Choose a reason for hiding this comment

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

There some ways to set attributes of the graph, but rendering is usually going to be up to the program that does the rendering and I would expect that most renderings would be jumbled. Before the log4j thing happened, I usually used the Gephi program to look at graphs, and depending on the layout algorithm the output can be pretty messy. In any case, the DOT output isn't going to be the default and will definitely be more of an "expert" thing. I did it originally to make sure I was getting the connections out of the BND correctly and decided to leave it in.

* An HTML-based representation, if possible in a single file. Modern browser
capabilities can be leveraged to produce semi-interactive representation of the
HVAC loops (e.g. simple controls to turn on/off node names or other ancilliary
information). Numerous visualization libraries are available (e.g. D3, p5.js) as
well as more traditional techniques (e.g. canvas, imagemaps).
Copy link
Contributor

Choose a reason for hiding this comment

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

Letting the user be able to zoom into part of the diagram that is important to them is good and an advantage to SVG. Can this be done with canvas or imagemaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it depends on how complex an approach is taken. If the Javascript path is taken, there're a lot of possibilities.

* [Under consideration] An SVG representation that closely duplicates
the output of the original utility.

The functionality will be implemented as a Python class that is initialized with
input data (e.g. the BND file) and has the capability to produce the output
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe for some complicated configurations, the diagrams won't render using the existing HVAC-Diagram because not all the connection information is in the BND file. Are you planning on enhancing the BND file as part of this effort?

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly. The first priority is to get as far as we can with the current BND and then look to either enhance the BND or perhaps pull information from epJSON.

described above. The script will be usable as a "packaged" executable and as a
pure Python script. Dependencies will be kept to a minimum.

## Reference Documentation ##

Appropriate documentation of the script will be provided in the auxiliary
programs documentation. Online documetation will be provided via the Python
`argparse` package. The current command line interface documentation is:

```
usage: hvac-diagram.py [-h] [-d] [-o file] BND

Generate a diagram of HVAC in an EnergyPlus model

positional arguments:
BND EnergyPlus BND file to process

options:
-h, --help show this help message and exit
-d, --dot Generate a graphviz DOT graph
-o file, --output file
write output to named file
```

Copy link
Contributor

Choose a reason for hiding this comment

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

please make the default operation without options consistent with the naming convention currently used with HVAC-Diagram.

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll do our best.

## Input Description ##

The program will initially make use of the BND file as input but may require
either extension of the BND or information from the epJSON.

## Output Description ##

The outputs of the program are one or more files that enable graphical rendering
of the HVAC setup of the model. The simple graph description in the DOT language
will enable users to import that graph into any software that can understand the
format, but will require additional user effort to understand. The HTML output is
intended to be a more full-featured representation of the HVAC with interactive
features (optional display of node names, etc.) with fewer possibilities of bad
rendering.
Copy link
Contributor

Choose a reason for hiding this comment

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

Interactive features would be great. Could you expand on this a bit? It would be great if additional information about the various connections could be shown.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, we can expand this.


## References ##

[1] SVG: Scalable Vector Graphics, https://developer.mozilla.org/en-US/docs/Web/SVG

[2] DOT Language, https://graphviz.org/doc/info/lang.html