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

FileClientDevice does not populate repeating block groups #71

Open
jmmgenerac opened this issue Oct 19, 2022 · 0 comments
Open

FileClientDevice does not populate repeating block groups #71

jmmgenerac opened this issue Oct 19, 2022 · 0 comments

Comments

@jmmgenerac
Copy link
Contributor

When initializing a FileClientDevice using a JSON file, models converted from SunSpec v1 SMDX do not properly populate. For example, take the JSON below, which contains an instance of Model 129, LVRT. When a FileClientDevice is instantiated from this JSON, the resulting object's Model 129 does not contain any data in the repeating blocks; only the fixed block's data is populated.

Source JSON:

{
    "name": null,
    "did": "fa0a9f2d-d503-470e-8ce8-ec9c51428829",
    "models": [
        {
            "ID": 1,
            "L": 66,
            "Mn": "Device Manufacturer",
            "Md": "Inverter 123",
            "Opt": null,
            "Vr": "v0.0.1",
            "SN": "9999abcd",
            "DA": null,
            "Pad": 32768
        },
        {
            "ID": 129,
            "L": 210,
            "ActCrv": 1,
            "ModEna": 0,
            "WinTms": null,
            "RvrtTms": null,
            "RmpTms": null,
            "NCrv": 4,
            "NPt": 10,
            "Tms_SF": -2,
            "V_SF": -1,
            "Pad": 32768,
            "curve": [
                {
                    "ActPt": 4,
                    "Tms1": 200,
                    "V1": 880,
                    "Tms2": 71,
                    "V2": 650,
                    "Tms3": 20,
                    "V3": 450,
                    "Tms4": 0,
                    "V4": 300,
                    "Tms5": 0,
                    "V5": 0,
                    "Tms6": 0,
                    "V6": 0,
                    "Tms7": 0,
                    "V7": 0,
                    "Tms8": 0,
                    "V8": 0,
                    "Tms9": 0,
                    "V9": 0,
                    "Tms10": 0,
                    "V10": 0,
                    "Tms11": null,
                    "V11": null,
                    "Tms12": null,
                    "V12": null,
                    "Tms13": null,
                    "V13": null,
                    "Tms14": null,
                    "V14": null,
                    "Tms15": null,
                    "V15": null,
                    "Tms16": null,
                    "V16": null,
                    "Tms17": null,
                    "V17": null,
                    "Tms18": null,
                    "V18": null,
                    "Tms19": null,
                    "V19": null,
                    "Tms20": null,
                    "V20": null,
                    "CrvNam": null,
                    "ReadOnly": 1
                },
                {
                    "ActPt": 0,
                    "Tms1": 0,
                    "V1": 0,
                    "Tms2": 0,
                    "V2": 0,
                    "Tms3": 0,
                    "V3": 0,
                    "Tms4": 0,
                    "V4": 0,
                    "Tms5": 0,
                    "V5": 0,
                    "Tms6": 0,
                    "V6": 0,
                    "Tms7": 0,
                    "V7": 0,
                    "Tms8": 0,
                    "V8": 0,
                    "Tms9": 0,
                    "V9": 0,
                    "Tms10": 0,
                    "V10": 0,
                    "Tms11": null,
                    "V11": null,
                    "Tms12": null,
                    "V12": null,
                    "Tms13": null,
                    "V13": null,
                    "Tms14": null,
                    "V14": null,
                    "Tms15": null,
                    "V15": null,
                    "Tms16": null,
                    "V16": null,
                    "Tms17": null,
                    "V17": null,
                    "Tms18": null,
                    "V18": null,
                    "Tms19": null,
                    "V19": null,
                    "Tms20": null,
                    "V20": null,
                    "CrvNam": null,
                    "ReadOnly": 0
                },
                {
                    "ActPt": 0,
                    "Tms1": 0,
                    "V1": 0,
                    "Tms2": 0,
                    "V2": 0,
                    "Tms3": 0,
                    "V3": 0,
                    "Tms4": 0,
                    "V4": 0,
                    "Tms5": 0,
                    "V5": 0,
                    "Tms6": 0,
                    "V6": 0,
                    "Tms7": 0,
                    "V7": 0,
                    "Tms8": 0,
                    "V8": 0,
                    "Tms9": 0,
                    "V9": 0,
                    "Tms10": 0,
                    "V10": 0,
                    "Tms11": null,
                    "V11": null,
                    "Tms12": null,
                    "V12": null,
                    "Tms13": null,
                    "V13": null,
                    "Tms14": null,
                    "V14": null,
                    "Tms15": null,
                    "V15": null,
                    "Tms16": null,
                    "V16": null,
                    "Tms17": null,
                    "V17": null,
                    "Tms18": null,
                    "V18": null,
                    "Tms19": null,
                    "V19": null,
                    "Tms20": null,
                    "V20": null,
                    "CrvNam": null,
                    "ReadOnly": 0
                },
                {
                    "ActPt": 0,
                    "Tms1": 0,
                    "V1": 0,
                    "Tms2": 0,
                    "V2": 0,
                    "Tms3": 0,
                    "V3": 0,
                    "Tms4": 0,
                    "V4": 0,
                    "Tms5": 0,
                    "V5": 0,
                    "Tms6": 0,
                    "V6": 0,
                    "Tms7": 0,
                    "V7": 0,
                    "Tms8": 0,
                    "V8": 0,
                    "Tms9": 0,
                    "V9": 0,
                    "Tms10": 0,
                    "V10": 0,
                    "Tms11": null,
                    "V11": null,
                    "Tms12": null,
                    "V12": null,
                    "Tms13": null,
                    "V13": null,
                    "Tms14": null,
                    "V14": null,
                    "Tms15": null,
                    "V15": null,
                    "Tms16": null,
                    "V16": null,
                    "Tms17": null,
                    "V17": null,
                    "Tms18": null,
                    "V18": null,
                    "Tms19": null,
                    "V19": null,
                    "Tms20": null,
                    "V20": null,
                    "CrvNam": null,
                    "ReadOnly": 0
                }
            ]
        }
    ]
}

Here is the resulting JSON after creating a FileClientDevice based on the file above. Note that all of the repeating block points contain the value null even where there are other values in the source JSON:

{
  "name": null,
  "did": "5690cb49-ed9e-4117-a26d-7e6060a275b0",
  "models": [
    {
      "ID": 1,
      "L": 66,
      "Mn": "Device Manufacturer",
      "Md": "Inverter 123",
      "Opt": null,
      "Vr": "v0.0.1",
      "SN": "9999abcd",
      "DA": null,
      "Pad": 32768
    },
    {
      "ID": 129,
      "L": 210,
      "ActCrv": 1,
      "ModEna": 0,
      "WinTms": null,
      "RvrtTms": null,
      "RmpTms": null,
      "NCrv": 4,
      "NPt": 10,
      "Tms_SF": -2,
      "V_SF": -1,
      "Pad": 32768,
      "curve": [
        {
          "ActPt": null,
          "Tms1": null,
          "V1": null,
          "Tms2": null,
          "V2": null,
          "Tms3": null,
          "V3": null,
          "Tms4": null,
          "V4": null,
          "Tms5": null,
          "V5": null,
          "Tms6": null,
          "V6": null,
          "Tms7": null,
          "V7": null,
          "Tms8": null,
          "V8": null,
          "Tms9": null,
          "V9": null,
          "Tms10": null,
          "V10": null,
          "Tms11": null,
          "V11": null,
          "Tms12": null,
          "V12": null,
          "Tms13": null,
          "V13": null,
          "Tms14": null,
          "V14": null,
          "Tms15": null,
          "V15": null,
          "Tms16": null,
          "V16": null,
          "Tms17": null,
          "V17": null,
          "Tms18": null,
          "V18": null,
          "Tms19": null,
          "V19": null,
          "Tms20": null,
          "V20": null,
          "CrvNam": null,
          "ReadOnly": null
        },
        {
          "ActPt": null,
          "Tms1": null,
          "V1": null,
          "Tms2": null,
          "V2": null,
          "Tms3": null,
          "V3": null,
          "Tms4": null,
          "V4": null,
          "Tms5": null,
          "V5": null,
          "Tms6": null,
          "V6": null,
          "Tms7": null,
          "V7": null,
          "Tms8": null,
          "V8": null,
          "Tms9": null,
          "V9": null,
          "Tms10": null,
          "V10": null,
          "Tms11": null,
          "V11": null,
          "Tms12": null,
          "V12": null,
          "Tms13": null,
          "V13": null,
          "Tms14": null,
          "V14": null,
          "Tms15": null,
          "V15": null,
          "Tms16": null,
          "V16": null,
          "Tms17": null,
          "V17": null,
          "Tms18": null,
          "V18": null,
          "Tms19": null,
          "V19": null,
          "Tms20": null,
          "V20": null,
          "CrvNam": null,
          "ReadOnly": null
        },
        {
          "ActPt": null,
          "Tms1": null,
          "V1": null,
          "Tms2": null,
          "V2": null,
          "Tms3": null,
          "V3": null,
          "Tms4": null,
          "V4": null,
          "Tms5": null,
          "V5": null,
          "Tms6": null,
          "V6": null,
          "Tms7": null,
          "V7": null,
          "Tms8": null,
          "V8": null,
          "Tms9": null,
          "V9": null,
          "Tms10": null,
          "V10": null,
          "Tms11": null,
          "V11": null,
          "Tms12": null,
          "V12": null,
          "Tms13": null,
          "V13": null,
          "Tms14": null,
          "V14": null,
          "Tms15": null,
          "V15": null,
          "Tms16": null,
          "V16": null,
          "Tms17": null,
          "V17": null,
          "Tms18": null,
          "V18": null,
          "Tms19": null,
          "V19": null,
          "Tms20": null,
          "V20": null,
          "CrvNam": null,
          "ReadOnly": null
        },
        {
          "ActPt": null,
          "Tms1": null,
          "V1": null,
          "Tms2": null,
          "V2": null,
          "Tms3": null,
          "V3": null,
          "Tms4": null,
          "V4": null,
          "Tms5": null,
          "V5": null,
          "Tms6": null,
          "V6": null,
          "Tms7": null,
          "V7": null,
          "Tms8": null,
          "V8": null,
          "Tms9": null,
          "V9": null,
          "Tms10": null,
          "V10": null,
          "Tms11": null,
          "V11": null,
          "Tms12": null,
          "V12": null,
          "Tms13": null,
          "V13": null,
          "Tms14": null,
          "V14": null,
          "Tms15": null,
          "V15": null,
          "Tms16": null,
          "V16": null,
          "Tms17": null,
          "V17": null,
          "Tms18": null,
          "V18": null,
          "Tms19": null,
          "V19": null,
          "Tms20": null,
          "V20": null,
          "CrvNam": null,
          "ReadOnly": null
        }
      ]
    }
  ]
}

CoRfr added a commit to CoRfr/pysunspec2 that referenced this issue Oct 26, 2022
Even though the group_class is being passed the index, it is not
being used at the point level, and any update that I tried to use
it at the point level resulted in the output changing, and lots of tests
failing.

Using the index as part of the _init_repeating_group instead, without
passing it to the group_class, provides the expected results.

Note that this follows the same logic as if the count is available (line
530).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant