Compile, run, and interact with Simulink models natively in Python!
Project description
PySimlink is a python package that automatically compiles Simulink codegen files into a simple interface that you can interact with in Python!
With this package, you can:
- Interact with the internals of your Simulink model
- Run the model in "accelerator mode"
- Send and receive data in the form of numpy arrays
- Run multiple instances of the same model
All without requiring a MATLAB runtime on the target machine! No C/C++ programming required!
To get started, you either need a copy of the generated model you want to simulate or, to generate the code yourself, you need the Simulink Coder. There are some limitations, namely that your model must use a fixed step solver (a requirement of the grt target).
Demo
Read Signal Values
from pysimlink import Model
model = Model("my_awesome_model", "model.zip")
model.reset()
for i in range(len(model)):
model.step()
signal_val = model.get_signal(block_path="Constant1", sig_name="Signal1")
print(signal_val)
Change Block Parameters
from pysimlink import Model
import numpy as np
model = Model("my_awesome_model", "model.zip")
model.reset()
new_param = np.eye(3)
model.set_block_param(block="Constant1", param="Value", value=new_param)
Change a Model's Final Time Step
from pysimlink import Model
model = Model("my_awesome_model", "model.zip")
model.reset()
model.set_tFinal(500)
print(model.tFinal)
And more...
Check out the docs to get started!
Project details
Release history Release notifications | RSS feed
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 pysimlink-1.2.1.tar.gz
.
File metadata
- Download URL: pysimlink-1.2.1.tar.gz
- Upload date:
- Size: 50.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8471aa1a0758a83e755095453497ee8c429c513c92ff587947218275a7be71de |
|
MD5 | 65fad10a9fd4bf0148a6609e2e0852d3 |
|
BLAKE2b-256 | b5fa81ce352fa65e0f97baf6d33f9bf7a0cda560b74e7b462b9c6963370e0239 |
File details
Details for the file pysimlink-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: pysimlink-1.2.1-py3-none-any.whl
- Upload date:
- Size: 51.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67c8ef049d566705349fc51d9c5e49b021df5079c6a3916e1a6c8b79d4684d03 |
|
MD5 | 9fee9fafb98c3271b78c86435dc67caa |
|
BLAKE2b-256 | 736a2e64e0cc4d489842e2dbe264133c2953b5c01bc0ecda54bc39a1456b7fc4 |