OpenDSSDirect.py icon indicating copy to clipboard operation
OpenDSSDirect.py copied to clipboard

JSON schema

Open daniel-thom opened this issue 10 months ago • 13 comments

Feature Request

Is there JSON schema that backs the JSON generated by the new ToJSON methods? If not, I would be open to generate it. I’m guessing that it wouldn’t be difficult based on all the versions of data models that already exist.

There are many potential use cases for the JSON schema, but I’ll explain mine here. There could be better ways to solve my problem.

My colleagues often do something like this:

  • Load an existing OpenDSS circuit.
  • Generate new versions of the circuit based on some set of scenarios being researched.

There a few basic problems often encountered:

  1. The circuit has lots of load shape data residing on slow storage. It can take 5 minutes to load a single circuit and they have to load 1000 different circuits.
  2. The Master.dss file enables a time-series simulation and so loading the circuit takes a long time - they don’t care about the simulation, just the static values of each circuit element.

To work around these problems they string-parse the OpenDSS files and comment-out things they don’t want. This is very prone to bugs.

An ideal solution to this problem would be flags to the compile command that disable time-series simulations and loading of load shape data. I am assuming that such an addition to OpenDSS is highly unlikely.

Another solution is to generate data models from the JSON schema (such as with the pydantic python library), export the JSON representations of the OpenDSS models into files or a database (one-time cost), and then de-serialize the JSON into Python classes for all transformation work. The Python classes could easily be converted back to OpenDSS text commands when it comes time to generate the new circuits.

A secondary benefit of this JSON solution is that people could run simulations with different load shape profiles more easily. No string manipulation to rewire load-to-loadshape connections would be required. Load shapes could be stored in any file format and passed to OpenDSS in memory.

daniel-thom avatar Aug 11 '23 17:08 daniel-thom