<h1 align="center">
<img src="https://github.com/lharri73/PySimlink/blob/master/refs/banner.svg?raw=true">
</h1>
![PyPI](https://img.shields.io/pypi/v/pysimlink)
**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
```python
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
```python
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
```python
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](https://lharri73.github.io/PySimlink/) to get started!
Raw data
{
"_id": null,
"home_page": "https://github.com/lharri73/PySimlink",
"name": "pysimlink",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "Simulink",
"author": "Landon Harris",
"author_email": "lharri73@vols.utk.edu",
"download_url": "https://files.pythonhosted.org/packages/b5/fa/81ce352fa65e0f97baf6d33f9bf7a0cda560b74e7b462b9c6963370e0239/pysimlink-1.2.1.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">\n<img src=\"https://github.com/lharri73/PySimlink/blob/master/refs/banner.svg?raw=true\">\n</h1>\n\n![PyPI](https://img.shields.io/pypi/v/pysimlink)\n\n**PySimlink** is a python package that automatically compiles Simulink codegen files \ninto a simple interface that you can interact with in Python!\n\nWith this package, you can:\n- Interact with the internals of your Simulink model\n- Run the model in \"accelerator mode\"\n- Send and receive data in the form of numpy arrays\n- Run multiple instances of the same model\n\nAll without requiring a MATLAB runtime on the target machine! No C/C++ programming required!\n\nTo get started, you either need a copy of the generated model you want to simulate or, to generate\nthe code yourself, you need the Simulink Coder. There are some limitations, namely that your model *must* use a fixed step solver \n(a requirement of the grt target). \n\n## Demo\n\n### Read Signal Values\n\n```python\nfrom pysimlink import Model\n\nmodel = Model(\"my_awesome_model\", \"model.zip\")\nmodel.reset()\n\nfor i in range(len(model)):\n model.step()\n signal_val = model.get_signal(block_path=\"Constant1\", sig_name=\"Signal1\")\n print(signal_val)\n\n```\n\n### Change Block Parameters\n\n```python\nfrom pysimlink import Model\nimport numpy as np\n\nmodel = Model(\"my_awesome_model\", \"model.zip\")\nmodel.reset()\n\nnew_param = np.eye(3)\nmodel.set_block_param(block=\"Constant1\", param=\"Value\", value=new_param)\n```\n\n### Change a Model's Final Time Step\n\n```python\nfrom pysimlink import Model\n\nmodel = Model(\"my_awesome_model\", \"model.zip\")\nmodel.reset()\nmodel.set_tFinal(500)\n\nprint(model.tFinal)\n```\n\nAnd more...\n\nCheck out the [docs](https://lharri73.github.io/PySimlink/) to get started! \n\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "Compile, run, and interact with Simulink models natively in Python!",
"version": "1.2.1",
"project_urls": {
"Documentation": "https://lharri73.github.io/PySimlink/",
"Homepage": "https://github.com/lharri73/PySimlink",
"Source": "https://github.com/lharri73/PySimlink"
},
"split_keywords": [
"simulink"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "736a2e64e0cc4d489842e2dbe264133c2953b5c01bc0ecda54bc39a1456b7fc4",
"md5": "9fee9fafb98c3271b78c86435dc67caa",
"sha256": "67c8ef049d566705349fc51d9c5e49b021df5079c6a3916e1a6c8b79d4684d03"
},
"downloads": -1,
"filename": "pysimlink-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9fee9fafb98c3271b78c86435dc67caa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 51100,
"upload_time": "2024-01-26T20:09:36",
"upload_time_iso_8601": "2024-01-26T20:09:36.539470Z",
"url": "https://files.pythonhosted.org/packages/73/6a/2e64e0cc4d489842e2dbe264133c2953b5c01bc0ecda54bc39a1456b7fc4/pysimlink-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b5fa81ce352fa65e0f97baf6d33f9bf7a0cda560b74e7b462b9c6963370e0239",
"md5": "65fad10a9fd4bf0148a6609e2e0852d3",
"sha256": "8471aa1a0758a83e755095453497ee8c429c513c92ff587947218275a7be71de"
},
"downloads": -1,
"filename": "pysimlink-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "65fad10a9fd4bf0148a6609e2e0852d3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 50708,
"upload_time": "2024-01-26T20:09:38",
"upload_time_iso_8601": "2024-01-26T20:09:38.633947Z",
"url": "https://files.pythonhosted.org/packages/b5/fa/81ce352fa65e0f97baf6d33f9bf7a0cda560b74e7b462b9c6963370e0239/pysimlink-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-26 20:09:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lharri73",
"github_project": "PySimlink",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pysimlink"
}