ConfigSpring
– Linear Spring acting on a configuration variable¶
Unlike the LinearSpring
which creates a spring force between
two points in 3D space, a ConfigSpring
implements a spring
force directly on a generalized coordinate:
where \(k\) is the spring stiffness and \(q_0\) is the neutral “length” of the spring.
¶ Calculation Implemented V Y V_dq Y V_dqdq Y V_dqdqdq Y
Examples¶
We can create a simple 1D harmonic oscillator using
ConfigSpring
on a translational configuration variable. The
same oscillator could be created using a LinearSpring
as
well.
import trep
from trep import tx,ty,tz,rx,ry,rz
# Create a sytem with one mass that moves in the x direction.
system = trep.System()
system.import_frames([tx('x', mass=1, name='block')])
trep.potentials.ConfigSpring(system, 'x', k=20, q0=0)
A ConfigSpring
can be used to create a torsional spring on a
rotational configuration variable. Here we create a pendulum with a
length of 2 and mass of 1. Instead of gravity, the pendulum is moved
by a single torsional spring.
import trep
from trep import tx,ty,tz,rx,ry,rz
system = trep.System()
system.import_frames([
ry("theta"), [
tz(2, mass=1)
]])
trep.potentials.ConfigSpring(system, 'theta', k=20, q0=0.7)
ConfigSpring Objects¶
-
class
trep.potentials.
ConfigSpring
(system, config, k[, q0=0.0, name=None])¶ Create a new spring acting on the specified configuration variable. The configuration variable must already exist in the system.
-
ConfigSpring.
config
¶ The configuration variable that spring depends and acts on.
(read only)
-
ConfigSpring.
q0
¶ The “neutral length” of the spring. When
self.config.q == q0
, the force is zero.
-
ConfigSpring.
k
¶ The spring constant of the spring.