Skip to content

Commit 86823dc

Browse files
committed
Merged with augmentation function feature
2 parents 19ce380 + aca2f0f commit 86823dc

83 files changed

Lines changed: 16299 additions & 237 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,6 @@ gradle-app.setting
206206
*.hprof
207207

208208
# End of https://www.toptal.com/developers/gitignore/api/gradle,java,intellij,macos
209-
.idea
209+
.idea
210+
211+
.claude

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ that led the design and development of the WLDT library.
5454
- ️️⚙️ [Resources & Management Interface](docs/resources_management_interface.md): Provides the details about
5555
the management interface of the WLDT library and how to use it to handle the manageable DT's resource through its life cycle.
5656
- 📝 [Logging in WLDT](docs/wldt_logger.md): Describes the logging system of the WLDT library, including how to configure, customize and use it.
57+
- 🧠 [Augmentation Functions](docs/augmentation_function.md): Provides the details about the Augmentation Functions, which are used to enhance the capabilities of the Digital Twin by adding new stateless or stateful functionalities.
5758

5859
---
5960

docs/augmentation_function.md

Lines changed: 2381 additions & 0 deletions
Large diffs are not rendered by default.

docs/changelogs/v0.7.0.md

Lines changed: 911 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
config:
3+
theme: neo
4+
---
5+
sequenceDiagram
6+
actor Dev as Developer
7+
participant AM as Augmentation Manager
8+
participant AFH as Augmentation Function Handler
9+
participant EB as Event Bus
10+
participant DT as Digital Twin
11+
participant DTM as Digital Twin Model
12+
actor EAF as External Augmentation Function
13+
14+
%% Phase 1: Developer registers first Augmentation Function (DT not yet started)
15+
Dev->>AM: getAugmentationFunctionHandler(handlerId)
16+
AM-->>Dev: AugmentationFunctionHandler
17+
18+
Dev->>AFH: register(AugmentationFunction1)
19+
AFH->>EB: publish(RegistrationEvent1)
20+
Note over EB: No subscribers — event is ignored
21+
22+
%% Phase 2: Developer starts the Digital Twin
23+
Dev->>DT: start()
24+
DT->>DTM: start()
25+
DTM->>EB: subscribe(RegistrationEvent, UnregistrationEvent)
26+
27+
DTM->>AM: getAugmentationFunctionHandlers()
28+
AM-->>DTM: [AugmentationFunctionHandler]
29+
30+
DTM->>AFH: getRegisteredAugmentationFunctions()
31+
AFH-->>DTM: [AugmentationFunction1]
32+
DTM->>DTM: Internal notification new AF List registered for an Handler
33+
34+
%% Phase 3: Developer registers a second Augmentation Function
35+
Note over Dev, EAF: Some time passes...
36+
37+
Dev->>AFH: register(AugmentationFunction 2)
38+
AFH->>EB: publish(RegistrationEvent 2)
39+
EB-->>DTM: notify(RegistrationEvent 2)
40+
Note over DTM: AF 2 Registered Notified
41+
42+
%% Phase 4: External Augmentation Function self-registers
43+
EAF->>AFH: register(self)
44+
AFH->>EB: publish(RegistrationEvent 3)
45+
EB-->>DTM: notify(RegistrationEvent 3)
46+
Note over DTM: External AF Registered Notified
47+
48+
%% Phase 5: Developer unregisters the Augmentation Function
49+
Note over Dev, EAF: Some time passes...
50+
51+
Dev->>AFH: unregister(AugmentationFunction 2)
52+
AFH->>EB: publish(UnRegistrationEvent 2)
53+
EB-->>DTM: notify(UnRegistrationEvent 2)
54+
Note over DTM: AF 2 Unregistered Notified

docs/schemes/augmentation_functions.excalidraw.md

Lines changed: 467 additions & 0 deletions
Large diffs are not rendered by default.

docs/schemes/model_refactoring.excalidraw.md

Lines changed: 306 additions & 0 deletions
Large diffs are not rendered by default.

docs/storage_query_system.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The main module of the Storage Layer is the one associated to Storage Capabiliti
3232
* Physical Asset Action Request storage and retrieval;
3333
* Physical Asset Event Notification storage and retrieval;
3434
* Each WldtStorage instance can be configured (using the right constructor method) to:
35-
* Observe all Wldt events (`stateEvents`, `physicalAssetEvents`, `physicalAssetActionEvents`, `physicalAssetDescriptionEvents`, `digitalActionEvents`, `lifeCycleEvents`)
35+
* Observe all Wldt events (`stateEvents`, `physicalAssetEvents`, `physicalAssetActionEvents`, `physicalAssetDescriptionEvents`, `digitalActionEvents`, `lifeCycleEvents`, `augmentationFunctionEvents`)
3636
* Filter only for specific class of events
3737
* Once the WldtStorage has been properly configured to receive target events the `StorageManager` automatically save information of interest for that specific storage. For example we can have a `StorageA` (e.g, REDIS) configured to receive all the generated events and a `StorageB` (e.g., MongoDB) in charge of saving only DT's state variation over time.
3838
* The default implementation of the `WldtStorage` is the class `DefaultWldtStorage`. This class provides a simple storage solution for digital twin states, digital twin state changes, physical asset events, and digital twin events. The class provides **ONLY** a memory based approach for storage using ArrayLists and HashMaps and more advanced solution should be implemented for production oriented Digital Twins for examples using external storage and memorization solutions.
@@ -96,6 +96,32 @@ The main module of the Storage Layer is the one associated to Storage Capabiliti
9696
* `getPhysicalAssetRelationshipInstanceDeletedNotificationCount()`: Get the number of Physical Asset Relationship Instance Updated Event
9797
* `getPhysicalAssetRelationshipInstanceDeletedNotificationInTimeRange(long startTimestampMs, long endTimestampMs)`: Get the Physical Asset Relationship Instance Updated Event in the specified time range
9898
* `getPhysicalAssetRelationshipInstanceDeletedNotificationInRange(int startIndex, int endIndex)`: Get the Physical Asset Relationship Instance Updated Event in the specified range of indices
99+
* **Augmentation Function**:
100+
* Error
101+
* `saveAugmentationFunctionError(String augmentationFunctionId, String augmentationFunctionHandlerId, AugmentationFunctionError augmentationFunctionError)`: Save the Augmentation Function Error
102+
* `getAugmentationFunctionErrorCount()`: Get the number of errors occurred during the execution of the Augmentation Functions
103+
* `getAugmentationFunctionErrorsInTimeRange(long startTimestampMs, long endTimestampMs)`: Get the errors in the specified time range
104+
* `getAugmentationFunctionErrorsInRange(int startIndex, int endIndex)`: Get the errors in the specified range of indices
105+
* Request
106+
* `saveAugmentationFunctionRequest(String augmentationFunctionId, String augmentationFunctionHandlerId, AugmentationFunctionRequest augmentationFunctionRequest)`: Save the Augmentation Function Request
107+
* `getAugmentationFunctionRequestCount()`: Get the number of Augmentation Function Requests stored
108+
* `getAugmentationFunctionRequestInTimeRange(long startTimestampMs, long endTimestampMs)`: Get the requests in the specified time range
109+
* `getAugmentationFunctionRequestInRange(int startIndex, int endIndex)`: Get the requests in the specified range of indices
110+
* Result
111+
* `saveAugmentationFunctionResult(String augmentationFunctionId, String augmentationFunctionHandlerId, AugmentationFunctionResult<?> augmentationFunctionResult)`: Save the Augmentation Function Result
112+
* `getAugmentationFunctionResultCount()`: Get the number of Augmentation Function Results stored
113+
* `getAugmentationFunctionResultInTimeRange(long startTimestampMs, long endTimestampMs)`: Get the results in the specified time range
114+
* `getAugmentationFunctionResultInRange(int startIndex, int endIndex)`: Get the results in the specified range of indices
115+
* Registration
116+
* `saveAugmentationFunctionRegistration(String augmentationFunctionId, String augmentationFunctionHandlerId, AugmentationFunctionType augmentationFunctionType)`: Save the Augmentation Function Registration
117+
* `getAugmentationFunctionRegistrationCount()`: Get the number of Augmentation Function Registrations stored
118+
* `getAugmentationFunctionRegistrationInTimeRange(long startTimestampMs, long endTimestampMs)`: Get the registrations in the specified time range
119+
* `getAugmentationFunctionRegistrationInRange(int startIndex, int endIndex)`: Get the registrations in the specified range of indices
120+
* Unregistration
121+
* `saveAugmentationFunctionUnregistration(String augmentationFunctionId, String augmentationFunctionHandlerId, AugmentationFunctionType augmentationFunctionType)`: Save the Augmentation Function Unregistration
122+
* `getAugmentationFunctionUnregistrationCount()`: Get the number of Augmentation Function Unregistrations stored
123+
* `getAugmentationFunctionUnregistrationInTimeRange(long startTimestampMs, long endTimestampMs)`: Get the unregistrations in the specified time range
124+
* `getAugmentationFunctionUnregistrationInRange(int startIndex, int endIndex)`: Get the unregistrations in the specified range of indices
99125

100126
Some examples of usage for the Storage Layer are the following:
101127

@@ -143,7 +169,7 @@ myRedisStorage.setRedisConfiguration(myRedisConfiguration);
143169
digitalTwin.getStorageManager().putStorage(myRedisStorage);
144170

145171
// Create a new MongoDbWldtStorage instance using the default implementation and observing only State and LifeCycle Events
146-
MongoDbWldtStorage myMongoDbStorage = new MongoDbWldtStorage("mongo_db_storage", true, false, false, false, false, true);
172+
MongoDbWldtStorage myMongoDbStorage = new MongoDbWldtStorage("mongo_db_storage", true, false, false, false, false, true, false);
147173
myMongoDbStorage.setMongoDbConfiguration(myMongoDbConfiguration);
148174

149175
// Add the new MongoDb Storage Instance to the Digital Twin Storage Manager
@@ -240,6 +266,26 @@ The main classes associated to the Query System are the following:
240266
- SAMPLE_RANGE
241267
- COUNT
242268
- LAST_VALUE
269+
- AUGMENTATION_FUNCTION_ERROR
270+
- TIME_RANGE
271+
- SAMPLE_RANGE
272+
- COUNT
273+
- AUGMENTATION_FUNCTION_REQUEST
274+
- TIME_RANGE
275+
- SAMPLE_RANGE
276+
- COUNT
277+
- AUGMENTATION_FUNCTION_RESULT
278+
- TIME_RANGE
279+
- SAMPLE_RANGE
280+
- COUNT
281+
- AUGMENTATION_FUNCTION_REGISTRATION
282+
- TIME_RANGE
283+
- SAMPLE_RANGE
284+
- COUNT
285+
- AUGMENTATION_FUNCTION_UNREGISTRATION
286+
- TIME_RANGE
287+
- SAMPLE_RANGE
288+
- COUNT
243289
- STORAGE_STATS
244290
- LAST_VALUE
245291
- `QueryExecutor`: This class represents the Query Executor used to execute queries on the storage system supporting both synchronous and asynchronous query execution. Internally is implemented through an event-based mechanism to handle the query request and response

images/aug_function_arch.png

93.3 KB
Loading
83.9 KB
Loading

0 commit comments

Comments
 (0)