Code Duplication    Length = 109-150 lines in 2 locations

src/egon/data/datasets/power_plants/__init__.py 1 location

@@ 1555-1704 (lines=150) @@
1552
tasks += (pp_metadata.metadata,)
1553
1554
1555
class PowerPlants(Dataset):
1556
    """
1557
    This dataset deals with the distribution and allocation of power plants
1558
1559
    For the distribution and allocation of power plants to their corresponding
1560
    grid connection point different technology-specific methods are applied.
1561
    In a first step separate tables are created for wind, pv, hydro and biomass
1562
    based power plants by running :py:func:`create_tables`.
1563
    Different methods rely on the locations of existing power plants retrieved
1564
    from the official power plant registry 'Marktstammdatenregister' applying
1565
    function :py:func:`ìmport_mastr`.
1566
1567
    *Hydro and Biomass*
1568
    Hydro and biomass power plants are distributed based on the status quo
1569
    locations of existing power plants assuming that no further expansion of
1570
    these technologies is to be expected in Germany. Hydro power plants include
1571
    reservoir and run-of-river plants.
1572
    Power plants without a correct geolocation are not taken into account.
1573
    To compensate this, the installed capacities of the suitable plants are
1574
    scaled up to meet the target value using function :py:func:`scale_prox2now`
1575
1576
    *Conventional power plants without CHP*
1577
    The distribution of conventional plants, excluding CHPs, takes place in
1578
    function :py:func:`allocate_conventional_non_chp_power_plants`. Therefore
1579
    information about future power plants from the grid development plan
1580
    function as the target value and are matched with actual existing power
1581
    plants with correct geolocations from MaStR registry.
1582
1583
    *Wind onshore*
1584
1585
1586
    *Wind offshore*
1587
1588
    *PV ground-mounted*
1589
1590
    *PV rooftop*
1591
1592
    *others*
1593
1594
    *Dependencies*
1595
      * :py:class:`Chp <egon.data.datasets.chp.Chp>`
1596
      * :py:class:`CtsElectricityDemand
1597
      <egon.data.datasets.electricity_demand.CtsElectricityDemand>`
1598
      * :py:class:`HouseholdElectricityDemand
1599
      <egon.data.datasets.electricity_demand.HouseholdElectricityDemand>`
1600
      * :py:class:`mastr_data <egon.data.datasets.mastr.mastr_data>`
1601
      * :py:func:`define_mv_grid_districts
1602
      <egon.data.datasets.mv_grid_districts.define_mv_grid_districts>`
1603
      * :py:class:`RePotentialAreas
1604
      <egon.data.datasets.re_potential_areas.RePotentialAreas>`
1605
      * :py:class:`ZensusVg250
1606
      <egon.data.datasets.RenewableFeedin>`
1607
      * :py:class:`ScenarioCapacities
1608
      <egon.data.datasets.scenario_capacities.ScenarioCapacities>`
1609
      * :py:class:`ScenarioParameters
1610
      <egon.data.datasets.scenario_parameters.ScenarioParameters>`
1611
      * :py:func:`Setup <egon.data.datasets.database.setup>`
1612
      * :py:class:`substation_extraction
1613
      <egon.data.datasets.substation.substation_extraction>`
1614
      * :py:class:`Vg250MvGridDistricts
1615
      <egon.data.datasets.Vg250MvGridDistricts>`
1616
      * :py:class:`ZensusMvGridDistricts
1617
      <egon.data.datasets.zensus_mv_grid_districts.ZensusMvGridDistricts>`
1618
1619
    *Resulting tables*
1620
      * :py:class:`supply.egon_power_plants
1621
      <egon.data.datasets.power_plants.EgonPowerPlants>` is filled
1622
1623
    """
1624
1625
    #:
1626
    name: str = "PowerPlants"
1627
    #:
1628
    version: str = "0.0.29"
1629
1630
    def __init__(self, dependencies):
1631
        super().__init__(
1632
            name=self.name,
1633
            version=self.version,
1634
            dependencies=dependencies,
1635
            tasks=tasks,
1636
            validation={
1637
                "data-quality": [
1638
                    RowCountValidation(
1639
                        table="supply.egon_power_plants",
1640
                        rule_id="TEST_ROW_COUNT.egon_power_plants",
1641
                        expected_count={"Schleswig-Holstein":34828, "Everything": 1103}
1642
                    ),
1643
                    DataTypeValidation(
1644
                        table="supply.egon_power_plants",
1645
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_power_plants",
1646
                        column_types={
1647
                            "id": "bigint",
1648
                            "sources": "jsonb",
1649
                            "source_id": "jsonb",
1650
                            "carrier": "character varying",
1651
                            "el_capacity": "double precision",
1652
                            "bus_id": "integer",
1653
                            "voltage_level": "integer",
1654
                            "weather_cell_id": "integer",
1655
                            "scenario": "character varying",
1656
                            "geom": "geometry"
1657
                        }
1658
                    ),
1659
                    NotNullAndNotNaNValidation(
1660
                        table="supply.egon_power_plants",
1661
                        rule_id="TEST_NOT_NAN.egon_power_plants",
1662
                        columns=["id",
1663
                            "sources",
1664
                            "source_id",
1665
                            "carrier",
1666
                            "el_capacity",
1667
                            "bus_id",
1668
                            "voltage_level",
1669
                            "weather_cell_id",
1670
                            "scenario",
1671
                            "geom"]
1672
                    ),
1673
                    WholeTableNotNullAndNotNaNValidation(
1674
                        table="supply.egon_power_plants",
1675
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_power_plants"
1676
                    ),
1677
                    ValueSetValidation(
1678
                        table="supply.egon_power_plants",
1679
                        rule_id="VALUE_SET_VALIDATION_CARRIER.egon_power_plants",
1680
                        column="carrier",
1681
                        expected_values=["others",
1682
                            "gas",
1683
                            "biomass",
1684
                            "run_of_river",
1685
                            "wind_onshore",
1686
                            "oil",
1687
                            "wind_offshore",
1688
                            "solar",
1689
                            "reservoir"]
1690
                    ),
1691
                    ValueSetValidation(
1692
                        table="supply.egon_power_plants",
1693
                        rule_id="VALUE_SET_VALIDATION_SCENARIO.egon_power_plants",
1694
                        column="scenario",
1695
                        expected_values=["eGon2035", "eGon100RE"]
1696
                    ),
1697
                    SRIDUniqueNonZero(
1698
                        table="supply.egon_power_plants",
1699
                        rule_id="SRIDUniqueNonZero.egon_power_plants.geom",
1700
                        column="geom"
1701
                    ),
1702
                ]
1703
            },
1704
            on_validation_failure="continue"
1705
        )
1706

src/egon/data/datasets/chp/__init__.py 1 location

@@ 825-933 (lines=109) @@
822
tasks += (metadata,)
823
824
825
class Chp(Dataset):
826
    """
827
    Extract combined heat and power plants for each scenario
828
829
    This dataset creates combined heat and power (CHP) plants for each scenario and defines their use case.
830
    The method bases on existing CHP plants from Marktstammdatenregister. For the eGon2035 scenario,
831
    a list of CHP plans from the grid operator is used for new largescale CHP plants. CHP < 10MW are
832
    randomly distributed.
833
    Depending on the distance to a district heating grid, it is decided if the CHP is used to
834
    supply a district heating grid or used by an industrial site.
835
836
837
    *Dependencies*
838
      * :py:class:`GasAreaseGon100RE <egon.data.datasets.gas_areas.GasAreaseGon100RE>`
839
      * :py:class:`GasAreaseGon2035 <egon.data.datasets.gas_areas.GasAreaseGon2035>`
840
      * :py:class:`DistrictHeatingAreas <egon.data.datasets.district_heating_areas.DistrictHeatingAreas>`
841
      * :py:class:`IndustrialDemandCurves <egon.data.datasets.industry.IndustrialDemandCurves>`
842
      * :py:class:`OsmLanduse <egon.data.datasets.loadarea.OsmLanduse>`
843
      * :py:func:`download_mastr_data <egon.data.datasets.mastr.download_mastr_data>`
844
      * :py:func:`define_mv_grid_districts <egon.data.datasets.mv_grid_districts.define_mv_grid_districts>`
845
      * :py:class:`ScenarioCapacities <egon.data.datasets.scenario_capacities.ScenarioCapacities>`
846
847
848
    *Resulting tables*
849
      * :py:class:`supply.egon_chp_plants <egon.data.datasets.chp.EgonChp>` is created and filled
850
      * :py:class:`supply.egon_mastr_conventional_without_chp <egon.data.datasets.chp.EgonMaStRConventinalWithoutChp>` is created and filled
851
852
    """
853
854
    #:
855
    name: str = "Chp"
856
    #:
857
    version: str = "0.0.10"
858
859
    def __init__(self, dependencies):
860
        super().__init__(
861
            name=self.name,
862
            version=self.version,
863
            dependencies=dependencies,
864
            tasks=tasks,
865
            validation={
866
                "data-quality":[
867
                    RowCountValidation(
868
                        table="supply.egon_chp_plants",
869
                        rule_id="TEST_ROW_COUNT.egon_chp_plants",
870
                        expected_count={"Schleswig-Holstein": 1720, "Everything": 40197}
871
                    ),
872
                    DataTypeValidation(
873
                        table="supply.egon_chp_plants",
874
                        rule_id="TEST_DATA_MULTIPLE_TYPES.egon_chp_plants",
875
                        column_types={
876
                            "id": "integer",
877
                            "sources": "jsonb",
878
                            "source_id": "jsonb",
879
                            "carrier": "character varying",
880
                            "district_heating": "boolean",
881
                            "el_capacity": "double precision",
882
                            "th_capacity": "double precision",
883
                            "electrical_bus_id": "integer",
884
                            "district_heating_area_id": "integer",
885
                            "ch4_bus_id": "integer",
886
                            "voltage_level": "integer",
887
                            "scenario": "character varying",
888
                            "geom": "geometry"
889
                        }
890
                    ),
891
                    NotNullAndNotNaNValidation(
892
                        table="supply.egon_chp_plants",
893
                        rule_id="TEST_NOT_NAN.egon_chp_plants",
894
                        columns=[
895
                            "id",
896
                            "sources",
897
                            "source_id",
898
                            "carrier",
899
                            "district_heating",
900
                            "el_capacity",
901
                            "th_capacity",
902
                            "electrical_bus_id",
903
                            "district_heating_area_id",
904
                            "ch4_bus_id",
905
                            "voltage_level",
906
                            "scenario",
907
                            "geom"
908
                        ]
909
                    ),
910
                    WholeTableNotNullAndNotNaNValidation(
911
                        table="supply.egon_chp_plants",
912
                        rule_id="TEST_WHOLE_TABLE_NOT_NAN.egon_chp_plants"
913
                    ),
914
                    ValueSetValidation(
915
                        table="supply.egon_chp_plants",
916
                        rule_id="VALUE_SET_VALIDATION_CARRIER.egon_chp_plants",
917
                        column="carrier",
918
                        expected_values=["oil", "others", "gas", "gas extended", "biomass"]
919
                    ),
920
                    ValueSetValidation(
921
                        table="supply.egon_chp_plants",
922
                        rule_id="VALUE_SET_VALIDATION_SCENARIO.egon_chp_plants",
923
                        column="scenario",
924
                        expected_values=["eGon2035", "eGon100RE"]
925
                    ),
926
                    SRIDUniqueNonZero(
927
                        table="supply.egon_chp_plants",
928
                        rule_id="SRIDUniqueNonZero.egon_chp_plants",
929
                        column="geom"
930
                    )
931
                ]
932
            },
933
            on_validation_failure="continue"
934
        )
935