0% found this document useful (0 votes)
8 views2 pages

Input User

The document provides examples of creating multibody systems in the Python multibody code Exudyn using mbs.Create functions. It defines mass points, springs, dampers, constraints, loads, and simulates the dynamics. Later examples include a mass-spring-damper system, a 5 mass system, and a double pendulum with 10 mass points in a row.

Uploaded by

Francis Nequinto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Input User

The document provides examples of creating multibody systems in the Python multibody code Exudyn using mbs.Create functions. It defines mass points, springs, dampers, constraints, loads, and simulates the dynamics. Later examples include a mass-spring-damper system, a 5 mass system, and a double pendulum with 10 mass points in a row.

Uploaded by

Francis Nequinto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

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: mbs.Create...(...) 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 exudyn.utilities import * #includes itemInterface, graphicsDataUtilities and
rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem() #create a MainSystem 'mbs' to work with

# create a simple mass point with initial velocity


m1 = mbs.CreateMassPoint(referencePosition=[1,-1,0], initialVelocity = [2,5,0],
physicsMass=1, drawSize = 0.2)

# add a ground object:


oGround = mbs.AddObject(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 = mbs.CreateSpringDamper(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
mbs.CreateDistanceConstraint(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 = mbs.AddMarker(MarkerBodyPosition(bodyNumber=m1))
mbs.AddLoad(Force(markerNumber=mMarker, loadVector=[0, -10, 0]))

# prepare mbs for simulation:


mbs.Assemble()

# some simulation parameters:


simulationSettings = exu.SimulationSettings() #takes currently set values or
default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 5

mbs.SolveDynamic(simulationSettings =
simulationSettings,solverType=exu.DynamicSolverType.GeneralizedAlpha)

# visualize results:
mbs.SolutionViewer()
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 mbs.Create 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 mbs.Create 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 mbs.Create 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?

You might also like