Skip to content

use cheap copies with setsuns #34

@mikofski

Description

@mikofski

observed: calling setsuns(Ee=x.x) takes a very long time if the pv system is very large, even if all of the objects in the system are identical.

proposed: check cell temperatures, and use cheap copies to duplicate cells that are identical, rather than calculating them individually, the same way that pv modules, strings and systems are created.

The previous proposal (crossed out above) was a great idea, but if issue #35 is implemented, then this proposal isn't relevant. And moreover if calling setsuns(Ee=<scalar>) then using the tips and tricks: the better/faster way is to make a new system.

new proposal: Assuming issue #35 is implemented, then it now becomes setsuns() methods job to create cells (using cheap copies of course) as needed.

** example**:

  1. create a system with Ee=<scalar> - the entire system is represented by one cell, one module and one string, with a cached_<obj> dictionary in system, string and module mapping which cells, modules and strings point to the cached references. EG: cached_strings = [0, 0, 0, 0, 0, 0] for 6 strings that all point to the reference zero, cached_modules = [0, 0, 0, 0, 0, ...] for a string of modules that all point to the reference of module zero, and `cached_cells = [0, 0, 0, 0, ...] for modules cells that all point to the reference of cell zero. For ease, if the cached list is a scalar, then we can assume that all of that objects items point to that reference. This is covered in detail in don't keep copies of identical objects (eg cells) #35. (see comments in don't keep copies of identical objects (eg cells) #35, caches are NOT necessary)
  2. change irradiance with setsuns(Ee={0, {0, {'cells': (0, 1, 2), 'Ee': (0.34, 0.45, 0.56)}}} - setsuns job is to figure out which cells need to be created now, so in this example we need 3 new cells,
    1. so use cheap copies to create 3 new cells from the previous cell, for examples, see PVsystem, PVstring or PVmodule and
    2. update the system, string and module cells directly, same as before caches (don't keep copies of identical objects (eg cells) #35) to point to the new references.EG_: cached_strings = [1, 0, 0, 0, 0, 0] since now there are two string references, one new string and five old, cached_modules = [1, 0, 0, 0, 0, ...] for the new string with the new shaded module, and `cached_cells = [1, 2, 3, 0, ...] for the new module with the 3 new shaded cells. The entire system is now represented by 4 cells, 2 modules and 2 strings. (see comments in don't keep copies of identical objects (eg cells) #35, caches are NOT necessary)
  3. As a further improvement, setsuns could also check if there are any duplicate cells (or modules or strings) either in the setsuns call or already existing in the system.
    1. For example if all 3 cells in the previous example are set to 0.5 suns then we only need one new cell, and the system is represented by 2 cells, 2 modules and 2 strings.
    2. Another example is if we further modify the previous example and add another cell with 0.56 irradiance, instead of creating another new cell, just point it to the duplicated that was previously created.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions