Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit 0a6bbf2

Browse files
committed
System of systems test data, update of the README
1 parent 319862a commit 0a6bbf2

44 files changed

Lines changed: 7469 additions & 23 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.

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,24 @@ The automation drivers support 3 different languages so far, even though 2 are p
104104

105105
The two buggy languages are encapsulated into experimental automation drivers.
106106

107+
### Remote Driver
108+
109+
The remote driver allows a hierarchical decomposition of the entire system into independent Reatmetric systems. An example
110+
of configuration enabling such decomposition is located in the module eu.dariolucia.reatmetric.remoting.test. Two station
111+
simulations can be individually executed, and a high-level M&C system can connect to both systems and provide a unified
112+
monitoring and control experience.
113+
114+
The purpose of such capability is to distribute the processing across several nodes, while still being able to offer a
115+
common M&C view of the whole system. The high level system can reflect only a subset of the processing elements of each
116+
sub-system.
117+
118+
Moreover, the approach is scalable and not limited to a 2-tiers deployments.
119+
120+
The UI module, when properly configured, allows the connection to each system with just two clicks.
121+
122+
The only limitation of the design is that each system entity in the overall system deployment **must have** a unique System Entity ID,
123+
for the elements that must be accessible to any remote high-level system.
124+
107125
### Performance
108126
The performance are computed with reference to the following 2 platforms:
109127

@@ -176,7 +194,6 @@ If you want to quickly try Reatmetric out, I suggest the following approach:
176194
- Build the complete tree with maven: mvn clean install
177195
- Create a folder called 'reatmetric' inside your home folder and decompress there the configuration zip inside eu.dariolucia.reatmetric.ui.test/src/main/resources
178196
- Update the configuration data as appropriate. There is no need to change the processing definition data
179-
- Go inside eu.dariolucia.reatmetric.ui.test/target/deps and remove jffi-1.2.19-native.jar
180197
- Go inside eu.dariolucia.reatmetric.ui.test/target and run the following line (assuming Java is in your path)
181198

182199
(Windows)
@@ -191,7 +208,6 @@ If you want to try Reatmetric using a client-server deployment, I suggest the fo
191208
- Build the complete tree with maven: mvn clean install
192209
- Create a folder called 'reatmetric' inside your home folder and decompress there the configuration zip inside eu.dariolucia.reatmetric.ui.test/src/main/resources
193210
- Update the configuration data as appropriate. There is no need to change the processing definition data
194-
- Go inside eu.dariolucia.reatmetric.remoting.test/target/deps and remove jffi-1.2.19-native.jar
195211
- Go inside eu.dariolucia.reatmetric.remoting.test/target and run the following line (assuming Java is in your path)
196212

197213
(Windows)
@@ -202,7 +218,6 @@ java --module-path="deps" -Dreatmetric.core.config=path to Reatmetric/configurat
202218

203219
- Create a folder called 'reatmetric_remoting' inside your home folder
204220
- Inside the folder created in the previous step, create a remoting configuration, so that the UI can connect
205-
- Go inside eu.dariolucia.reatmetric.ui.remoting/target/deps and remove jffi-1.2.19-native.jar
206221
- Go inside eu.dariolucia.reatmetric.ui.remoting/target and run the following line (assuming Java is in your path)
207222

208223
(Windows)

eu.dariolucia.reatmetric.driver.remote/src/main/java/eu/dariolucia/reatmetric/driver/remote/definition/RemoteConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public static RemoteConfiguration load(InputStream is) throws IOException {
5050

5151
/**
5252
* Prefix added to the remote definitions in the processing model.
53-
* This property is needed to derive the system entity paths of the remote processing model,
54-
* starting from the paths of the local processing model.
53+
* This property is needed to derive the system entity paths of the remote (lower level) processing model,
54+
* starting from the paths of the local (higher level) processing model.
5555
* <p>
5656
* For instance:
5757
* <ul>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
~ Copyright (c) 2022 Dario Lucia (https://www.dariolucia.eu)
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<ns1:remote xmlns:ns1="http://dariolucia.eu/reatmetric/driver/remote"
18+
remote-system-name="Test System Station 1"
19+
remote-path-prefix="MASTER."
20+
remote-path-selector="MASTER.STATION">
21+
</ns1:remote>

eu.dariolucia.reatmetric.driver.test/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
<artifactId>eu.dariolucia.reatmetric.processing</artifactId>
4646
<version>${project.parent.version}</version>
4747
</dependency>
48+
<dependency>
49+
<groupId>org.glassfish.jaxb</groupId>
50+
<artifactId>jaxb-runtime</artifactId>
51+
<version>${jaxb.version}</version>
52+
</dependency>
4853
</dependencies>
4954

5055
</project>

eu.dariolucia.reatmetric.driver.test/src/main/java/eu/dariolucia/reatmetric/driver/test/CommandEncoder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public class CommandEncoder {
2626

2727
private final AtomicInteger commandTagSequencer = new AtomicInteger(0);
2828

29-
public Pair<Integer, byte[]> encode(IActivityHandler.ActivityInvocation activityInvocation) {
29+
public Pair<Integer, byte[]> encode(IActivityHandler.ActivityInvocation activityInvocation, int systemEntityOffset) {
3030
// Read the activityInvocation arguments and encode accordingly
31-
int eqId = ((Number) activityInvocation.getArguments().get(TestDriver.EQUIPMENT_ID_ARGKEY)).intValue();
31+
int eqId = ((Number) activityInvocation.getArguments().get(TestDriver.EQUIPMENT_ID_ARGKEY)).intValue() - systemEntityOffset;
3232
int commandId = ((Number) activityInvocation.getArguments().get(TestDriver.COMMAND_ID_ARGKEY)).intValue();
3333
Number arg1 = (Number) activityInvocation.getArguments().get(TestDriver.ARG_1_ARGKEY);
3434
if(arg1 == null) {

eu.dariolucia.reatmetric.driver.test/src/main/java/eu/dariolucia/reatmetric/driver/test/MonitoringDecoder.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ public class MonitoringDecoder implements IRawDataSubscriber {
3737
private final Map<Integer, Consumer<RawData>> monitoringMap = new HashMap<>();
3838
private final Map<Integer, Function<RawData, LinkedHashMap<String, Pair<Integer, Object>>>> renderingMap = new HashMap<>();
3939
private final IProcessingModel model;
40+
private final int systemEntityOffset;
4041

41-
public MonitoringDecoder(IProcessingModel model, IRawDataBroker broker) {
42+
public MonitoringDecoder(IProcessingModel model, IRawDataBroker broker, int systemEntityOffset) {
4243
this.model = model;
44+
this.systemEntityOffset = systemEntityOffset;
4345
// Initialise monitoring processing map
4446
monitoringMap.put(1, this::powerSupplyMon);
4547
monitoringMap.put(2, this::powerSupplyMon);
@@ -178,7 +180,7 @@ private void inject(Instant genTime, LinkedHashMap<String, Pair<Integer, Object>
178180
}
179181

180182
private ParameterSample toParameterSample(Instant generationTime, Pair<Integer, Object> integerObjectPair) {
181-
return ParameterSample.of(integerObjectPair.getFirst(), generationTime, Instant.now(), integerObjectPair.getSecond());
183+
return ParameterSample.of(integerObjectPair.getFirst() + this.systemEntityOffset, generationTime, Instant.now(), integerObjectPair.getSecond());
182184
}
183185

184186
private void processMonitoringData(RawData rd) {

eu.dariolucia.reatmetric.driver.test/src/main/java/eu/dariolucia/reatmetric/driver/test/TestDriver.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@
4242
import eu.dariolucia.reatmetric.core.api.IServiceCoreContext;
4343
import eu.dariolucia.reatmetric.core.api.exceptions.DriverException;
4444
import eu.dariolucia.reatmetric.core.configuration.ServiceCoreConfiguration;
45+
import eu.dariolucia.reatmetric.driver.test.definition.TestDriverConfiguration;
4546
import eu.dariolucia.reatmetric.processing.definition.ProcessingDefinition;
4647

48+
import java.io.File;
49+
import java.io.FileInputStream;
50+
import java.io.IOException;
4751
import java.nio.ByteBuffer;
4852
import java.time.Instant;
4953
import java.util.Arrays;
@@ -106,12 +110,17 @@ public class TestDriver implements IDriver, IActivityHandler, IRawDataRenderer {
106110
public static final String EXECUTION_COMPLETED_STAGE = "Execution Completed";
107111
public static final String TRANSMISSION_STAGE = "Transmission";
108112

113+
private static final String CONFIGURATION_FILE = "configuration.xml";
114+
109115
private volatile String name;
110116
private volatile IServiceCoreContext context;
111117
private volatile IProcessingModel model;
112118
private volatile ProcessingDefinition definitions;
113119
private volatile IDriverListener subscriber;
114120

121+
// Driver configuration
122+
private volatile TestDriverConfiguration configuration;
123+
115124
// For activity execution
116125
private final ExecutorService executor = Executors.newFixedThreadPool(1, (t) -> {
117126
Thread toReturn = new Thread(t, "TestDriver Activity Handler Thread");
@@ -149,6 +158,13 @@ public void initialise(String name, String driverConfigurationDirectory, IServic
149158
this.subscriber = subscriber;
150159
try {
151160
this.definitions = ProcessingDefinition.loadAll(coreConfiguration.getDefinitionsLocation());
161+
162+
// Read the configuration
163+
this.configuration = TestDriverConfiguration.load(new FileInputStream(driverConfigurationDirectory + File.separator + CONFIGURATION_FILE));
164+
} catch (IOException e) {
165+
// You can ignore, assuming no offset will be used
166+
LOG.log(Level.WARNING, "Test driver: no configuration file found at " + driverConfigurationDirectory + File.separator + CONFIGURATION_FILE + ", assuming no offset will be used");
167+
this.configuration = new TestDriverConfiguration();
152168
} catch (ReatmetricException e) {
153169
throw new DriverException(e);
154170
}
@@ -159,7 +175,7 @@ public void initialise(String name, String driverConfigurationDirectory, IServic
159175
this.rawDataSubscriber = this::eventReceived;
160176
this.context.getRawDataBroker().subscribe(this.rawDataSubscriber, null, new RawDataFilter(true, null, null, Collections.singletonList(STATION_EVENT), null, Collections.singletonList(Quality.GOOD)), null);
161177
// Decoder
162-
this.decoder = new MonitoringDecoder(context.getProcessingModel(), context.getRawDataBroker());
178+
this.decoder = new MonitoringDecoder(context.getProcessingModel(), context.getRawDataBroker(), this.configuration.getSystemEntityOffset());
163179
// CommandVerifier
164180
this.verifier = new CommandVerifier(this, context.getRawDataBroker());
165181

@@ -182,7 +198,7 @@ private void eventReceived(List<RawData> rawDatas) {
182198
int code = bb.getInt();
183199
equipmentId += code;
184200
//
185-
this.context.getProcessingModel().raiseEvent(EventOccurrence.of(equipmentId, Instant.ofEpochMilli(genTime), Instant.now(), null, null, code, TestDriver.STATION_ROUTE, TestDriver.STATION_SOURCE, null));
201+
this.context.getProcessingModel().raiseEvent(EventOccurrence.of(equipmentId + this.configuration.getSystemEntityOffset(), Instant.ofEpochMilli(genTime), Instant.now(), null, null, code, TestDriver.STATION_ROUTE, TestDriver.STATION_SOURCE, null));
186202
}
187203
}
188204

@@ -292,7 +308,7 @@ private boolean connectorReady() {
292308
private void execute(IActivityHandler.ActivityInvocation activityInvocation, IProcessingModel model) {
293309
Pair<Integer, byte[]> encodedCommand = null;
294310
try {
295-
encodedCommand = encoder.encode(activityInvocation);
311+
encodedCommand = encoder.encode(activityInvocation, this.configuration.getSystemEntityOffset());
296312
storeRawData(activityInvocation.getActivityOccurrenceId(), activityInvocation.getPath(), activityInvocation.getGenerationTime(), activityInvocation.getRoute(), activityInvocation.getType(), activityInvocation.getSource(), encodedCommand.getSecond());
297313
synchronized (this) {
298314
// Record verification
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (c) 2020 Dario Lucia (https://www.dariolucia.eu)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package eu.dariolucia.reatmetric.driver.test.definition;
18+
19+
import javax.xml.bind.JAXBContext;
20+
import javax.xml.bind.JAXBException;
21+
import javax.xml.bind.Unmarshaller;
22+
import javax.xml.bind.annotation.XmlAccessType;
23+
import javax.xml.bind.annotation.XmlAccessorType;
24+
import javax.xml.bind.annotation.XmlAttribute;
25+
import javax.xml.bind.annotation.XmlRootElement;
26+
import java.io.IOException;
27+
import java.io.InputStream;
28+
29+
@XmlRootElement(name = "test-driver", namespace = "http://dariolucia.eu/reatmetric/driver/test")
30+
@XmlAccessorType(XmlAccessType.FIELD)
31+
public class TestDriverConfiguration {
32+
33+
public static TestDriverConfiguration load(InputStream is) throws IOException {
34+
try {
35+
JAXBContext jc = JAXBContext.newInstance(TestDriverConfiguration.class);
36+
Unmarshaller u = jc.createUnmarshaller();
37+
return (TestDriverConfiguration) u.unmarshal(is);
38+
} catch (JAXBException e) {
39+
throw new IOException(e);
40+
}
41+
}
42+
43+
/**
44+
* System entity offset: it is applied (added) to the system entity ID of parameters, events and (subtracted) telecommands.
45+
*/
46+
@XmlAttribute(name = "system-entity-offset")
47+
private int systemEntityOffset = 0;
48+
49+
public int getSystemEntityOffset() {
50+
return systemEntityOffset;
51+
}
52+
53+
public void setSystemEntityOffset(int systemEntityOffset) {
54+
this.systemEntityOffset = systemEntityOffset;
55+
}
56+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
open module eu.dariolucia.reatmetric.driver.test {
22
requires java.logging;
33
requires java.rmi;
4+
requires java.xml.bind;
45

56
requires eu.dariolucia.reatmetric.api;
67
requires eu.dariolucia.reatmetric.core;
78
requires eu.dariolucia.reatmetric.processing;
89

910
exports eu.dariolucia.reatmetric.driver.test;
11+
exports eu.dariolucia.reatmetric.driver.test.definition;
1012

1113
provides eu.dariolucia.reatmetric.core.api.IDriver with eu.dariolucia.reatmetric.driver.test.TestDriver;
1214
}

eu.dariolucia.reatmetric.driver.test/src/main/resources/Station Chart Overview.dat renamed to eu.dariolucia.reatmetric.driver.test/src/main/resources/config/Station Chart Overview.dat

File renamed without changes.

0 commit comments

Comments
 (0)