Skip to content
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

Model 802: SOC Incorrect Type #13

Closed
kenny-peak-energy opened this issue Oct 26, 2024 · 4 comments
Closed

Model 802: SOC Incorrect Type #13

kenny-peak-energy opened this issue Oct 26, 2024 · 4 comments
Labels
invalid This doesn't seem right

Comments

@kenny-peak-energy
Copy link

Per my comment on the file. I believe this should be an Option<u16>.

    /// State of Charge
    ///
    /// State of charge, expressed as a percentage.
    ///
    /// Notes: Measurement.
    pub soc: u16,
@bikeshedder
Copy link
Owner

The SoC field is marked as mandatory in the JSON model:

            {
                "desc": "State of charge, expressed as a percentage.",
                "label": "State of Charge",
                "mandatory": "M",
                "name": "SoC",
                "sf": "SoC_SF",
                "size": 1,
                "type": "uint16",
                "units": "%WHRtg"
            },

https://github.com/sunspec/models/blob/241057a11d8cd82ca1c2c7e69a7eb4b210169bb1/json/model_802.json#L112-L121

I just checked the SMDX (XML) model file and it's been mandatory ever since:

      <point id="SoC" offset="9" type="uint16" sf="SoC_SF" units="%WHRtg" mandatory="true" />

https://github.com/sunspec/models/blob/a1184356743f7a2673b2a58d633c3d884b6a04ba/smdx/smdx_00802.xml#L14C7-L14C94

Just to be sure I also checked in the SunSpec_Information_Model_Referenc_20211209.xls file:

image


Unless the spec is wrong this really should be a u16 and not an Option<u16>.

@bikeshedder bikeshedder added the question Further information is requested label Oct 26, 2024
@bikeshedder
Copy link
Owner

I just opened a new issue about parsing invalid model data:

Is this maybe what you were looking for?

@kenny-peak-energy
Copy link
Author

You did it right. I didn't realize you were using Option for non-mandatory points. That makes complete sense.

@bikeshedder bikeshedder added invalid This doesn't seem right and removed question Further information is requested labels Oct 28, 2024
@bikeshedder
Copy link
Owner

I'll close this issue a invalid then. 👍

Ticket #16 now tracks the feature of parsing invalid model data. While I think it's going to cause a lot of troubles when parsing invalid data it shouldn't be impossible. I just don't have a great idea on what's necessary here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants