|
17 | 17 | from werkzeug import Response |
18 | 18 | from zepben.ewb.auth import ZepbenTokenFetcher |
19 | 19 |
|
20 | | -from zepben.eas import EasClient, Study, SolveConfig, InterventionConfig, YearRange |
| 20 | +from zepben.eas import EasClient, Study, SolveConfig, InterventionConfig, YearRange, CandidateGenerationConfig, CandidateGenerationType |
21 | 21 | from zepben.eas import FeederConfig, ForecastConfig, FixedTimeLoadOverride |
22 | 22 | from zepben.eas.client.ingestor import IngestorConfigInput, IngestorRunsSortCriteriaInput, IngestorRunsFilterInput, \ |
23 | 23 | IngestorRunState, IngestorRuntimeKind |
@@ -1744,3 +1744,53 @@ def test_work_package_config_to_json_includes_server_defaulted_fields_if_specifi |
1744 | 1744 | "dvms": None, |
1745 | 1745 | "allocationLimitPerYear": 5 |
1746 | 1746 | } |
| 1747 | + |
| 1748 | +def test_work_package_config_to_json_for_tap_optimization(httpserver: HTTPServer): |
| 1749 | + eas_client = EasClient( |
| 1750 | + LOCALHOST, |
| 1751 | + httpserver.port, |
| 1752 | + verify_certificate=False |
| 1753 | + ) |
| 1754 | + |
| 1755 | + wp_config = WorkPackageConfig( |
| 1756 | + name="wp", |
| 1757 | + syf_config=FeederConfigs([]), |
| 1758 | + intervention=InterventionConfig( |
| 1759 | + base_work_package_id="abc", |
| 1760 | + year_range=YearRange(2020, 2025), |
| 1761 | + intervention_type=InterventionClass.DISTRIBUTION_TAP_OPTIMIZATION, |
| 1762 | + allocation_limit_per_year=5, |
| 1763 | + candidate_generation=CandidateGenerationConfig( |
| 1764 | + type=CandidateGenerationType.TAP_OPTIMIZATION, |
| 1765 | + average_voltage_spread_threshold=40, |
| 1766 | + voltage_under_limit_hours_threshold=1, |
| 1767 | + voltage_over_limit_hours_threshold=2, |
| 1768 | + tap_weighting_factor_lower_threshold=-0.3, |
| 1769 | + tap_weighting_factor_upper_threshold=0.4 |
| 1770 | + ) |
| 1771 | + ) |
| 1772 | + ) |
| 1773 | + json_config = eas_client.work_package_config_to_json(wp_config) |
| 1774 | + |
| 1775 | + assert json_config["intervention"] == { |
| 1776 | + "baseWorkPackageId": "abc", |
| 1777 | + "yearRange": { |
| 1778 | + "maxYear": 2025, |
| 1779 | + "minYear": 2020 |
| 1780 | + }, |
| 1781 | + "interventionType": "DISTRIBUTION_TAP_OPTIMIZATION", |
| 1782 | + "candidateGeneration": { |
| 1783 | + "type": "TAP_OPTIMIZATION", |
| 1784 | + "interventionCriteriaName": None, |
| 1785 | + "averageVoltageSpreadThreshold": 40, |
| 1786 | + "voltageUnderLimitHoursThreshold": 1, |
| 1787 | + "voltageOverLimitHoursThreshold": 2, |
| 1788 | + "tapWeightingFactorLowerThreshold": -0.3, |
| 1789 | + "tapWeightingFactorUpperThreshold": 0.4, |
| 1790 | + }, |
| 1791 | + "allocationCriteria": None, |
| 1792 | + "specificAllocationInstance": None, |
| 1793 | + "phaseRebalanceProportions": None, |
| 1794 | + "dvms": None, |
| 1795 | + "allocationLimitPerYear": 5 |
| 1796 | + } |
0 commit comments