Mass-Spring-Damper
What you'll learn
- How parameters control physical behavior (stiffness, damping, mass)
- Damped oscillations and how energy dissipates over time
- How to read a second-order ODE system in Modelica
The mass-spring-damper is the canonical introductory ODE system. A mass m is attached to a spring with stiffness k and a damper with coefficient c. The governing equations are:
In Modelica, this is expressed naturally. Simulate the model below and watch the position oscillate and decay as the damper removes energy from the system.
Understanding the results
With the default parameters, the system is underdamped — position oscillates while the amplitude decays exponentially. The damper converts kinetic energy into heat, so each swing is smaller than the last. Toggle v in the plot legend to see the velocity lagging position by roughly a quarter cycle, a hallmark of oscillatory systems.
Things to try
- Set
c = 0to remove damping entirely — the system oscillates forever. - Increase
cto3.0to see overdamped behavior (no oscillation, slow return to zero). - Find the critically damped value: = 2.0 with the defaults. This is the fastest return to zero without overshooting.
- Double the spring stiffness
k— the oscillation frequency increases.