4
$\begingroup$

I'm looking for alternatives to Matlab/Simulink and Dymola for simulating a non-linear dynamic system. I know it's possible to implement the time-domain behavior without a lot of code and a good simulator template which would do fixed-step simulation, but I don't want to re-invent the wheel.

I'm basically looking for a template library that allows me to define my system, pass it to a simulator and analyze the results using other C++ libraries. The results would feed a system identifcation code that adjusts the simulated system to data gathered in experiments. Later, I'd like to use the same set of libraries to design a controller for my real system.

I don't want to use Matlab/Simulink or Dymola because I don't have access to them at home and I don't want to buy them. Matlab, Simulink, system identification toolbox and all other toolboxes I might need for this project are way too expensive for me as a single person.

A google search revealed some candidates, but they don't seem to be very active. The most recent update I found was in 2011. Does anyone here actually use such a library and can recommend one?

$\endgroup$
2
  • $\begingroup$ Do you really need a templated library? Numerical libraries tend to sacrifice generality for speed by operating on double precision floating-point numbers. $\endgroup$ Apr 1, 2013 at 18:15
  • $\begingroup$ I was thinking about templates not for the underlying datatype, but on a higher level. I don't think speed will really be an issue. $\endgroup$
    – Christoph
    Apr 1, 2013 at 20:15

2 Answers 2

3
$\begingroup$

If you're looking for something with a feature set roughly equivalent to that of MATLAB, but templated C++, Boost.odeint is probably the closest you'll get, replacing the NDF/BDF methods in ode15s with 4th-order Rosenbrock methods and no DAE solution capability.

Trilinos is the big templated C++ numerical library out there, written by Sandia National Laboratories. With it, you can probably do almost anything you can think of, including automatic differentiation of your dynamical system to generate Jacobian matrix information, if you so choose. In the design space of C++ templated libraries you could use for nonlinear dynamical systems, it is probably the other extreme in terms of features and learning curve.

There aren't many established, templated C++ libraries for dynamical systems out there. Most are written in C or Fortran (e.g., SUNDIALS, Ernst Hairer's collection of codes).

$\endgroup$
1
  • $\begingroup$ Thanks for your remarks on the scope of both libraries, I'll see what fits best. $\endgroup$
    – Christoph
    Apr 2, 2013 at 20:49
2
$\begingroup$

The latest boost library has numerical ode solvers -

http://www.boost.org/doc/libs/1_53_0/libs/numeric/odeint/doc/html/index.html

$\endgroup$
4
  • 2
    $\begingroup$ Since the implicit solvers are based on Boost.uBLAS, those solvers will be slow. I guess if performance isn't an issue, then this library will be useful, but if performance isn't an issue, an interpreted language with appropriate libraries would probably speed development more than C++, all other things (language mastery, for one) being equal. $\endgroup$ Apr 1, 2013 at 18:46
  • 1
    $\begingroup$ As I noted in a comment above, I don't think speed will be an issue. To be honest, I feel more comfortable with lower level languages, assembler for 8-bit AVRs being the one I "mastered" before all others. Then come C, C++ (more or less) and languages like Matlab, Perl (all noise, but I've used them successfully). So I think C++ will pay off, even more so since I know my way around boost. $\endgroup$
    – Christoph
    Apr 1, 2013 at 20:20
  • $\begingroup$ @GeoffOxberry This library allows you to use [simunova.com/node/33](MTL) which should have decent performance. Please check the examples provided with this library - boost.org/doc/libs/1_53_0/libs/numeric/odeint/doc/html/… $\endgroup$
    – Rajeev
    Apr 2, 2013 at 11:02
  • $\begingroup$ @Rajeev: I saw that. I also saw that they're trying to enable interoperability with CUDA (via Thrust). Their only benchmark on their website right now is a 3 equation Lorenz attractor. The ODE integrator community has developed suites of test problems (each suited to different numerical methods) that they could use for performance testing, but they haven't done so. And while they do mention the possibility of using other linear algebra libraries, they point out in the docs that certain interfaces require uBLAS data structures. $\endgroup$ Apr 2, 2013 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.