basicTutorial2024.py
You can view and download this file on Github: basicTutorial2024.py
1#++++++++++++++++++++++++++++++++
2#author: Johannes Gerstmayr
3#data: 2024-02-15
4#++++++++++++++++++++++++++++++++
5
6import exudyn as exu
7from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
8import exudyn.graphics as graphics #only import if it does not conflict
9
10SC = exu.SystemContainer()
11mbs = SC.AddSystem()
12
13#++++++++++++++++++++++++++++++++++
14
15oGround = mbs.CreateGround() #[0,0,0]
16
17oMass = mbs.CreateMassPoint(name='HeavyMass',
18 referencePosition=[2,0,0],
19 physicsMass=12,
20 gravity=[0,-9.81,0],
21 drawSize=0.2,
22 color=graphics.color.red)
23
24oSD = mbs.CreateSpringDamper(bodyNumbers=[oGround, oMass],
25 stiffness=500,
26 damping=10,
27 drawSize=0.1)
28
29mbs.Assemble()
30
31SC.visualizationSettings.nodes.drawNodesAsPoint = False
32SC.visualizationSettings.general.drawWorldBasis = True
33
34tEnd = 10
35stepSize = 0.02 #smaller gives more accurate results
36
37simulationSettings = exu.SimulationSettings()
38simulationSettings.timeIntegration.verboseMode = 1
39simulationSettings.timeIntegration.endTime = tEnd
40simulationSettings.timeIntegration.numberOfSteps = int(tEnd/stepSize)
41
42mbs.SolveDynamic(simulationSettings=simulationSettings)
43
44mbs.SolutionViewer()