Skip to main content

a class to integrate ordinary differential equation

Project description

simulatetraj

Documentation Status

Using simulatetraj, initial value problems can be solved numerically. In the backend, an adaptive numerical integration is performed using CVODES from the SUNDIALS suite.

Given initial state $x(t_0)=x_0$ and control inputs $u(t)$ on $t \in [t_0,t_f]$, the state trajectory $x(t)$ is computed for the explicit differential equation $\dot{x}=f(x,u,t,p)$.

Symbol Description Dimensions
$x(t)$ State vector $\mathbb{R}^{n_x}$
$u(t)$ Control vector $\mathbb{R}^{n_u}$
$p$ Parameter vector $\mathbb{R}^{n_p}$
$t$ time $\mathbb{R}^{1}$

Backend Implementation

The simulatetraj function utilizes a CasADi integrator backend, supporting various numerical methods such as explicit RK4, IRK, and solvers from the CVODES suite. The framework supports symbolic objects, allowing for the construction of symbolic state trajectories that can be embedded into expression graphs for nonlinear optimization within CasADi.

Numerical Transformation and Efficiency

Internally, the differential equation is transformed from the time interval $[t_0, t_f]$ to a normalized domain $[0, 1]$.

$$\dot{x}=f(t,x,u)$$

$$\dot{x}=(t_f-t_0) f(t_0+(t_f-t_0)\tau,x,u)$$

This approach offers significant advantages:

Numerical Conditioning – It improves stability and facilitates parametric studies.

Resource Optimization – Most importantly, it allows the integrator object to be reused within the context of multiple shooting. This eliminates the overhead of repeated object creation, saving valuable computational time.

Dependencies

  • casadi
  • scipy
  • numpy
  • matplotlib

Installation

User

Create a virtual environment and install the package using pip.

python -m venv sim_env
pip install simulatetraj

Run the scripts from examples folder to verify the installation.

Developer

Install poetry and clone the repository.

git clone https://github.com/sandeep026/simulatetraj.git

Install the packages using poetry

poetry install --with docs, dev

Poetry will either use an existing environment or will create a new one.

Examples

Check the docs for examples and usage.

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

simulatetraj-0.0.5.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simulatetraj-0.0.5-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file simulatetraj-0.0.5.tar.gz.

File metadata

  • Download URL: simulatetraj-0.0.5.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Windows/10

File hashes

Hashes for simulatetraj-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ae3f6e555144aa12420ad11e29415fc6e67d61d97047f800a9cfbba6837134bb
MD5 ab76f4e00fb65caf6519e9a8eebe9e92
BLAKE2b-256 5457686e26c1a3929b798b7a39777ad2cb20ffa45a793676ca5751b708dbbc08

See more details on using hashes here.

File details

Details for the file simulatetraj-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: simulatetraj-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Windows/10

File hashes

Hashes for simulatetraj-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9cec5344b24f28f61c4c360067f023f6077c9257a52b455de495011b0069fe0c
MD5 2915d3311c526add16509fe1f99b7d24
BLAKE2b-256 da58a5a21f1288614297ab858219f14ac6139a26397ce2e745a0ac7ceeedfffc

See more details on using hashes here.

Supported by

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