# spring_mass_damper.mbd #----------------------------------------------------------------------------- # [Data Block] begin: data; problem: initial value; end: data; #----------------------------------------------------------------------------- # [ Block] begin: initial value; initial time: 0.; final time: 5.; time step: 1.e-3; max iterations: 10; tolerance: 1.e-6; end: initial value; #----------------------------------------------------------------------------- # [Control Data Block] begin: control data; output frequency: 10; structural nodes: 2; rigid bodies: 1; joints: 3; forces: 1; gravity; end: control data; #----------------------------------------------------------------------------- # Design Variables set: real M = 1.; #[kg] Mass set: real L = 1.; #[m] Spring Natural Length set: real K = 20.; #[N/m] Spring Stiffness Coefficient set: real C = 1; #[Ns/m] Damper Damping Coefficient #----------------------------------------------------------------------------- # Node Labels set: integer Node_Ground = 1; set: integer Node_Mass = 2; # Body Labels set: integer Body_Mass = 1; # Joint Labels set: integer JoClamp_Ground = 1; set: integer JoInLin_Ground_Mass = 2; set: integer JoPrism_Ground_Mass = 3; # Force Labels set: integer Force_SpringDamper = 1; #----------------------------------------------------------------------------- # [Nodes Block] begin: nodes; #----------------------------------------------------------------------------- # Nodes structural: Node_Ground, static, null, # absolute position eye, # absolute orientation null, # absolute velocity null; # absolute angular velocity structural: Node_Mass, dynamic, 0., 0., -L, # absolute position eye, # absolute orientation null, # absolute velocity null; # absolute angular velocity end: nodes; #----------------------------------------------------------------------------- # Plugin Variables set: [node, DZ, Node_Mass, structural, string="X[3]"]; set: [node, VZ, Node_Mass, structural, string="XP[3]"]; #----------------------------------------------------------------------------- # [Elements Block] begin: elements; #----------------------------------------------------------------------------- # Bodies body: Body_Mass, Node_Mass, M, # mass null, # relative center of mass eye; # inertia matrix #----------------------------------------------------------------------------- # Joints joint: JoClamp_Ground, clamp, Node_Ground, null, # absolute position eye; # absolute orientation joint: JoInLin_Ground_Mass, in line, Node_Ground, null, # relative line position eye, # relative line orientation Node_Mass; joint: JoPrism_Ground_Mass, prismatic, Node_Ground, Node_Mass; #----------------------------------------------------------------------------- # Forces force: Force_SpringDamper, follower internal, Node_Mass, position, null, # relative arm Node_Ground, position, null, # relative arm single, 0., 0., 1., string, "-K*(DZ-(-L))-C*VZ"; # force value #----------------------------------------------------------------------------- # Gravity gravity: 0., 0., -1., const, 9.81; end: elements;