2020-04-09 14:21:57 +00:00
|
|
|
## Has been <u>tested</u> and <u>developed</u> using:
|
|
|
|
> ubuntu 16.04.6<br/>
|
|
|
|
> openssl: 1.0.2g<br/>
|
2020-04-09 14:19:31 +00:00
|
|
|
> node: 8.16.0
|
2019-09-18 08:11:16 +00:00
|
|
|
|
2020-04-09 14:21:57 +00:00
|
|
|
|
|
|
|
## Requirements:
|
2020-08-03 11:12:14 +00:00
|
|
|
```sh
|
|
|
|
curl -sL [https://deb.nodesource.com/setup_8.x](https://deb.nodesource.com/setup_8.x) | sudo -E bash -
|
|
|
|
sudo apt-get install -y nodejs
|
|
|
|
sudo apt-get install -y build-essential
|
|
|
|
install python 2.7
|
|
|
|
rm package-lock.json && rm -rf node_modules && rm -rf ~/.node-gyp only **(if package-lock.json/node_modules or node was installed)**
|
|
|
|
sudo apt-get install libasound2-dev
|
|
|
|
sudo npm i -g node-gyp
|
|
|
|
sudo npm install --unsafe-perm
|
|
|
|
```
|
|
|
|
|
|
|
|
## How to guide how to configure units and the simulator
|
2020-08-03 11:23:31 +00:00
|
|
|
|
2020-08-03 11:12:14 +00:00
|
|
|
<br/>
|
|
|
|
**1. Insert Groups** <br/>
|
|
|
|
Groups will be inserted using the following script directly on the database:
|
|
|
|
```sql
|
|
|
|
set search_path to public;
|
|
|
|
|
|
|
|
do $$
|
2020-04-09 14:21:57 +00:00
|
|
|
|
2020-08-03 11:12:14 +00:00
|
|
|
declare i INTEGER := 1;
|
|
|
|
declare sipid integer;
|
|
|
|
declare ressql varchar;
|
|
|
|
declare acc_id integer = 1;
|
|
|
|
declare p_account_name varchar := 'AIRWizard';
|
|
|
|
declare number_of_groups INTEGER := 100; -- How many groups we create
|
|
|
|
declare dispatcher_name varchar := 'Dispatcher Sergiu';
|
|
|
|
declare groups_name varchar := 'sim-test-';
|
2020-04-09 14:02:44 +00:00
|
|
|
|
2020-08-03 11:12:14 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
-- Create groups
|
|
|
|
WHILE i <= number_of_groups LOOP
|
|
|
|
SELECT get_new_sipid(acc_id) INTO sipid;
|
|
|
|
SELECT insert_update_groups(acc_id, Null, groups_name || i, '1', '1', '0', '0', '0', sipid, 0,'','') INTO ressql;
|
|
|
|
i = i + 1;
|
|
|
|
end loop;
|
|
|
|
|
|
|
|
-- Assign dispatcher on the groups
|
|
|
|
insert into public.asset_group (asset_id, group_id)
|
|
|
|
select (select id from public.asset where name = dispatcher_name), id from public."group" g where name like groups_name || '%';
|
|
|
|
|
|
|
|
end; $$;
|
|
|
|
```
|
2020-08-03 11:23:31 +00:00
|
|
|
|
2020-08-03 11:12:14 +00:00
|
|
|
<br/>
|
|
|
|
**2. Insert units** <br/>
|
|
|
|
The units will be inserted from the provisioning(**Units -> Import from file**) and the **file_name.xlsx** file will have the following format:
|
2020-08-03 11:28:26 +00:00
|
|
|
![FILE.XLSX Format](./doc/units-xlsx.png)
|
2020-08-03 11:23:31 +00:00
|
|
|
|
2020-08-03 11:12:14 +00:00
|
|
|
<br/>
|
|
|
|
**3. Cimulator configuration:** <br/>
|
|
|
|
**For the simulation to simulate in a period**, we must put the **testing_period setting in settings** (the value is in milliseconds).<br/>
|
|
|
|
Example in **config**:<br/>
|
|
|
|
```toml
|
|
|
|
[settings]
|
|
|
|
max_fails = 3
|
|
|
|
send_voice = true
|
|
|
|
send_gps = true
|
|
|
|
gps_report_interval = 10000
|
|
|
|
gps_lng_start_point = 24.776126
|
|
|
|
testing_period = 7000 // we will simulate all the units in a period of 7 seconds**
|
|
|
|
```
|
|
|
|
<br/>
|
|
|
|
**4. To start the simulator** <br/>
|
|
|
|
To start the simulator we must specify which config file we want to use.
|
|
|
|
```
|
|
|
|
node index.js --path="./config/stage"
|
|
|
|
```
|