-
Notifications
You must be signed in to change notification settings - Fork 11
Using the data simulator
This page describes how to simulate various types of Victron installations; to allow development without having all that hardware installed installed and operational.
The simulator is run using the venus-docker project: https://github.com/victronenergy/venus-docker
git clone https://github.com/victronenergy/venus-docker.git
cd venus-docker
./build.sh # set up the container (if you update the repo, run this again)
Assuming you are in the repo venus-docker directory:
./run.sh # this runs the container as an interactive shell, so the commands below are within that shell
./start_services.sh # start mqtt and other services
./simulate.sh r # run the 'r' simulation
You should see output similar to:
parallels@parallels ~/src/victron/venus-docker (master)$ ./run.sh
root@2b093a921ddf:~# ./start_services.sh
* Starting system message bus dbus [ OK ]
* Starting network daemon: mosquitto [ OK ]
root@2b093a921ddf:~# ./simulate.sh r
Waiting for localsettings .
Applying settings for this simulation...
Starting the simulation, press ctrl+C to terminate.
INFO:root:Opening recordings
INFO:root:Initialising service com.victronenergy.solarcharger.ttyO0
INFO:root:Initialising service com.victronenergy.battery.ttyUSB0
INFO:root:Initialising service com.victronenergy.dcsystem.ttyS5
INFO:root:Initialising service com.victronenergy.tank.adc_builtin0_3
INFO:root:Initialising service com.victronenergy.temperature.adc_builtin0_8
INFO:root:Initialising service com.victronenergy.temperature.ruuvi_f00f00d00001
INFO:root:Initialising service com.victronenergy.temperature.ruuvi_f00f00d00002
INFO:root:Initialising service com.victronenergy.vebus.ttyO1
INFO:root:Initialising service com.victronenergy.tank.adc_builtin0_4
INFO:root:Initialising service com.victronenergy.temperature.adc_builtin0_7
INFO:root:Stage set, starting simulation
The app executable has to be run with the --dbus-default argument. E.g. this can be added in your Qt Creator project 'Run' configuration:
Now, if a simulation is running, then if you run the app it should automatically connect to the dbus services and show the simulation data.
https://github.com/victronenergy/venus-docker documents the available simulations. Some useful ones include:
- r: solar
- k: grid (3-phase), generator and loads
- l: AC loads
- f: AC inputs (e.g. different inverters)
- s: alternates between shore and generator inputs
- n: shore input with 3 phase on com.victronenergy.genset service
dbus-spy (in the container root) is a super useful tool for checking the dbus values published by the simulations.
E.g. run the simulation in the background, then run dbus-spy:
./simulate.sh r &
dbus-spy
To see output similar to this:
Some things can be tested on the CerboGX via the /opt/victronenergy scripts.
To add a vecan device: /opt/victronenergy/vecan-dbus/vecan-dbus -c socketcan:can1
To add a rvc device: /opt/victronenergy/dbus-rv-c/dbus-rv-c -c socketcan:can1
Now if you go to Settings > Services, you should see devices appear below the "Console on VE.Direct 1" list item.
Some demo data has been pre-recorded and can be played back to test the UI. You can select a demo mode via Settings -> General -> Demo Modes.
Instead of using real data, you can use the mock backend (via passing --mock
argument when launching venus-gui-v2).
This is mostly useful for desktop (i.e. testing/development) builds. Pressing left/right arrows cycles through mocked system setups.
On my ubuntu system, running vpn software can cause issues with running simulations. I see the following error:
root@d3fd6ec881a8:~# ./start_services.sh
* Starting system message bus dbus [ OK ]
mosquitto: unrecognized service
Once I stopped the vpn software and restarted the docker container, it all worked ok for me