This commit is contained in:
Claudio Maggioni 2023-03-26 15:49:23 +02:00
parent eed426d4d7
commit daebf54665
1 changed files with 132 additions and 1 deletions

View File

@ -577,14 +577,145 @@ Exceed: >6 components (>1 decomposed) and >2 use case/process view
## Logical View
The existing components in in this diagram are all the stateful components. All of them will be instances of the PostgreSQL 15 RDBMS ([sources here](https://github.com/postgres/postgres) and [specification here](https://www.postgresql.org/docs/15/index.html)), a _free as in beer_ and FOSS piece of software.
```puml
@startuml
skinparam componentStyle rectangle
!include <tupadr3/font-awesome/database>
title Smarthut.sm Logical View
interface " " as DF
interface " " as DIF
interface " " as TF
interface " " as SCF
interface " " as UIF
[Smart device] as D
[Smart sensor] as S
[User Interface] as UI
component "Users and Devices" as DEV {
interface " " as DIDBF
[Device Engine] as DI
[User and Device DB <$database{scale=0.33}>] as DIDB
DIDBF-DIDB
DI -( DIDBF
}
component "Triggers and Automations" as TRIG {
interface " " as TDBF
[Trigger and Automation Engine] as T
[Trigger and Automation DB <$database{scale=0.33}>] as TDB
TDBF-TDB
T -( TDBF
}
component "Scenes" as SCENE {
interface " " as SCDBF
[Scene Engine] as SC
[Scene DB <$database{scale=0.33}>] as SCDB
SCDBF-SCDB
SC -( SCDBF
}
D--DF
UI--UIF
DIF--DI
TF--T
SCF--SC
S --( DIF
D --( DIF
DI --( TF
T --( SCF
DIF )-- SC
DF )-- DI
UIF )-- DI
UI --( DIF
UI --( SCF
UI --( TF
skinparam monochrome true
skinparam shadowing false
skinparam defaultFontName Courier
@enduml
```
## Process Views
Use Case:
Use Case: A smart sensor 'S' reports a value which satisfies the condition defined in a trigger. Thanks to an automation specification, this in turn triggers the application of a scene which changes the state of smart device 'D'.
```puml
@startuml
title Process View: Sensor triggers trigger and scene application
participant "Smart device 'D'" as D
participant "Smart sensor 'S'" as S
participant "User Interface" as UI
participant "Device Engine" as DI
participant "User and Device DB" as DIDB
participant "Trigger and Automation Engine" as T
participant "Trigger and Automation DB" as TDB
participant "Scene Engine" as SC
participant "Scene DB" as SCDB
S -> DI: report new value
DI -> DIDB: store new value
DI -> UI: display new value
DI -> T: report latest device state
T -> TDB: query for relevant triggers
T -> TDB: query for triggered automations
T -> TDB: query for scenes included in automation
T -> SC: request scene application
SC -> SCDB: query for device states to apply
SC -> DI: request application of new state to device 'D'
DI -> D: apply new state
D -> DI: report successful application
DI -> DIDB: store new state
DI -> UI: display new state
skinparam monochrome true
skinparam shadowing false
skinparam defaultFontName Courier
@enduml
```
Use case: a user alters manually the state of a device in the UI, and the device updates accordingly.
```puml
@startuml
title Process View: Sensor triggers trigger and scene application
participant "Smart device 'D'" as D
participant "Smart sensor 'S'" as S
participant "User Interface" as UI
participant "Device Engine" as DI
participant "User and Device DB" as DIDB
participant "Trigger and Automation Engine" as T
participant "Trigger and Automation DB" as TDB
participant "Scene Engine" as SC
participant "Scene DB" as SCDB
skinparam monochrome true
skinparam shadowing false
skinparam defaultFontName Courier
@enduml
```
# Ex - Component Model: Bottom-Up
{.instructions