Skip to content

Commit 37db9b0

Browse files
Merge branch 'dev' into sp/#565-restructure-timeseries-meta-information
2 parents 4a9ee65 + 8722f17 commit 37db9b0

File tree

14 files changed

+201
-25
lines changed

14 files changed

+201
-25
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Graph with impedance weighted edges including facilities to create it [#440](https://github.com/ie3-institute/PowerSystemDataModel/issues/440)
1313
- `TimeSeriesMetaInformationSource` providing a source for the mapping of time series uuids to column schemes (previously provided by `TimeSeriesMappingSource`) [#515](https://github.com/ie3-institute/PowerSystemDataModel/issues/515)
1414
- `TemperatureDependantLoadProfile`s for depiction of profile behavior of night storage heating and heat pumps [#601](https://github.com/ie3-institute/PowerSystemDataModel/issues/601)
15+
- `ThermalUnits` as a container to hold all thermal units [#134](https://github.com/ie3-institute/PowerSystemDataModel/issues/134)
16+
- `ThermalInput` as a distinct abstract class for all thermal models
17+
- `ThermalGrid` as a container for a completly connected thermal grid
1518

1619
### Fixed
1720
- Reduced code smells [#492](https://github.com/ie3-institute/PowerSystemDataModel/issues/492)
@@ -161,6 +164,7 @@ coordinates or multiple exactly equal coordinates possible
161164
- ``CsvDataSource`` now parses valid RFC 4180 rows correctly (invalid, old syntax is still supported but deprecated!)
162165
- Consolidate test tasks. `gradle allTests` is now replaced by `gradle test`. Only unit tests can be run with `gradle unitTest`.
163166
- Changed projects toString() methods for readability/completeness
167+
- Adapted to changes in PowerSystemUnits in PowerSystemUtils [#631](https://github.com/ie3-institute/PowerSystemDataModel/issues/631)
164168

165169
### Fixed
166170
- CsvDataSource now stops trying to get an operator for empty operator uuid field in entities

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id 'maven-publish'
55
id 'signing'
66
id 'pmd' // code check, working on source code
7-
id 'com.diffplug.spotless' version '6.8.0'//code format
7+
id 'com.diffplug.spotless' version '6.9.0'//code format
88
id 'com.github.spotbugs' version '5.0.9' // code check, working on byte code
99
id 'de.undercouch.download' version '5.1.0'
1010
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
@@ -73,7 +73,7 @@ dependencies {
7373
implementation 'org.jgrapht:jgrapht-core:1.5.1'
7474

7575
// testing
76-
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
76+
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
7777
testImplementation 'org.spockframework:spock-core:2.1-groovy-3.0'
7878
testImplementation 'org.objenesis:objenesis:3.2' // Mock creation with constructor parameters
7979

docs/uml/main/input/ThermalDatamodelConcept.puml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,16 @@ package models {
8686
package system {}
8787

8888
package thermal {
89+
abstract class ThermalInput
90+
ThermalInput --|> AssetInput
91+
8992
class ThermalBusInput
90-
ThermalBusInput --|> AssetInput
93+
ThermalBusInput --|> ThermalInput
9194

9295
abstract class ThermalUnitInput {
9396
- thermalBus: ThermalBusInput
9497
}
95-
ThermalUnitInput --|> AssetInput
98+
ThermalUnitInput --|> ThermalInput
9699
ThermalUnitInput ..|> HasThermalBus
97100

98101
abstract class ThermalSinkInput

gradle.properties

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,7 @@
88

99
# Specifies the JVM arguments used for the daemon process.
1010
# The setting is particularly useful for tweaking memory settings.
11-
12-
13-
# Workaround to make spotless work with java 17 -
14-
# see https://github.com/diffplug/spotless/tree/main/plugin-gradle#google-java-format and
15-
# https://github.com/ie3-institute/PowerSystemDataModel/issues/481 for details
16-
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m \
17-
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
18-
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
19-
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
20-
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
21-
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
11+
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m
2212

2313
# When configured, Gradle will run in incubating parallel mode.
2414
# This option should only be used with decoupled projects. More details, visit
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* © 2022. TU Dortmund University,
3+
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
4+
* Research group Distribution grid planning and operation
5+
*/
6+
package edu.ie3.datamodel.models.input.container;
7+
8+
import edu.ie3.datamodel.models.input.thermal.ThermalBusInput;
9+
import edu.ie3.datamodel.models.input.thermal.ThermalHouseInput;
10+
import edu.ie3.datamodel.models.input.thermal.ThermalInput;
11+
import edu.ie3.datamodel.models.input.thermal.ThermalStorageInput;
12+
import java.util.*;
13+
14+
/**
15+
* Container object to denote a fully connected thermal "grid". As there are currently no branch
16+
* elements, a grid always only consists of one {@link ThermalBusInput} and all its connected {@link
17+
* edu.ie3.datamodel.models.input.thermal.ThermalUnitInput}s
18+
*/
19+
public record ThermalGrid(
20+
ThermalBusInput bus, Set<ThermalHouseInput> houses, Set<ThermalStorageInput> storages)
21+
implements InputContainer<ThermalInput> {
22+
public ThermalGrid(
23+
ThermalBusInput bus,
24+
Collection<ThermalHouseInput> houses,
25+
Collection<ThermalStorageInput> storages) {
26+
this(bus, new HashSet<>(houses), new HashSet<>(storages));
27+
}
28+
29+
@Override
30+
public List<ThermalInput> allEntitiesAsList() {
31+
List<ThermalInput> ret = new ArrayList<>(houses.size() + storages.size() + 1);
32+
ret.add(bus);
33+
ret.addAll(houses);
34+
ret.addAll(storages);
35+
return ret;
36+
}
37+
38+
@Override
39+
public String toString() {
40+
return "ThermalGrid{"
41+
+ "bus="
42+
+ bus
43+
+ ", #houses="
44+
+ houses.size()
45+
+ ", #storages="
46+
+ storages.size()
47+
+ '}';
48+
}
49+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* © 2022. TU Dortmund University,
3+
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
4+
* Research group Distribution grid planning and operation
5+
*/
6+
package edu.ie3.datamodel.models.input.container;
7+
8+
import edu.ie3.datamodel.models.input.thermal.ThermalHouseInput;
9+
import edu.ie3.datamodel.models.input.thermal.ThermalStorageInput;
10+
import edu.ie3.datamodel.models.input.thermal.ThermalUnitInput;
11+
import java.util.*;
12+
13+
/**
14+
* Container to group together all {@link ThermalUnitInput}s
15+
*
16+
* @param houses Available houses
17+
* @param storages Available storage
18+
*/
19+
public record ThermalUnits(Set<ThermalHouseInput> houses, Set<ThermalStorageInput> storages)
20+
implements InputContainer<ThermalUnitInput> {
21+
public ThermalUnits(
22+
Collection<ThermalHouseInput> houses, Collection<ThermalStorageInput> storages) {
23+
this(new HashSet<>(houses), new HashSet<>(storages));
24+
}
25+
26+
@Override
27+
public List<ThermalUnitInput> allEntitiesAsList() {
28+
List<ThermalUnitInput> ret = new ArrayList<>(houses.size() + storages.size());
29+
ret.addAll(houses);
30+
ret.addAll(storages);
31+
return ret;
32+
}
33+
34+
@Override
35+
public String toString() {
36+
return "ThermalUnits{" + "#houses=" + houses.size() + ", #storages=" + storages.size() + '}';
37+
}
38+
}

src/main/java/edu/ie3/datamodel/models/input/thermal/ThermalBusInput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import java.util.UUID;
1212

1313
/** A thermal bus, to which different {@link ThermalUnitInput} units may be connected */
14-
public class ThermalBusInput extends AssetInput {
14+
public class ThermalBusInput extends ThermalInput {
1515
/**
1616
* Constructor for an operated thermal bus
1717
*
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* © 2022. TU Dortmund University,
3+
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
4+
* Research group Distribution grid planning and operation
5+
*/
6+
package edu.ie3.datamodel.models.input.thermal;
7+
8+
import edu.ie3.datamodel.models.OperationTime;
9+
import edu.ie3.datamodel.models.input.AssetInput;
10+
import edu.ie3.datamodel.models.input.OperatorInput;
11+
import java.util.UUID;
12+
13+
/** Abstract class as a common super class of all thermal input models */
14+
public abstract class ThermalInput extends AssetInput {
15+
/**
16+
* Constructor for a thermal input model
17+
*
18+
* @param uuid Unique identifier
19+
* @param id Human readable identifier
20+
* @param operator Reference to the operator
21+
* @param operationTime Time frame, within the asset is in operation
22+
*/
23+
protected ThermalInput(
24+
UUID uuid, String id, OperatorInput operator, OperationTime operationTime) {
25+
super(uuid, id, operator, operationTime);
26+
}
27+
28+
/**
29+
* Constructor for a thermal input model
30+
*
31+
* @param uuid Unique identifier
32+
* @param id Human readable identifier
33+
*/
34+
protected ThermalInput(UUID uuid, String id) {
35+
super(uuid, id);
36+
}
37+
}

src/main/java/edu/ie3/datamodel/models/input/thermal/ThermalUnitInput.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@
77

88
import edu.ie3.datamodel.io.extractor.HasThermalBus;
99
import edu.ie3.datamodel.models.OperationTime;
10-
import edu.ie3.datamodel.models.input.AssetInput;
1110
import edu.ie3.datamodel.models.input.OperatorInput;
1211
import java.util.Objects;
1312
import java.util.UUID;
1413

1514
/** Abstract class for grouping all common properties to thermal models. */
16-
public abstract class ThermalUnitInput extends AssetInput implements HasThermalBus {
15+
public abstract class ThermalUnitInput extends ThermalInput implements HasThermalBus {
1716
/** The thermal bus, a thermal unit is connected to. */
1817
private final ThermalBusInput thermalBus;
1918

2019
/**
2120
* @param uuid Unique identifier of a certain thermal input
2221
* @param id Identifier of the thermal unit
23-
* @param thermalBus hermal bus, a thermal unit is connected to
22+
* @param thermalBus thermal bus, a thermal unit is connected to
2423
*/
2524
ThermalUnitInput(UUID uuid, String id, ThermalBusInput thermalBus) {
2625
super(uuid, id);

src/test/groovy/edu/ie3/datamodel/models/input/connector/LineInputTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ class LineInputTest extends Specification {
9696
", type=3bed3eb3-9790-4874-89b5-a5434d408088" +
9797
", length=0.003 km" +
9898
", geoPosition=LINESTRING (7.411111 51.492528, 7.414116 51.484136)" +
99-
", olmCharacteristic=OlmCharacteristicInput{points=[CharacteristicCoordinate{x=0 m/s, y=1 PU}]}}"
99+
", olmCharacteristic=OlmCharacteristicInput{points=[CharacteristicCoordinate{x=0 m/s, y=1 p.u.}]}}"
100100
}
101101
}

src/test/groovy/edu/ie3/datamodel/models/input/container/SystemParticipantsTest.groovy

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
*/
66
package edu.ie3.datamodel.models.input.container
77

8-
import edu.ie3.datamodel.models.input.system.BmInput
9-
import edu.ie3.test.common.ComplexTopology
108
import edu.ie3.test.common.SystemParticipantTestData
119
import spock.lang.Specification
1210

13-
1411
class SystemParticipantsTest extends Specification {
1512

1613
def "A valid collection of asset entities can be used to build a valid instance of SystemParticipants"() {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* © 2022. TU Dortmund University,
3+
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
4+
* Research group Distribution grid planning and operation
5+
*/
6+
package edu.ie3.datamodel.models.input.container
7+
8+
import edu.ie3.datamodel.models.input.thermal.CylindricalStorageInput
9+
import edu.ie3.datamodel.models.input.thermal.ThermalBusInput
10+
import edu.ie3.datamodel.models.input.thermal.ThermalHouseInput
11+
import spock.lang.Specification
12+
13+
class ThermalGridTest extends Specification {
14+
15+
def "A ThermalGrid object compiles the correct list of all entities"() {
16+
given:
17+
def thermalBus = Mock(ThermalBusInput)
18+
def thermalHouses = [Mock(ThermalHouseInput), Mock(ThermalHouseInput)]
19+
def thermalStorages = [Mock(CylindricalStorageInput)]
20+
def thermalUnits = new ThermalGrid(thermalBus, thermalHouses, thermalStorages)
21+
22+
when:
23+
def actualAllEntities = thermalUnits.allEntitiesAsList()
24+
25+
then:
26+
actualAllEntities.size() == 1 + thermalHouses.size() + thermalStorages.size()
27+
actualAllEntities.contains(thermalBus)
28+
actualAllEntities.containsAll(thermalHouses)
29+
actualAllEntities.containsAll(thermalStorages)
30+
}
31+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* © 2022. TU Dortmund University,
3+
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
4+
* Research group Distribution grid planning and operation
5+
*/
6+
package edu.ie3.datamodel.models.input.container
7+
8+
import edu.ie3.datamodel.models.input.thermal.CylindricalStorageInput
9+
import edu.ie3.datamodel.models.input.thermal.ThermalHouseInput
10+
import spock.lang.Specification
11+
12+
class ThermalUnitsTest extends Specification {
13+
14+
def "A ThermalUnits object compiles the correct list of all entities"() {
15+
given:
16+
def thermalHouses = [Mock(ThermalHouseInput), Mock(ThermalHouseInput)]
17+
def thermalStorages = [Mock(CylindricalStorageInput)]
18+
def thermalUnits = new ThermalUnits(thermalHouses, thermalStorages)
19+
20+
when:
21+
def actualAllEntities = thermalUnits.allEntitiesAsList()
22+
23+
then:
24+
actualAllEntities.size() == thermalHouses.size() + thermalStorages.size()
25+
actualAllEntities.containsAll(thermalHouses)
26+
actualAllEntities.containsAll(thermalStorages)
27+
}
28+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class ValidationUtilsTest extends Specification {
9595
GermanVoltageLevelUtils.LV,
9696
6)
9797
] as Set || Optional.of("9e37ce48-9650-44ec-b888-c2fd182aff01: 2\n" +
98-
" - NodeInput{uuid=9e37ce48-9650-44ec-b888-c2fd182aff01, id='node_f', operator=f15105c4-a2de-4ab8-a621-4bc98e372d92, operationTime=OperationTime{startDate=null, endDate=null, isLimited=false}, vTarget=1 PU, slack=false, geoPosition=null, voltLvl=CommonVoltageLevel{id='Niederspannung', nominalVoltage=0.4 kV, synonymousIds=[Niederspannung, lv, ns], voltageRange=Interval [0 kV, 10 kV)}, subnet=6}\n" +
99-
" - NodeInput{uuid=9e37ce48-9650-44ec-b888-c2fd182aff01, id='node_g', operator=f15105c4-a2de-4ab8-a621-4bc98e372d92, operationTime=OperationTime{startDate=null, endDate=null, isLimited=false}, vTarget=1 PU, slack=false, geoPosition=null, voltLvl=CommonVoltageLevel{id='Niederspannung', nominalVoltage=0.4 kV, synonymousIds=[Niederspannung, lv, ns], voltageRange=Interval [0 kV, 10 kV)}, subnet=6}")
98+
" - NodeInput{uuid=9e37ce48-9650-44ec-b888-c2fd182aff01, id='node_f', operator=f15105c4-a2de-4ab8-a621-4bc98e372d92, operationTime=OperationTime{startDate=null, endDate=null, isLimited=false}, vTarget=1 p.u., slack=false, geoPosition=null, voltLvl=CommonVoltageLevel{id='Niederspannung', nominalVoltage=0.4 kV, synonymousIds=[Niederspannung, lv, ns], voltageRange=Interval [0 kV, 10 kV)}, subnet=6}\n" +
99+
" - NodeInput{uuid=9e37ce48-9650-44ec-b888-c2fd182aff01, id='node_g', operator=f15105c4-a2de-4ab8-a621-4bc98e372d92, operationTime=OperationTime{startDate=null, endDate=null, isLimited=false}, vTarget=1 p.u., slack=false, geoPosition=null, voltLvl=CommonVoltageLevel{id='Niederspannung', nominalVoltage=0.4 kV, synonymousIds=[Niederspannung, lv, ns], voltageRange=Interval [0 kV, 10 kV)}, subnet=6}")
100100
[
101101
GridTestData.nodeD,
102102
GridTestData.nodeE

0 commit comments

Comments
 (0)