The virtual fleet provides the ability to simulate the movement of multiple vehicles. The script will run one MQTT broker using VerneMQ and will launch a virtual vehicle, a module gateway, and an external server for each entry in the configuration JSON
git clone https://github.com/bringauto/virtual-fleet.git
cd virtual-fleet
pip install -r requirements.txt
--config=<string>
- path to the JSON configuration file. If not set, the default path./config/virtual-fleet-config.json
is used.
The JSON configuration file should contain the following fields:
vernemq-docker-image
: MQTT broker docker image name/addressvernemq-docker-tag
: MQTT broker image tagexternal-server-docker-image
: External server docker image name/addressexternal-server-docker-tag
: External server image taggateway-docker-image
: Module gateway docker image name/addressgateway-docker-tag
: Module gateway image tagvehicle-docker-image
: Virtual vehicle docker image name/addressvehicle-docker-tag
: Virtual vehicle image tagstart-port
: Starting port used for communication between virtual vehicles and their module gateway. The port will be iterated, so 8 virtual vehicles will use ports 42000 - 42007. If a port is already used by another program, it will skip it and try the next one.stop-running-containers
: If set totrue
, all running containers used by the virtual fleet will be stopped and removed. If set tofalse
, the script will run alongside the already running containers, which may cause vehicles to exhibit undefined behavior. Default istrue
.vehicles
: Array of vehicles to createvehicles.name
: Name of the vehicle. The name must be unique and adhere to the regular expression^[a-z0-9_]*$
vehicles.company
: Name of the company that runs the vehicle. The name must adhere to the regular expression^[a-z0-9_]*$
Example JSON configuration: config/virtual-fleet-config.json
Component | Configuration Directory | Repository Link |
---|---|---|
External Server | config/external-server |
External Server Repository |
Module Gateway | config/module-gateway |
Module Gateway Repository |
Virtual Vehicle | config/virtual-vehicle |
Virtual Vehicle Repository |
MQTT Broker | config/vernemq |
VerneMQ Repository |
python3 VirtualFleetDocker.py --config=./config/virtual-fleet-config.json
Do not run multiple virtual fleets on the same machine. Since they will share the same MQTT broker, this can lead to conflicts in car names and operational issues.