diff --git a/docs/uml/main/ExtPrimaryResultSimulationClasses.puml b/docs/uml/main/ExtPrimaryResultSimulationClasses.puml index e35c8e130a..e13c3e6be2 100644 --- a/docs/uml/main/ExtPrimaryResultSimulationClasses.puml +++ b/docs/uml/main/ExtPrimaryResultSimulationClasses.puml @@ -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 receiveTriggerQueue + + interface ExtData + + class ExtPrimaryData { - ActorRef dataService - ActorRef extSimAdapter - + List requestAvailablePublicEvCs() - + List sendEvPositions(EvMovementsMessage evMovementsMessage) - - void sendData(ExtEvMessage msg) - + void queueExtMsg(ExtEvResponseMessage extEvResponse) + - PrimaryDataFactory factory + - List primaryDataAssets + --- + + void providePrimaryData(Long tick, Map primaryData) + + void sendExtMsg(PrimaryDataMessageFromExt msg) + } + ExtPrimaryData --|> ExtData + + class ExtResultData { + - ActorRef dataService + - ActorRef dataServiceActivation + - ActorRef extSimAdapter + - ResultDataFactory factory + - List resultDataAssets + --- + + List requestResults(long tick) + + Map requestResultObjects(long tick) + ~ Map convertResultsList(List results) + } + ExtResultData --|> ExtData + + ' MIDDLE PART + class ExtEvData + ExtEvData --|> ExtData + + interface ExtDataSimulation + + class ExtPrimaryDataSimulation { + - List primaryDataAssets + - PrimaryDataFactory primaryDataFactory + - ExtPrimaryData extPrimaryData + --- + + void setExtPrimaryData(ExtPrimaryData extPrimaryData) + } + ExtPrimaryDataSimulation --|> ExtDataSimulation + + class ExtResultDataSimulation { + - List 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 receiveTriggerQueue - - ActorRef extSimAdapter + - Map extSimAdapters + void queueExtMsg(ExtTrigger trigger) + void send(ExtTriggerResponse msg) } - interface ExtData abstract class ExtSimulation { + - ExtSimAdapterData data + void setup(ExtSimAdapterData data, List adapters) + void run() - # {abstract} List doActivity(long tick) + # Optional doActivity(long tick, int phase) + # {abstract} Optional initialize() + # {abstract} Optional doPreActivity(long tick) + # {abstract} Optional 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 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 getSRated() - + ComparableQuantity getEStorage() - + ComparableQuantity getStoredEnergy() - + EvModel copyWith(ComparableQuantity 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> movements - } - class RequestEvcsFreeLots - RequestEvcsFreeLots --|> ExtEvMessage - EvMovementsMessage --|> ExtEvMessage - RequestEvcsFreeLots -[hidden]> EvMovementsMessage - - interface ExtEvResponseMessage - class AllDepartedEvsRepsonse { - - Map> 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 results } - ExtEvResponseMessage -[hidden]> ScheduleDataServiceMessage - ExtEvData -> ScheduleDataServiceMessage + ProvideResultEntities --|> ResultDataResponseMessageToExt + ExtSimAdapterData --> ExtSimulation - ' LEFT PART interface ExtLinkInterface { - + ExtSimulation getExtSimulation() - + List getExtDataSimulations() + ExtSimulation getExtSimulation() + List getExtDataSimulation() } - ExtLinkInterface -[hidden]> ExtSimulation ExtLink --|> ExtLinkInterface - interface ExtTrigger - class ActivityStartTrigger { - - Long tick - } - ActivityStartTrigger --|> ExtTrigger - - interface ExtTriggerResponse - class CompletionMessage { - - List 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 \ No newline at end of file diff --git a/docs/uml/protocol/ExtSimulationSequence.puml b/docs/uml/protocol/ExtSimulationSequence.puml new file mode 100644 index 0000000000..c0df9bd9d0 --- /dev/null +++ b/docs/uml/protocol/ExtSimulationSequence.puml @@ -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 \ No newline at end of file