Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
### New Features
* Added optional fields to `ModelConfig` to control network simplification: `simplify_network`, `collapse_negligible_impedances`, and `combine_common_impedances`.
* Added optional `node_level_results` field to `GeneratorConfig`. This `NodeLevelResultsConfig` allows the configuration of node level power flow results from OpenDss.
* Introduce `span_level_threshold` and `simplify_plsi` into `work_package` so it can be passed through for hosting capacity studies.
* Introduce new variables into `work_package` so it can be passed through for hosting capacity studies.
* `use_span_level_threshold`
* `rating_threshold`
* `simplify_plsi_threshold`
* `emerg_amp_scaling`

### Enhancements
* None.
Expand Down
32 changes: 26 additions & 6 deletions src/zepben/eas/client/eas_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ def generator_config_to_json(self, generator_config: Optional[GeneratorConfig])
"defaultGenVar": generator_config.model.default_gen_var,
"transformerTapSettings": generator_config.model.transformer_tap_settings,
"ctPrimScalingFactor": generator_config.model.ct_prim_scaling_factor,
"useSpanLevelThreshold": generator_config.model.use_span_level_threshold,
"ratingThreshold": generator_config.model.rating_threshold,
"simplifyPLSIThreshold": generator_config.model.simplify_plsi_threshold,
"emergAmpScaling": generator_config.model.emerg_amp_scaling
},
"solve": generator_config.solve and {
"normVMinPu": generator_config.solve.norm_vmin_pu,
Expand Down Expand Up @@ -316,15 +320,27 @@ def work_package_config_to_json(self, work_package: Optional[WorkPackageConfig])
"timePeriod": {
"startTime": work_package.syf_config.load_time.start_time.isoformat(),
"endTime": work_package.syf_config.load_time.end_time.isoformat(),
"overrides": work_package.syf_config.load_time.load_overrides and {
key: value.__dict__
for key, value in work_package.syf_config.load_time.load_overrides.items()}
"overrides": work_package.syf_config.load_time.load_overrides and [
{
"loadId": key,
"loadWattsOverride": value.load_watts,
"genWattsOverride": value.gen_watts,
"loadVarOverride": value.load_var,
"genVarOverride": value.gen_var,
} for key, value in work_package.syf_config.load_time.load_overrides.items()
]
} if isinstance(work_package.syf_config.load_time, TimePeriod) else None,
"fixedTime": work_package.syf_config.load_time and {
"loadTime": work_package.syf_config.load_time.load_time.isoformat(),
"overrides": work_package.syf_config.load_time.load_overrides and {
key: value.__dict__
for key, value in work_package.syf_config.load_time.load_overrides.items()}
"overrides": work_package.syf_config.load_time.load_overrides and [
{
"loadId": key,
"loadWattsOverride": value.load_watts,
"genWattsOverride": value.gen_watts,
"loadVarOverride": value.load_var,
"genVarOverride": value.gen_var,
} for key, value in work_package.syf_config.load_time.load_overrides.items()
]
} if isinstance(work_package.syf_config.load_time, FixedTime) else None
} if isinstance(work_package.syf_config, ForecastConfig) else None,
"qualityAssuranceProcessing": work_package.quality_assurance_processing,
Expand Down Expand Up @@ -1310,6 +1326,10 @@ async def async_get_paged_opendss_models(
defaultGenVar
transformerTapSettings
ctPrimScalingFactor
useSpanLevelThreshold
ratingThreshold
simplifyPLSIThreshold
emergAmpScaling
}
solve {
normVMinPu
Expand Down
25 changes: 25 additions & 0 deletions src/zepben/eas/client/work_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,31 @@ class ModelConfig:
Optional setting for scaling factor of calculated CTPrim for zone sub transformers.
"""

use_span_level_threshold: bool = False
"""
Set to true if `AcLineSegment.designRating` is to be used for conductor rated current in the model.
"""

rating_threshold: Optional[float] = None
"""
Optional setting to loosen rated current comparison between conductors during network simplification by providing a threshold
of allowed differences. Neighbouring conductors within this threshold and matching impedance's will be collapsed.
Set as a % value, i.e put as 50.0 if threshold is 50%
"""

simplify_plsi_threshold: Optional[float] = None
"""
Optional setting to indicate if sequence impedance's should be normalized during network simplification.
Connected AcLineSegments with PerLengthSequenceImpedance value differences within the threshold will be normalized.
Set as a % value, i.e put as 50.0 if threshold is 50%
"""

emerg_amp_scaling: Optional[float] = None
"""
Scaling factor for emergency current rating for conductors.
Set as a factor value, i.e put as 1.5 if scaling is 150%
"""


class SolveMode(Enum):
YEARLY = "YEARLY"
Expand Down
34 changes: 29 additions & 5 deletions test/test_eas_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import random
import ssl
import string
from datetime import datetime, timezone, timedelta
from datetime import datetime
from http import HTTPStatus
from unittest import mock

Expand Down Expand Up @@ -769,6 +769,10 @@ def hosting_capacity_run_calibration_with_calibration_time_request_handler(reque
'pFactorForecastPv': None,
'seed': None,
'simplifyNetwork': None,
'useSpanLevelThreshold': False,
'ratingThreshold': None,
'simplifyPLSIThreshold': None,
'emergAmpScaling': None,
'splitPhaseDefaultLoadLossPercentage': None,
'splitPhaseLVKV': None,
'swerVoltageToLineVoltage': None,
Expand Down Expand Up @@ -872,6 +876,10 @@ def hosting_capacity_run_calibration_with_generator_config_request_handler(reque
'pFactorForecastPv': None,
'seed': None,
'simplifyNetwork': None,
'useSpanLevelThreshold': False,
'ratingThreshold': None,
'simplifyPLSIThreshold': None,
'emergAmpScaling': None,
'splitPhaseDefaultLoadLossPercentage': None,
'splitPhaseLVKV': None,
'swerVoltageToLineVoltage': None,
Expand Down Expand Up @@ -969,6 +977,10 @@ def hosting_capacity_run_calibration_with_partial_model_config_request_handler(r
'pFactorForecastPv': None,
'seed': None,
'simplifyNetwork': None,
'useSpanLevelThreshold': False,
'ratingThreshold': None,
'simplifyPLSIThreshold': None,
'emergAmpScaling': None,
'splitPhaseDefaultLoadLossPercentage': None,
'splitPhaseLVKV': None,
'swerVoltageToLineVoltage': None,
Expand Down Expand Up @@ -1023,6 +1035,7 @@ def test_run_hosting_capacity_calibration_with_explicit_transformer_tap_settings
httpserver.check_assertions()
assert res == {"result": "success"}


def get_hosting_capacity_calibration_sets_request_handler(request):
actual_body = json.loads(request.data.decode())
query = " ".join(actual_body['query'].split())
Expand Down Expand Up @@ -1152,7 +1165,11 @@ def run_opendss_export_request_handler(request):
"defaultLoadVar": [10.0, 20.0, 30.0],
"defaultGenVar": [5.0, 15.0, 25.0],
"transformerTapSettings": "tap-3",
"ctPrimScalingFactor": 2.0
"ctPrimScalingFactor": 2.0,
"useSpanLevelThreshold": True,
"ratingThreshold": 20.0,
"simplifyPLSIThreshold": 20.0,
"emergAmpScaling": 1.8
},
"solve": {
"normVMinPu": 0.9,
Expand Down Expand Up @@ -1261,7 +1278,11 @@ def run_opendss_export_request_handler(request):
default_load_var=[10.0, 20.0, 30.0],
default_gen_var=[5.0, 15.0, 25.0],
transformer_tap_settings="tap-3",
ct_prim_scaling_factor=2.0
ct_prim_scaling_factor=2.0,
use_span_level_threshold=True,
rating_threshold=20.0,
simplify_plsi_threshold=20.0,
emerg_amp_scaling= 1.8
),
SolveConfig(
norm_vmin_pu=0.9,
Expand Down Expand Up @@ -1333,8 +1354,7 @@ def test_run_opendss_export_valid_certificate_success(ca: trustme.CA, httpserver
)

OPENDSS_CONFIG.load_time = FixedTime(datetime(2022, 4, 1), {"meter1": FixedTimeLoadOverride([1.0], [2.0], [3.0], [4.0])})
httpserver.expect_oneshot_request("/api/graphql").respond_with_handler(
run_opendss_export_request_handler)
httpserver.expect_oneshot_request("/api/graphql").respond_with_handler(run_opendss_export_request_handler)
res = eas_client.run_opendss_export(OPENDSS_CONFIG)
httpserver.check_assertions()
assert res == {"result": "success"}
Expand Down Expand Up @@ -1440,6 +1460,10 @@ def test_run_opendss_export_valid_certificate_success(ca: trustme.CA, httpserver
defaultGenVar
transformerTapSettings
ctPrimScalingFactor
useSpanLevelThreshold
ratingThreshold
simplifyPLSIThreshold
emergAmpScaling
}
solve {
normVMinPu
Expand Down