Fun with dice

June 10th, 2016 by Mahdieh Mehrabi

Written by: Garron Fish – Chief Engineer

This is a simple demonstration of the ability of incorporating an element of surface contact to a model; it demonstrates a model of a dice being thrown onto a table with some quick notes on how it was created using the IdealizedContact library.

The IdealizedContact library is a free contact library that supports the contact of a number of shapes, such as ellipsoids, cylinders, rectangles and egg shaped surfaces, with each other. It is available to download from the Modelica website:  https://www.modelica.org/libraries

For the dice example three rectangular surfaces are used to represent the top and bottom of the dice and the surface the dice is rolled onto.

Figure 1-Dice bouncing along table

Figure 1:  Dice bouncing along table.

The Modelica model consists of the IdealizedContact library cuboid coming into contact with a rectangular surface.

Figure 2 -- Diagram layer of dice throwing model

Figure 2: Diagram layer of dice throwing model

For this simulation only the vertices of the dice come into contact with the flat tableSurface, hence of this only the top and bottom surface of the dice need to be included.
The dice was chosen to have a width of 2cm and a density of 1000kg/m3. The surface contact was set to be very stiff with a stiffness and damping of c=1e6 and d=1e6.

The Modelica.Mechanics.MultiBody.Visualizers.FixedShape model was used to visualize the dice.  The stl for the dice was created by jsirgado and can be obtained from here: http://www.thingiverse.com/thing:303286 (Creative Commons ShareAlike licence). URI referencing as described in Section 13.2.3 of the Modelica Specification is used for assigning shapeType (i.e. shapeType=”modelica://IdealizedContactDiceExample/Resources/Shapes/Dice2.stl”). The stl animation was scaled by setting extra=1 and length, width and height to 0.0011. This scaling was required due to the scaling of the animation in the stl file.

Figure 3 - diceShape parameter settings

Figure 3: diceShape parameter settings

The model requires some initial conditions to be chosen; the initial velocity of the dice is set to 1m/s in the x direction and the rotation is set to 20rad/s about the z axis. With these settings the following animation was created (running at a 10th of real-time): Dice animation

The Modelica model is available to be downloaded here, Fun with dice example, and can be examined by readers with a Dymola license who have downloaded the idealizedContact library.

 

Written by: Garron Fish – Cheif Engineer

Archives

2017

2016

2015

2013

2012

2011

2010