Skip to content

Commit 5ca1bff

Browse files
Merge branch 'dev' into pp/#873-thermal-house-documentation-in-docs-not-up-to-date
2 parents 295e3dd + 49bad16 commit 5ca1bff

File tree

10 files changed

+88
-26
lines changed

10 files changed

+88
-26
lines changed

AUTHORS

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
Copyright (c) 2023, Institute of Energy Systems, Energy Efficiency and Energy Economics (ie3)
1+
Copyright (c) 2024, Institute of Energy Systems, Energy Efficiency and Energy Economics (ie3)
22
All rights reserved.
33

44
Lead Developers:
55
- Johannes Hiry
66
- Chris Kittl
77
- Debopama Sen-Sarma
8+
- Thomas Oberließen
9+
- Daniel Feismann
10+
- Johannes Bao
11+
- Sebastian Peter
812

913
Main Contributers:
1014
- Johannes Hiry - https://github.com/johanneshiry
@@ -20,3 +24,8 @@ Main Contributers:
2024
- Marius Staudt - https://github.com/staudtMarius
2125
- Lara Roumeliotis - https://github.com/lararou
2226
- Vicky Bung - https://github.com/vickybung1
27+
- Daniel Feismann - https://github.com/danielfeismann
28+
- Johannes Bao - https://github.com/jo-bao
29+
- Julian Hohmann - https://github.com/julianhohmann
30+
- Simon Huette - https://github.com/SimonHuette
31+
- Pierre Petersmeier - http://github.com/pierrepetersmeier

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Formatting Spotless Groovy import order [#960](https://github.com/ie3-institute/PowerSystemDataModel/issues/960)
1111
- Implementing missing typical methods in `Try` [#970](https://github.com/ie3-institute/PowerSystemDataModel/issues/970)
12+
- Added log warning when using `SwitchInputs` with `parallelDevices` parameter [#840](https://github.com/ie3-institute/PowerSystemDataModel/issues/840)
1213

1314
### Fixed
1415
- Fixed Couchbase integration tests that randomly failed [#755](https://github.com/ie3-institute/PowerSystemDataModel/issues/755)
@@ -25,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2526
- Allowing for additional unused columns in sources [#839](https://github.com/ie3-institute/PowerSystemDataModel/issues/839)
2627
- Improving column name validation to only run once per source [#849](https://github.com/ie3-institute/PowerSystemDataModel/issues/849)
2728
- Refactored and abstracted `EntitySource`s and `EntityData` creation [#969](https://github.com/ie3-institute/PowerSystemDataModel/issues/969)
29+
- Updated contributing.md [#737](https://github.com/ie3-institute/PowerSystemDataModel/issues/737)
2830

2931
## [4.1.0] - 2023-11-02
3032

@@ -48,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4850
### Fixed
4951
- Fixed wrong rated power unit hint [#804](https://github.com/ie3-institute/PowerSystemDataModel/issues/804)
5052
- Fixed wrong hash code generation of ConnectorResult [#817](https://github.com/ie3-institute/PowerSystemDataModel/issues/817)
53+
- Fixed wrong path for timeSeriesMapping [#886](https://github.com/ie3-institute/PowerSystemDataModel/issues/886)
5154

5255
### Changed
5356
- Removing deprecated classes and methods [#540](https://github.com/ie3-institute/PowerSystemDataModel/issues/540)

CONTRIBUTING.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ With this document we would like to give you some orientation on how you can con
1616
## Testing and reporting bugs
1717
We really appreciate your usage of this project.
1818
Whenever you find a bug, it would be nice to check, if this isn't a feature to us. :wink:
19-
You may find extensive information about the intended behaviour when you [Read the Docs](https://powersystemdatamodel.readthedocs.io/en/latest/) or within the [javadoc](https://ie3-institute.github.io/PowerSystemDataModel/javadoc/).
19+
You may find extensive information about the intended behaviour when you [Read the Docs](https://powersystemdatamodel.readthedocs.io/en/latest/).
2020
If you still think it's a bug, please raise an [issue](https://guides.github.com/features/issues/) for us.
2121
Considering the following aspects in your inquiry, assists us in helping you:
2222

@@ -67,9 +67,6 @@ Before marking the pull request as 'ready to review', take these precautionary a
6767
`gradle finalizePR` summarizes all of these steps .
6868

6969
## For any doubts
70-
... please contact
71-
* Johannes (@johanneshiry),
72-
* Debopama (@sensarmad) or
73-
* Chris (@ckittl)
70+
... please contact [us](AUTHORS)
7471

7572
We are happy to help! :smiley:

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
id 'signing'
66
id 'pmd' // code check, working on source code
77
id 'com.diffplug.spotless' version '6.25.0' //code format
8-
id 'com.github.spotbugs' version '5.2.5' // code check, working on byte code
8+
id 'com.github.spotbugs' version '6.0.7' // code check, working on byte code
99
id 'de.undercouch.download' version '5.5.0'
1010
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
1111
id 'jacoco' // java code coverage plugin
@@ -18,7 +18,7 @@ ext {
1818
javaVersion = JavaVersion.VERSION_17
1919
groovyVersion = "4.0"
2020
groovyBinaryVersion = "4.0.18"
21-
testcontainersVersion = '1.19.3'
21+
testcontainersVersion = '1.19.4'
2222

2323
scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator //location of script plugins
2424
}

gradle/scripts/spotbugs.gradle

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
// spotBugs is a code check tool, working on byte code
22

3+
// workaround because imports do not work in files that are only included by build.gradle
4+
def classLoader = plugins['com.github.spotbugs'].class.classLoader
5+
def SpotBugsEffort = classLoader.findLoadedClass( 'com.github.spotbugs.snom.Effort' )
6+
def SpotBugsConfidence = classLoader.findLoadedClass( 'com.github.spotbugs.snom.Confidence' )
7+
38
spotbugs{
49
ignoreFailures = true // dont let the build fail on rule violations
5-
effort = 'max'
6-
reportLevel = 'high'
10+
effort = SpotBugsEffort.valueOf("MAX")
11+
reportLevel = SpotBugsConfidence.valueOf("HIGH")
712
}
813

914
spotbugsMain{
1015
reports{
11-
html.enabled = false
12-
xml.enabled = true
16+
html.required.set(false)
17+
xml.required.set(true)
1318
}
1419
}
1520

1621
spotbugsTest{
1722
reports{
18-
html.enabled = false
19-
xml.enabled = true
23+
html.required.set(false)
24+
xml.required.set(true)
2025
}
2126
}

src/main/java/edu/ie3/datamodel/io/connectors/CsvFileConnector.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public class CsvFileConnector implements DataConnector {
4242
private final Map<UUID, BufferedCsvWriter> timeSeriesWriters = new HashMap<>();
4343

4444
private final FileNamingStrategy fileNamingStrategy;
45-
private final Path baseDirectoryName;
45+
private final Path baseDirectory;
4646

4747
private static final String FILE_ENDING = ".csv";
4848

49-
public CsvFileConnector(Path baseDirectoryName, FileNamingStrategy fileNamingStrategy) {
50-
this.baseDirectoryName = baseDirectoryName;
49+
public CsvFileConnector(Path baseDirectory, FileNamingStrategy fileNamingStrategy) {
50+
this.baseDirectory = baseDirectory;
5151
this.fileNamingStrategy = fileNamingStrategy;
5252
}
5353

@@ -61,7 +61,7 @@ public synchronized BufferedCsvWriter getOrInitWriter(
6161
/* If it is not available, build and register one */
6262
try {
6363
CsvFileDefinition fileDefinition = buildFileDefinition(clz, headerElements, csvSep);
64-
BufferedCsvWriter newWriter = initWriter(baseDirectoryName, fileDefinition);
64+
BufferedCsvWriter newWriter = initWriter(baseDirectory, fileDefinition);
6565

6666
entityWriters.put(clz, newWriter);
6767
return newWriter;
@@ -81,7 +81,7 @@ BufferedCsvWriter getOrInitWriter(T timeSeries, String[] headerElements, String
8181
/* If it is not available, build and register one */
8282
try {
8383
CsvFileDefinition fileDefinition = buildFileDefinition(timeSeries, headerElements, csvSep);
84-
BufferedCsvWriter newWriter = initWriter(baseDirectoryName, fileDefinition);
84+
BufferedCsvWriter newWriter = initWriter(baseDirectory, fileDefinition);
8585

8686
timeSeriesWriters.put(timeSeries.getUuid(), newWriter);
8787
return newWriter;
@@ -188,7 +188,7 @@ public BufferedReader initReader(Class<? extends UniqueEntity> clz)
188188
* @throws FileNotFoundException if no file with the provided file name can be found
189189
*/
190190
public BufferedReader initReader(Path filePath) throws FileNotFoundException {
191-
File fullPath = baseDirectoryName.resolve(filePath.toString() + FILE_ENDING).toFile();
191+
File fullPath = baseDirectory.resolve(filePath.toString() + FILE_ENDING).toFile();
192192
return new BufferedReader(
193193
new InputStreamReader(new FileInputStream(fullPath), StandardCharsets.UTF_8), 16384);
194194
}
@@ -228,10 +228,9 @@ public BufferedReader initReader(Path filePath) throws FileNotFoundException {
228228
* @return A set of relative paths to time series files, with respect to the base folder path
229229
*/
230230
private Set<Path> getIndividualTimeSeriesFilePaths() {
231-
Path baseDirectoryPath = baseDirectoryName.resolve(baseDirectoryName);
232-
try (Stream<Path> pathStream = Files.walk(baseDirectoryPath)) {
231+
try (Stream<Path> pathStream = Files.walk(baseDirectory)) {
233232
return pathStream
234-
.map(baseDirectoryPath::relativize)
233+
.map(baseDirectory::relativize)
235234
.filter(
236235
path -> {
237236
Path withoutEnding =

src/main/java/edu/ie3/datamodel/io/factory/input/SwitchInputFactory.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ protected SwitchInput buildModel(
3434
OperatorInput operator,
3535
OperationTime operationTime) {
3636
final boolean closed = data.getBoolean(CLOSED);
37+
38+
if (data.containsKey(PARALLEL_DEVICES)) {
39+
String parallelDevices = data.getField(PARALLEL_DEVICES);
40+
41+
log.warn(
42+
"The SwitchInput with id `{}` specifies the unused parameter `parallelDevices` with a value of `{}`."
43+
+ " SwitchInputs do not need to specify `parallelDevices`, as its physical value depends on"
44+
+ " the electrotechnical context of where the switch is embedded.",
45+
id,
46+
parallelDevices);
47+
}
48+
3749
return new SwitchInput(uuid, id, operator, operationTime, nodeA, nodeB, closed);
3850
}
3951
}

src/test/groovy/edu/ie3/datamodel/io/csv/BufferedCsvWriterTest.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ class BufferedCsvWriterTest extends Specification {
2323
}
2424

2525
def cleanupSpec() {
26-
FileIOUtils.deleteRecursively(tmpDirectory)
26+
try {
27+
FileIOUtils.deleteRecursively(tmpDirectory)
28+
} catch (IOException e) {
29+
throw new FileException("Unable to delete recursively.", e)
30+
}
2731
}
28-
2932
def "The convenience constructor of the BufferedCsvWriter class works as expected."() {
3033
given:
3134
def baseDirectory = tmpDirectory

src/test/groovy/edu/ie3/datamodel/io/factory/input/SwitchInputFactoryTest.groovy

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,38 @@ class SwitchInputFactoryTest extends Specification implements FactoryTestHelper
5858
assert closed
5959
}
6060
}
61+
62+
def "A SwitchInputFactory should parse a valid SwitchInput with parallelDevices parameter correctly"() {
63+
given: "a system participant input type factory and model data"
64+
def inputFactory = new SwitchInputFactory()
65+
Map<String, String> parameter = [
66+
"uuid" : "91ec3bcf-1777-4d38-af67-0bf7c9fa73c7",
67+
"operatesfrom" : "2019-01-01T00:00:00+01:00[Europe/Berlin]",
68+
"operatesuntil": "",
69+
"id" : "TestID",
70+
"closed" : "true",
71+
"paralleldevices": "2"
72+
]
73+
def inputClass = SwitchInput
74+
def operatorInput = Mock(OperatorInput)
75+
def nodeInputA = Mock(NodeInput)
76+
def nodeInputB = Mock(NodeInput)
77+
78+
expect:
79+
Try<SwitchInput, FactoryException> input = inputFactory.get(new ConnectorInputEntityData(parameter, inputClass, operatorInput, nodeInputA, nodeInputB))
80+
input.success
81+
input.data.get().getClass() == inputClass
82+
input.data.get().with {
83+
assert uuid == UUID.fromString(parameter["uuid"])
84+
assert operationTime.startDate.present
85+
assert operationTime.startDate.get() == ZonedDateTime.parse(parameter["operatesfrom"])
86+
assert !operationTime.endDate.present
87+
assert operator == operatorInput
88+
assert id == parameter["id"]
89+
assert nodeA == nodeInputA
90+
assert nodeB == nodeInputB
91+
assert closed
92+
assert parallelDevices == 1
93+
}
94+
}
6195
}

src/test/groovy/edu/ie3/datamodel/io/source/csv/CsvDataSourceTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class CsvDataSourceTest extends Specification implements CsvTestDataMeta {
6868
def "A DataSource should contain a valid connector after initialization"() {
6969
expect:
7070
dummyCsvSource.connector != null
71-
dummyCsvSource.connector.baseDirectoryName == testBaseFolderPath
71+
dummyCsvSource.connector.baseDirectory == testBaseFolderPath
7272
dummyCsvSource.connector.fileNamingStrategy == fileNamingStrategy
7373
dummyCsvSource.connector.entityWriters.isEmpty()
7474
}

0 commit comments

Comments
 (0)