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.
To try them out online, you can use .
Usage
Identification
- 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')
- 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()
- Identify a state space model with order 3 using the "PO-MOESP" algorithm.
mod = llsi.sysid(data,'Nu','Re',(3,),method='po-moesp')
- 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
Built Distribution
File details
Details for the file llsi-0.4.0.tar.gz
.
File metadata
- Download URL: llsi-0.4.0.tar.gz
- Upload date:
- Size: 6.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2573f02a4d5dad72d9d91f70271f9756d41959c4f83fec74c0c296913cda2c1d |
|
MD5 | 18d20045847d2a5c3d0246c00f11c2d1 |
|
BLAKE2b-256 | 8532b2c5eb80aa7cdf5895d001ab2a1cb87c656bf77e34840cdc364110de8fa1 |
File details
Details for the file llsi-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: llsi-0.4.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9664ddf620cc01d6b79bae2087a1cc6a4038b17510d2bf4a46ab49b68ea0a568 |
|
MD5 | 53b857b5674754f341ba43d616a19dca |
|
BLAKE2b-256 | a06931550404b6af72bf73f25cd8a1bc274640b9453ec37926771ffb31f53778 |