Vleet is a node.js application which allows you to create a fleet of systems and simulate embedded applications with specific behavior for each data type. Both device and application-generated data can be simulated.
Install the vleet engine by cloning this Github repository
Install the dependencies: npm install
from the root folder
First take a look at the config/simulations/trucks.json.template
file, which will help you understand how to create your own simulated systems.
Let’s say you want to simulate an alarm system. First create an alarmSystem.json
file in the config/simulations
folder. (You can have as many simulators as you want.) The name of the file will be used to reference your simulation.
This file contains several sections and data:
Example:
{
"name": "Building",
"label": "Buildings",
"fleet": {
...
},
"generation": {
...
},
"application": {
...
},
"clean": false
}
Each section is explained in more detail below.
Truck
(note the space at the end), the first system will be Truck 0
.Example:
"fleet": {
"size": 96,
"namePrefix": "Asset "
},
Example:
"generation": {
"mode": "backToTheFuture",
"backToTheFuture": { // Use mode name to specify options for the generation mode
"nbDaysInPast": 1,
"valuesPerDay": 10
},
"data": {
}
}
This section describes options for some data generators. This section is not exhaustive. Have a look at lib/engine
.
backToTheFuture This engine generates values from a given date in the past until the current day:
This section specifies options that the generator will use for the given data type.
You can use Device Management processed data to display data about connectivity or device (go to References menu > System > Fields and scroll down to the second table).
Default generators are:
You can add a new generator (see next section).
Example:
"data": {
"phone.custom.dn.1": {
"generator": "randomFloat",
"options": {
"min": -5,
"max": 35,
"fixed": 1
}
},
"phone.custom.dn.2": {
"generator": "randomBoolean", // Default generator
"options": {
"likelihood": 1
}
},
"_RSSI": {
"generator": "RSSIGenerator", // Custom generator
"options": {
}
}
}
Add these in the custom-generators
folder, whatever the filename.
The exported function name is the identifier declared in the data section described above.
Tip: look at existing generators to help you to create your own.
You can use Chance library , Math library , …
Example:
function RSSIGenerator() {}
RSSIGenerator.prototype.generate = function() {
return -100 + (Math.round(Math.random() * 30));
};
module.exports = RSSIGenerator;
This section describes the application associated with the fleet systems. This application will be automatically created for all systems of your fleet. All applicative data must be specified so it can be be used in AirVantage, for example to plot charts. However you don’t need to describe Device Management processed data in this file, as this is already specified for AirVantage.
"application": {
"name": "SecurityApp",
"type": "avphone.demo.security",
"data": [{
"id": "phone.custom.dn.1",
"label": "Temperature",
"elementType": "variable",
"type": "double"
}, {
"id": "phone.custom.dn.2",
"label": "Leakage",
"elementType": "variable",
"type": "boolean"
},{
"id": "phone.alarmSystem",
"label": "Alarm System",
"description":"The command description",
"elementType": "command",
"parameters": [
{
"id": "TurnON",
"defaultValue": true,
"defaultLabel": "TurnON",
"type": "boolean",
"optional": false
}]
}]
}
If you need help to create an application model manually, refer to the Application Format Reference page and use the following howto .
setup.json
out of the setup.json.template
file.config/simulations
)eu
or na
{
"simulation": "building",
"dataCenter": "eu",
"companyUid": "78c45b83021c450ebefca60635314090",
"credentials": {
"username": "rjacolin@sierrawireless.com",
"password": "t0t0!"
}
}
From the root folder, launch npm start
to run a fleet simulation.
$ npm start
> virtual-fleet@0.0.1 start /vleet-engine
> node .
Authenticated
Application already exists
Fleet already exists
Start simulation - Buildings
For 96 systems
start
init engine for mode: backToTheFuture
init "backToTheFuture" engine
send data for system: Asset 210
Generate data for system: Asset 210
Minutes offset by day: 144
Day # 0
Nth value of day: 0 Time : Monday, April 4th 2016, 2:24:00 am
generate value for data: phone.custom.dn.1
## generatorConfig: { generator: 'randomFloat',
options: { min: -5, max: 35, fixed: 1 } }
generate value for data: phone.custom.dn.2
## generatorConfig: { generator: 'randomBoolean', options: { likelihood: 1 } }
generate value for data: phone.custom.up.1
## generatorConfig: { generator: 'randomBoolean', options: { likelihood: 1 } }
generate value for data: _RSSI
## generatorConfig: { generator: 'RSSIGenerator', options: {} }
generate value for data: _ECIO
## generatorConfig: { generator: 'ECIOGenerator', options: {} }
generate value for data: _BYTES_RECEIVED
## generatorConfig: { generator: 'BytesReceivedGenerator', options: {} }
generate value for data: _BYTES_SENT
...