-
Notifications
You must be signed in to change notification settings - Fork 3
Matlab
The installation script (install.m) is contained in distribution/matlab. You can execute it once.
Let start from a simple example (multipleMonitorSimple.m) that you can find in example/TemporalExamples/SimpleExamples/
The script which defines formulas, domain, and type, is contained in multipleMonitor.mls.
% file multipleMonitor.mls
signal { real x; real y}
domain boolean;
formula future = globally [0, 0.2] (x > y);
formula past = historically [0, 0.2] (x > y);
As you can see, it is a temporal script, there are two formulas: future and past and the domain is Boolean.
The signal should be composed of two real value represented by the variable x and y.
For more details about Moonlight scripts please visit the dedicated section
This script has been loaded and used in multipleMonitor.m which is reported below
% file multipleMonitorSimple.m
clear
close all;
%% STEP 1: generating signal
trajFunction = @(t)[sin(t);cos(t)]';
time = 0:0.1:3.1;
values = trajFunction(time);
%% STEP 2: loading the Moonlight Script
moonlightScript = ScriptLoader.loadFromFile("multipleMonitors");
%% STEP 3 (optional): change the domain on the fly
moonlightScript.setMinMaxDomain();
%% STEP 4: getting the monitor associated with a target formula
boolFutureMonitor = moonlightScript.getMonitor("future");
%% STEP 5: monitor the signal
boolFutureMonitorResult = boolFutureMonitor.monitor(time,values);
Pay attention to comments. As you can see there are 5 steps:
- STEP 1: define a temporal signal.
- STEP 2: loading the Moonlight Script from a file named multipleMonitors.mls and contained in the same folder as our Matlab script. We use the method
loadFromFile
of the Matlab classScriptLoader
- STEP 3 (optional): we can decide to change the domain of the script on the fly by using one of the two methods
setMinMaxDomain()
orsetBooleanDomain()
to set the MinMax or Boolean Domain, respectively. - STEP 4: getting the monitor associated with a target formula. We use the method
getMonitor("future")
which accepts the string of the formula name we want to use. - STEP 5: finally we can use the generated monitor (boolFutureMonitor) to monitor each compatible tempora signal
Please note that Moonlight and its interfaces are still under active development.
In case of any problem, file a new issue on Github, or reach us directly on any communication channel!