Skip to content

Commit 171e7cc

Browse files
Merge pull request #1222 from ie3-institute/ms/#1221-fix-connectivity-check-for-open-switches
Removing opened switches during connectivity check
2 parents de1b2fd + 98c8ff7 commit 171e7cc

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Added Staudt to list of reviewers [#1190](https://github.com/ie3-institute/PowerSystemDataModel/issues/1190)
1414

1515
### Fixed
16+
- Removing opened `SwitchInput` during connectivity check [#1221](https://github.com/ie3-institute/PowerSystemDataModel/issues/1221)
1617

1718
### Changed
1819
- Storage minimum level parameter removed from cylindrical thermal storage [#1123](https://github.com/ie3-institute/PowerSystemDataModel/issues/1123)

docs/readthedocs/io/ValidationUtils.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The methods in ValidationUtils and subclasses can be used to check that objects
1111
The general validation checks:
1212
- if assigned values are valid, e.g. lines are not allowed to have negative lengths or the rated power factor of any unit must be between 0 and 1
1313
- furthermore, several connections are checked, e.g. that lines only connect nodes of the same voltage level or that the voltage levels indicated for the transformer sides match the voltage levels of the nodes they are connected to.
14-
- the connectivity of the given grid for all defined operation intervals
14+
- the connectivity of the given grid for all defined operation intervals, if a switch is opened, it is filtered out for the connectivity check
1515

1616
The uniqueness validation checks if a collection of given objects are unique in either:
1717
- a specific field

src/main/java/edu/ie3/datamodel/utils/validation/GridContainerValidationUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
import edu.ie3.datamodel.models.input.AssetInput;
1717
import edu.ie3.datamodel.models.input.MeasurementUnitInput;
1818
import edu.ie3.datamodel.models.input.NodeInput;
19-
import edu.ie3.datamodel.models.input.connector.ConnectorInput;
20-
import edu.ie3.datamodel.models.input.connector.LineInput;
21-
import edu.ie3.datamodel.models.input.connector.Transformer3WInput;
19+
import edu.ie3.datamodel.models.input.connector.*;
2220
import edu.ie3.datamodel.models.input.container.*;
2321
import edu.ie3.datamodel.models.input.graphics.GraphicInput;
2422
import edu.ie3.datamodel.models.input.system.SystemParticipantInput;
@@ -241,6 +239,7 @@ protected static Try<Void, InvalidGridException> checkConnectivity(
241239
graph.addEdge(connector.getNodeA().getUuid(), connector.getNodeB().getUuid()));
242240
rawGridElements.getSwitches().stream()
243241
.filter(isInOperation)
242+
.filter(SwitchInput::isClosed)
244243
.forEach(
245244
connector ->
246245
graph.addEdge(connector.getNodeA().getUuid(), connector.getNodeB().getUuid()));

src/test/groovy/edu/ie3/datamodel/utils/validation/GridContainerValidationUtilsTest.groovy

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,25 @@ class GridContainerValidationUtilsTest extends Specification {
103103
GTD.nodeG.uuid
104104
])
105105
}
106+
107+
def "The GridContainerValidationUtils should return an exception if the grid is not properly connected, because a switch is open"() {
108+
given:
109+
def nodeA = GTD.nodeA.copy().operationTime(OperationTime.notLimited()).build()
110+
def nodeB = GTD.nodeB.copy().operationTime(OperationTime.notLimited()).build()
111+
112+
def switchAtoB = GTD.switchAtoB.copy()
113+
.nodeA(nodeA)
114+
.nodeB(nodeB)
115+
.operationTime(OperationTime.notLimited())
116+
.closed(false)
117+
.build()
118+
119+
def rawGrid = new RawGridElements([nodeA, nodeB] as Set, [] as Set, [] as Set, [] as Set, [switchAtoB] as Set, [] as Set)
120+
121+
when:
122+
def actual = GridContainerValidationUtils.checkConnectivity(rawGrid, Optional.of(start) as Optional<ZonedDateTime>)
123+
124+
then:
125+
actual.exception.get().message == "The grid contains unconnected elements for time "+start+": [47d29df0-ba2d-4d23-8e75-c82229c5c758]"
126+
}
106127
}

0 commit comments

Comments
 (0)