-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON models do not conform with current specifications #62
Comments
Thanks for the detailed comments. As you can see it was a first approximation but needs some work. We are working through it now and should have an update shortly. |
Is there any schema file that defines the form of the JSON? |
Currently, there is not. We are certainly open to seeing if there is a productive way to make use of one. We would like to get pysunpec to the point of being a good validator of information models in all of the encodings. |
JSON Schema with a check script (there's https://github.com/Julian/jsonschema) and Travis turned on would go a long way. Or if you won't be clicking the button to enable Travis then we could put together a quick GitHub Actions for you. |
The latest pull request (#74) has an initial JSON schema to take a look at. |
* Corrected some smdx translation issues (#62) * Corrected issues in models 701-705 and added information model schema. Corrected issues outlined in #74 and added JSON schema for information models. All: - Add static attribute to applicable points - Add 'group' or 'sync' type to all groups 701: - Add static designation to scale factors 702: - Add reactive susceptance point and scale factor - Add supported control modes - Add intentional island categories (need bit values) 703: - Increase frequent point size to 32-bits 704: - Some points should be changed to enum instead of uint16 - Some enum32 can be changed to enum16 - Remove Ctl group level and accompanying counts - Remove duplicate DERCtlAC.Ctl.PFWInj.Pt - Add IEEE_1547 to enumeration for reactive power priority - Add PF to enumeration for reactive power priority - Add other to enumeration for reactive power priority - Add RGra for Ramp gradiant with enum for power and current based ramping 705: Update power priority enum with additional options
I'm wondering: In all of my projects I prefer having a single source of truth and an automated process converting between the various formats. |
You will continue to support the XML models as well, right? JSON is just an alternative? I have software written around the XML schema, I would prefer to not rewrite that. |
Sorry for the delay in response. We have refining the tools and process to try to make it as automated as possible. We now have a feature in the SVP Dashboard to convert from xml to spreadsheet, json to spreadsheet, spreadsheet to json, and spreadsheet to spreadsheet. We consider Excel (or application with .xlsx support) to be the information model editor. json files should not be edited by hand so that we can be provide a uniform json encoding. Once models are created/updated in the spreadsheet that can be cleaned up by generating a new spreadsheet from that one. Once the spreadsheet version is correct, the json version can be generated from that. |
I agree one format should be authoritative and everything else derived from that. It sounds like this decision has already been made, so my comment here may very well be moot - which is okay, I'll live with whatever you decide. It is my experience that JSON schema is not as robust, and that validation tools (including editors) aren't as good. The XSD you developed is very high quality. If it were me, I would consider the XML to be authoritative, and derive everything else from that - including writing one or two .XSLTs to go back and forth between the different formats. I say that knowing that, while I love xsl transformation, it's basically greek to a lot of people. I currently use Xpaths to take all you .XML files and build Kotlin objects. I'm making this public, so you can see what I'm doing if you're interested. I don't mind at some point converting that to use the JSON instead of the XML ... it's just work (it took me a few days to get the code generator working). One piece of feedback I would really like to add (but it's off topic here) is giving models unique names. 111, 112, 113 are all named "inverter." They have different labels, but I can't use the labels to name objects, so I've created a bunch of objects named Model_111, Model_112, etc. That is not especially convenient for users of this library. |
I agree that XML is a more robust solution for model definition and validation. The motivation for moving to JSON involved multiple factors. The SunSpec model definitions are fairly simple system that JSON can handle. Most companies have more developers that understand JSON than XML so it is preferred by many. We will be developing a simple HTTP based web service interface for SunSpec data exchange once we can all the 1547 content completed and frozen. It will be specified using JSON. We have migrated our file based sample devices to JSON encoding and they are easier to work with as well. So these are some of the factors that influenced the decision. At the end of the day, it seemed better to use one encoding strategy for all of the use cases. |
No worries, it's obvious you've thought this through and made careful decisions. I'm on board. The next thing I'm wondering is: any thought been given to a set of COAP models bindings as well? That's going to be my next task - communicating with SunSpec compliant DERs but over the AMI network using COAP. |
To add to the initial list:
|
@bobfox I'm currently trying to migrate https://github.com/andig/gosunspec from smdx to json. It is painful. Even two years later now, the JSON models still appear inconsistent. I'll try to post a diff of the prior/after results to give an indication of the amount of differences. Not necessarily every difference is an issue with the newer JSON definitions, but the diff will show that the differences are unpredictable instead of following a clear forward-improvement pattern. |
I'm currently implementing a parser for the JSON models according to the information model specification and found some issues when using the current models as a test case, because the currently provided models do not fully conform to the (admittedly also not quite yet consistent or final) information model specification:
The text was updated successfully, but these errors were encountered: