What is GunnsDraw - nasa/gunns GitHub Wiki

GunnsDraw is a set of scripts in gunns/draw that allow you to generate GUNNS networks from draw.io drawings. draw.io is a free, open source and platform independent Visio-like drawing tool that saves drawings in an XML format.

  • Draw.io supports drawings and custom libraries in XML, which makes collaborating (merging) and maintaining files easy.
  • Draw.io offers platform independence and easy integration with any environment. It can run in all major browsers, and also on Android & IOS. It also has downloadable desktop apps for Linux, Mac, Windows and ChromeOS.
  • Draw.io is free & open-source on GitHub.
  • Draw.io has very few dependencies and all are free. More draw.io resources:
  • Draw.io is approved for use by NASA.
  • We’ve been assured by the Draw.io support team that they won’t change the drawing XML schema or restrict the embedding of XML elements in it that we rely on, so there is little risk of them breaking us in the future.

Here is a screenshot of GUNNS network drawing in draw.io, with the GUNNS_Generic and GUNNS_Electric shape libraries:

Python Versions

GunnsDraw uses Python scripts in gunns/draw to export network code from drawings, and other things.

The GunnsDraw scripts should work with Python 2.7 and 3. We have tested it with 2.7.5, 2.7.10, and 3.7.5.

Scalability

GunnsDraw scales well. We’ve tested up to 400 nodes on a Dell Precision T7600 running CentOS 7 Linux and Python 2.7:

  • netexport.py exports 400 nodes in about 5 seconds. This is much faster than GunnShow. Compare with TS21’s EpsPriElect which has 437 nodes and last took about 260 seconds to export, not counting the .pdf generation.
  • The export time appears to scale with the square of number of nodes. See the plot below.
  • The Draw.io desktop app refresh rate gets a little slower but is still well fast enough to be usable.
  • The web app running in Firefox has a noticeably faster refresh rate than the desktop app.
  • Even in the uncompressed form, our file sizes are smaller than Visio .vsd files. Our 400 node test grid network is about 1.7 MB, compared to TS21’s EpsPriElect.vsd which has 437 nodes and is about 5.2 MB.
  • To test scalability we do:
    • Use this script: draw/utils/create_grid_drawing.py to create draw.io drawing files with a grid of capacitive nodes and conductors of size N x N. To create a 20×20 grid (400 nodes), do:
      • $ python create_grid_drawing.py 20
    • Load the generated drawing into draw.io, then save it again to compress the file to test the elapsed time of netexport including decompressing the drawing.
    • Run netexport.py on the file to get its elapsed time.

Further Work

Where we go from here:

  • Clean up, refactor & OO-ize, bullet-proof & add more error handling to the netexport code, other to-do items.
  • Document & test.
  • We want to try to remain compatible with the default draw.io so that we can use their website or app as-is, and not have to use our own version
  • Add display of real-time data from sims, which was GunnSite’s original purpose. Draw.io doesn’t natively support this, but if we have our own fork, we may be able to migrate some of the old GunnSite design into this.

Risks & Unknowns

  • Early users risk having their drawings broken by design changes we have to make as our implementation matures.
  • We could also be broken by changes to draw.io, but our fall-back is to maintain our own fork of a working version.
  • Draw.io source code is mostly JavaScript, and poorly commented. A lot of their internal data tables are compressed, which will make them harder to modify, and the code harder to understand.
  • We have very little web software expertise on our team.
  • Even though JGraph ensures users that their data is private and protected (uses https, etc.), many of our users will not want to use their public web host. However, draw.io has a desktop app version that performs identically to their website, for all major OS’s. This should suffice.
⚠️ **GitHub.com Fallback** ⚠️