openclimatefix / pv-site-datamodel

Datamodel for PV sites
MIT License
2 stars 9 forks source link

Rename sites -> location #104

Open peterdudfield opened 8 months ago

peterdudfield commented 8 months ago
peterdudfield commented 8 months ago

It could be something like


---
title: SQLAlchemy Location relationships
---
classDiagram

   class LocationSQL{
        + location_uuid
        + client_site_id
        + client_site_name 
        + country 
        + location_type:
        + latitude
        + longitude
         + ml_id 
     }

    class SiteSQL{
        + site_uuid : UUID ≪ PK ≫
        + region : String(255)
        + dno : String(255)
        + gsp : String(255)
        + asset_type : Enum ≪ D ≫
        + orientation : Float
        + tilt : Float
        + capacity_kw : Float
        + inverter_capacity_kw : Float
        + module_capacity_kw : Float
    }

    class RegionSQL{
        + site_uuid : UUID ≪ PK ≫
        + region : String(255)
        + region_type: 
        + meta_data : json
        + capacity_kw : Float
    }

        LocationSQL "1" -- "N" SiteSQL : contains
        LocationSQL "1" -- "N" RegionSQL : contains
        LocationSQL "N" -- "N" LocationSQL : relationships
peterdudfield commented 8 months ago

Examples could be

Many sites

graph TD;
      L1(Location1 - site ) ;
    L2(Location2 - site ) ;
    L3(Location3 - site) ;

Many regions, like GSPs

graph TD;
      L1(Location1 - region);
    L2(Location1 - region);
    L3(Location1 - region);

Many sites in one region

graph TD;
      L1(Location1 - site) 
    L2(Location2 - site);
    L3(Location3- site) ;
   L4(Location4 region);
   L1 --> L4
 L2 --> L4
 L3 --> L4

Many sites, many region,

graph TD;
      L1(Location1 - site) 
    L2(Location2 - site);
    L3(Location3- site) ;
   L4(Location4 - site) 
    L5(Location5 - site);
    L6(Location6 - site) ;
   R1(Location7 - region);
   R2(Location8 -  region);
   L1 --> R1
 L2 --> R1
 L3 --> R1
   L4--> R2
 L5 --> R2
 L6 --> R2

Many sites, many region, regions in region. In the UK, the first layer of regions could be GSPs, and the grand regions could be DNOs or Wind constraints regions

graph TD;
      L1(Location1 - site) 
    L2(Location2 - site);
    L3(Location3- site) ;
   L4(Location4 - site) 
    L5(Location5 - site);
   L7(Location7 - site) 
    L8(Location8 - site);
   R1(Location7 - region);
   R2(Location8 -  region);
   R3(Location9 -  region);
 RR1(Location10 -  region);
 RR2(Location11 -  region);
   L1 --> R1
 L2 --> R1
 L3 --> R1
   L4--> R2
 L5 --> R2
 L7--> R3
 L8 --> R3
R1 --> RR1
R2--> RR1
R3 --> RR2