Skip to content

Commit 8904d57

Browse files
Merge pull request #363 from ie3-institute/rel/sp/#362-release-0.11.0
Release 0.11.0
2 parents e6aea96 + 873d545 commit 8904d57

32 files changed

+833
-386
lines changed

CHANGELOG.md

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

77
## [Unreleased/Snapshot]
88

9+
## [0.11.0] - 2025-10-23
10+
11+
### Added
12+
- General flex options [#348](https://github.com/ie3-institute/simonaAPI/issues/348)
13+
- Enhanced em set points [#357](https://github.com/ie3-institute/simonaAPI/issues/348)
14+
- Added dedicated flex communication classes [#358](https://github.com/ie3-institute/simonaAPI/issues/348)
15+
916
### Changed
1017
- Updated the maven central publishing scripts [#339](https://github.com/ie3-institute/simonaAPI/issues/339)
18+
- Refactoring `ExtSimAdapterData` [#347](https://github.com/ie3-institute/simonaAPI/issues/347)
19+
- Enhanced `ExtEntityMapping` [#355](https://github.com/ie3-institute/simonaAPI/issues/355)
1120

1221
## [0.10.0] - 2025-09-10
1322

@@ -96,7 +105,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
96105
- Renamed messages to ease understanding [#62](https://github.com/ie3-institute/simonaAPI/issues/62)
97106
- Separating departures and arrivals in message protocol, properly handling exceptions [#77](https://github.com/ie3-institute/simonaAPI/issues/77)
98107

99-
[Unreleased/Snapshot]: https://github.com/ie3-institute/simonaapi/compare/0.10.0...HEAD
108+
[Unreleased/Snapshot]: https://github.com/ie3-institute/simonaapi/compare/0.11.0...HEAD
109+
[0.11.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/0.10.0...0.11.0
100110
[0.10.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/0.9.0...0.10.0
101111
[0.9.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/0.8.0...0.9.0
102112
[0.8.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/0.7.0...0.8.0

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
22
id 'groovy' // groovy support
33
id 'java' // java support
4-
id 'com.diffplug.spotless' version '7.2.1'//code format
4+
id 'com.diffplug.spotless' version '8.0.0'//code format
55
id 'pmd' // code check, working on source code
6-
id 'com.github.spotbugs' version '6.3.0' // code check, working on byte code
7-
id "org.sonarqube" version "6.3.1.5724" // sonarqube
6+
id 'com.github.spotbugs' version '6.4.4' // code check, working on byte code
7+
id "org.sonarqube" version "7.0.0.6105" // sonarqube
88
id 'signing'
99
id 'maven-publish' // publish to a maven repo (local or mvn central, has to be defined)
1010
id 'jacoco' // java code coverage plugin
@@ -19,7 +19,7 @@ ext {
1919
// required for pekko
2020
scalaVersion = '3'
2121
scalaBinaryVersion = '3.7.3'
22-
pekkoVersion = "1.2.0"
22+
pekkoVersion = "1.2.1"
2323
}
2424

2525
group = 'com.github.ie3-institute'
@@ -71,7 +71,7 @@ dependencies{
7171
}
7272

7373
// logging
74-
implementation platform('org.apache.logging.log4j:log4j-bom:2.25.1')
74+
implementation platform('org.apache.logging.log4j:log4j-bom:2.25.2')
7575
implementation 'org.apache.logging.log4j:log4j-api' // log4j
7676
implementation 'org.apache.logging.log4j:log4j-core' // log4j
7777
implementation 'org.apache.logging.log4j:log4j-slf4j-impl' // log4j -> slf4j

docs/readthedocs/gettingstarted.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ SimonaAPI requires Java to be at least Version 21.
88

99
## Where to get
1010

11-
Checkout latest from [GitHub](https://github.com/ie3-institute/simonaAPI) or use maven for dependency
12-
management:
11+
Checkout latest from [GitHub](https://github.com/ie3-institute/simonaAPI) or use our releases on maven central:
1312

1413
### Stable releases
1514

@@ -19,34 +18,19 @@ On [Maven central](https://search.maven.org/artifact/com.github.ie3-institute/si
1918
<dependency>
2019
<groupId>com.github.ie3-institute</groupId>
2120
<artifactId>simonaAPI</artifactId>
22-
<version>0.9.0</version>
21+
<version>0.11.0</version>
2322
</dependency>
2423
```
2524

2625
### Snapshot releases
2726

28-
Available on [OSS Sonatype](https://s01.oss.sonatype.org/).
29-
Add the correct repository:
30-
31-
```xml
32-
<repositories>
33-
<repository>https://s01.oss.sonatype.org/content/repositories/snapshots</repository>
34-
</repositories>
35-
```
36-
37-
and add the dependency:
38-
39-
```xml
40-
<dependency>
41-
<groupId>com.github.ie3-institute</groupId>
42-
<artifactId>simonaAPI</artifactId>
43-
<version>0.10-SNAPSHOT</version>
44-
</dependency>
45-
```
27+
There are currently no snapshot releases.
4628

4729
## Important changes
4830

4931
With the release of version `0.6.0` there were major changes in the way external simulations are
5032
set up. Therefore, older simulations no longer work with the version `0.6.0`.
5133

5234
With the release of version `0.10.0` there was a lot of refactoring, which breaks compatibility with older simulations.
35+
36+
Additional breaking changes in version `0.11.0`

src/main/java/edu/ie3/simona/api/ExtLinkInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
package edu.ie3.simona.api;
88

9+
import edu.ie3.simona.api.data.ExtSimAdapterData;
910
import edu.ie3.simona.api.exceptions.NoExtSimulationException;
10-
import edu.ie3.simona.api.simulation.ExtSimAdapterData;
1111
import edu.ie3.simona.api.simulation.ExtSimulation;
1212

1313
/**

src/main/java/edu/ie3/simona/api/simulation/ExtSimAdapterData.java renamed to src/main/java/edu/ie3/simona/api/data/ExtSimAdapterData.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
* Research group Distribution grid planning and operation
55
*/
66

7-
package edu.ie3.simona.api.simulation;
7+
package edu.ie3.simona.api.data;
88

9+
import com.typesafe.config.Config;
10+
import edu.ie3.datamodel.models.input.container.JointGridContainer;
911
import edu.ie3.simona.api.ontology.simulation.ControlMessageToExt;
1012
import edu.ie3.simona.api.ontology.simulation.ControlResponseMessageFromExt;
1113
import java.util.concurrent.LinkedBlockingQueue;
@@ -23,12 +25,23 @@ public class ExtSimAdapterData {
2325
/** CLI arguments with which SIMONA is initiated */
2426
private final String[] mainArgs;
2527

28+
/** The parsed simona config. */
29+
private final Config simonaConfig;
30+
31+
/** The electrical grid. */
32+
private final JointGridContainer grid;
33+
2634
// important trigger queue must be the same as held in actor
2735
// to make it safer one might consider asking the actor for a reference on its trigger queue?!
2836
public ExtSimAdapterData(
29-
ActorRef<ControlResponseMessageFromExt> extSimAdapter, String[] mainArgs) {
37+
ActorRef<ControlResponseMessageFromExt> extSimAdapter,
38+
String[] mainArgs,
39+
Config simonaConfig,
40+
JointGridContainer grid) {
3041
this.extSimAdapter = extSimAdapter;
3142
this.mainArgs = mainArgs;
43+
this.simonaConfig = simonaConfig;
44+
this.grid = grid;
3245
}
3346

3447
public ActorRef<ControlResponseMessageFromExt> getAdapter() {
@@ -59,4 +72,12 @@ public void send(ControlResponseMessageFromExt msg) {
5972
public String[] getMainArgs() {
6073
return mainArgs;
6174
}
75+
76+
public Config getSimonaConfig() {
77+
return simonaConfig;
78+
}
79+
80+
public JointGridContainer getGrid() {
81+
return grid;
82+
}
6283
}

src/main/java/edu/ie3/simona/api/data/connection/ExtEmDataConnection.java

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
package edu.ie3.simona.api.data.connection;
88

9-
import edu.ie3.simona.api.data.model.em.EmSetPoint;
10-
import edu.ie3.simona.api.data.model.em.ExtendedFlexOptionsResult;
11-
import edu.ie3.simona.api.data.model.em.FlexOptionRequest;
12-
import edu.ie3.simona.api.data.model.em.FlexOptions;
9+
import edu.ie3.simona.api.data.model.em.*;
1310
import edu.ie3.simona.api.ontology.em.*;
1411
import java.util.*;
1512

@@ -58,6 +55,45 @@ public boolean sendEmData(
5855
return false;
5956
}
6057

58+
/**
59+
* Tries to send flex option requests to SIMONA. A message is sent, if at least one entity is
60+
* given.
61+
*
62+
* @param tick current tick
63+
* @param entities for which flex options should be requested
64+
* @param disaggregated if disaggregated flex option should be returned
65+
* @return true, if data was sent
66+
*/
67+
public boolean sendFlexRequest(long tick, Collection<UUID> entities, boolean disaggregated) {
68+
// send message only if at least one value is present
69+
if (!entities.isEmpty()) {
70+
sendExtMsg(new RequestEmFlexResults(tick, new ArrayList<>(entities), disaggregated));
71+
return true;
72+
}
73+
return false;
74+
}
75+
76+
/**
77+
* Tries to send communication messages to SIMONA. A message is sent, if at least one message is
78+
* given.
79+
*
80+
* @param tick current tick
81+
* @param emCommunicationMessages that should be sent
82+
* @param maybeNextTick an option for the next tick
83+
* @return true, if data was sent
84+
*/
85+
public boolean sendCommunicationMessage(
86+
long tick,
87+
List<EmCommunicationMessage<?>> emCommunicationMessages,
88+
Optional<Long> maybeNextTick) {
89+
// send message only if at least one value is present
90+
if (!emCommunicationMessages.isEmpty()) {
91+
sendExtMsg(new EmCommunicationMessages(tick, emCommunicationMessages, maybeNextTick));
92+
return true;
93+
}
94+
return false;
95+
}
96+
6197
/**
6298
* Tries to send the em set points to SIMONA.
6399
*

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
package edu.ie3.simona.api.data.container;
88

9+
import java.util.ArrayList;
910
import java.util.HashMap;
11+
import java.util.List;
1012
import java.util.Map;
1113

1214
/** Interface for data that are exchanged between an external simulation and SimonaAPI */
@@ -28,4 +30,17 @@ default <K, V> Map<K, V> copyAndClear(Map<K, V> map) {
2830
map.clear();
2931
return result;
3032
}
33+
34+
/**
35+
* Method to copy a given list and clear the original.
36+
*
37+
* @param list to be copied and cleared
38+
* @return the copy
39+
* @param <V> type of value
40+
*/
41+
default <V> List<V> copyAndClear(List<V> list) {
42+
List<V> result = new ArrayList<>(list);
43+
list.clear();
44+
return result;
45+
}
3146
}

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

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +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;
1112
import edu.ie3.simona.api.data.model.em.EmSetPoint;
1213
import edu.ie3.simona.api.data.model.em.FlexOptionRequest;
1314
import edu.ie3.simona.api.data.model.em.FlexOptions;
@@ -36,6 +37,9 @@ public final class ExtInputContainer implements ExtDataContainer {
3637
/** Map uuid to em set points. */
3738
private final Map<UUID, EmSetPoint> setPoints = new HashMap<>();
3839

40+
/** List of em communication messages. */
41+
private final List<EmCommunicationMessage<?>> emMessages = new ArrayList<>();
42+
3943
/**
4044
* Container class for input data for SIMONA which can be read by SimonaAPI
4145
*
@@ -82,15 +86,18 @@ public void addPrimaryValue(UUID asset, Value value) {
8286
primaryData.put(asset, value);
8387
}
8488

89+
public void addFlexComMessage(EmCommunicationMessage<?> message) {
90+
emMessages.add(message);
91+
}
92+
8593
/**
8694
* Method for adding flex option requests. No disaggregated flex option will be requested using
8795
* this method.
8896
*
8997
* @param receiver the uuid of the agent, that will receive the request
90-
* @param sender option for the uuid of the sender
9198
*/
92-
public void addRequest(UUID receiver, UUID sender) {
93-
flexRequests.put(receiver, new FlexOptionRequest(receiver, sender, false));
99+
public void addRequest(UUID receiver) {
100+
flexRequests.put(receiver, new FlexOptionRequest(receiver, false));
94101
}
95102

96103
public void addRequest(UUID receiver, FlexOptionRequest request) {
@@ -104,12 +111,7 @@ public void addRequest(UUID receiver, FlexOptionRequest request) {
104111
* @param flexOption that will be added
105112
*/
106113
public void addFlexOptions(UUID receiver, List<FlexOptions> flexOption) {
107-
if (!flexOptions.containsKey(receiver)) {
108-
List<FlexOptions> flexOptionValues = new ArrayList<>(flexOption);
109-
flexOptions.put(receiver, flexOptionValues);
110-
} else {
111-
flexOptions.get(receiver).addAll(flexOption);
112-
}
114+
flexOptions.computeIfAbsent(receiver, k -> new ArrayList<>()).addAll(flexOption);
113115
}
114116

115117
/**
@@ -118,8 +120,8 @@ public void addFlexOptions(UUID receiver, List<FlexOptions> flexOption) {
118120
* @param asset that will receive the set point
119121
* @param power of the set point
120122
*/
121-
public void addSetPoint(UUID asset, UUID sender, PValue power) {
122-
setPoints.put(asset, new EmSetPoint(asset, sender, power));
123+
public void addSetPoint(UUID asset, PValue power) {
124+
setPoints.put(asset, new EmSetPoint(asset, power));
123125
}
124126

125127
/**
@@ -160,6 +162,13 @@ public Map<UUID, EmSetPoint> extractSetPoints() {
160162
return copyAndClear(setPoints);
161163
}
162164

165+
/**
166+
* Extracts the em message input data from this container. All other input data remains the same.
167+
*/
168+
public List<EmCommunicationMessage<?>> extractEmMessages() {
169+
return copyAndClear(emMessages);
170+
}
171+
163172
/**
164173
* Returns a string representation of the primary input data without changing the data. To extract
165174
* (remove) the primary input data, use {@link #extractPrimaryData()} instead.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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.UUID;
10+
11+
/**
12+
* Model of communication messages that can be sent between em agents.
13+
*
14+
* @param receiver of the data
15+
* @param sender of the data
16+
* @param msgId the message id of this message
17+
* @param content the actual em data that is sent
18+
* @param <D> type of the em data
19+
*/
20+
public record EmCommunicationMessage<D extends EmData>(
21+
UUID receiver, UUID sender, UUID msgId, D content) implements EmData {
22+
23+
/**
24+
* Constructor for {@link EmCommunicationMessage} that will generate a random message id.
25+
*
26+
* @param receiver of the data
27+
* @param sender of the data
28+
* @param content the actual em data that is sent
29+
*/
30+
public EmCommunicationMessage(UUID receiver, UUID sender, D content) {
31+
this(receiver, sender, UUID.randomUUID(), content);
32+
}
33+
}

src/main/java/edu/ie3/simona/api/data/model/em/EmData.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,5 @@
66

77
package edu.ie3.simona.api.data.model.em;
88

9-
import java.util.UUID;
10-
119
/** Interface that is extended by all em data models. */
12-
public interface EmData {
13-
14-
/** Returns the uuid of the receiver. */
15-
UUID getReceiver();
16-
17-
/** Returns the uuid of the sender. */
18-
UUID getSender();
19-
}
10+
public interface EmData {}

0 commit comments

Comments
 (0)