Пример #1
0
                      inertia=2.0)

        # the ground object made with the ground shape. As the mass is
        # not given, it is a static object only involved in contact
        # detection.
        io.add_object('ground', [Contactor('Ground')], translation=[0, -.5])

# Run the simulation from the inputs previously defined and add
# results to the hdf5 file. The visualisation of the output may be done
# with the vview command.

bullet_options = SiconosBulletOptions()
bullet_options.worldScale = 1.0
bullet_options.contactBreakingThreshold = 0.04
bullet_options.dimension = SICONOS_BULLET_2D
bullet_options.perturbationIterations = 0
bullet_options.minimumPointsPerturbationThreshold = 0

options = sk.solver_options_create(sn.SICONOS_FRICTION_2D_NSGS)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = 100000
options.dparam[sn.SICONOS_DPARAM_TOL] = 1e-8

T = 2.0
if restart:
    T = 2.0
#T=1*0.001
hstep = 0.01
run_options = MechanicsHdf5Runner_run_options()
run_options['t0'] = 0
run_options['T'] = T
run_options['h'] = hstep
Пример #2
0
# classical time-stepping method. Reducing the step-size led to
# different results as the divergence or deadening was weakened."

mu = 0.3
m = 6 * 1e-3  # kg
r1 = 1.5  # cm
r2 = 0.5  # cm
a1 = 0.3  # cm
a2 = 1.6  # cm
I1 = 8 * 1e-3  # kg . cm^2
I3 = 7 * 1e-3  # kg . cm^2

# Bullet: do not generate extra contact points for convex pairs by
# rotational purterbation method.
options = SiconosBulletOptions()
options.perturbationIterations = 0
options.minimumPointsPerturbationThreshold = 0

with MechanicsHdf5Runner() as io:

    io.add_primitive_shape('Body1', 'Sphere', (r1, ))
    io.add_primitive_shape('Body2', 'Cylinder', (r2, a2))
    io.add_primitive_shape('Body3', 'Sphere', (r2, ))
    io.add_primitive_shape('Ground', 'Box', (100, 100, .5))

    io.add_Newton_impact_friction_nsl('contact', mu=mu)
    io.add_object('ground', [Contactor('Ground')], translation=[0, 0, 0])

    io.add_object(
        'tippe-top',
        [