Skip to main content

Tooling to generate toy MDOF dynamics data for arbitrary linear and nonlinear systems in python

Project description

Toybox

test-on-commit codecov

Tooling to generate toy MDOF dynamics data for arbitrary physical linear and nonlinear systems in python.

Feel free to raise any issues of make suggestions.

Quickstart guide

import toybox as tb

# Initialise a linear symetric sytem
system = tb.symetric(dofs=2, m=1, c=20, k=1e5)

# Define a nonlinearity
def quadratic_cubic_stiffness_2dof_single(_, t, y, ydot):
    return np.dot(y**2, np.array([5e7, 0])) + np.dot(y**3, np.array([1e9, 0]))

# Attach the nonlinearity
system.N = quadratic_cubic_stiffness_2dof_single

#Define some excitations for the system
system.excitation = [tb.forcings.white_gaussian(0, 1), None]

# Simulate
n_points = 1e3
fs = 1/500
normalised_data = system.simulate((n_points, fs),  normalise=True)

# Denormalise later if required
data = sytem.denormalise()

data is a python dict with time series as follows:

Variable Description Dictionary key
t Time points 'ts'
Xd(t) Forcing at location d 'x{d}'
Yd(t) Displacement at location d 'y{d}'
Y'd(t) Velocity at location d 'ydot{d}'

Customisation

Arbitrary systems

toybox.system Allows the specification of arbitrary M, C and K matrices.

Arbitrary forcing

Set your_system.excitation to a per degree-of-freedom iterable. Entries can include either:

  • Premade excitations (such as white_gaussian or sinusoidal)
  • Timeseries (with shape (n_points, ndofs))
  • None for unforced degrees of freedom.

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

MDOF-toybox-0.2.1.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

MDOF_toybox-0.2.1-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

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