Generate Python wheel package from Simulink model!
Project description
Simbind CLI
Generate Python Wheel package from Simulink model to enhance
your Software-in-Loop tests development workflow!
Please refer to Wiki
and Examples to explore the project's
capabilities and limitations.
You also might be interested into pytest-simbind plugin that
allows to test Simbind models with pytest!
Requirements
We highly recommend to use Dockerized version of Simbind, since collecting the correct versions of the necessary requirements can be challenging. If you opt for local installation, the following is required:
- Linux x86-64 machine with installed Matlab R2023b.
- Python 3.10 or 3.11: Simbind Architect requires Python 3.10+ and Simulink Exporter needs Python 3.9, 3.10 or 3.11.
- From Matlab side you need Simulink suite with Embedded Coder.
- You also need pip, gcc, cmake, make and swig. Under Debian-based distros you can install it with
sudo apt-get install python3-pip build-essential cmake swig
To run output model you need only Linux x86-64 machine and Python 3.8+. We're open to extending support to Linux ARM and Windows x86-64 if there's sufficient interest!
Installation
To install from PyPi run
$ pip install simbind
Please, notice that you will need to satisfy requirements before running pip!
To clone project you will also need to pull submodules with:
$ git clone --recurse-submodules https://github.com/swag-engineering/simbind-cli.git
Usage
Simbind CLI is a wrapper around Simulink Exporter and Simbind Architect projects and intended to be used as a standalone tool, not as an importable module. If you want to use its functionality programmatically, please refer to subprojects.
$ simbind --help
usage: simbind [-h] --slx-path SLX_PATH [--pkg-name PKG_NAME] [--wheel-out-dir WHEEL_OUT_DIR]
[--solver {ode1,ode2,ode3,ode4,ode5,ode8,ode14x,ode1be}] [--step STEP_SIZE]
[--license-text LICENSE_TEXT] [-v]
Tool to generate Python wheel package from Simulink model.
options:
-h, --help show this help message and exit
--slx-path SLX_PATH Path to Simulink .slx file.
--pkg-name PKG_NAME Name of the output Python package. (default: 'model')
--wheel-out-dir WHEEL_OUT_DIR
Path to folder where wheel package will be stored. (default: '.')
--solver {ode1,ode2,ode3,ode4,ode5,ode8,ode14x,ode1be}
Fixed-step solver. (default: 'ode5')
--step STEP_SIZE Fixed step size in seconds. (default: '0.001')
--license-text LICENSE_TEXT
License text that will be included in output Python wheel package. (default: '')
-v Specifies the level of verbosity. Example: -vvv
For detailed instructions on the structure of the output Python package, please refer to our Wiki.
Docker Usage
Disclaimer
Before utilizing Docker containers to run MathWorks products, it is crucial to verify that your licensing agreement with MathWorks explicitly permits such usage. Licensing terms can vary, and it is the responsibility of the user to ensure compliance with these terms to avoid potential violations.
The primary challenge in using MathWorks products within Docker containers lies in the licencing the application.
MathWorks offers various license types, detailed
further here.
If you have access to a network license or your organization utilizes
a License Manager through their organization,
you can uncomment the corresponding option in
the Dockerfile. This section demonstrates
how to apply your Individual License for using Simbind in a Docker container.
Since R2023b MathWorks does not generate dedicated Individual license file that could be utilized inside Docker
container. Instead, it uses online license that requires you to login on a first use of newly installed Matlab:
- Log in into docker container and provide your credentials:
$ docker run -it --ulimit nofile=65535:65535 ghcr.io/swag-engineering/simbind-cli/simbind-cli:latest matlab MATLAB is selecting SOFTWARE OPENGL rendering. Please enter your MathWorks Account email address and press Enter: your@email.com Please enter your MathWorks Account password and press Enter:
- Without terminating Docker session, in new
terminal commit changes:
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES aef878e19c3f ghcr.io/swag-engineering/simbind-cli/simbind-cli:latest "matlab" 2 minutes ago Up 2 minutes focused_satoshi $ docker commit aef878e19c3f simbind-cli:licensed
- Terminate docker session in the first terminal with:
>> exit()
Now that you have configured your license, you're all set to utilize the simbind-cli:licensed image to use Simbind:
$ docker run --rm --ulimit nofile=65535:65535 \
-v /path/to/model.slx:/tmp/model.slx \
-v /path/to/output/dir:/tmp/output \
simbind-cli:licensed \
simbind \
--slx-path /tmp/model.slx \
--wheel-out-dir /tmp/output \
--pkg-name fancypackage \
--solver ode8 \
--step 0.005
Issues
If you run into any issues or believe additional functionality is needed, please don't hesitate to open an issue or email us at contact@swag-engineering.io. We're always ready to assist!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file simbind-0.1.10.tar.gz
.
File metadata
- Download URL: simbind-0.1.10.tar.gz
- Upload date:
- Size: 55.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 966a2dad23e0cc5244beda9b0038fb977f091e17db0bd0f68e8ed0f9c82aebf7 |
|
MD5 | 8ac2a9aa5f04c58aa13ecbbdf89a3c97 |
|
BLAKE2b-256 | 445b11975fa0355a36776857973e7ab1e978d37ca524c4948c6c56e0e533af30 |
File details
Details for the file simbind-0.1.10-py3-none-manylinux2010_x86_64.whl
.
File metadata
- Download URL: simbind-0.1.10-py3-none-manylinux2010_x86_64.whl
- Upload date:
- Size: 51.3 kB
- Tags: Python 3, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 152f0c551d1abf9e43450a85d53c37df175e1bfb1ba70284d045bd46d4c514f2 |
|
MD5 | b95f6eede6dbdfaa36d6ceb78713f684 |
|
BLAKE2b-256 | cfb73abd1ce162516d989ec04e8d6c20643c730e8f9d81279ebf2e7fb3803497 |