Simulating with Vortex on Windows Subsystem for Linux - WSL2

This document details how to use the same machine when running a Vortex simulation on Linux while Creating Content and Debugging Simulation on Windows.

Installing WSL2

See https://docs.microsoft.com/en-us/windows/wsl/

Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.

Follow the installation guidelines provided by Microsoft.

In this document, the distro Ubuntu 20.04 LTS is used.

Installing Vortex

From Windows, the Ubuntu distribution is accessible under \\wsl$\Ubuntu\.

If you already have a license file for your computer, you can copy it under /opt/cmlabs/licenses/.

Running a Simulation with Vortex

Create a Setup File for Linux

The SimApp, simulation application of Vortex, has no default setup file for Linux.

The default SimApp.vxc in resources folder is targeting Windows.

On Linux, only dynamics related modules are needed.

On Windows, using the Vortex Editor, create a new Setup document, add DynamicsEngine module, save it under \\wsl$\Ubuntu\usr\vortex\resources\config\simapp_DynamicsOnly.vxc. (you can overwrite the default one or create a new one)

In the Vortex Editor, create some content, e.g. a new Assembly with CGs associated to parts and e.g. a static plane.

Save it under \\wsl$\Ubuntu\usr\vortex\content\Assembly.vxassembly.

Running the simulation

In Ubuntu, navigate to \wsl$\Ubuntu\usr\vortex\bin\ and call

# ./SimApp ../content/Assembly.vxassembly

Some log information will appear describing the operations made by Vortex when initializing the application and loading the content.

Stopping the simulation

Ctrl + C will stop the command running Vortex.

However to make sure that SimApp is actually stopped, it is recommended to list the processes running

# ps

If SimApp appears in the list, a call to kill -9 PID will ensure that Vortex is actually terminated.

Debugging the Simulation

The remote Debugger is the preferred way to debug simulations on Linux, see Remote Debugger User Guide.

The command line to call the remote debugger is 

PowerShell
 PS C:\CM Labs\Vortex Studio <Version>\bin> .\SimApp.exe --config ..\resources\config\VortexRemoteDebugger.vxc

You can also use grpc with python and connection should work, see Remote debugging with Python

Don't forget to enable Remote Access in the Setup file and define a Listening Port, save it in SimApp.vxc and start the simulation again.

Configuring and using Ubuntu IPv4 with Remote Debugger

The current Vortex version of the Remote Debugger supports only IPv4.

By default, your Ubuntu Distro might favor IPv6 which won't work with the remote debugger application.

The following instructions will enable IPv4 for an Ubuntu distro.

  1. In WSL, localhost forwarding must be enabled ,see https://docs.microsoft.com/en-us/windows/wsl/wsl-config

    .wslconfig
    [wsl2]
    localhostForwarding=true
  2. In Ubuntu, IPv4 must be favored, edit /etc/gai.conf and uncomment IPv4 commented lines

  3. In case, this would not be sufficient, it is possible to disable IPv6, for example with the following command

    # sysctl -w net.ipv6.conf.all.disable_ipv6=1
    # sysctl -w net.ipv6.conf.default.disable_ipv6=1
  4. Finally, the IP address to use in the remote debugger interface can be determined with the following command
    The console output for eth0 inet value will describe an IPv4 address, e.g. 172.31.78.54

    # ip addr