UpdateMassPoints:
User:
# Use the following information as an update of the internal data of the Python
multibody code Exudyn.
# See the following examples to create multibody systems in Exudyn.
# NOTE: [Link]...(...) calls several functions in the background to create
nodes, objects, markers and loads in Exudyn.
# all quantities are giving as 3D lists [x,y,z] for positions, velocities, ....
# rotations are usually given as rotation matrix (numpy array);
# RotationVector2RotationMatrix([rotX, rotY, rotZ]) computes a rotation around the
global x,y,z rotation axis
# create rigid bodies and mass points with distance constraint and joints
import exudyn as exu
from [Link] import * #includes itemInterface, graphicsDataUtilities and
rigidBodyUtilities
import numpy as np
SC = [Link]()
mbs = [Link]() #create a MainSystem 'mbs' to work with
# create a simple mass point with initial velocity
m1 = [Link](referencePosition=[1,-1,0], initialVelocity = [2,5,0],
physicsMass=1, drawSize = 0.2)
# add a ground object:
oGround = [Link](ObjectGround())
# create spring damper between bodies (using local position) or between nodes,
spring-damper may not have size 0; spring reference length is computed from
reference configuration
oSD = [Link](bodyOrNodeList=[oGround, m1], localPosition0=[6,0,0],
localPosition1=[0,0,0], stiffness=1e3, damping=1e1, drawSize=0.2)
# create a rigid distance between the local position of bodies (or ground) or
between nodes
[Link](bodyOrNodeList=[oGround, m1], localPosition0 =
[0,0,0], localPosition1 = [-0.5,0,0], distance=None, drawSize=0.06)
# add an additional load to a mass point; this always requires markers; for torques
use Torque(...) instead of Force(...)
mMarker = [Link](MarkerBodyPosition(bodyNumber=m1))
[Link](Force(markerNumber=mMarker, loadVector=[0, -10, 0]))
# prepare mbs for simulation:
[Link]()
# some simulation parameters:
simulationSettings = [Link]() #takes currently set values or
default values
[Link] = 1000
[Link] = 5
[Link](simulationSettings =
simulationSettings,solverType=[Link])
# visualize results:
[Link]()
Example4:
User:
Consider a mass-spring-damper system with the following properties: mass m=8kg,
stiffness k=5000N/m, and damping d=50Ns/m. The force acting on the mass is f=100N
and applied to the mass in the direction in which the spring expands at the
beginning of the simulation. The spring has a length of 5 cm and is relaxed in the
initial position. Gravity is neglected and the mass should be placed in the x-
direction at the relaxed position of the spring relative to the ground. Create a
simulation model using Exudyn to simulate the dynamics of the mass-spring-damper
system. Use the previously defined [Link] functions. Please write the code with
no comments and in one block.
Example4.1:
User:
Consider a 5-mass-spring-damper system with the following properties: mass m=8kg,
stiffness k=2000N/m, and damping d=25Ns/m. The force acting on the last mass is
f=100N and applied to the mass in the direction in which the spring expands at the
beginning of the simulation. The springs have a length of 5 cm and are relaxed in
the initial position. Gravity is neglected and the first mass should be placed in
the x-direction at the relaxed position of the spring relative to the ground and
the first spring is connected to the ground. Create a simulation model using Exudyn
to simulate the dynamics of the 5-mass-spring-damper system. Use the previously
defined [Link] functions. Please write the code with no comments and in one
block.
Example5:
User:
Consider a double pendulum using two mass points and distance constraints in
Exudyn, using the previous update info with [Link] functions. The mass points
shall have 1 kg and the length of the first link is 2m and the second link 1m. The
initial configuration is an L-shape, where the first link points along the x-axis
and the second link points up. Gravity acts in a negative y-direction. Draw the
nodes not as points, mass points have a size of 0.1m. Please write the code with no
comments and in one block.
Example5.1:
Can you add now 10 mass points in a row?