Skip to content

janneshb/SimpleSim.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleSim.jl

JuliaTest Codecov

SimpleSim.jl is a light-weight simulation package for dynamical systems simulation, controller synthesis and testing and robotics.

Run import Pkg; Pkg.add("SimpleSim") from within your Julia environment to install SimpleSim.jl.

Short Overview

The main point of interaction with SimpleSim.jl is the simulate function. As a first argument, it expects to be passed some object that provides named fields that supply hooks for various functionalities.

A simple example of a dynamical system model accepted by SimpleSim.jl would be

my_model = (
    fc = dynamics_function,
    gc = measurement_function,
)

where we pass two functions dynamics_function and measurement_function that we have defined elsewhere.

These two functions model the dynamics of the model using the following approach for continuous-time dynamical systems

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

or in Julia

dynamics_function = (x, u, p, t) -> ...
measurement_function = (x, u, p, t) -> ...

If my_model has no field named p, SimpleSim.jl will pass nothing to fc and gc.

Similarly, SimpleSim.jl supports discrete-time systems

$$x_{k+1} = f(x_k, u_k, p, t)\\\ y_k = g(x_k, u_k, p, t)$$

which are modeled as

my_dt_model = (
    fd = dt_dynamics_function,
    gd = dt_measurement_function,
    Δt = 1 // 10,
)

Running a simulation is as easy as calling simulate with your model and a total simulation time T.

data = simulate(my_model, T = 10 // 1)

Examples

Multiple demos in the examples/ provide a rough but incomplete overview of what SimpleSim.jl can do.

Some examples are described in detail in the official documentation. In the future more complex examples and tutorials will be added there.

Credit

A similar simulation architecture was proposed by @tuckermcclure in overdot-sandbox.