How to compose discrete-time static and dynamic models for systems simulation similar to Simulink?

JanKap
Wed, 19 Jan 2022 09:58:37 +0000
Modelling & Simulations

Hi all,

I’m searching for a Simulink replacement. The main purpose is to have a simplified system simulation for quick prototyping. The domain is mechanical/electrical

Usually, I have 4 kinds of models/subsystems

1. Sensor models that measure some ideal physical values and perturb them according to the model to generate realistic measurements

2. Environmental models to create ideal input data for 1., such as trajectory generators, temperature settings, orientation, simulation time etc.

3. Compensation models that try to invert 1., i.e. are algorithms that try to figure out the ideal input data from noisy measurement data

4. Logging & plotting modules

Details:

1. Are discrete models based on difference equations, LSTM models, simple lookup tables, digital filters (state space or transfer function formulation), usually a non-deterministic portion is included to simulate noise and drift (integrated noise)

2. Basically handles external parameter sets, loads data or generates data based on mechanically inspired equations. It’s discretized currently, but in theory it’s in continuous time

3. Is the rapid prototyping part. I want to exchange these algorithms quickly, ideally tune and optimize its parameters according to some output error metric. Examples are State Space Observer, (Extended) Kalman Filters, discrete filters, switching elements based on the value of input data, complementary filters, LSTM, … That part might get implemented in a µC when the optimal approach has been found

4. Not much to say, save results, errors, plots, push it to a database, things like that

Is there anything in the awesome Julia ecosystem that could handle that? So far there’s no need to mix continuous and discrete modeling, I guess, discrete systems are sufficient for now. Of course 2. mimics the environment and therefore is continuous, but since this might make things much more complicated, I would be happy with staying in the discrete time domain.

Any input is very welcome
Thank you very much!
Jan

edit: I forgot that of course I’ve had a look at ModelingToolkit.jl and Modia.jl. MTK seems not to have discrete states implemented yet, see Discrete-Time (Sub-)Systems · Issue #894 · SciML/ModelingToolkit.jl (github.com) and Allowing discrete Difference equations in ODESystem · Issue #1122 · SciML/ModelingToolkit.jl (github.com).
Modia seems also not to support discrete time modeling?

DifferentialEquations.jl seem to support discrete ODEs. Is this the way to go? Discrete Solvers · DifferentialEquations.jl (sciml.ai)

Probably I’m getting something very wrong and discrete time modeling is a subset of all the great tools already implemented

Thanks!

8 posts - 3 participants

Read full topic