Skip to content
Michal Lenc edited this page Feb 29, 2024 · 4 revisions

PysimCoder is an open source rapid control prototyping development tool. It can be used to generate a real time code for various targets.

Supported Targets

Specific target has to be compiled before the application is generated using pysimCoder. This is usually done by entering target's directory and running make command there. Typical approach is:

cd pysimCoder
cd CodeGen/your_target_name/devices
make

Note that for NuttX target, you have to copy exported NuttX folder to target folder. This approach is described in NuttX documentation.

Communication

PysimCoder can send data to outer world (or receive data) with several options.

Instalation

Project requires Python 3.9 runtime to be present on the system. Installation instructions and scripts expect Debian derived distribution and may require adjustments on other systems.

Superuser privileges are necessary for installation of the compiled drivers.

In cases when environment doesn't fulfill the aforementioned conditions, a containerized deployment with one of the provided images is preferable.

Unix-like systems

Install system dependencies and python libraries

sudo apt install gcc gfortran git cmake binutils emacs python3.9 python3-numpy \
    python3-scipy python3-sympy python3-matplotlib python3-pip jupyter-qtconsole \
    python3-lxml python3-pyqtgraph libopenblas-dev liblapack-dev libxml2-dev \
    libcomedi-dev python3-pyqt5

sudo pip install -r requirements.txt

Alternatively the dependencies can be installed with provided scripts:

sudo python3 ubuntu_dependency_installer.py
sudo python3 python_libs_install.py

Install pysimCoder to your computer

Build and install the code as a superuser with:

sudo make

Set environment variables in user .bashrc

make user

You may also install modules for different targets as a normal user with:

make <target>

Finally you launch the application from the command line. The .bashrc may have to be reloaded beforehand.

pysimCoder

Run pysimCoder from script

Alternative approach is not to install pysimCoder on the system, but run it directly from the script. You still need Python dependencies mentioned above though. You have to set PYSUPSICTRL variable with the path to pysimCoder directory.

export PYSUPSICTRL=/path/to/pysimCoder

It is recommended to add this export to your system initialization so you do not have to do it every time from new terminal window. Then pysimCoder can be run by executing pysim-run script.

./pysim-run.sh

This will open pysimCoder editor. You can run the script from pysimCoder directory or you can move in anywhere else (just make sure you update the path in the script).

pysimCoder as docker image

It is now possible to pull a docker image to run pysimCoder in a container.

Install docker (see https://docs.docker.com/engine/install/ubuntu/).

Download a pysimCoder image directly from the Docker Container page:

docker pull robertobucher/pysimcoder:latest

The image can be launched with

$ docker run --rm --env="DISPLAY" --net=host -v $XAUTHORITY:/tmp/.XAuthority -e XAUTHORITY=/tmp/.XAuthority robertobucher/pysimcoder:latest

At the prompt launch

psc

More info and the Dockerfile can be found at https://github.com/robertobucher/pysimCoder-Docker

pysimCoder in Windows

pysimCoder can run in Windows under WSL.

Simply install some additional packages download pysimCoder and istall it.

    sudo apt-get update
    sudo apt-det dist-upgrade

and

sudo apt-get install \
	gcc \
	gfortran \
	git \
	cmake \
	binutils \
	emacs \
	python3 \
	python3-numpy \
	python3-scipy \
	python3-sympy \
	python3-matplotlib \
	python3-pip \
	jupyter-qtconsole \
	python3-lxml \
	python3-pyqtgraph \
	libopenblas-dev \
	liblapack-dev \
	libxml2-dev \
	libcomedi-dev \
	python3-pyqt5 \
	python3-qwt \
	python3-serial

In Debian the following package should be installed for pyQt6

sudo apt-get install qt6-svg-dev

In Ubuntu the following packages should be installed for pyQt6

sudo apt-get install \
    qt6-base-dev \
    libqt6svg6-dev

Then move to a directory where to install pysimCoder and do

git clone https://github.com/robertobucher/pysimCoder
cd pysimCoder
make addfiles
make modules
make fmu
sudo make link
make user
make alias
make full_lib