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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added Staudt to list of reviewers [#1190](https://github.com/ie3-institute/PowerSystemDataModel/issues/1190)

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

### Changed
- Storage minimum level parameter removed from cylindrical thermal storage [#1123](https://github.com/ie3-institute/PowerSystemDataModel/issues/1123)
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/io/ValidationUtils.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The methods in ValidationUtils and subclasses can be used to check that objects
The general validation checks:
- 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
- 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.
- the connectivity of the given grid for all defined operation intervals
- the connectivity of the given grid for all defined operation intervals, if a switch is opened, it is filtered out for the connectivity check

The uniqueness validation checks if a collection of given objects are unique in either:
- a specific field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
import edu.ie3.datamodel.models.input.AssetInput;
import edu.ie3.datamodel.models.input.MeasurementUnitInput;
import edu.ie3.datamodel.models.input.NodeInput;
import edu.ie3.datamodel.models.input.connector.ConnectorInput;
import edu.ie3.datamodel.models.input.connector.LineInput;
import edu.ie3.datamodel.models.input.connector.Transformer3WInput;
import edu.ie3.datamodel.models.input.connector.*;
import edu.ie3.datamodel.models.input.container.*;
import edu.ie3.datamodel.models.input.graphics.GraphicInput;
import edu.ie3.datamodel.models.input.system.SystemParticipantInput;
Expand Down Expand Up @@ -241,6 +239,7 @@ protected static Try<Void, InvalidGridException> checkConnectivity(
graph.addEdge(connector.getNodeA().getUuid(), connector.getNodeB().getUuid()));
rawGridElements.getSwitches().stream()
.filter(isInOperation)
.filter(SwitchInput::isClosed)
.forEach(
connector ->
graph.addEdge(connector.getNodeA().getUuid(), connector.getNodeB().getUuid()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,25 @@ class GridContainerValidationUtilsTest extends Specification {
GTD.nodeG.uuid
])
}

def "The GridContainerValidationUtils should return an exception if the grid is not properly connected, because a switch is open"() {
given:
def nodeA = GTD.nodeA.copy().operationTime(OperationTime.notLimited()).build()
def nodeB = GTD.nodeB.copy().operationTime(OperationTime.notLimited()).build()

def switchAtoB = GTD.switchAtoB.copy()
.nodeA(nodeA)
.nodeB(nodeB)
.operationTime(OperationTime.notLimited())
.closed(false)
.build()

def rawGrid = new RawGridElements([nodeA, nodeB] as Set, [] as Set, [] as Set, [] as Set, [switchAtoB] as Set, [] as Set)

when:
def actual = GridContainerValidationUtils.checkConnectivity(rawGrid, Optional.of(start) as Optional<ZonedDateTime>)

then:
actual.exception.get().message == "The grid contains unconnected elements for time "+start+": [47d29df0-ba2d-4d23-8e75-c82229c5c758]"
}
}