SpringDamper

SpringDamper

Class SpringDamper()

SpringDamper(parent='MODEL', name='SpringDamper_n', label='SpringDamper_n', 
active=True, type='CoilSpring', b1=None, b2=None, p1=None, p2=None, f=0, len=0, t=0, 
ang=0, origin=None, align_meth1='Point', align_pt1=None, align_vec1=None)

Create a spring damper of type coil spring or torsion spring.

Keyword Arguments

Argument Data Type Description Default
name String The variable name. SpringDamper_n, for next available integer n.
label String The descriptive label. SpringDamper_n, for next available integer n.
parent Object The parent. MODEL
active Boolean Used to activate or deactivate this entity. True
type Enum They type. One of CoilSpring or TorsionSpring. CoilSpring
b1 Body The first body to which the spring is attached. None
b2 Body The second body to which the spring is attached. None
p1 Point The point at which the coil spring is attached to b1. None
p2 Point The point at which the coil spring is attached to b2. None
f Double The load on the coil spring at a particular length. 0
len Double The length of the coil spring when it has a particular load. 0
t Double The load on the torsion spring when it has a particular angle. 0
ang Double The angle of the torsion when the spring has a particular load. 0
origin Point The location for torsion spring. None
align_meth1 MultiRef Alignment method for torsion spring. One of Point or Vector. Point
align_pt1 Point Reference point for alignment when align_meth1 is Point. None
align_vec1 Vector Reference vector for alignment when align_meth1 is Vector. None

Instances

Instance Type Description  
k Nonlinear The stiffness coefficient of the spring.  
c Nonlinear The damping coefficient of the spring.  
kt Nonlinear The stiffness coefficient of the torsion spring.  
ct Nonlinear The damping coefficient of the torsion spring.  
i Marker The marker on b1.  
j Marker The marker on b2.  

Readonly Properties

Argument Data Type Description
dist_x Double Distance between p1 and p2 in x.
dist_y Double Distance between p1 and p2 in y.
dist_z Double Distance between p1 and p2 in z.
dist_mag Double Magnitude of distance between p1 and p2 in x.

Notes

1. The parent parameter can only be initialized by the constructor and should not be modified directly.

2. Only parent can be used as a positional argument in the constructor.

3. Instance is a reference to an entity. You cannot modify an instance, but can modify its properties.

4. Readonly Properties cannot be modified.

Methods

getAssociatedGraphics()

Get all the graphics that are associated with this object.

Returns:

List of all graphic associated with this body.

Return type:

(list)

Spring Damper Pair

Class SpringDamperPair

SpringDamperPair(parent='MODEL', name='SpringDamperPair_n', 
label='SpringDamperPair_n', active=True, sym='NONE')

SpringDamper pair containing left and right instances of singles.

Keyword Arguments

Argument Data Type Description Default
name String The variable name. SpringDamperPair_n, for next available integer n.
label String The descriptive label. SpringDamperPair_n, for next available integer n.
parent Object The parent. MODEL
active Bool Defines if entity is activated when True or deactivated when False. True
sym Enum The symmetry of pair entity. Takes values 'LEFT' for left entity as leader, 'RIGHT' for right entity as leader or 'NONE' when it is not symmetric. ‘NONE'

Instances

Instance Type Description
l Point The left SpringDamper.
r Point The right SpringDamper.

Notes

Instance is a reference to an entity. You cannot modify an instance, but can modify its properties.

Examples

========
Create a spring damper and modify its attribute values.
>>> # Import mview module
>>> from hw import mview
>>> # Create body and point for SpringDamper
>>> b1 = mview.Body(name = 'b1', label = 'top body',usecm = True)
>>> p1 = mview.Point(name = 'startpoint', x = 60)
>>> b1.cg = p1
>>> # Create a coil spring SpringDamper for the graphic
>>> spdp = mview.SpringDamper(name = 'spdp')
>>> # Set multiple values at once
>>> spdp.setValues(b1 = b1, b2 = 'B_Ground',p1 = p1, p2 = 'P_Global_Origin')
>>> # Get value of attribute
>>> spdp.k.lin
0.0
>>> # Set stiffness as an expression
>>> spdp.k.type = 'EXPR'
>>> spdp.k.expr = "`STEP5(TIME,0,0,5,25)`"
>>> # Set damping coefficient as a curve
>>> spdp.c.type = 'CRV'
>>> c1 = mview.Curve(x_type = 'VALUE',y_type = 'VALUE',x_value = [0,1,2],y_value = [10,20,5])
>>> spdp.c.crv = c1
>>> # Set interpolation type and independant variable
>>> spdp.c.int_type = 'CUBIC'
>>> spdp.c.indep_var = '`TIME`'
>>> # Change the type to torsion spring
>>> spdp.type = 'TorsionSpring'
>>> spdp.setValues(origin = p1,align_meth1 = 'VECTOR',align_vec1 = 'V_Global_Z'
>>> spdp.kty.lin = 25
>>> # Follow similar procedure for SpringDamperPair
>>> spdp = mview.SpringDamperPair(name = 'spdp2',sym = 'RIGHT')
>>> # Set multiple values at once
>>> spdp.setValues(b1 = b1, b2 = 'B_Ground',p1 = p1, p2 = 'P_Global_Origin')
>>> spdp.r.k.lin = 25
>>> # Get value of attribute
>>> spdp.l.k.lin
25.0