Skip to content

Commit

Permalink
uml
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-bao committed Apr 2, 2024
1 parent 5525738 commit 16130a3
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 166 deletions.
275 changes: 109 additions & 166 deletions docs/uml/main/ExtPrimaryResultSimulationClasses.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,222 +2,165 @@
'https://plantuml.com/class-diagram
skinparam linetype ortho

package ev-simulation {
package simple-ext-simulation {
class ExtLink
class ExternalSampleSim
class EvModelImpl

' adding hidden elements for layout purposes
class placeholderA {
w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w
class SimpleExtSimulation {
- ExtPrimaryDataSimulation extPrimaryDataSimulation
- ExtResultDataSimulation extResultDataSimulation
}
hide placeholderA
class SimplePrimaryDataFactory

class placeholderB {
w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w
}
hide placeholderB
class SimpleResultDataFactory

ExtLink -[hidden]> placeholderA
placeholderA -[hidden]> ExternalSampleSim
ExternalSampleSim -[hidden]> placeholderB
placeholderB -[hidden]> EvModelImpl
SimplePrimaryDataFactory --> SimpleExtSimulation
SimpleResultDataFactory --> SimpleExtSimulation
}

package simona-api {
' MIDDLE PART
class ExtEvData {
~ LinkedBlockingQueue<ExtEvResponseMessage> receiveTriggerQueue

interface ExtData

class ExtPrimaryData {
- ActorRef dataService
- ActorRef extSimAdapter
+ List<UUID> requestAvailablePublicEvCs()
+ List<EvModel> sendEvPositions(EvMovementsMessage evMovementsMessage)
- void sendData(ExtEvMessage msg)
+ void queueExtMsg(ExtEvResponseMessage extEvResponse)
- 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
- ActorRef extSimAdapter
- Map<Integer, ActorRef> extSimAdapters
+ void queueExtMsg(ExtTrigger trigger)
+ void send(ExtTriggerResponse msg)
}

interface ExtData

abstract class ExtSimulation {
- ExtSimAdapterData data
+ void setup(ExtSimAdapterData data, List<ExtData> adapters)
+ void run()
# {abstract} List<Long> doActivity(long tick)
# 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)
}

interface ExtDataSimulation

ExternalSampleSim --|> ExtSimulation
ExternalSampleSim --|> ExtEvSimulation

ExtSimulation -[hidden]> ExtDataSimulation
ExtEvSimulation -|> ExtDataSimulation
ExtEvSimulation --> ExtEvData

ExtSimulation --> ExtData
ExtSimulation --> ExtSimAdapterData
ExtEvSimulation --|> ExtDataSimulation

ExtSimAdapterData -[hidden]> ExtEvData
ExtData <|-- ExtEvData
interface DataMessageFromExt
interface PrimaryDataMessageFromExt
interface ResultDataMessageFromExt
interface EvDataMessageFromExt
PrimaryDataMessageFromExt --|> DataMessageFromExt
ResultDataMessageFromExt --|> DataMessageFromExt
EvDataMessageFromExt --|> DataMessageFromExt

' placeholder
class plchldr1 {
w-w-w-w-w
}
hide plchldr1
class placeholder2 {
w-w-w-w-w-w-w-w-w-w-w-w-w-w-w
}
hide placeholder2
class placeholder3 {
w-w-w-w-w-w-w-w-w-w-w
}
hide placeholder3
class placeholder4 {
w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w-w
class ProvidePrimaryData {
- long tick
- Map<UUID, Value> primaryData
}
hide placeholder4

ExtData -[hidden]> plchldr1
plchldr1 -[hidden]> placeholder4
placeholder4 -[hidden]> EvMovement
ExtSimulation -[hidden]-> placeholder2
placeholder2 -[hidden]-> placeholder3
placeholder3 -[hidden]-> ExtSimAdapterData
placeholder2 -[hidden]> ExtData


' RIGHT PART
abstract class EvMovement
class Arrival
class Departure
Arrival --|> EvMovement
Departure --|> EvMovement
Arrival -[hidden]> Departure

interface EvModel {
+ UUID getUuid()
+ String getId()
+ ComparableQuantity<Power> getSRated()
+ ComparableQuantity<Energy> getEStorage()
+ ComparableQuantity<Energy> getStoredEnergy()
+ EvModel copyWith(ComparableQuantity<Energy> newStoredEnergy)
ProvidePrimaryData --|> PrimaryDataMessageFromExt

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

ExtDataSimulation -[hidden]> Arrival
EvMovement *-> EvModel
EvModelImpl --|> EvModel

interface DataResponseMessageToExt
interface ResultDataResponseMessageToExt
interface EvDataResponseMessageToExt

interface ExtEvMessage
class EvMovementsMessage {
- Map<UUID, List<EvMovement>> movements
}
class RequestEvcsFreeLots
RequestEvcsFreeLots --|> ExtEvMessage
EvMovementsMessage --|> ExtEvMessage
RequestEvcsFreeLots -[hidden]> EvMovementsMessage

interface ExtEvResponseMessage
class AllDepartedEvsRepsonse {
- Map<UUID, List<EvMovement>> movements
}
class ProvideEvcsFreeLots
ProvideEvcsFreeLots --|> ExtEvResponseMessage
AllDepartedEvsRepsonse --|> ExtEvResponseMessage
ExtEvData -> ExtEvMessage
ExtEvData -> ExtEvResponseMessage
EvMovement -[hidden]-> RequestEvcsFreeLots
ExtEvMessage -[hidden]> ExtEvResponseMessage
EvMovementsMessage -[hidden]> ProvideEvcsFreeLots
ProvideEvcsFreeLots -[hidden]> AllDepartedEvsRepsonse

class ScheduleDataServiceMessage {
- ExtEvDataService dataService
ResultDataResponseMessageToExt --|> DataResponseMessageToExt
EvDataResponseMessageToExt --|> DataResponseMessageToExt
class ProvideResultEntities {
+ List<ResultEntity> results
}
ExtEvResponseMessage -[hidden]> ScheduleDataServiceMessage
ExtEvData -> ScheduleDataServiceMessage
ProvideResultEntities --|> ResultDataResponseMessageToExt

ExtSimAdapterData --> ExtSimulation

' LEFT PART
interface ExtLinkInterface {
+ ExtSimulation getExtSimulation()
+ List<ExtDataSimulation> getExtDataSimulations()
ExtSimulation getExtSimulation()
List<ExtDataSimulation> getExtDataSimulation()
}
ExtLinkInterface -[hidden]> ExtSimulation
ExtLink --|> ExtLinkInterface

interface ExtTrigger
class ActivityStartTrigger {
- Long tick
}
ActivityStartTrigger --|> ExtTrigger

interface ExtTriggerResponse
class CompletionMessage {
- List<Long> newTriggers
}
CompletionMessage --|> ExtTriggerResponse

ExtTrigger -[hidden]> ExtTriggerResponse
ExtTrigger <- ExtSimAdapterData
ExtTriggerResponse <- ExtSimAdapterData
class ScheduleDataServiceMessage
}

package simona {
abstract class ParticipantAgent

class EvcsModel
class ExtPrimaryDataService

class EvcsAgent

interface SecondaryData
class EvMovementData {
movements: Set[EvMovement]
}
ExtPrimaryData --> ExtPrimaryDataService

class SimonaSim
class ExtResultDataProvider

class SimScheduler

class SimonaStandaloneSetup

class ExtSimLoader
ExtResultData --> ExtResultDataProvider

class ExtSimAdapter

class ExtEvDataService

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

ExtSimAdapter -- SimScheduler
ExtEvDataService -- SimScheduler

SecondaryData <|-- EvMovementData

SimonaService <|- ExtEvDataService
ExtEvData <--- ExtEvDataService

ExtSimAdapterData <--- ExtSimAdapter

' 1 and n are swapped here due to bug with linetype ortho and labels
ExtEvDataService "n" <-> "1" EvcsAgent
EvcsAgent --|> ParticipantAgent
EvcsAgent *- EvcsModel

ExtSimAdapter -[hidden]> SimonaService
ExtSimAdapterData --> ExtSimAdapter
}

@enduml
28 changes: 28 additions & 0 deletions docs/uml/protocol/ExtSimulationSequence.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@startuml

== Phase 1 ==
ExtScheduler -> ExtSimAdapter: ! Activation(tick)
ExtSimAdapter -> ExtSimAdapter: StateData(currentTick = Some(tick))
ExtSimAdapter -> ExtSimAdapterData: queueExtMessage(ActivationMessage(tick))

ExtSimulation -> ExtPrimaryDataService: ProvidePrimaryData
ExtSimulation -> ExtSimAdapter: ! ScheduleDataServiceMessage(dataService)
ExtSimulation -> ExtSimAdapter: ! CompletionMessage(nextTriggers)
ExtSimAdapter -> ExtScheduler: ! Completion
ExtSimAdapter -> ExtPrimaryDataService: ! ScheduleServiceActivation(tick, key)
ExtPrimaryDataService -> ExtScheduler: ! ScheduleActivation(_, tick, _)
ExtScheduler -> ExtPrimaryDataService: ! Activation(tick)

ExtPrimaryDataService -> ParticipantAgent1: ! ProvisionMessage
ExtPrimaryDataService -> ParticipantAgent2: ! ProvisionMessage
ExtPrimaryDataService -> ExtScheduler: ! Completion(_, maybeNextTriggers)
ExtScheduler -> SimScheduler: ! Completion

== Phase 2 ==

SimScheduler -> ParticipantAgent1: ! Activation(tick)
SimScheduler -> ParticipantAgent2: ! Activation(tick)

activate ParticipantAgent1

@enduml

0 comments on commit 16130a3

Please sign in to comment.