Skip to content

Commit d46b0d1

Browse files
Merge branch 'dev' into pp/#1343-add-ground-temperature-1m-as-option-to-weather-data
2 parents 6a77ffc + 7e14215 commit d46b0d1

Some content is hidden

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

47 files changed

+588
-340
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased/Snapshot]
88

99
### Added
10+
- Extend Validation to EnergyManagement Systems. [#1356](https://github.com/ie3-institute/PowerSystemDataModel/issues/1356)
1011
- Add ground temperature (1m) as option to weather data. [#1343](https://github.com/ie3-institute/PowerSystemDataModel/issues/1343)
1112

1213
### Fixed
1314
- Fixed handling of `CongestionResult.InputModelType` in `EntityProcessor` [#1325](https://github.com/ie3-institute/PowerSystemDataModel/issues/1325)
14-
- -Fixed em fields in input models [#1331](https://github.com/ie3-institute/PowerSystemDataModel/issues/1331)
15+
- Fixed em fields in input models [#1331](https://github.com/ie3-institute/PowerSystemDataModel/issues/1331)
16+
- Fixed valid fields for `EmInput` [#1360](https://github.com/ie3-institute/PowerSystemDataModel/issues/1360)
1517

1618
### Changed
1719
- Updated dependabot workflow and added CODEOWNERS [#1328](https://github.com/ie3-institute/PowerSystemDataModel/issues/1328)
1820
- Extend azimuth angle range to [-180°, 180°] for PV inputs [#1330](https://github.com/ie3-institute/PowerSystemDataModel/issues/1330)
21+
- Improved error messages when reading and validating an invalid grid [#1354](https://github.com/ie3-institute/PowerSystemDataModel/issues/1354)
1922

2023
## [7.0.0] - 2025-05-08
2124

build.gradle

Lines changed: 1 addition & 1 deletion
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 '7.0.4' //code format
7+
id 'com.diffplug.spotless' version '7.1.0' //code format
88
id 'com.github.spotbugs' version '6.2.1' // code check, working on byte code
99
id 'de.undercouch.download' version '5.6.0'
1010
id 'kr.motd.sphinx' version '2.10.1' // documentation generation

src/main/java/edu/ie3/datamodel/exceptions/DuplicateEntitiesException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public DuplicateEntitiesException(
1919
this(
2020
"The following exception(s) occurred while checking the uniqueness of '"
2121
+ entityName
22-
+ "' entities: "
23-
+ ExceptionUtils.getMessages(exceptions));
22+
+ "' entities: \n"
23+
+ ExceptionUtils.combineExceptions(exceptions));
2424
}
2525
}

src/main/java/edu/ie3/datamodel/exceptions/FailedValidationException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public FailedValidationException(String message) {
2323

2424
/** @param exceptions List of exceptions, which must not be empty */
2525
public FailedValidationException(List<? extends Exception> exceptions) {
26-
super(
27-
"Validation failed due to: \n" + ExceptionUtils.getMessages(exceptions), exceptions.get(0));
26+
super("Validation failed due to:\n " + ExceptionUtils.combineExceptions(exceptions));
2827
}
2928
}

src/main/java/edu/ie3/datamodel/exceptions/InvalidEntityException.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ public class InvalidEntityException extends ValidationException {
1313
private static final long serialVersionUID = 809496087520306374L;
1414

1515
public InvalidEntityException(String faultDescription, UniqueEntity invalidEntity) {
16-
super("Entity is invalid because of: \n" + faultDescription + " [" + invalidEntity + "]");
16+
super("Entity is invalid because of: " + faultDescription + " [" + invalidEntity + "]");
1717
}
1818

1919
public InvalidEntityException(
2020
String faultDescription, Throwable cause, UniqueEntity invalidEntity) {
21-
super(
22-
"Entity is invalid because of: \n" + faultDescription + " [" + invalidEntity + "]", cause);
21+
super("Entity is invalid because of: " + faultDescription + " [" + invalidEntity + "]", cause);
2322
}
2423

2524
public InvalidEntityException(String message, Throwable cause) {

src/main/java/edu/ie3/datamodel/exceptions/SourceException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public SourceException(final String message) {
3232
}
3333

3434
public SourceException(String message, List<? extends Exception> exceptions) {
35-
super(message + " " + ExceptionUtils.getMessages(exceptions), exceptions.get(0));
35+
super(message + "\n " + ExceptionUtils.combineExceptions(exceptions));
3636
}
3737
}

src/main/java/edu/ie3/datamodel/io/factory/Factory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public Try<R, FactoryException> get(D data) {
7373
* {@link Failure}
7474
*/
7575
public Try<R, FactoryException> get(Try<D, ?> data) {
76-
return data.transformF(FactoryException::new).flatMap(this::get);
76+
return data.transformF(e -> new FactoryException(e.getMessage(), e)).flatMap(this::get);
7777
}
7878

7979
/**

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
public abstract class AssetInputEntityFactory<T extends AssetInput, D extends AssetInputEntityData>
2525
extends UniqueEntityFactory<T, D> {
2626

27-
private static final String OPERATES_FROM = "operatesFrom";
28-
private static final String OPERATES_UNTIL = "operatesUntil";
27+
protected static final String OPERATOR = "operator";
28+
protected static final String OPERATES_FROM = "operatesFrom";
29+
protected static final String OPERATES_UNTIL = "operatesUntil";
2930

3031
@SafeVarargs
3132
protected AssetInputEntityFactory(Class<? extends T>... allowedClasses) {
@@ -48,14 +49,33 @@ protected List<Set<String>> getFields(Class<?> entityClass) {
4849
Set<String> constructorParamsUntil = expandSet(constructorParamsMin, OPERATES_UNTIL);
4950
Set<String> constructorParamsBoth = expandSet(constructorParamsFrom, OPERATES_UNTIL);
5051

52+
// with operator field
53+
Set<String> constructorParamsOperator = expandSet(constructorParamsMin, OPERATOR);
54+
Set<String> constructorParamsOperatorFrom = expandSet(constructorParamsFrom, OPERATOR);
55+
Set<String> constructorParamsOperatorUntil = expandSet(constructorParamsUntil, OPERATOR);
56+
Set<String> constructorParamsOperatorBoth = expandSet(constructorParamsBoth, OPERATOR);
57+
5158
final String[] additionalFields = getAdditionalFields();
5259

5360
constructorParamsMin = expandSet(constructorParamsMin, additionalFields);
5461
constructorParamsFrom = expandSet(constructorParamsFrom, additionalFields);
5562
constructorParamsUntil = expandSet(constructorParamsUntil, additionalFields);
5663
constructorParamsBoth = expandSet(constructorParamsBoth, additionalFields);
64+
65+
constructorParamsOperator = expandSet(constructorParamsOperator, additionalFields);
66+
constructorParamsOperatorFrom = expandSet(constructorParamsOperatorFrom, additionalFields);
67+
constructorParamsOperatorUntil = expandSet(constructorParamsOperatorUntil, additionalFields);
68+
constructorParamsOperatorBoth = expandSet(constructorParamsOperatorBoth, additionalFields);
69+
5770
return Arrays.asList(
58-
constructorParamsMin, constructorParamsFrom, constructorParamsUntil, constructorParamsBoth);
71+
constructorParamsMin,
72+
constructorParamsFrom,
73+
constructorParamsUntil,
74+
constructorParamsBoth,
75+
constructorParamsOperator,
76+
constructorParamsOperatorFrom,
77+
constructorParamsOperatorUntil,
78+
constructorParamsOperatorBoth);
5979
}
6080

6181
/**

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
import edu.ie3.datamodel.models.OperationTime;
99
import edu.ie3.datamodel.models.input.EmInput;
1010
import edu.ie3.datamodel.models.input.OperatorInput;
11-
import java.util.ArrayList;
12-
import java.util.List;
13-
import java.util.Set;
14-
import java.util.UUID;
11+
import java.util.*;
1512

1613
public class EmInputFactory extends AssetInputEntityFactory<EmInput, EmAssetInputEntityData> {
1714

@@ -23,21 +20,9 @@ public EmInputFactory() {
2320
super(EmInput.class);
2421
}
2522

26-
@Override
27-
protected List<Set<String>> getFields(Class<?> entityClass) {
28-
List<Set<String>> fields = new ArrayList<>(super.getFields(entityClass));
29-
30-
List<Set<String>> withEm =
31-
fields.stream().map(f -> (Set<String>) expandSet(f, CONTROLLING_EM)).toList();
32-
33-
fields.addAll(withEm);
34-
35-
return fields;
36-
}
37-
3823
@Override
3924
protected String[] getAdditionalFields() {
40-
return new String[] {CONTROL_STRATEGY};
25+
return new String[] {CONTROL_STRATEGY, CONTROLLING_EM};
4126
}
4227

4328
@Override

src/main/java/edu/ie3/datamodel/io/processor/ProcessorProvider.java

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package edu.ie3.datamodel.io.processor;
77

88
import edu.ie3.datamodel.exceptions.EntityProcessorException;
9-
import edu.ie3.datamodel.exceptions.FailureException;
109
import edu.ie3.datamodel.exceptions.ProcessorProviderException;
1110
import edu.ie3.datamodel.io.processor.input.InputEntityProcessor;
1211
import edu.ie3.datamodel.io.processor.result.ResultEntityProcessor;
@@ -313,25 +312,22 @@ public static Collection<EntityProcessor<? extends Entity>> allResultEntityProce
313312
Value,
314313
Value>>
315314
allTimeSeriesProcessors() throws EntityProcessorException {
316-
try {
317-
return Try.scanStream(
318-
TimeSeriesProcessor.eligibleKeys.stream()
319-
.map(
320-
key ->
321-
Try.of(
322-
() ->
323-
new TimeSeriesProcessor<>(
324-
(Class<TimeSeries<TimeSeriesEntry<Value>, Value, Value>>)
325-
key.getTimeSeriesClass(),
326-
(Class<TimeSeriesEntry<Value>>) key.getEntryClass(),
327-
(Class<Value>) key.getValueClass()),
328-
EntityProcessorException.class)),
329-
"list of processors")
330-
.getOrThrow()
331-
.collect(Collectors.toMap(TimeSeriesProcessor::getRegisteredKey, Function.identity()));
332-
} catch (FailureException e) {
333-
throw new EntityProcessorException(e.getCause());
334-
}
315+
return Try.scanStream(
316+
TimeSeriesProcessor.eligibleKeys.stream()
317+
.map(
318+
key ->
319+
Try.of(
320+
() ->
321+
new TimeSeriesProcessor<>(
322+
(Class<TimeSeries<TimeSeriesEntry<Value>, Value, Value>>)
323+
key.getTimeSeriesClass(),
324+
(Class<TimeSeriesEntry<Value>>) key.getEntryClass(),
325+
(Class<Value>) key.getValueClass()),
326+
EntityProcessorException.class)),
327+
"time series processors",
328+
EntityProcessorException::new)
329+
.getOrThrow()
330+
.collect(Collectors.toMap(TimeSeriesProcessor::getRegisteredKey, Function.identity()));
335331
}
336332

337333
@SuppressWarnings("unchecked cast")

0 commit comments

Comments
 (0)