Skip to content

Commit 6a64ff1

Browse files
authored
Merge branch 'dev' into df/#1216-ValidationUtils-for-validating-ThermalGrids
2 parents 40a4174 + 171e7cc commit 6a64ff1

File tree

6 files changed

+30
-8
lines changed

6 files changed

+30
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Extend ValidationUtils for validating ThermalGrids [#1216](https://github.com/ie3-institute/PowerSystemDataModel/issues/1216)
1515

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

1819
### Changed
1920
- Storage minimum level parameter removed from cylindrical thermal storage [#1123](https://github.com/ie3-institute/PowerSystemDataModel/issues/1123)
@@ -24,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2425
- Converted `MappingEntry` into a normal class [#1087](https://github.com/ie3-institute/PowerSystemDataModel/issues/1087)
2526
- Renamed timeseries mapping `participant` column to `asset` [#1191](https://github.com/ie3-institute/PowerSystemDataModel/issues/1191)
2627
- Removed attribute `dsm` from `LoadInput` [#1195](https://github.com/ie3-institute/PowerSystemDataModel/issues/1195)
28+
- Fix spotless deprecations [#1123](https://github.com/ie3-institute/PowerSystemDataModel/issues/1223)
2729

2830
## [5.1.0] - 2024-06-24
2931

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ dependencies {
7373
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
7474
testImplementation "org.spockframework:spock-core:2.3-groovy-$groovyVersion"
7575
testImplementation 'org.objenesis:objenesis:3.4' // Mock creation with constructor parameters
76-
testImplementation 'net.bytebuddy:byte-buddy:1.16.1' // Mocks of classes
76+
testImplementation 'net.bytebuddy:byte-buddy:1.17.0' // Mocks of classes
7777

7878
// testcontainers (docker framework for testing)
7979
testImplementation "org.testcontainers:testcontainers:$testcontainersVersion"

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

gradle/scripts/spotless.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ spotless {
2222
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
2323
// so it formats Java files by default (unless `excludeJava` is used).
2424
greclipse().configFile('greclipse.properties')
25-
indentWithSpaces 2
25+
leadingTabsToSpaces 2
2626
}
2727

2828
groovyGradle {
2929
// same as groovy, but for .gradle (defaults to '*.gradle')
3030
target '*.gradle', 'gradle/scripts/*.gradle'
3131
greclipse()
32-
indentWithSpaces 2
32+
leadingTabsToSpaces 2
3333
}
3434

3535
// removes unnecessary whitespace, indents with tabs and ends on new line for gradle, md and gitignore files and config-XMLs
3636
format 'misc', {
3737
target '**/.gitignore', 'configs/**'
3838
trimTrailingWhitespace()
39-
indentWithTabs()
39+
leadingSpacesToTabs()
4040
endWithNewline()
4141
}
4242
}

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)