Mass-Spring-Damper Tutorial
In this quick tour, you will build and simulate a classic mass–spring–damper (SDOF) system and visualize the response, all in a few minutes.
Prerequisites
- Simit installed or access to the web workspace
- Basic familiarity with dynamic systems terminology
Goal
Model a unit mass attached to a spring and damper with an external force input, and observe displacement over time.
Parameters (editable later):
m = 1.0 kgk = 50.0 N/mc = 0.8 N·s/m
1. Create a new model
- File → New Model → “MSD Quick Tour”
- Set simulation: step size
dt = 0.002 s, durationT = 5 s
2. Add blocks
- Sources:
Step(force input), initial value 0 → step to 1 N at 0.2 s - Dynamics:
Integrator(velocity),Integrator(position) - Elements:
Gain(−k),Gain(−c) - Sinks:
Scope(position)
Tip: Use / to open the palette and type to insert.
3. Wire the dynamics
The SDOF equations are ( m \dot v = F - kx - cv ), ( \dot x = v ).
- Sum forces: create a
Sumblock with inputs+ + − −- Connect:
F(Step) →+,k*x→−,c*v→−
- Connect:
- Compute
k*x:position→Gain(−k)→Sum - Compute
c*v:velocity→Gain(−c)→
4. Set parameters
- Set gains:
1/m = 1.0,−k = −50.0,−c = −0.8 - Initial conditions:
velocity(0) = 0,position(0) = 0
Optional via Console:
m = 1.0
k = 50.0
c = 0.8Bind gains to variables 1/m, -k, and -c if your editor supports expressions or link fields to m,k,c as appropriate.
5. Run the simulation
- Press Run ▶; the position scope should show a lightly damped step response
- Use cursors to measure peak and settling time
6. Iterate quickly
- Change
cto2.0(more damping) and re-run; compare curves - Shorten
dtto0.001 sif the response looks jagged
Troubleshooting
- If signals blow up: check the
1/m,-k,-csigns and integrator connections - If execution stops with a loop warning: ensure there is state (integrators) breaking algebraic cycles