← Back to team overview

yade-users team mailing list archive

Re: [Question #690051]: eccentric motor vibration

 

Question #690051 on Yade changed:
https://answers.launchpad.net/yade/+question/690051

Jan Stránský posted a new comment:
Hello,

you can do any motion composing translation and rotation.
In the MWE below, the point is to adjust translation(translationAxis and velocity) and rotation (zeroPoint, rotationAxis and angularVelocity) every iteration:
###
ids = O.bodies.append((
   sphere((0, 0, 0),1),
   sphere((0,-1, 0),1),
   sphere((0,+1, 0),1),
   sphere((0, 0,-1),1),
   sphere((0, 0,+1),1),
))
trans = TranslationEngine(ids=ids) # translation part
rot = RotationEngine(ids=ids,rotateAroundZero=True) # rotation part
O.engines = [
   ForceResetter(),
   trans + rot, # composed motion
   NewtonIntegrator(),
   PyRunner(iterPeriod=1,initRun=True,command="adjustKinematicEngines()"), # adjust the motion every iteration
]
O.dt = 1e-4
def adjustKinematicEngines():
   t = O.time
   trans.translationAxis = (0,0,1)
   trans.velocity = cos(2*t)
   #
   rot.rotationAxis = (1,0,0)
   z = .5*sin(2*t) # here integral of trans.velocity function
   rot.zeroPoint = (0,0,z)
   rot.angularVelocity = sin(1.6*t)+1
###

or you can use some existing (or implement a new one and then use it)
kinematic engine dedicated for that motion.

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.