Drake
Drake C++ Documentation
MassDamperSpringAnalyticalSolution< T > Class Template Reference

Detailed Description

template<typename T>
class drake::multibody::benchmarks::MassDamperSpringAnalyticalSolution< T >

This class provides an analytical solution to a mass-damper-spring system.

The system consists of a particle Q of mass m that can only move left/right on flat Earth (frame N). Particle Q is connected by an ideal translational spring/damper. The other end of the spring/damper is welded to point No (the origin of frame N). Q's position from No is x*Nx where x(t) is a time- dependent variable (to-be-calculated) and Nx is a horizontal unit vector fixed in Earth (N). The spring force on Q is -k*x*Nx, where k is a spring constant. The damper force on Q is -b*ẋ*Nx where b is a damper constant and ẋ is the time-derivative of x.

Note
All units must be self-consistent (e.g., standard SI with MKS units). The solution provided herein is also applicable to a rotating system, e.g., having rigid-body inertia, rotational damper, rotational spring.
Template Parameters
TThe scalar type, which must be one of the default nonsymbolic scalars.

#include <drake/multibody/benchmarks/mass_damper_spring/mass_damper_spring_analytical_solution.h>

Public Member Functions

 MassDamperSpringAnalyticalSolution (const T &mass, const T &b, const T &k)
 This constructs the aforementioned mass-damper-spring system. More...
 
void SetInitialValue (const T &x0, const T &xDt0)
 Sets the initial values of x and ẋ for this system. More...
 
Vector3< T > CalculateOutput (const T &t) const
 For this mass-damper-spring system, and with the given initial values, this method calculates the values of x, ẋ, ẍ at time t. More...
 
get_x (const T &t) const
 Returns x (Nx measure of Q's position from No) at time t. More...
 
get_xDt (const T &t) const
 Returns ẋ (Nx measure of Q's velocity in N) at time t. More...
 
get_xDtDt (const T &t) const
 Returns ẍ (Nx measure of Q's acceleration in N) at time t. More...
 
Does not allow copy, move, or assignment
 MassDamperSpringAnalyticalSolution (const MassDamperSpringAnalyticalSolution &)=delete
 
MassDamperSpringAnalyticalSolutionoperator= (const MassDamperSpringAnalyticalSolution &)=delete
 
 MassDamperSpringAnalyticalSolution (MassDamperSpringAnalyticalSolution &&)=delete
 
MassDamperSpringAnalyticalSolutionoperator= (MassDamperSpringAnalyticalSolution &&)=delete
 

Constructor & Destructor Documentation

◆ MassDamperSpringAnalyticalSolution() [1/3]

◆ MassDamperSpringAnalyticalSolution() [2/3]

◆ MassDamperSpringAnalyticalSolution() [3/3]

MassDamperSpringAnalyticalSolution ( const T &  mass,
const T &  b,
const T &  k 
)

This constructs the aforementioned mass-damper-spring system.

Parameters
[in]massMass of system (particle Q).
[in]bLinear damping constant.
[in]kLinear spring constant.

Member Function Documentation

◆ CalculateOutput()

Vector3<T> CalculateOutput ( const T &  t) const

For this mass-damper-spring system, and with the given initial values, this method calculates the values of x, ẋ, ẍ at time t.

Parameters
[in]tThe value of time at which output is requested.
Returns
Three-element matrix consisting of x, ẋ, ẍ, respectively.

◆ get_x()

T get_x ( const T &  t) const

Returns x (Nx measure of Q's position from No) at time t.

◆ get_xDt()

T get_xDt ( const T &  t) const

Returns ẋ (Nx measure of Q's velocity in N) at time t.

◆ get_xDtDt()

T get_xDtDt ( const T &  t) const

Returns ẍ (Nx measure of Q's acceleration in N) at time t.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ SetInitialValue()

void SetInitialValue ( const T &  x0,
const T &  xDt0 
)

Sets the initial values of x and ẋ for this system.

Parameters
[in]x0Initial value of x (value of x at time t = 0).
[in]xDt0Initial value of ẋ (value of ẋ at time t = 0).

The documentation for this class was generated from the following file: