A package for working with system dynamics symbolically and numerically
Project description
DySys
A Python package for system dynamics and control systems utilities (using numpy, sympy, and control)
Installation
This package now published on PyPI and can be installed with
pip install dysys
Usage
To import the package into a script, use
import dysys as ds
Symbolic State-Space Models
Create a symbolic state-space model:
A = [[-4, -3, 0], [0, -8, 4], [0, 0, -1]]
B = [[0], [1], [0]]
C = [[0, 1, 0]]
D = [[0]]
sys = ds.sss(A, B, C, D) # Create a symbolic state-space model
Factoring a Transfer Function
import dysys as ds
import control
import matplotlib.pyplot as plt
Define a transfer function using the dysys package as follows:
H = ds.tf(
[1_000_000, 300_000_000], # Numerator coef's
[1, 1030, 40200, 10_300_000, 100_000_000] # Denominator coef's
)
Get a list of transfer functions that are the canonical factors of H{.py}:
factors = H.factor_canonical(check=True) # Check that the factors are correct
Print the factors:
for factor in factors:
print(factor)
$\frac{3}{1}$
$\frac{0.003333 s + 1}{1}$
$\frac{1 \times 10^{4}}{s^2 + 20 s + 1 \times 10^{4}}$
$\frac{1}{0.1 s + 1}$
$\frac{1}{0.001 s + 1}$
Generate a Bode plot:
control.bode_plot([H] + factors, dB=True, wrap_phase=True)
plt.gcf().legend(
list(map(lambda x: x._repr_latex_()[1:-1], [H] + factors)),
loc="outside center right",
)
plt.show()
Issues
If you have issues, please report them on the issues page.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dysys-0.1.5.tar.gz.
File metadata
- Download URL: dysys-0.1.5.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.8 Darwin/23.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4e7e6ebdf511edd6b3b6c7ab02195e2854d2d77a92b62dc35b3634a7cf48415
|
|
| MD5 |
57cbd43023794e119af0f3f76f85d192
|
|
| BLAKE2b-256 |
79f6ce1c23a0ca5e8c6d4e9f386b3a15841075cfdbb4f6f0c873708641f6836d
|
File details
Details for the file dysys-0.1.5-py3-none-any.whl.
File metadata
- Download URL: dysys-0.1.5-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.8 Darwin/23.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96d0393759d4810fa0fc2d4f7290f51c76232c0ccaff1312910628bb8b7da58b
|
|
| MD5 |
00522ba32f611f842cba5529d6defc19
|
|
| BLAKE2b-256 |
f7e02c646d9c9e6f2dcf65e49b1c0a21dda6aa9cb908b9a5d79f4682cde90579
|