top | item 42432613

(no title)

vsskanth | 1 year ago

This is a pretty niche acausal language, and is used extensively in Motorsports (F1, NASCAR) for real-time simulation on the driver simulator.

The language spec is open source but there many commercial compilers, Dymola is the most popular.

I code in this language extensively and its acausal nature is extremely powerful. It makes your models highly composable, you can basically assemble a mechanical system like a bunch of lego blocks and the equations fall out automatically. You can also easily invert your models.

The closest analogy in the programming world is Haskell.

discuss

order

lutorm|1 year ago

This approach seemed super interesting and we attempted to use it for modeling a fairly complicated fluid system (pipes, valves, tanks, etc). However, in the end the equations that fell out made the solver choke. We abandoned the effort since it seemed like an undebuggable black box. It's unclear to me whether we just didn't do it right or if the open source alternatives just aren't capable.

alhirzel|1 year ago

Agreed on all fronts - and I bet you're doing interesting work!

I feel like acausal modeling environments are also much like symbolic computer algebra systems (because they are basically applied CAS...)

jpfr|1 year ago

Modelica underneath uses DAE (differential algebraic equations) [1,2].

Think of it like a solver for many coupled differential equations. The coupling happens through "linear" equality constraints. Such as "the output pressure variable of component A needs to be equal the input pressure variable of component B".

Something that Modelica doesn't do very well is stochastic systems. There you would need to go into SDE and that brings a lot of technicalities.

[1] Petzold, Linda R. Description of DASSL: a differential/algebraic system solver. No. SAND-82-8637; Sandia National Labs, 1982.

[2] Kunkel, Peter. Differential-algebraic equations: analysis and numerical solution. European Mathematical Society, 2006.