CIDARLAB / Parchmint

http://parchmint.org
3 stars 5 forks source link

[RFC] Valve Representations #12

Open rkrishnasanka opened 2 years ago

rkrishnasanka commented 2 years ago

Valve Representations

Summary

This PR changes the representation for valves in the device. It changes both the reading from JSON and returning JSON. We replace the two interim representations of valves using the keys valveMap and valveTypeMap to be replaced by an object array on the key valves.

Motivation

Changing the valves object array will streamline the data structure and remove the need to have 2 keys for querying the JSON data. And also ensures that the data is grouped correctly. The current version requires cross-validation against the different objects with the two keys: valveTypeMap and valveMap.

Standardize Valve Representations

So far the valve representations have been varied and outside of the Parchmint Standards. The python package parchmint (v0.3.1) represents valves using indexes valveTypeMap and valveMap to support 3DuF's output formats. This will be modified in the upcoming patches to reflect the right versions.

Workarounds and Compatibility

Since the valves object array would combine the properties of the indexes valveTypeMap and valveMap, it's a fairly straightforward method to modify the existing device representations.

Detailed design

This RFC will add a new Valve object into the Parchmint Standard

Valve Object

{
   "componentid": string,
   "connectionid": string,
   "type": "NORMALLY_OPEN" | "NORMALLY_CLOSED",
   "params":{
       "key": "value"
   }
}

Technical Background

Valve objects will be used to describe the valve descriptions.

Implementation

How we teach this

Since the objects will be embedded into the libraries, there will be no need to teach this.

Drawbacks

We would need to retcon and update Parchmint Libraries

Alternatives

No other alternatives have been considered at the moment

Unresolved questions