Skip to content

Commit d75926f

Browse files
committed
Adapting LoadProfileSources.
1 parent 44f9ec8 commit d75926f

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ protected Try<LoadProfileEntry<V>, FactoryException> createEntries(
8383
public abstract P getLoadProfile();
8484

8585
/** Returns the maximal power value of the time series */
86-
public abstract ComparableQuantity<Power> getMaxPower();
86+
public abstract Optional<ComparableQuantity<Power>> getMaxPower();
8787

8888
/** Returns the load profile energy scaling for this load profile time series. */
89-
public abstract ComparableQuantity<Energy> getLoadProfileEnergyScaling();
89+
public abstract Optional<ComparableQuantity<Energy>> getLoadProfileEnergyScaling();
9090

9191
/**
9292
* Method to read in the build-in {@link BdewStandardLoadProfile}s.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ public P getLoadProfile() {
8383
}
8484

8585
@Override
86-
public ComparableQuantity<Power> getMaxPower() {
87-
return loadProfileTimeSeries.maxPower;
86+
public Optional<ComparableQuantity<Power>> getMaxPower() {
87+
return loadProfileTimeSeries.maxPower();
8888
}
8989

9090
@Override
91-
public ComparableQuantity<Energy> getLoadProfileEnergyScaling() {
92-
return loadProfileTimeSeries.profileEnergyScaling;
91+
public Optional<ComparableQuantity<Energy>> getLoadProfileEnergyScaling() {
92+
return loadProfileTimeSeries.loadProfileScaling();
9393
}
9494

9595
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,14 @@ public P getLoadProfile() {
126126
}
127127

128128
@Override
129-
public ComparableQuantity<Power> getMaxPower() {
130-
return entryFactory.calculateMaxPower(loadProfile, getEntries(queryFull, ps -> {}));
129+
public Optional<ComparableQuantity<Power>> getMaxPower() {
130+
return Optional.ofNullable(
131+
entryFactory.calculateMaxPower(loadProfile, getEntries(queryFull, ps -> {})));
131132
}
132133

133134
@Override
134-
public ComparableQuantity<Energy> getLoadProfileEnergyScaling() {
135-
return entryFactory.getLoadProfileEnergyScaling(loadProfile);
135+
public Optional<ComparableQuantity<Energy>> getLoadProfileEnergyScaling() {
136+
return Optional.ofNullable(entryFactory.getLoadProfileEnergyScaling(loadProfile));
136137
}
137138

138139
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

0 commit comments

Comments
 (0)