Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement external data service for primary data and results #698

Open
wants to merge 67 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
a682776
Temporary
jo-bao Jan 16, 2024
5765cdc
Implement ExtPrimaryDataService
jo-bao Jan 17, 2024
778b4e6
in development
jo-bao Feb 19, 2024
ffaa520
tests for PrimaryServiceProxy
jo-bao Feb 21, 2024
3effeab
Merge remote-tracking branch 'origin/jb/#671-externaldataservice' int…
jo-bao Feb 21, 2024
16c485c
spotless
jo-bao Feb 21, 2024
223c8a2
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
jo-bao Feb 21, 2024
4c22d87
spotless scala
jo-bao Feb 21, 2024
fff290a
spotless
jo-bao Feb 21, 2024
bdb9b0b
fixed registration failed message
jo-bao Feb 23, 2024
94aba27
spotless
jo-bao Feb 23, 2024
93b9327
Merge branch 'dev' into jb/#671-externaldataservice
jo-bao Feb 23, 2024
f04c4e6
code quality
jo-bao Feb 23, 2024
6b07e15
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
jo-bao Feb 26, 2024
d2b8b67
pekko typed
jo-bao Feb 26, 2024
7fba817
Merge remote-tracking branch 'origin/jb/#671-externaldataservice' int…
jo-bao Feb 26, 2024
27d4a83
Merge branch 'dev' into jb/#671-externaldataservice
jo-bao Mar 5, 2024
6cdbf83
working
jo-bao Mar 13, 2024
a39da22
working
jo-bao Mar 14, 2024
10f8536
primary and result init
jo-bao Mar 15, 2024
9d24e72
delayed stopping
jo-bao Mar 15, 2024
ab38e48
imports
jo-bao Mar 15, 2024
2be6d58
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
jo-bao Mar 15, 2024
fdbcef8
simplify
jo-bao Mar 15, 2024
d875226
uml
jo-bao Mar 19, 2024
dc2ee3a
extSimulation
jo-bao Mar 19, 2024
c4c753e
testgrids
jo-bao Mar 19, 2024
e8bdad6
fine tuning
jo-bao Mar 19, 2024
595cf06
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
jo-bao Mar 20, 2024
1f84793
temp
jo-bao Mar 22, 2024
5525738
phase in extsim
jo-bao Mar 27, 2024
16130a3
uml
jo-bao Apr 2, 2024
66fdd88
Merge branch 'dev' into jb/#671-externaldataservice
jo-bao Apr 2, 2024
f45e5c3
opsim coupling
jo-bao Apr 9, 2024
063dc89
temp
jo-bao May 16, 2024
58ed7a0
simple em ext simulation
jo-bao May 20, 2024
8da5def
temp
May 21, 2024
a8e8d8b
UncontrolledStrat
jo-bao May 21, 2024
37fd8e3
temp
May 21, 2024
575955d
ext address as argument
jo-bao May 24, 2024
c75518a
mapping in runtime
Jun 3, 2024
d361070
temp
Jun 4, 2024
9364df9
merge dev
Jun 4, 2024
126e107
removed dataSimulation
jo-bao Jun 5, 2024
da39065
gitignore
Jun 5, 2024
1b8cee4
removed testgrids
Jun 5, 2024
cbedc48
gitignore
Jun 5, 2024
a2d0174
modified setup
Jun 7, 2024
ddcaa59
docs
jo-bao Jun 11, 2024
50450a0
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
Jul 12, 2024
d36ea9a
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
Jul 23, 2024
f6f8ba8
ext simulation with storage
Jul 23, 2024
2cc7018
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
Jul 25, 2024
0a39eef
merge dev
Jul 25, 2024
960d75a
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
Aug 30, 2024
4994680
merge dev
Aug 30, 2024
c422352
provide next tick
Sep 10, 2024
cf7108f
delete grid files
Sep 12, 2024
be36d53
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
Sep 18, 2024
eefb415
merge dev
Sep 18, 2024
d22598f
Merge remote-tracking branch 'origin/dev' into jb/#671-externaldatase…
Sep 20, 2024
6aad658
merge dev
Oct 10, 2024
35759e6
Add SimpleExtSimulation
Oct 10, 2024
d133856
Opsim Dummy
Oct 10, 2024
bd25ed7
fix power flow
Oct 15, 2024
cb1208d
added recode grid
Oct 22, 2024
f0470ee
simple ext grid
Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ repositories {
}

dependencies {
constraints {
implementation( 'com.fasterxml.jackson.core:jackson-databind:2.16.0+' ){
because "[CVE-2020-25649] CWE-611: Improper Restriction of XML External Entity Reference ('XXE')"
}
}

// ie³ internal repository
implementation('com.github.ie3-institute:PowerSystemUtils:2.2.1') {
Expand Down Expand Up @@ -96,6 +101,14 @@ dependencies {
exclude group: 'edu.ie3'
}

implementation('com.github.ie3-institute:simosaik') {
exclude group: 'org.apache.logging.log4j'
exclude group: 'org.slf4j'
exclude group: 'edu.ie3'
}

implementation project('simopsim')

/* logging */
implementation "com.typesafe.scala-logging:scala-logging_${scalaVersion}:3.9.5" // pekko scala logging
implementation "ch.qos.logback:logback-classic:1.5.8"
Expand Down
166 changes: 166 additions & 0 deletions docs/uml/main/ExtPrimaryResultSimulationClasses.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
@startuml
'https://plantuml.com/class-diagram
skinparam linetype ortho

package simple-ext-simulation {
class ExtLink
class SimpleExtSimulation {
- ExtPrimaryDataSimulation extPrimaryDataSimulation
- ExtResultDataSimulation extResultDataSimulation
}
class SimplePrimaryDataFactory

class SimpleResultDataFactory

SimplePrimaryDataFactory --> SimpleExtSimulation
SimpleResultDataFactory --> SimpleExtSimulation
}

package simona-api {

interface ExtData

class ExtPrimaryData {
- ActorRef dataService
- ActorRef extSimAdapter
- PrimaryDataFactory factory
- List<UUID> primaryDataAssets
---
+ void providePrimaryData(Long tick, Map<String, Object> primaryData)
+ void sendExtMsg(PrimaryDataMessageFromExt msg)
}
ExtPrimaryData --|> ExtData

class ExtResultData {
- ActorRef dataService
- ActorRef dataServiceActivation
- ActorRef extSimAdapter
- ResultDataFactory factory
- List<UUID> resultDataAssets
---
+ List<ResultEntity> requestResults(long tick)
+ Map<String, Object> requestResultObjects(long tick)
~ Map<String, Object> convertResultsList(List<ResultEntity> results)
}
ExtResultData --|> ExtData

' MIDDLE PART
class ExtEvData
ExtEvData --|> ExtData

interface ExtDataSimulation

class ExtPrimaryDataSimulation {
- List<UUID> primaryDataAssets
- PrimaryDataFactory primaryDataFactory
- ExtPrimaryData extPrimaryData
---
+ void setExtPrimaryData(ExtPrimaryData extPrimaryData)
}
ExtPrimaryDataSimulation --|> ExtDataSimulation

class ExtResultDataSimulation {
- List<UUID> resultDataAssets
- ResultDataFactory resultDataFactory
- ExtResultData extResultData
---
+ void setExtResultData(ExtResultData extResultData)
}
ExtResultDataSimulation --|> ExtDataSimulation

interface PrimaryDataFactory {
Value convert(Object entity)
}
PrimaryDataFactory --> ExtPrimaryDataSimulation

interface ResultDataFactory {
Object convert(ResultEntity entity)
}
ResultDataFactory --> ExtResultDataSimulation

SimplePrimaryDataFactory --|> PrimaryDataFactory
SimpleResultDataFactory --|> ResultDataFactory

class ExtSimAdapterData {
~ LinkedBlockingQueue<ExtTrigger> receiveTriggerQueue
- Map<Integer, ActorRef> extSimAdapters
+ void queueExtMsg(ExtTrigger trigger)
+ void send(ExtTriggerResponse msg)
}


abstract class ExtSimulation {
- ExtSimAdapterData data
+ void setup(ExtSimAdapterData data, List<ExtData> adapters)
+ void run()
# Optional<Long> doActivity(long tick, int phase)
# {abstract} Optional<Long> initialize()
# {abstract} Optional<Long> doPreActivity(long tick)
# {abstract} Optional<Long> doPostActivity(long tick)
}

SimpleExtSimulation --|> ExtSimulation

interface ExtEvSimulation {
+ void setExtEvData(ExtEvData evData)
}

ExtEvSimulation --|> ExtDataSimulation

interface DataMessageFromExt
interface PrimaryDataMessageFromExt
interface ResultDataMessageFromExt
interface EvDataMessageFromExt
PrimaryDataMessageFromExt --|> DataMessageFromExt
ResultDataMessageFromExt --|> DataMessageFromExt
EvDataMessageFromExt --|> DataMessageFromExt

class ProvidePrimaryData {
- long tick
- Map<UUID, Value> primaryData
}
ProvidePrimaryData --|> PrimaryDataMessageFromExt

class RequestResultEntities {
- long tick
}
RequestResultEntities --|> ResultDataMessageFromExt


interface DataResponseMessageToExt
interface ResultDataResponseMessageToExt
interface EvDataResponseMessageToExt

ResultDataResponseMessageToExt --|> DataResponseMessageToExt
EvDataResponseMessageToExt --|> DataResponseMessageToExt
class ProvideResultEntities {
+ List<ResultEntity> results
}
ProvideResultEntities --|> ResultDataResponseMessageToExt

ExtSimAdapterData --> ExtSimulation

interface ExtLinkInterface {
ExtSimulation getExtSimulation()
List<ExtDataSimulation> getExtDataSimulation()
}
ExtLink --|> ExtLinkInterface

class ScheduleDataServiceMessage
}

package simona {
class ExtPrimaryDataService

ExtPrimaryData --> ExtPrimaryDataService

class ExtResultDataProvider

ExtResultData --> ExtResultDataProvider

class ExtSimAdapter

ExtSimAdapterData --> ExtSimAdapter
}

@enduml
133 changes: 133 additions & 0 deletions docs/uml/main/ExtSimulationAndAPIClasses.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
@startuml
'https://plantuml.com/class-diagram
skinparam linetype ortho

package simona-api {

interface DataMessageFromExt
interface PrimaryDataMessageFromExt
interface EvDataMessageFromExt

PrimaryDataMessageFromExt --> DataMessageFromExt
EvDataMessageFromExt --> DataMessageFromExt
ResultDataMessageFromExt --> DataMessageFromExt

class ProvidePrimaryData {
+ long tick
+ Map<UUID, Value> primaryData
}

ProvidePrimaryData --> PrimaryDataMessageFromExt

class ProvideArrivingEvs {
+ Map<UUID, List<EvModel>> arrivals)
}

class RequestCurrentPrices
class RequestDepartingEvs
class RequestEvcsFreeLots

ProvideArrivingEvs --> EvDataMessageFromExt
RequestCurrentPrices --> EvDataMessageFromExt
RequestDepartingEvs --> EvDataMessageFromExt
RequestEvcsFreeLots --> EvDataMessageFromExt

class RequestResultEntities {
+ Long tick
}

RequestResultEntities --> ResultDataMessageFromExt

interface DataResponseMessageToExt
interface ResultDataResponseMessageToExt
interface EvDataResponseMessageToExt

ResultDataResponseMessageToExt --> DataResponseMessageToExt
EvDataResponseMessageToExt --> DataResponseMessageToExt

class ProvideResultEntities {
+ List<ResultEntity> results
}

ProvideResultEntities --> ResultDataResponseMessageToExt

class ProvideCurrentPrices

class ProvideDepartingEvs

class ProvideEvcsFreeLots
ProvideCurrentPrices --> EvDataResponseMessageToExt
ProvideDepartingEvs --> EvDataResponseMessageToExt
ProvideEvcsFreeLots --> EvDataResponseMessageToExt

interface ExtData

class ExtEvData
class ExtPrimaryData {
PrimaryDataFactory primaryDataFactory
}
class ExtResultData

ExtEvData --> ExtData
ExtPrimaryData --> ExtData
ExtResultData --> ExtData



interface PrimaryDataFactory {
+ Value convert(Object entity)
}
PrimaryDataFactory -- ExtPrimaryData

interface ResultDataFactory {
+ Object convert(ResultEntity entity)
}
ResultDataFactory -- ExtResultData

interface ExtDataSimulation
interface ExtResultDataSimulation
interface ExtPrimaryDataSimulation
interface ExtEvDataSimulation

ExtPrimaryDataSimulation --> ExtDataSimulation
ExtResultDataSimulation --> ExtDataSimulation
ExtEvDataSimulation --> ExtDataSimulation

abstract class ExtSimulation {
- ExtSimAdapterData data

# Optional<Long> initialize()
# Optional<Long> doActivity(long tick)
}
}

package simona {
class SimonaSim

class SimScheduler

class SimonaStandaloneSetup

class ExtSimLoader

class ExtSimAdapter

class ExtResultDataProvider
ExtResultDataProvider -- ExtResultData

class ExtPrimaryDataService
ExtPrimaryDataService -- ExtPrimaryData

SimScheduler -- SimonaSim
SimonaSim *- SimonaStandaloneSetup
SimonaStandaloneSetup *- ExtSimLoader

ExtSimAdapter -- SimScheduler
ExtPrimaryDataService -- SimScheduler

SimonaService <|- ExtPrimaryDataService

ExtSimAdapterData <--- ExtSimAdapter
}

@enduml
Loading