Mass-Spring-Damper System
This example demonstrates how to model a classical Mass-Spring-Damper system in Simit. This system is a fundamental building block in mechanical engineering and control theory.
Mathematical Model
The system is governed by Newton’s Second Law:
Rearranging for the acceleration :
Where:
- : Mass (kg)
- : Damping coefficient (N·s/m)
- : Spring stiffness (N/m)
- : Position (m)
- : External force input (N)
Simit Implementation
To implement this in the Simit Canvas:
- Integrators: Use two
Integratorblocks to convert acceleration to velocity and position . - Sum: Use a
Sumblock to compute the net force. - Gain: Use
Gainblocks for , , and .
Simulation Results
For a critically damped system (), the response should settle without oscillation. For an underdamped system (), you will observe decaying oscillations.
Parameter Sweep
You can run a parameter sweep in the console to see the effect of varying damping :
// Console script
const results = [];
for (let c = 0.1; c <= 2.0; c += 0.5) {
sys.parameters.c = c;
const res = sys.run(10.0); // Run for 10 seconds
results.push(res);
}
plot(results);