Skip to content

Commit 9a062f8

Browse files
authored
Merge branch 'dev' into ms/#1007-refactor-CsvFileConnector-and-CsvDataSource
2 parents 72801af + a0c008c commit 9a062f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+213
-122
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased/Snapshot]
88

9+
## [5.0.1] - 2024-03-07
10+
11+
### Fixed
12+
- Fixed `equals` of `ResultEntity` and `TimeSeriesEntry` [#1037](https://github.com/ie3-institute/PowerSystemDataModel/issues/1037)
13+
14+
## [5.0.0] - 2024-03-06
15+
916
### Added
1017
- Formatting Spotless Groovy import order [#960](https://github.com/ie3-institute/PowerSystemDataModel/issues/960)
1118
- Implementing missing typical methods in `Try` [#970](https://github.com/ie3-institute/PowerSystemDataModel/issues/970)
@@ -271,7 +278,9 @@ coordinates or multiple exactly equal coordinates possible
271278
- CsvDataSource now stops trying to get an operator for empty operator uuid field in entities
272279
- CsvDataSource now parsing multiple geoJson strings correctly
273280

274-
[Unreleased/Snapshot]: https://github.com/ie3-institute/powersystemdatamodel/compare/4.1.0...HEAD
281+
[Unreleased/Snapshot]: https://github.com/ie3-institute/powersystemdatamodel/compare/5.0.1...HEAD
282+
[5.0.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/5.0.0...5.0.1
283+
[4.1.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/4.1.0...5.0.0
275284
[4.1.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/4.0.0...4.1.0
276285
[4.0.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/3.0.0...4.0.0
277286
[3.0.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/2.1.0...3.0.0

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ext {
1818
javaVersion = JavaVersion.VERSION_17
1919
groovyVersion = "4.0"
2020
groovyBinaryVersion = "4.0.19"
21-
testcontainersVersion = '1.19.6'
21+
testcontainersVersion = '1.19.7'
2222

2323
scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator //location of script plugins
2424
}
@@ -53,7 +53,7 @@ repositories {
5353
dependencies {
5454

5555
// ie³ power system utils
56-
implementation 'com.github.ie3-institute:PowerSystemUtils:2.2'
56+
implementation 'com.github.ie3-institute:PowerSystemUtils:2.2.1'
5757

5858
implementation 'tech.units:indriya:2.2'
5959

gradle/wrapper/gradle-wrapper.jar

2.1 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,26 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
146147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
148149
MAX_FD=$( ulimit -H -n ) ||
149150
warn "Could not query maximum file descriptor limit"
150151
esac
151152
case $MAX_FD in #(
152153
'' | soft) :;; #(
153154
*)
154155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
156157
ulimit -n "$MAX_FD" ||
157158
warn "Could not set maximum file descriptor limit to $MAX_FD"
158159
esac
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
197198
done
198199
fi
199200

200-
# Collect all arguments for the java command;
201-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202-
# shell script including quotes and variable substitutions, so put them in
203-
# double quotes to make sure that they get re-expanded; and
204-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
205210

206211
set -- \
207212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

src/main/java/edu/ie3/datamodel/io/extractor/Extractor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public static Set<UniqueInputEntity> extractElements(NestedEntity nestedEntity)
5151
if (nestedEntity instanceof HasLine nestedHasLine) {
5252
resultingList.add(nestedHasLine.getLine());
5353
}
54+
if (nestedEntity instanceof HasEm nestedHasEms) {
55+
nestedHasEms.getControllingEm().ifPresent(resultingList::add);
56+
}
5457

5558
if (resultingList.contains(null)) {
5659
log.warn(
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* © 2024. 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.extractor;
7+
8+
import edu.ie3.datamodel.models.input.EmInput;
9+
import java.util.Optional;
10+
11+
/**
12+
* Interface that should be implemented by all elements that can be controlled by {@link
13+
* edu.ie3.datamodel.models.input.EmInput} elements and should be processable by the {@link
14+
* Extractor}.
15+
*/
16+
public interface HasEm extends NestedEntity {
17+
Optional<EmInput> getControllingEm();
18+
}

src/main/java/edu/ie3/datamodel/io/source/IdCoordinateSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ List<CoordinateDistance> getClosestCoordinates(
9595
default List<CoordinateDistance> calculateCoordinateDistances(
9696
Point coordinate, int n, Collection<Point> coordinates) {
9797
if (coordinates != null && !coordinates.isEmpty()) {
98-
SortedSet<CoordinateDistance> sortedDistances =
98+
List<CoordinateDistance> sortedDistances =
9999
GeoUtils.calcOrderedCoordinateDistances(coordinate, coordinates);
100100
return restrictToBoundingBox(coordinate, sortedDistances, n);
101101
} else {

src/main/java/edu/ie3/datamodel/models/input/EmInput.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
*/
66
package edu.ie3.datamodel.models.input;
77

8+
import edu.ie3.datamodel.io.extractor.HasEm;
89
import edu.ie3.datamodel.models.OperationTime;
910
import edu.ie3.datamodel.models.UniqueEntity;
1011
import java.util.Objects;
1112
import java.util.Optional;
1213
import java.util.UUID;
1314

14-
public class EmInput extends AssetInput {
15+
public class EmInput extends AssetInput implements HasEm {
1516

1617
/** Reference to the control strategy to be used for this model */
1718
private final String controlStrategy;
@@ -20,7 +21,7 @@ public class EmInput extends AssetInput {
2021
* Optional UUID of the parent {@link EmInput} that is controlling this em unit. If null, this em
2122
* unit is not em-controlled.
2223
*/
23-
private final EmInput parentEm;
24+
private final EmInput controllingEm;
2425

2526
/**
2627
* Constructor for an operated energy management system
@@ -30,18 +31,18 @@ public class EmInput extends AssetInput {
3031
* @param operator of the asset
3132
* @param operationTime time for which the entity is operated
3233
* @param emControlStrategy the control strategy
33-
* @param parentEm The {@link EmInput} controlling this em unit. Null, if not applicable.
34+
* @param controllingEm The {@link EmInput} controlling this em unit. Null, if not applicable.
3435
*/
3536
public EmInput(
3637
UUID uuid,
3738
String id,
3839
OperatorInput operator,
3940
OperationTime operationTime,
4041
String emControlStrategy,
41-
EmInput parentEm) {
42+
EmInput controllingEm) {
4243
super(uuid, id, operator, operationTime);
4344
this.controlStrategy = emControlStrategy;
44-
this.parentEm = parentEm;
45+
this.controllingEm = controllingEm;
4546
}
4647

4748
/**
@@ -50,22 +51,18 @@ public EmInput(
5051
* @param uuid of the input entity
5152
* @param id of the asset
5253
* @param emControlStrategy the control strategy
53-
* @param parentEm The {@link EmInput} controlling this em unit. Null, if not applicable.
54+
* @param controllingEm The {@link EmInput} controlling this em unit. Null, if not applicable.
5455
*/
55-
public EmInput(UUID uuid, String id, String emControlStrategy, EmInput parentEm) {
56+
public EmInput(UUID uuid, String id, String emControlStrategy, EmInput controllingEm) {
5657
super(uuid, id);
5758
this.controlStrategy = emControlStrategy;
58-
this.parentEm = parentEm;
59+
this.controllingEm = controllingEm;
5960
}
6061

6162
public String getControlStrategy() {
6263
return controlStrategy;
6364
}
6465

65-
public Optional<EmInput> getParentEm() {
66-
return Optional.ofNullable(parentEm);
67-
}
68-
6966
@Override
7067
public EmInputCopyBuilder copy() {
7168
return new EmInputCopyBuilder(this);
@@ -77,12 +74,12 @@ public boolean equals(Object o) {
7774
if (!(o instanceof EmInput emInput)) return false;
7875
if (!super.equals(o)) return false;
7976
return Objects.equals(controlStrategy, emInput.controlStrategy)
80-
&& Objects.equals(parentEm, emInput.parentEm);
77+
&& Objects.equals(controllingEm, emInput.controllingEm);
8178
}
8279

8380
@Override
8481
public int hashCode() {
85-
return Objects.hash(super.hashCode(), controlStrategy, parentEm);
82+
return Objects.hash(super.hashCode(), controlStrategy, controllingEm);
8683
}
8784

8885
@Override
@@ -92,15 +89,20 @@ public String toString() {
9289
+ getUuid()
9390
+ ", id='"
9491
+ getId()
95-
+ ", operator="
92+
+ "', operator="
9693
+ getOperator().getUuid()
9794
+ ", operationTime="
9895
+ getOperationTime()
9996
+ ", controlStrategy="
10097
+ getControlStrategy()
101-
+ ", parentEm="
102-
+ getParentEm().map(UniqueEntity::getUuid).map(UUID::toString).orElse("")
103-
+ '}';
98+
+ ", controllingEm="
99+
+ getControllingEm().map(UniqueEntity::getUuid).map(UUID::toString).orElse("")
100+
+ "}";
101+
}
102+
103+
@Override
104+
public Optional<EmInput> getControllingEm() {
105+
return Optional.ofNullable(controllingEm);
104106
}
105107

106108
public static class EmInputCopyBuilder extends AssetInputCopyBuilder<EmInputCopyBuilder> {
@@ -112,7 +114,7 @@ public static class EmInputCopyBuilder extends AssetInputCopyBuilder<EmInputCopy
112114
protected EmInputCopyBuilder(EmInput entity) {
113115
super(entity);
114116
this.controlStrategy = entity.getControlStrategy();
115-
this.parentEm = entity.parentEm;
117+
this.parentEm = entity.controllingEm;
116118
}
117119

118120
public EmInputCopyBuilder controlStrategy(String controlStrategy) {

src/main/java/edu/ie3/datamodel/models/input/system/BmInput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public String toString() {
150150
+ ", qCharacteristics='"
151151
+ getqCharacteristics()
152152
+ "', em="
153-
+ getEm()
153+
+ getControllingEm()
154154
+ ", type="
155155
+ type.getUuid()
156156
+ ", marketReaction="

0 commit comments

Comments
 (0)