Skip to main content

A framework for hierarchical modelling and simulation of dynamic systems

Project description

PyPi Version PyPI - Python Version GitHub Build Status ReadTheDocs Build Status Code Coverage Code Quality Store Code Grade

MoDyPy (rhymes with “modify”) is a Python framework for Modelling dynamic systems in Python. The framework provides methods for describing continuous-time linear and non-linear systems in state-space representation. It was originally inspired by simupy developed by Ben Margolis, but has a completely different philosophy and architecture than simupy.

The basic components of a dynamic system in MoDyPy are states and signals. States represent the internal state of the system, and signals represent the values calculated based on the state. Ports can be connected to signals, so that reusable blocks with input and output ports can be easily built. For more details refer to the documentation.

Main Features

  • Simple architecture based on states, signals and connectible ports

  • Enables hierarchical modelling

  • Allows the establishment of reusable building blocks

  • Simulator for linear and non-linear continuous- and discrete-time systems

  • Clock system to model periodic events and discrete-time components

  • Steady state determination and linearization

  • Library of standard blocks, including 6-degree-of-freedom rigid body motion

  • Tested for 100% statement and branch coverage

Installation

MoDyPy is available via the pip installer:

$ pip install modypy

To install the development version,

$ git clone https://github.com/modypy/modypy.git
$ pip install -e modypy

Examples

Simulation of a DC-motor with propeller

Simulation of a DC-motor with propeller

Check out the examples in the examples directory and the User’s Guide. These include:

dcmotor.py

A simple example using a DC-motor driving a propeller and sampling the thrust using a zero-order hold.

rigidbody.py

Some rigid-body simulation using moments and forces showing an object moving in a circle with constant velocity and turn-rate.

bouncing_ball.py

An example modelling a bouncing ball, demonstrating the use of events and event-handler functions.

quadcopter_trim.py

A larger example showcasing the steady-state-determination and linearisation of complex systems, in this case for a quadrocopter frame with four DC-motors with propellers.

They can be run from the sources using, e.g.,

$ pip install matplotlib
$ python examples/bouncing_ball.py

Note that some of the examples require matplotlib to run and display the results.

Contributing

Contributions are welcome! Check out the GitHub Project Page for issues and ideas on how to add to the project.

Contributions must adhere to the following conditions:

  • New features must be accompanied by appropriate pytest tests (ensure 100% statement and branch coverage!)

  • New features should at least carry Python Docstrings for API documentation following the general style of the existing API documentation.

  • Use black with a line-length of 80 to format your code. We are successively moving the project to the black style.

  • Contributors must accept publishing their contribution under the licensing conditions laid out in the LICENSE file.

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

modypy-3.0.0.tar.gz (775.3 kB view details)

Uploaded Source

Built Distribution

modypy-3.0.0-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

Details for the file modypy-3.0.0.tar.gz.

File metadata

  • Download URL: modypy-3.0.0.tar.gz
  • Upload date:
  • Size: 775.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for modypy-3.0.0.tar.gz
Algorithm Hash digest
SHA256 7445cbce019090fab802882f50e6774894dab279033d1bec172b15f05434929a
MD5 97c51d9d900e258ff0c942b8de65bfdd
BLAKE2b-256 05b4e321e88c815e013d0ea0e50e2b37fd530517e932036714965af126617220

See more details on using hashes here.

File details

Details for the file modypy-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: modypy-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for modypy-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c2af0996abc7d8fdb877cf8d2903272af46482c79436bc3e0d1c7608bc09db8
MD5 4356bd6cb538c3fdbe736d6a9547e5a8
BLAKE2b-256 ccf43d107c73b14692353da1e1d193ca7774999b1dbe952b6d0767745f8bb80b

See more details on using hashes here.

Supported by

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