Skip to content

Commit 415e39d

Browse files
Merge branch 'dev' into rel/sp/#730-release-3.0
2 parents b0c4622 + 7670ca7 commit 415e39d

30 files changed

+2534
-23
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ updates:
1212
- sensarmad
1313
- sebastian-peter
1414
- danielfeismann
15+
- jo-bao
1516
ignore:
1617
- dependency-name: org.spockframework:spock-core
1718
versions:
1819
- 2.3-groovy-4.0
20+
21+
- package-ecosystem: pip
22+
directory: "/docs/readthedocs"
23+
schedule:
24+
interval: daily
25+
time: "04:00"
26+
open-pull-requests-limit: 8
27+
target-branch: dev

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- `ThermalGrid` as a container for a completely connected thermal grid
2020
- `EmResult` and `FlexOptionsResult` for Energy Management Systems [#651](https://github.com/ie3-institute/PowerSystemDataModel/issues/651)
2121
- `EvcsInput` now has a parameter for enabling and disabling vehicle to grid support [#681](https://github.com/ie3-institute/PowerSystemDataModel/issues/681)
22+
- Added Dependabot updates to sphinx/readthedocs dependencies [#735](https://github.com/ie3-institute/PowerSystemDataModel/issues/735)
23+
- Created convenience function for JointGridContainer from CSV [#502](https://github.com/ie3-institute/PowerSystemDataModel/issues/502)
24+
- Added CSV grid IO integration test [#586](https://github.com/ie3-institute/PowerSystemDataModel/issues/586)
2225

2326
### Fixed
2427
- Reduced code smells [#492](https://github.com/ie3-institute/PowerSystemDataModel/issues/492)

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ plugins {
44
id 'maven-publish'
55
id 'signing'
66
id 'pmd' // code check, working on source code
7-
id 'com.diffplug.spotless' version '6.14.0'//code format
7+
id 'com.diffplug.spotless' version '6.15.0'//code format
88
id 'com.github.spotbugs' version '5.0.13' // code check, working on byte code
9-
id 'de.undercouch.download' version '5.3.0'
9+
id 'de.undercouch.download' version '5.3.1'
1010
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
1111
id 'jacoco' // java code coverage plugin
1212
id "org.sonarqube" version "3.5.0.2730" // sonarqube
@@ -67,7 +67,7 @@ dependencies {
6767
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
6868
testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0'
6969
testImplementation 'org.objenesis:objenesis:3.3' // Mock creation with constructor parameters
70-
testImplementation 'net.bytebuddy:byte-buddy:1.12.22' // Mocks of classes
70+
testImplementation 'net.bytebuddy:byte-buddy:1.13.0' // Mocks of classes
7171

7272
// testcontainers (docker framework for testing)
7373
testImplementation "org.testcontainers:testcontainers:$testcontainersVersion"
@@ -84,8 +84,8 @@ dependencies {
8484

8585
// Databases
8686
implementation 'org.influxdb:influxdb-java:2.23'
87-
implementation 'com.couchbase.client:java-client:3.4.2'
88-
runtimeOnly 'org.postgresql:postgresql:42.5.1' // postgresql jdbc driver required during runtime
87+
implementation 'com.couchbase.client:java-client:3.4.3'
88+
runtimeOnly 'org.postgresql:postgresql:42.5.3' // postgresql jdbc driver required during runtime
8989

9090
implementation 'commons-io:commons-io:2.11.0' // I/O functionalities
9191
implementation 'org.apache.commons:commons-compress:1.22' // I/O functionalities

docs/readthedocs/index.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ Contact the (Main) Maintainers
1919
If you feel, something this missing, wrong or misleading, please contact one of our main contributors:
2020

2121
* `@sensarmad <https://github.com/sensarmad>`_
22-
* `@johanneshiry <https://github.com/johanneshiry>`_
23-
* `@ckittl <https://github.com/ckittl>`_
22+
* `@t-ober <https://github.com/t-ober>`_
23+
* `@danielfeismann <https://github.com/danielfeismann>`_
24+
* `@sebastian-peter <https://github.com/sebastian-peter>`_
25+
* `@jo-bao <https://github.com/jo-bao>`_
26+
* `@julianhohmann <https://github.com/julianhohmann>`_
2427

2528
Hat tip to all other contributors!
2629

docs/readthedocs/models/models.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Immutability
2424
Copyable
2525
With the general design principle of immutability, entity modifications (e.g. updates of field values) can become
2626
hard and annoying. To avoid generating methods to update each field value, we provide an adapted version of the
27-
`builder pattern <https://en.wikipedia.org/wiki/Builder_pattern/>`_ to make entity modifications as easy as possible.
27+
`builder pattern <https://en.wikipedia.org/wiki/Builder_pattern/>`__ to make entity modifications as easy as possible.
2828
Each entity holds it's own copy builder class, which follows the same inheritance as the entity class itself. With a
2929
call of `.copy()` on an entity instance a builder instance is returned, that allows for modification of fields and
3030
can be terminated with `.build()` which will return an instance of the entity with modified field values as required.
@@ -50,7 +50,7 @@ Harmonized Units System
5050

5151
Equality Checks
5252
To represent quantities in the models within an acceptable accuracy, the JSR 385 reference implementation
53-
`Indriya <https://github.com/unitsofmeasurement/indriya>`_ is used. Comparing quantity objects or objects holding quantity
53+
`Indriya <https://github.com/unitsofmeasurement/indriya>`__ is used. Comparing quantity objects or objects holding quantity
5454
instances is not as trivial as it might seem, because there might be different understandings about the equality of
5555
quantities (e.g. there is a big difference between two instances being equal or equivalent). After long discussions how to
5656
treat quantities in the entity :code:`equals()` method, we agreed on the following rules to be applied:
@@ -74,12 +74,12 @@ Equality Checks
7474
would return :code:`false` as the equality check does NOT convert units. If you want to compare two entity instances
7575
based on their equivalence you have (for now) check for each quantity manually using their :code:`isEquivalentTo()`
7676
method. If you think you would benefit from a standard method that allows entity equivalence check, please consider
77-
handing in an issue `here <https://github.com/ie3-institute/PowerSystemDataModel/issues>`_.
77+
handing in an issue `here <https://github.com/ie3-institute/PowerSystemDataModel/issues>`__.
7878
Furthermore, the current existing implementation of :code:`isEquivalentTo()` in indriya does not allow the provision of
7979
a tolerance threshold that might be necessary when comparing values from floating point operations. We consider
80-
providing such a method in our `PowerSystemUtils <https://github.com/ie3-institute/PowerSystemUtils>`_ library.
80+
providing such a method in our `PowerSystemUtils <https://github.com/ie3-institute/PowerSystemUtils>`__ library.
8181
If you think you would benefit from such a method, please consider handing in an issue
82-
`here <https://github.com/ie3-institute/PowerSystemUtils/issues>`_.
82+
`here <https://github.com/ie3-institute/PowerSystemUtils/issues>`__.
8383

8484
Conditional Parameters
8585
Some of the models have conditional parameters. When reading model data from a data source, their respective factories for building these
@@ -97,8 +97,8 @@ Model classes you can use to describe a data set as input to power system simula
9797

9898
input/operator
9999

100-
Grid Related Models
101-
===================
100+
Grid Related Input Models
101+
=========================
102102
.. toctree::
103103
:maxdepth: 1
104104

@@ -112,8 +112,8 @@ Grid Related Models
112112
input/grid/measurementunit
113113
input/grid/gridcontainer
114114

115-
Participant Related Models
116-
==========================
115+
Participant Related Input Models
116+
================================
117117
.. toctree::
118118
:maxdepth: 1
119119

@@ -137,8 +137,8 @@ Result
137137
******
138138
Model classes you can use to describe the outcome of a power system simulation.
139139

140-
Grid Related Models
141-
===================
140+
Grid Related Result Models
141+
==========================
142142
.. toctree::
143143
:maxdepth: 1
144144

@@ -150,8 +150,8 @@ Grid Related Models
150150
result/grid/transformer2w
151151
result/grid/transformer3w
152152

153-
Participant Related Models
154-
==========================
153+
Participant Related Result Models
154+
=================================
155155
.. toctree::
156156
:maxdepth: 1
157157

docs/readthedocs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
commonmark==0.9.1
22
recommonmark==0.7.1
3-
Sphinx==4.2.0
4-
sphinx-rtd-theme==1.0.0
3+
Sphinx==5.3.0
4+
sphinx-rtd-theme==1.2.0
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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.io.source.csv;
7+
8+
import edu.ie3.datamodel.exceptions.SourceException;
9+
import edu.ie3.datamodel.io.naming.FileNamingStrategy;
10+
import edu.ie3.datamodel.io.source.*;
11+
import edu.ie3.datamodel.models.input.container.GraphicElements;
12+
import edu.ie3.datamodel.models.input.container.JointGridContainer;
13+
import edu.ie3.datamodel.models.input.container.RawGridElements;
14+
import edu.ie3.datamodel.models.input.container.SystemParticipants;
15+
16+
/** Convenience class for cases where all used data comes from CSV sources */
17+
public class CsvJointGridContainerSource {
18+
private CsvJointGridContainerSource() {}
19+
20+
public static JointGridContainer read(String gridName, String csvSep, String directoryPath)
21+
throws SourceException {
22+
23+
/* Parameterization */
24+
25+
FileNamingStrategy namingStrategy = new FileNamingStrategy(); // Default naming strategy
26+
27+
/* Instantiating sources */
28+
TypeSource typeSource = new CsvTypeSource(csvSep, directoryPath, namingStrategy);
29+
RawGridSource rawGridSource =
30+
new CsvRawGridSource(csvSep, directoryPath, namingStrategy, typeSource);
31+
ThermalSource thermalSource =
32+
new CsvThermalSource(csvSep, directoryPath, namingStrategy, typeSource);
33+
SystemParticipantSource systemParticipantSource =
34+
new CsvSystemParticipantSource(
35+
csvSep, directoryPath, namingStrategy, typeSource, thermalSource, rawGridSource);
36+
GraphicSource graphicsSource =
37+
new CsvGraphicSource(csvSep, directoryPath, namingStrategy, typeSource, rawGridSource);
38+
39+
/* Loading models */
40+
RawGridElements rawGridElements =
41+
rawGridSource
42+
.getGridData()
43+
.orElseThrow(() -> new SourceException("Error during reading of raw grid data."));
44+
SystemParticipants systemParticipants =
45+
systemParticipantSource
46+
.getSystemParticipants()
47+
.orElseThrow(
48+
() -> new SourceException("Error during reading of system participant data."));
49+
GraphicElements graphicElements =
50+
graphicsSource
51+
.getGraphicElements()
52+
.orElseThrow(() -> new SourceException("Error during reading of graphic elements."));
53+
54+
return new JointGridContainer(gridName, rawGridElements, systemParticipants, graphicElements);
55+
}
56+
}

src/test/groovy/edu/ie3/datamodel/io/connectors/CsvFileConnectorTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class CsvFileConnectorTest extends Specification {
6262
}
6363

6464
def cleanupSpec() {
65-
FileIOUtils.deleteRecursively(tmpDirectory)
6665
cfc.shutdown()
66+
FileIOUtils.deleteRecursively(tmpDirectory)
6767
}
6868

6969
def "The csv file connector is able to provide correct paths to time series files"() {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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.io.csv
7+
8+
import edu.ie3.datamodel.io.sink.CsvFileSink
9+
import edu.ie3.datamodel.io.source.csv.CsvJointGridContainerSource
10+
import edu.ie3.datamodel.io.source.csv.CsvTestDataMeta
11+
import edu.ie3.util.io.FileIOUtils
12+
import spock.lang.Shared
13+
import spock.lang.Specification
14+
15+
import java.nio.file.Files
16+
import java.nio.file.Path
17+
18+
/**
19+
* Testing whether PSDM CSV grids are equal when serialized and deserialized sequentially.
20+
* Grid data should <strong>not</strong> change when written out or parsed.
21+
*/
22+
class GridIoIT extends Specification implements CsvTestDataMeta {
23+
24+
@Shared
25+
Path tempDirectory
26+
27+
@Shared
28+
CsvFileSink sink
29+
30+
def setupSpec() {
31+
tempDirectory = Files.createTempDirectory("GridIoIT")
32+
sink = new CsvFileSink(tempDirectory.toAbsolutePath().toString())
33+
}
34+
35+
def cleanupSpec() {
36+
sink.shutdown()
37+
FileIOUtils.deleteRecursively(tempDirectory)
38+
}
39+
40+
def "Input JointGridContainer equals Output JointGridContainer."() {
41+
42+
given:
43+
// create joint grid container
44+
def gridName = "vn_simona"
45+
def separator = ","
46+
def firstGridContainer = CsvJointGridContainerSource.read(gridName, separator, jointGridFolderPath)
47+
48+
when:
49+
// write files from joint grid container in output directory
50+
sink.persistJointGrid(firstGridContainer)
51+
52+
// create second grid container from output folder
53+
def secondGridContainer = CsvJointGridContainerSource.read(gridName, separator, tempDirectory.toAbsolutePath().toString())
54+
55+
then:
56+
// compare input and output joint grid container
57+
firstGridContainer == secondGridContainer
58+
59+
}
60+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ trait CsvTestDataMeta {
2424
static String coordinatesCosmoFolderPath = getResourceAbs("_coordinates/cosmo")
2525
static String weatherCosmoFolderPath = getResourceAbs("_weather/cosmo")
2626
static String weatherIconFolderPath = getResourceAbs("_weather/icon")
27+
static String jointGridFolderPath = getResourceAbs("_joint_grid")
2728

2829
static String gridDefaultFolderPath = getResourceAbs("_grid/default")
2930
static String gridMalformedFolderPath = getResourceAbs("_grid/malformed")

0 commit comments

Comments
 (0)