Skip to main content

A python wrapper for running the simulink model with multiple batch

Project description

SimulinkRunner

SimulinkRunner is an automation tool designed to streamline the process of running and managing Simulink models. This provides a simple API to simulate the model multiple times for further recording and testing, helpful for control system design and analysis.

Prerequisite

To enable this library, the Matlab engine for Python should be manually installed on your PC, according to your MATLAB version.

Installation

The package can be installed via pip

pip install simulinkRunner

And it can also be installed from source code:

git clone git@github.com:PACRian/SimulinkRunner.git
cd simulinkRunner
pip install -e .

Quickstart

Firstly, import related utiltis from simulinkRunner and initialize the matlab.engine object

import matlab.engine
from simulinkRunner import Model, Runner, OutputPortProcessor, HDF5Recorder

eng = matlab.engine.start_matlab()

Two main classes should be utilized, one is Model used to initialize a Simulink model reference object:

model = Model(eng, MODEL_NAME)

Then you need to introduce a Runner instance to construct the simulation framework, for parameter management, data processing, recording, etc.

runner = Runner(model, 
        model_path=MODEL_PATH,
        model_args=MODEL_MULTI_ARGS,
        sim_args=SIM_ARGS,
        rec_path=HDF5_PATH,
        rec_cls=HDF5Recorder,
        proc_cls=OutputPortProcessor)

Call runner to perform the simulation, and close the content by calling close():

runner()
runner.close()

Check the simple demo run_batch_test.py along with a simple Simulink model test.slx(located in tests/simulink_model), execute the script to run the Simulink model multi-batch.

python .\run_batch_test.py

Command line tool

[TODO]

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

simulinkrunner-1.0.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simulinkrunner-1.0.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file simulinkrunner-1.0.1.tar.gz.

File metadata

  • Download URL: simulinkrunner-1.0.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for simulinkrunner-1.0.1.tar.gz
Algorithm Hash digest
SHA256 dd9220f5e58e34a2c02efe1b6391c07b5c940480eeebbceb3af5d3bf5b59729f
MD5 e8483f64772ce8e252dce588dd5afc74
BLAKE2b-256 413e5bf017e1a8d4490c28a4a00d967c111c957625a6e1c5a282196d780bd890

See more details on using hashes here.

File details

Details for the file simulinkrunner-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: simulinkrunner-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for simulinkrunner-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f6de4b331d3da4f185a23e9f29b4c30c6eb18be23e47371c6c4ac6a5a5288f43
MD5 9373387fe0d6b115ae4c77f86719a9b0
BLAKE2b-256 26e41bf4e97a1208e83b8135060e132ff81084bc40cb07e24e4c2ffae8e40940

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page