Skip to content

Commit c27604a

Browse files
committed
Extending flex option handling in ExtInputContainer.
1 parent 257bfea commit c27604a

File tree

3 files changed

+53
-7
lines changed

3 files changed

+53
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### Added
1010
- Adding some utility methods [#368](https://github.com/ie3-institute/simonaAPI/issues/368)
11+
- Extending flex option handling in `ExtInputContainer` [#371](https://github.com/ie3-institute/simonaAPI/issues/371)
1112

1213
### Changed
1314
- Changes to sent and received em data [#2366](https://github.com/ie3-institute/simonaAPI/issues/366)

src/main/java/edu/ie3/simona/api/data/container/ExtInputContainer.java

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88

99
import edu.ie3.datamodel.models.value.PValue;
1010
import edu.ie3.datamodel.models.value.Value;
11-
import edu.ie3.simona.api.data.model.em.EmCommunicationMessage;
12-
import edu.ie3.simona.api.data.model.em.EmSetPoint;
13-
import edu.ie3.simona.api.data.model.em.FlexOptionRequest;
14-
import edu.ie3.simona.api.data.model.em.FlexOptions;
11+
import edu.ie3.simona.api.data.model.em.*;
1512
import java.util.*;
1613

1714
/** Contains all inputs for SIMONA for a certain tick */
@@ -61,7 +58,8 @@ public boolean isEmpty() {
6158
return primaryData.isEmpty()
6259
&& flexRequests.isEmpty()
6360
&& flexOptions.isEmpty()
64-
&& setPoints.isEmpty();
61+
&& setPoints.isEmpty()
62+
&& emMessages.isEmpty();
6563
}
6664

6765
/** Returns the tick the data is provided for. */
@@ -100,8 +98,32 @@ public void addRequest(UUID receiver) {
10098
flexRequests.put(receiver, new FlexOptionRequest(receiver, false));
10199
}
102100

103-
public void addRequest(UUID receiver, FlexOptionRequest request) {
104-
flexRequests.put(receiver, request);
101+
/**
102+
* Method for adding a flex option request.
103+
*
104+
* @param request to be added
105+
*/
106+
public void addRequest(FlexOptionRequest request) {
107+
flexRequests.put(request.receiver(), request);
108+
}
109+
110+
/**
111+
* Method for adding flex options to a given receiver.
112+
*
113+
* @param multiFlexOptions that will be added to this container
114+
*/
115+
public void addFlexOptions(MultiFlexOptions multiFlexOptions) {
116+
addFlexOptions(multiFlexOptions.receiver(), multiFlexOptions.flexOptions());
117+
}
118+
119+
/**
120+
* Method for adding flex options to a given receiver.
121+
*
122+
* @param receiver that will receive the flex options
123+
* @param flexOption that will be added
124+
*/
125+
public void addFlexOptions(UUID receiver, FlexOptions flexOption) {
126+
flexOptions.computeIfAbsent(receiver, k -> new ArrayList<>()).add(flexOption);
105127
}
106128

107129
/**
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* © 2025. TU Dortmund University,
3+
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
4+
* Research group Distribution grid planning and operation
5+
*/
6+
7+
package edu.ie3.simona.api.data.model.em;
8+
9+
import java.util.ArrayList;
10+
import java.util.List;
11+
import java.util.UUID;
12+
13+
/**
14+
* Container class for grouping multiple flex options to a single receiver.
15+
*
16+
* @param receiver that should receive the flex options
17+
* @param flexOptions that should be received
18+
*/
19+
public record MultiFlexOptions(UUID receiver, List<FlexOptions> flexOptions) implements EmData {
20+
public MultiFlexOptions(UUID receiver) {
21+
this(receiver, new ArrayList<>());
22+
}
23+
}

0 commit comments

Comments
 (0)