Skip to content

Commit c3c38f7

Browse files
committed
Merge branch 'dev' into ms/#1292-add-updated-bdew-standard-load-profiles
# Conflicts: # CHANGELOG.md
2 parents 2e91707 + 67da4a1 commit c3c38f7

29 files changed

+754
-610
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased/Snapshot]
88

99
### Added
10+
- Enhanced check for invalid field names in sources [#1383](https://github.com/ie3-institute/PowerSystemDataModel/issues/1383)
11+
- Enhancing value retrieval in `TimeSeriesSource` [1280](https://github.com/ie3-institute/PowerSystemDataModel/issues/1280)
12+
- Enhancing the `LoadProfileSource` to return the resolution [1288](https://github.com/ie3-institute/PowerSystemDataModel/issues/1288)
13+
- Enhancing Validation for sRated of `HpTypeInput` [1394](https://github.com/ie3-institute/PowerSystemDataModel/issues/1394)
1014
- Added updated `BdewStandardLoadProfiles` [#1292](https://github.com/ie3-institute/PowerSystemDataModel/issues/1292)
1115

12-
### Fixed
13-
1416
### Changed
17+
- Fixed CFF-Version [#1392](https://github.com/ie3-institute/PowerSystemDataModel/issues/1392)
1518

1619
## [8.0.0] - 2025-07-22
1720

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cff-version: 1.0.0
1+
cff-version: 1.2.0
22
title: "PowerSystemDataModel - Provides an elaborated data model to model energy systems with a high granularity."
33
message: "If you use this software, please cite it as below."
44
type: software

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ext {
1818
//version (changing these should be considered thoroughly!)
1919
javaVersion = JavaVersion.VERSION_17
2020
groovyVersion = "4.0"
21-
groovyBinaryVersion = "4.0.27"
21+
groovyBinaryVersion = "4.0.28"
2222

2323
junitVersion = '1.12.0'
2424
testcontainersVersion = '1.21.3'

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ public Try<Void, ValidationException> validate(
174174
+ "' are possible (NOT case-sensitive!):\n"
175175
+ possibleOptions));
176176
} else {
177+
// find all unused fields
177178
Set<String> unused = getUnusedFields(harmonizedActualFields, validFieldSets);
178179

179180
if (!unused.isEmpty()) {
180-
log.debug(
181+
log.info(
181182
"The following additional fields were found for entity class of '{}': {}",
182183
entityClass.getSimpleName(),
183184
unused);

src/main/java/edu/ie3/datamodel/io/factory/input/participant/SystemParticipantInputEntityFactory.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,26 @@ public abstract class SystemParticipantInputEntityFactory<
3030
T extends SystemParticipantInput, D extends SystemParticipantEntityData>
3131
extends AssetInputEntityFactory<T, D> {
3232

33+
private static final String NODE = "node";
34+
3335
private static final String Q_CHARACTERISTICS = "qCharacteristics";
3436

3537
public static final String CONTROLLING_EM = "controllingEm";
3638

39+
@SafeVarargs
3740
protected SystemParticipantInputEntityFactory(Class<? extends T>... allowedClasses) {
3841
super(allowedClasses);
3942
}
4043

4144
@Override
4245
protected List<Set<String>> getFields(Class<?> entityClass) {
4346
List<Set<String>> fields = new ArrayList<>(super.getFields(entityClass));
44-
for (Set<String> set : fields) set.add(Q_CHARACTERISTICS);
45-
46-
List<Set<String>> withEm =
47-
fields.stream().map(f -> (Set<String>) expandSet(f, CONTROLLING_EM)).toList();
4847

49-
fields.addAll(withEm);
48+
for (Set<String> set : fields) {
49+
set.add(Q_CHARACTERISTICS);
50+
set.add(NODE);
51+
set.add(CONTROLLING_EM);
52+
}
5053

5154
return fields;
5255
}

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@ protected Try<LoadProfileEntry<V>, FactoryException> createEntries(
8888
/** Returns the load profile energy scaling for this load profile time series. */
8989
public abstract Optional<ComparableQuantity<Energy>> getLoadProfileEnergyScaling();
9090

91+
/**
92+
* Returns the resolution for the given {@link LoadProfile}.
93+
*
94+
* @param loadProfile given load profile
95+
* @return the resolution in seconds.
96+
*/
97+
public static long getResolution(LoadProfile loadProfile) {
98+
99+
if (loadProfile == LoadProfile.DefaultLoadProfiles.NO_LOAD_PROFILE) {
100+
// since no load profile was assigned, we return the maximal possible value
101+
return Long.MAX_VALUE;
102+
} else {
103+
// currently all registered profiles and all sources use 15 minutes intervals
104+
return 900L;
105+
}
106+
}
107+
91108
/**
92109
* Method to read in the build-in {@link BdewStandardLoadProfile}s.
93110
*

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ public abstract IndividualTimeSeries<V> getTimeSeries(ClosedInterval<ZonedDateTi
5252

5353
public abstract Optional<V> getValue(ZonedDateTime time);
5454

55+
/**
56+
* Method to retrieve the value of the given time or the last timestamp before the given time.
57+
*
58+
* @param time given time
59+
* @return an option for a value
60+
*/
61+
public Optional<V> getValueOrLast(ZonedDateTime time) {
62+
Optional<V> value = getValue(time);
63+
64+
if (value.isEmpty()) {
65+
return getPreviousTimeBasedValue(time).map(TimeBasedValue::getValue);
66+
}
67+
68+
return value;
69+
}
70+
5571
public abstract Optional<TimeBasedValue<V>> getPreviousTimeBasedValue(ZonedDateTime time);
5672

5773
/**
@@ -61,4 +77,12 @@ public abstract IndividualTimeSeries<V> getTimeSeries(ClosedInterval<ZonedDateTi
6177
* @return a list of time keys
6278
*/
6379
public abstract List<ZonedDateTime> getTimeKeysAfter(ZonedDateTime time);
80+
81+
/**
82+
* Method to return all last known time keys before a given timestamp.
83+
*
84+
* @param time given time
85+
* @return an option for the time key
86+
*/
87+
public abstract Optional<ZonedDateTime> getLastTimeKeyBefore(ZonedDateTime time);
6488
}

src/main/java/edu/ie3/datamodel/io/source/csv/CsvTimeSeriesSource.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public List<ZonedDateTime> getTimeKeysAfter(ZonedDateTime time) {
142142
return timeSeries.getTimeKeysAfter(time);
143143
}
144144

145+
@Override
146+
public Optional<ZonedDateTime> getLastTimeKeyBefore(ZonedDateTime time) {
147+
return timeSeries.getPreviousDateTime(time);
148+
}
149+
145150
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
146151

147152
/**

src/main/java/edu/ie3/datamodel/io/source/sql/SqlTimeSeriesSource.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ public List<ZonedDateTime> getTimeKeysAfter(ZonedDateTime time) {
199199
.toList();
200200
}
201201

202+
@Override
203+
public Optional<ZonedDateTime> getLastTimeKeyBefore(ZonedDateTime time) {
204+
return dataSource
205+
.executeQuery(
206+
queryForValueBefore, ps -> ps.setTimestamp(1, Timestamp.from(time.toInstant())))
207+
.map(valueFactory::extractTime)
208+
.max(ZonedDateTime::compareTo);
209+
}
210+
202211
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
203212

204213
/** Creates a set of TimeBasedValues from database */

src/main/java/edu/ie3/datamodel/models/result/system/HpResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class HpResult extends SystemParticipantWithHeatResult {
2020
* @param inputModel uuid of the input model that produces the result
2121
* @param p active power output normally provided in MW
2222
* @param q reactive power output normally provided in MVAr
23-
* @param qDot provided head energy
23+
* @param qDot provided heat energy
2424
*/
2525
public HpResult(
2626
ZonedDateTime time,

0 commit comments

Comments
 (0)