PVSystem.racking_model not supported for multi-array systems

48 views
Skip to first unread message

Stefan

unread,
Jun 1, 2023, 5:38:18 PM6/1/23
to pvlib-python
Hi,

I have a nasty error I cannot seem to solve, see below code.

The full error is:
AttributeError: PVSystem.racking_model not supported for multi-array systems. Set racking_model for each Array in PVSystem.arrays instead.

I guess the error is referring to pvsystem.Array? Except that class doesn't have a property 'racking_model'. The mount object does have that property which is referenced in the Array object but setting it there did not solve the error. 

Does anyone know what I'm doing wrong?

Code:

        # loop over all systems
        for system in systems:
            _LOGGER.debug("Creating PV system model for system %s", system["name"])
            uses_micro: bool = system["microinverter"]
            arrays: list = system["arrays"]
            temp_params = TEMPERATURE_MODEL_PARAMETERS["pvsyst"]["freestanding"]

            # loop over all arrays
            pv_arrays = []
            for array in arrays:
                _LOGGER.debug("Creating PV system model for array %s", array["name"])
                mount = FixedMount(surface_tilt=array["tilt"], surface_azimuth=array["azimuth"])
                module = self._cec_modules[array["module"]]

                pv_arrays.append(
                    Array(
                        mount=mount,
                        module_parameters=module,
                        strings=array["strings"],
                        modules_per_string=array["modules_per_string"],
                        name=array["name"],
                    )
                )

            # create the PV system
            inverter = self._cec_inverters[system["inverter"]]
            pv_system = PVSystem(
                arrays=pv_arrays,
                inverter_parameters=inverter,
                temperature_model_parameters=temp_params,
                name=system["name"],
            )

            # create the model chain
            modelchain = ModelChain(
                pv_system, self._location, name=system["name"], aoi_model="physical", temperature_model="sapm"
            )

cwh...@sandia.gov

unread,
Jun 1, 2023, 5:43:55 PM6/1/23
to pvlib-python
Are you setting PVSystem.racking_model when the systems are defined? If so, let racking_model take its default of None.

Stefan

unread,
Jun 1, 2023, 5:46:57 PM6/1/23
to pvlib-python
Not sure I understand the question but I am not setting racking_model myself anywhere. The above code is the only part that interacts with PVLib at this point. 

Op donderdag 1 juni 2023 om 23:43:55 UTC+2 schreef cwh...@sandia.gov:

Stefan

unread,
Jun 1, 2023, 5:51:16 PM6/1/23
to pvlib-python
Here is the full log: (location share is okay, it's the Van Gogh museum)

vscode ➜ /workspaces/pvcast $ python3 -m src.pvcast
2023-06-01 21:43:39 DEBUG (MainThread) [src.pvcast.model.pvmodel] Creating PV system model for system EastWest
2023-06-01 21:43:39 DEBUG (MainThread) [src.pvcast.model.pvmodel] Creating PV system model for array East
2023-06-01 21:43:39 DEBUG (MainThread) [src.pvcast.model.pvmodel] Creating PV system model for array West
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/workspaces/pvcast/src/pvcast/__main__.py", line 33, in <module>
    main()
  File "/workspaces/pvcast/src/pvcast/__main__.py", line 29, in main
    pv_model = PVModelChain(config["plant"], location=(52.35845515630293, 4.88115070391368))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/pvcast/src/pvcast/model/pvmodel.py", line 36, in __init__
    self._pv_model: list([ModelChain]) = self._create_pv_model()
                                         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/pvcast/src/pvcast/model/pvmodel.py", line 82, in _create_pv_model
    modelchain = ModelChain(
                 ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pvlib/modelchain.py", line 499, in __init__
    self.temperature_model = temperature_model
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pvlib/modelchain.py", line 525, in __setattr__
    super().__setattr__(key, value)
  File "/usr/local/lib/python3.11/site-packages/pvlib/modelchain.py", line 1051, in temperature_model
    name_from_params = self.infer_temperature_model().__name__
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pvlib/modelchain.py", line 1073, in infer_temperature_model
    not params and self.system.racking_model is None
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pvlib/pvsystem.py", line 64, in f
    x = func(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pvlib/pvsystem.py", line 90, in wrapper
    raise AttributeError(

AttributeError: PVSystem.racking_model not supported for multi-array systems. Set racking_model for each Array in PVSystem.arrays instead.

Op donderdag 1 juni 2023 om 23:46:57 UTC+2 schreef Stefan:

cwh...@sandia.gov

unread,
Jun 1, 2023, 5:54:53 PM6/1/23
to pvlib-python
Does the error go away if you assign the temperature_model_parameters on the Arrays rather than the PVSystem?

Stefan

unread,
Jun 1, 2023, 5:59:40 PM6/1/23
to pvlib-python
That worked! Thanks a lot. I guess it's because of the deprecation of pass through from PVSystem talked about here: https://github.com/pvlib/pvlib-python/blob/main/pvlib/pvsystem.py#L71

But the error message is just the result of that, so kind of difficult to understand.

Op donderdag 1 juni 2023 om 23:54:53 UTC+2 schreef cwh...@sandia.gov:

cwh...@sandia.gov

unread,
Jun 1, 2023, 6:54:23 PM6/1/23
to pvlib-python
Nice to hear that worked. I think you found some undesirable behavior in pvlib. I agree that the error message wasn't very helpful.

Cliff
Reply all
Reply to author
Forward
0 new messages