Skip to main content

A lightweight linear system identification tool

Project description

llsi

Lightweight Linear System Identification package.

llsi offers easy acess to system identification algorithms. Currently implemented are n4sid, PO-MOESP for state space identification, and arx for the identification of transfer function models. Additionally, a prediction error method (pem) exists for the identification of output-error (oe) models or iterative improvement of state-space models. llsi only depeds on numpy, scipy and matplotlib.

Code style: black Imports: isort

Usage

Identification

  1. Load data start with loading the heated wire dataset (found in the data/ folder at the root of this repo) using numpy
import numpy as np
d = np.load('heated_wire_data.npy')
  1. Create a SysIdData object
import llsi
data = llsi.SysIdData(t=d[:,0],Re=d[:,1],Nu=d[:,2])

the three data series are time (t), Reynolds number (Re) and Nußelt number (Nu). We are going to model the dynamics of the Nußelt number (heat transfer from wire to surrounding fluid) using Reynolds number (velocity of the surrounding fluid) as input. 3. Ensure the time steps are equidistant and the sampling rate is reasonable. Moreover, the beginning of the time series (transient start) is removed and finally the series are centerd around their respective mean value (which is a requirement for linear systems).

data.equidistant()
data.downsample(3)
data.crop(start=100)
data.center()
  1. Identify a state space model with order 3 using the "PO-MOESP" algorithm.
mod = llsi.sysid(data,'Nu','Re',(3,),method='po-moesp')
  1. Use it further with scipy by exporting it to a scipy.signal.StateSpace object
ss = mod.to_ss()

or to a continuous time transfer function

ss = mod.to_tf(continuous=True)

Plotting

Optionally, if matplotlib is installed, simple plots can be created using the llsi.Figure context manager:

with llsi.Figure() as fig:
    fig.plot(ss,'impulse')

will plot the impulse response of the model ss.

Contribution

Thank you for considering to contribute. Any exchange and help is welcome. However, I have to ask you to be patient with me responding.

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

llsi-0.3.1.tar.gz (5.9 MB view details)

Uploaded Source

Built Distribution

llsi-0.3.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file llsi-0.3.1.tar.gz.

File metadata

  • Download URL: llsi-0.3.1.tar.gz
  • Upload date:
  • Size: 5.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for llsi-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3daf9f04c22c53b8f6b8cbd7a1ae87bd928c06125eeba5ed4dcf3d625d29c9df
MD5 0580cf59219ecffff872fd572ece2509
BLAKE2b-256 fb08126b6789882052fb33fca3630bafc8fb5ad37c99fa42729c7c216cbc1f5b

See more details on using hashes here.

File details

Details for the file llsi-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: llsi-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for llsi-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ddd22890c66de27ab770b8946a744d70d098abc7a5298446c34c1aee46f9256d
MD5 8a2e34e331e9a95c6b0ff288c66ad075
BLAKE2b-256 c21826e3d018a0c4d7a871ea12837c5c33b48ae5046b1be0c0f0af98df5dcf4b

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