Marine systems simulation
Ball in Box

Balls that elastically bounce inside a box.

+ Collaboration diagram for Ball in Box:

Simulation model of balls bouncing in a specified box in three degrees of freedom.

The balls are modeled as spheres with linear springs between contact surfaces and other balls. The model is intended for use with the companion class CBox.

Author
Joakim Haugen
Date
12.06.2014: Initial version

Example configuration excerpt

<Lib
LibName = "fhsim_base"
SimObject = "Ballbox/Ball"
Name = "B"
Stiffnesses = "1e7"
Radii = "1"
Masses = "1"
Gravity = "9.81"
BoxDimensions = "5,5,5"
/>
...
<Connection
B.BoxPos = "0,0,0"
B.BoxRot = "0,0,0"
/>
...
<InitialCondition
B.Pos="0,0,-2.5"
B.Vel="10,10,30"
/>

Input Ports

Name Width Description
BoxPos 3 The position of the centroid of the box.
BoxRot 3 The orientation of the box. Euler angles.

Output Ports

Name Width Description
Pos 3 The spring force from end A.
Vel 3 The spring force from end B.
ForceOut 3 The forces from the balls on the box.

Configuration parameters

Name Width Description
Count 1 Number of balls.
Gravity 1 Gravity along z-axis [kg per meter squared].
Stiffnesses Count Linear stiffnesses of the balls [N/m].
Radii Count Radii of the balls [m].
Masses Count Masses of the balls [kg].
BoxDimensions 3 Dimensions of the box in meter,

\[ L_x, L_y, L_z\]

Material 1 String name for sphere material (Default: "Simple/Black"). (Visualization only)
Mesh 1 String name for sphere mesh (Default: "fhSphere.mesh"). (Visualization only)
Scale 1 Scale of rendered ball objects, typically 1. (Visualization only)

Initial conditions

Name Width Description
Pos

\[ 3\cdot \text{Count}\]

North, East, Down, position; repeated Count times.
Vel

\[ 3\cdot \text{Count}\]

North, East, Down, velocity; repeated Count times.

Full example file

Note
Try to press x while running the simulation to look inside the box.
<Contents>
<OBJECTS>
<Lib
LibName="fhsim_base"
SimObject="Ballbox/Box"
Name="S"
BoxDimensions="5,5,5"
/>
<Lib
LibName="fhsim_base"
SimObject="Ballbox/Ball"
Name="B"
Count="1"
Stiffnesses="1e7"
Radii="1"
Masses="1"
Gravity="9.81"
BoxDimensions="5,5,5"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
B.BoxPos = "S.Pos"
B.BoxRot = "S.Rot"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
B.Pos="0,0,-2"
B.Vel="0,0,2"
S.Pos="0,0,-2.5"
S.Vel="0.1,-0.2,0.5"
S.Rot="0,0,0"
/>
</INITIALIZATION>
<INTEGRATION>
<Engine
IntegratorMethod="2"
NumCores="1"
TOutput="0, 10"
LogStates ="0"
stepsize ="0.0006"
HMax="0.002"
HMin="0.0000001"
AbsTol="1e-3" RelTol="1e-3"
UseRSSNormInsteadOfInfNorm="0"
FileOutput="union(objects:ports,objects:states)"
/>
</INTEGRATION>
</Contents>

This SimObject is referred to as Ballbox/Ball