I know a little bit of Modelica so when I recently encountered ModelingToolkit.jl, I was excited to try it out. But I ran into some unexpected problems even for a very simple model.
I created an acausal model of a simple spring-damper system with one mass. At first, I get these 15 equations:
0 ~ spring₊flange_a₊f(t) + support₊flange₊f(t) support₊flange₊s(t) ~ spring₊flange_a₊s(t) 0 ~ mass₊flange₊f(t) + spring₊flange_b₊f(t) mass₊flange₊s(t) ~ spring₊flange_b₊s(t) mass₊a(t) ~ mass₊flange₊f(t)*(mass₊m^-1) Differential(t)(mass₊flange₊s(t)) ~ mass₊v(t) Differential(t)(mass₊v(t)) ~ mass₊a(t) spring₊s_rel(t) ~ spring₊flange_b₊s(t) - spring₊flange_a₊s(t) Differential(t)(spring₊s_rel(t)) ~ spring₊v_rel(t) spring₊flange_b₊f(t) ~ spring₊f(t) spring₊flange_a₊f(t) ~ -spring₊f(t) spring₊f_c(t) ~ spring₊c*spring₊s_rel(t) spring₊f_d(t) ~ spring₊d*spring₊v_rel(t) spring₊f(t) ~ spring₊f_c(t) + spring₊f_d(t) support₊flange₊s(t) ~ 0
Using structural_simplify, this is reduced to three equations:
Differential(t)(mass₊flange₊s(t)) ~ mass₊v(t) Differential(t)(mass₊v(t)) ~ (mass₊m^-1)*(-spring₊c*spring₊s_rel(t) - (spring₊d*mass₊v(t))) Differential(t)(spring₊s_rel(t)) ~ mass₊v(t)
This confused me. Why is the first equation not eliminated? mass.flange.s is just the same as spring.s_rel. Is there anything other than structural_simplify I should use for this? I would appreciate some insight from anybody with more experience in ModelingToolkit.
Also, is there anybody out there who has experience with both ModelingToolkit.jl and TinyModia.jl? They seem to have similar functionality, and TinyModia was created by the same people as Modelica. Which one do you prefer?