Beispiel #1
0
def test_autocast():
    dsA = K.LagrangianDS([0],[0],[[1]])
    dsB = K.FirstOrderLinearDS([0],[[1]])
    model = K.Model(0, 0)
    model.nonSmoothDynamicalSystem().insertDynamicalSystem(dsA)
    model.nonSmoothDynamicalSystem().insertDynamicalSystem(dsB)

    assert(type(model.nonSmoothDynamicalSystem().dynamicalSystem(dsA.number())) == K.LagrangianDS)
    assert(type(model.nonSmoothDynamicalSystem().dynamicalSystem(dsB.number())) == K.FirstOrderLinearDS)
Beispiel #2
0
def compute_dt_matrices(A, B, h, TV=False):
    # variable declaration
    t0 = 0.0  # start time
    T = 1  # end time
    n, m = B.shape

    # Matrix declaration
    x0 = np.random.random(n)
    Csurface = np.random.random((m, n))

    # Declaration of the Dynamical System
    if TV:
        process_ds = SK.FirstOrderLinearDS(x0, A)
    else:
        process_ds = SK.FirstOrderLinearTIDS(x0, A)
    # Model
    process = SK.Model(t0, T)
    process.nonSmoothDynamicalSystem().insertDynamicalSystem(process_ds)
    # time discretisation
    process_time_discretisation = SK.TimeDiscretisation(t0, h)
    # Creation of the Simulation
    process_simu = SK.TimeStepping(process_time_discretisation, 0)
    process_simu.setName("plant simulation")
    # Declaration of the integrator
    process_integrator = SK.ZeroOrderHoldOSI()
    process_integrator.insertDynamicalSystem(process_ds)
    process_simu.insertIntegrator(process_integrator)

    rel = SK.FirstOrderLinearTIR(Csurface, B)
    nslaw = SK.RelayNSL(m)
    inter = SK.Interaction(m, nslaw, rel)

    #process.nonSmoothDynamicalSystem().insertInteraction(inter, True)
    process.nonSmoothDynamicalSystem().link(inter, process_ds)
    process.nonSmoothDynamicalSystem().setControlProperty(inter, True)
    # Initialization
    process.initialize(process_simu)

    # Main loop
    process_simu.computeOneStep()
    Ad = SK.getMatrix(process_integrator.Ad(process_ds)).copy()
    Bd = SK.getMatrix(process_integrator.Bd(process_ds)).copy()

    return (Ad, Bd)
def test_bouncing_ball2():

    import siconos.kernel as K
    from numpy import array, eye, empty

    t0 = 0       # start time
    T = 5        # end time
    h = 0.005    # time step
    r = 0.1      # ball radius
    g = 9.81     # gravity
    m = 1        # ball mass
    e = 0.9      # restitution coeficient
    theta = 0.5  # theta scheme

    #
    # dynamical system
    #
    x = array([1, 0, 0])  # initial position
    v = array([0, 0, 0])  # initial velocity
    mass = eye(3)         # mass matrix
    mass[2, 2] = 3./5 * r * r

    # the dynamical system
    ball = K.LagrangianLinearTIDS(x, v, mass)

    # set external forces
    weight = array([-m * g, 0, 0])
    ball.setFExtPtr(weight)

    # a ball with its own computeFExt
    class Ball(K.LagrangianLinearTIDS):
        def computeFExt(self, t):
            #print("computing FExt at t=", t)
            weight = array([-m * g, 0, 0])
            self.setFExtPtr(weight)

    ball_d = Ball(array([1, 0, 0]), array([0, 0, 0]), mass)

    ball_d.setFExtPtr(array([0, 0, 0]))

    #
    # Interactions
    #

    # ball-floor
    H = array([[1, 0, 0]])

    nslaw = K.NewtonImpactNSL(e)
    nslaw_d = K.NewtonImpactNSL(e)

    relation = K.LagrangianLinearTIR(H)
    relation_d = K.LagrangianLinearTIR(H)

    inter = K.Interaction(1, nslaw, relation)
    inter_d = K.Interaction(1, nslaw_d, relation_d)

    #
    # Model
    #
    bouncingBall = K.Model(t0, T)

    bouncingBall_d = K.Model(t0, T)

    # add the dynamical system to the non smooth dynamical system
    bouncingBall.nonSmoothDynamicalSystem().insertDynamicalSystem(ball)
    bouncingBall_d.nonSmoothDynamicalSystem().insertDynamicalSystem(ball_d)

    # link the interaction and the dynamical system
    bouncingBall.nonSmoothDynamicalSystem().link(inter, ball)
    bouncingBall_d.nonSmoothDynamicalSystem().link(inter_d, ball_d)

    #
    # Simulation
    #

    # (1) OneStepIntegrators
    OSI = K.MoreauJeanOSI(theta)
    OSI.insertDynamicalSystem(ball)

    OSI_d = K.MoreauJeanOSI(theta)
    OSI_d.insertDynamicalSystem(ball_d)

    # (2) Time discretisation --
    t = K.TimeDiscretisation(t0, h)
    t_d = K.TimeDiscretisation(t0, h)

    # (3) one step non smooth problem
    osnspb = K.LCP()

    osnspb_d = K.LCP()

    # (4) Simulation setup with (1) (2) (3)
    s = K.TimeStepping(t)
    s.insertIntegrator(OSI)
    s.insertNonSmoothProblem(osnspb)

    s_d = K.TimeStepping(t_d)
    s_d.insertIntegrator(OSI_d)
    s_d.insertNonSmoothProblem(osnspb_d)

    # end of model definition

    #
    # computation
    #

    # simulation initialization
    bouncingBall.initialize(s)

    bouncingBall_d.initialize(s_d)

    # the number of time steps
    N = (T-t0)/h+1

    # Get the values to be plotted
    # ->saved in a matrix dataPlot

    s_d.computeOneStep()

    dataPlot = empty((N+1, 5))
    dataPlot_d = empty((N+1, 5))

    dataPlot[0, 0] = t0
    dataPlot[0, 1] = ball.q()[0]
    dataPlot[0, 2] = ball.velocity()[0]
    dataPlot[0, 3] = ball.p(1)[0]
    dataPlot[0, 4] = inter.lambda_(1)

    dataPlot_d[0, 0] = t0
    dataPlot_d[0, 1] = ball_d.q()[0]
    dataPlot_d[0, 2] = ball_d.velocity()[0]
    dataPlot_d[0, 3] = ball_d.p(1)[0]
    dataPlot_d[0, 4] = inter_d.lambda_(1)

    k = 1

    # time loop
    while(s.hasNextEvent()):
        s.computeOneStep()
        s_d.computeOneStep()

        dataPlot[k, 0] = s.nextTime()
        dataPlot[k, 1] = ball.q()[0]
        dataPlot[k, 2] = ball.velocity()[0]
        dataPlot[k, 3] = ball.p(1)[0]
        dataPlot[k, 4] = inter.lambda_(1)[0]

        dataPlot_d[k, 0] = s_d.nextTime()
        dataPlot_d[k, 1] = ball_d.q()[0]
        dataPlot_d[k, 2] = ball_d.velocity()[0]
        dataPlot_d[k, 3] = ball_d.p(1)[0]
        dataPlot_d[k, 4] = inter_d.lambda_(1)[0]

        assert dataPlot[k, 1] == dataPlot_d[k, 1]

        #print(s.nextTime())
        k += 1
        s.nextStep()
        s_d.nextStep()
Beispiel #4
0
theta = 0.5
N = int((T - t0) / h + 10)  # number of time steps
outputSize = 5  # number of variable to store at each time step

# Matrix declaration
A = zeros((2, 2))
A[0, 1] = 1
B = [[0], [1]]
x0 = [10., 10.]
C = [[1., 0]]  # we have to specify ndmin=2, so it's understood as
K = [.25, .125, 2]

# Declaration of the Dynamical System
doubleIntegrator = sk.FirstOrderLinearTIDS(x0, A)
# Model
process = sk.Model(t0, T)
process.nonSmoothDynamicalSystem().insertDynamicalSystem(doubleIntegrator)
# Declaration of the integrator
OSI = sk.EulerMoreauOSI(theta)
# time discretisation
t = sk.TimeDiscretisation(t0, h)
tSensor = sk.TimeDiscretisation(t0, h)
tActuator = sk.TimeDiscretisation(t0, h)
s = sk.TimeStepping(t, 0)
s.insertIntegrator(OSI)

# Actuator, Sensor & ControlManager
control = ControlManager(s)
sens = LinearSensor(doubleIntegrator, C)
control.addSensorPtr(sens, tSensor)
act = PID(sens)
def test_bouncing_ball1():
    """Run a complete simulation (Bouncing ball example)
    LagrangianLinearTIDS,  no plugins.
    """

    t0 = 0.  # start time
    tend = 10.  # end time
    h = 0.005  # time step
    r = 0.1  # ball radius
    g = 9.81  # gravity
    m = 1  # ball mass
    e = 0.9  # restitution coeficient
    theta = 0.5  # theta scheme

    #
    # dynamical system
    #
    x = np.zeros(3, dtype=np.float64)
    x[0] = 1.
    v = np.zeros_like(x)
    # mass matrix
    mass = np.eye(3, dtype=np.float64)
    mass[2, 2] = 3. / 5 * r * r

    # the dynamical system
    ball = sk.LagrangianLinearTIDS(x, v, mass)

    # set external forces
    weight = np.zeros_like(x)
    weight[0] = -m * g
    ball.setFExtPtr(weight)

    #
    # Interactions
    #

    # ball-floor
    H = np.zeros((1, 3), dtype=np.float64)
    H[0, 0] = 1.

    nslaw = sk.NewtonImpactNSL(e)
    relation = sk.LagrangianLinearTIR(H)
    inter = sk.Interaction(nslaw, relation)

    #
    # Model
    #
    bouncing_ball = sk.Model(t0, tend)

    # add the dynamical system to the non smooth dynamical system
    bouncing_ball.nonSmoothDynamicalSystem().insertDynamicalSystem(ball)

    # link the interaction and the dynamical system
    bouncing_ball.nonSmoothDynamicalSystem().link(inter, ball)

    #
    # Simulation
    #

    # (1) OneStepIntegrators
    OSI = sk.MoreauJeanOSI(theta)

    # (2) Time discretisation --
    t = sk.TimeDiscretisation(t0, h)

    # (3) one step non smooth problem
    osnspb = sk.LCP()

    # (4) Simulation setup with (1) (2) (3)
    s = sk.TimeStepping(t)
    s.insertIntegrator(OSI)
    s.insertNonSmoothProblem(osnspb)

    # end of model definition

    #
    # computation
    #

    # simulation initialization
    bouncing_ball.setSimulation(s)
    bouncing_ball.initialize()

    #
    # save and load data from xml and .dat
    #
    try:
        from siconos.io import save
        save(bouncing_ball, "bouncingBall.xml")
        save(bouncing_ball, "bouncingBall.bin")

    except:
        print("Warning : could not import save from siconos.io")

    # the number of time steps
    nb_time_steps = int((tend - t0) / h + 1)

    # Get the values to be plotted
    # ->saved in a matrix dataPlot

    data = np.empty((nb_time_steps, 5))

    #
    # numpy pointers on dense Siconos vectors
    #
    q = ball.q()
    v = ball.velocity()
    p = ball.p(1)
    lambda_ = inter.lambda_(1)

    #
    # initial data
    #
    data[0, 0] = t0
    data[0, 1] = q[0]
    data[0, 2] = v[0]
    data[0, 3] = p[0]
    data[0, 4] = lambda_[0]

    k = 1

    # time loop
    while (s.hasNextEvent()):
        s.computeOneStep()

        data[k, 0] = s.nextTime()
        data[k, 1] = q[0]
        data[k, 2] = v[0]
        data[k, 3] = p[0]
        data[k, 4] = lambda_[0]

        k += 1
        #print(s.nextTime())
        s.nextStep()

    #
    # comparison with the reference file
    #

    ref = sk.getMatrix(
        sk.SimpleMatrix(os.path.join(working_dir, "data/result.ref")))
    assert (np.linalg.norm(data - ref) < 1e-12)
def test_bouncing_ball2():
    """Run a complete simulation (Bouncing ball example)
    LagrangianLinearTIDS,  plugged Fext.
    """

    t0 = 0  # start time
    T = 5  # end time
    h = 0.005  # time step
    r = 0.1  # ball radius
    g = 9.81  # gravity
    m = 1  # ball mass
    e = 0.9  # restitution coeficient
    theta = 0.5  # theta scheme

    #
    # dynamical system
    #
    x = np.zeros(3, dtype=np.float64)
    x[0] = 1.
    v = np.zeros_like(x)
    # mass matrix
    mass = np.eye(3, dtype=np.float64)
    mass[2, 2] = 3. / 5 * r * r

    # the dynamical system
    ball = sk.LagrangianLinearTIDS(x, v, mass)
    weight = np.zeros(ball.dimension())
    weight[0] = -m * g
    ball.setFExtPtr(weight)

    # a ball with its own computeFExt
    class Ball(sk.LagrangianLinearTIDS):
        def computeFExt(self, t):
            """External forces operator computation
            """
            print("computing FExt at t=", t)
            #self._fExt[0] = -m * g
            weight = np.zeros(self.dimension())
            weight[0] = -m * g
            self.setFExtPtr(weight)

    ball_d = Ball(x.copy(), v.copy(), mass)
    ball_d.computeFExt(t0)
    # Interactions
    #

    # ball-floor
    H = np.zeros((1, 3), dtype=np.float64)
    H[0, 0] = 1.

    nslaw = sk.NewtonImpactNSL(e)
    nslaw_d = sk.NewtonImpactNSL(e)

    relation = sk.LagrangianLinearTIR(H)
    relation_d = sk.LagrangianLinearTIR(H)

    inter = sk.Interaction(nslaw, relation)
    inter_d = sk.Interaction(nslaw_d, relation_d)

    #
    # Model
    #
    bouncing_ball = sk.Model(t0, T)

    bouncing_ball_d = sk.Model(t0, T)

    # add the dynamical system to the non smooth dynamical system
    bouncing_ball.nonSmoothDynamicalSystem().insertDynamicalSystem(ball)
    bouncing_ball_d.nonSmoothDynamicalSystem().insertDynamicalSystem(ball_d)

    # link the interaction and the dynamical system
    bouncing_ball.nonSmoothDynamicalSystem().link(inter, ball)
    bouncing_ball_d.nonSmoothDynamicalSystem().link(inter_d, ball_d)

    #
    # Simulation
    #

    # (1) OneStepIntegrators
    OSI = sk.MoreauJeanOSI(theta)

    OSI_d = sk.MoreauJeanOSI(theta)

    # (2) Time discretisation --
    t = sk.TimeDiscretisation(t0, h)
    t_d = sk.TimeDiscretisation(t0, h)

    # (3) one step non smooth problem
    osnspb = sk.LCP()

    osnspb_d = sk.LCP()

    # (4) Simulation setup with (1) (2) (3)
    s = sk.TimeStepping(t)
    s.insertIntegrator(OSI)
    s.insertNonSmoothProblem(osnspb)

    s_d = sk.TimeStepping(t_d)
    s_d.insertIntegrator(OSI_d)
    s_d.insertNonSmoothProblem(osnspb_d)

    # end of model definition

    #
    # computation
    #

    # simulation initialization
    bouncing_ball.setSimulation(s)
    bouncing_ball_d.setSimulation(s_d)
    bouncing_ball.initialize()
    bouncing_ball_d.initialize()

    # the number of time steps
    nb_time_steps = int((T - t0) / h + 1)

    # Get the values to be plotted
    # ->saved in a matrix data

    s_d.computeOneStep()

    data = np.empty((nb_time_steps + 1, 5))
    data_d = np.empty((nb_time_steps + 1, 5))

    data[0, 0] = t0
    data[0, 1] = ball.q()[0]
    data[0, 2] = ball.velocity()[0]
    data[0, 3] = ball.p(1)[0]
    data[0, 4] = inter.lambda_(1)

    data_d[0, 0] = t0
    data_d[0, 1] = ball_d.q()[0]
    data_d[0, 2] = ball_d.velocity()[0]
    data_d[0, 3] = ball_d.p(1)[0]
    data_d[0, 4] = inter_d.lambda_(1)

    k = 1

    # time loop
    while (s.hasNextEvent()):
        s.computeOneStep()
        s_d.computeOneStep()

        data[k, 0] = s.nextTime()
        data[k, 1] = ball.q()[0]
        data[k, 2] = ball.velocity()[0]
        data[k, 3] = ball.p(1)[0]
        data[k, 4] = inter.lambda_(1)[0]

        data_d[k, 0] = s_d.nextTime()
        data_d[k, 1] = ball_d.q()[0]
        data_d[k, 2] = ball_d.velocity()[0]
        data_d[k, 3] = ball_d.p(1)[0]
        data_d[k, 4] = inter_d.lambda_(1)[0]

        assert np.allclose(data[k, 1], data_d[k, 1])

        #print(s.nextTime())
        k += 1
        s.nextStep()
        s_d.nextStep()
Beispiel #7
0
inter = []
hh = np.zeros((diminter, sico.nbdof))
nbInter = pidbot.shape[0]
for i in range(nbInter):
    # hh is a submatrix of sico.H with 1 row.
    hh[:, :] = sico.H[k, :]
    k += 3
    relation.append(kernel.LagrangianLinearTIR(hh, b))
    inter.append(kernel.Interaction(diminter, nslaw, relation[i]))

nbInter = len(inter)

# =======================================
# The Model
# =======================================
blockModel = kernel.Model(t0, T)

# add the dynamical system to the non smooth dynamical system
blockModel.nonSmoothDynamicalSystem().insertDynamicalSystem(block)

# link the interactions and the dynamical system
for i in range(nbInter):
    blockModel.nonSmoothDynamicalSystem().link(inter[i], block)

# =======================================
# The Simulation
# =======================================

# (1) OneStepIntegrators
OSI = kernel.Moreau(theta)
D = [[1. / Rvalue, 1. / Rvalue, -1., 0.], [1. / Rvalue, 1. / Rvalue, 0., -1.],
     [1., 0., 0., 0.], [0., 1., 0., 0.]]

B = [[0., 0., -1. / Cvalue, 1. / Cvalue], [0., 0., 0., 0.]]

LTIRDiodeBridge = sk.FirstOrderLinearTIR(C, B)
LTIRDiodeBridge.setDPtr(D)

nslaw = sk.ComplementarityConditionNSL(4)
InterDiodeBridge = sk.Interaction(nslaw, LTIRDiodeBridge)

#
# Model
#
DiodeBridge = sk.Model(t0, T, Modeltitle)

#   add the dynamical system in the non smooth dynamical system
DiodeBridge.nonSmoothDynamicalSystem().insertDynamicalSystem(LSDiodeBridge)

#   link the interaction and the dynamical system
DiodeBridge.nonSmoothDynamicalSystem().link(InterDiodeBridge, LSDiodeBridge)

#
# Simulation
#

# (1) OneStepIntegrators
theta = 0.5
aOSI = sk.EulerMoreauOSI(theta)
# (2) Time discretisation
def test_Model():
    bouncing_ball = K.Model(t0, T)
    assert bouncing_ball.t0() == t0
Beispiel #10
0
B[1, 0] = -B[0, 1]
B[1, 1] = B[0, 0]
B[2, 0] = gamma * 0.5
B[2, 1] = gamma * 0.5

C = np.zeros((ninter, ndof), dtype=np.float64)
C[0, 0] = C[1, 1] = -1.

particle_relation = sk.FirstOrderLinearR(C, B)

nslaw = sk.RelayNSL(ninter)

particle_interaction = sk.Interaction(nslaw, particle_relation)

# -- The Model --
filippov = sk.Model(t0, T)
nsds = filippov.nonSmoothDynamicalSystem()
nsds.insertDynamicalSystem(particle)
nsds.link(particle_interaction, particle)

# -- Simulation --
td = sk.TimeDiscretisation(t0, h)
simu = sk.TimeStepping(td)
# osi
theta = 0.5
myIntegrator = sk.EulerMoreauOSI(theta)
simu.insertIntegrator(myIntegrator)

# osns
osnspb = sk.Relay(sn.SICONOS_RELAY_LEMKE)
simu.insertNonSmoothProblem(osnspb)
Beispiel #11
0
C = [[-1., 0.]]

D = [[Rvalue]]

B = [[-1. / Cvalue], [0.]]

LTIRCircuitRLCD = sk.FirstOrderLinearTIR(C, B)
LTIRCircuitRLCD.setDPtr(D)

nslaw = sk.ComplementarityConditionNSL(1)
InterCircuitRLCD = sk.Interaction(nslaw, LTIRCircuitRLCD)

#
# Model
#
CircuitRLCD = sk.Model(t0, T, "CircuitRLCD")

#   add the dynamical system in the non smooth dynamical system
CircuitRLCD.nonSmoothDynamicalSystem().insertDynamicalSystem(LSCircuitRLCD)

#   link the interaction and the dynamical system
CircuitRLCD.nonSmoothDynamicalSystem().link(InterCircuitRLCD, LSCircuitRLCD)

#
# Simulation
#

# (1) OneStepIntegrators
theta = 0.500000001
aOSI = sk.EulerMoreauOSI(theta)
Beispiel #12
0
M = np.zeros((ninter, ninter), dtype=np.float64)
np.fill_diagonal(M[:number_of_cars, :number_of_cars], S)

N = np.zeros((ninter, ndof), dtype=np.float64)
np.fill_diagonal(N[:number_of_cars, number_of_cars:], -1.)

relation = sk.FirstOrderLinearTIR(N, B)
relation.setDPtr(M)

nslaw = sk.ComplementarityConditionNSL(ninter)

interaction = sk.Interaction(ninter, nslaw, relation)

# -- The Model --
circuit = sk.Model(t0, T, 'train')
nsds = circuit.nonSmoothDynamicalSystem()
nsds.insertDynamicalSystem(RC)
nsds.link(interaction, RC)

# -- Simulation --
td = sk.TimeDiscretisation(t0, tau)
simu = sk.TimeStepping(td)
# osi
theta = 0.50000000000001
osi = sk.EulerMoreauOSI(theta)
osi.insertDynamicalSystem(RC)
simu.insertIntegrator(osi)

# osns
osnspb = sk.LCP()
Beispiel #13
0
def test_lagrangian_and_osis():
    """Tests osi/lagrangian combinations
    """
    # --- The dynamical systems ---
    # dimension
    ndof = 3
    # initial conditons
    q0 = np.zeros(ndof, dtype=np.float64)
    v0 = np.zeros_like(q0)
    q0[0] = 1.
    # mass, stiffness and damping matrices
    # (diagonal values only)
    mass_diag = np.ones(ndof, dtype=np.float64)
    k_diag = np.zeros_like(mass_diag)
    c_diag = np.zeros_like(mass_diag)
    sigma = 0.2
    omega2 = 1.2
    k_diag[...] = omega2
    c_diag[...] = sigma

    ds_list = {}
    # - LagrangianLinearTIDS -
    ds_list['LTIDS+MJ'] = sk.LagrangianLinearTIDS(q0, v0, np.diag(mass_diag),
                                                  np.diag(k_diag),
                                                  np.diag(c_diag))
    # - LagrangianLinearDiagonalDS -
    ds_list['LLDDS+MJ'] = sk.LagrangianLinearDiagonalDS(q0, v0, k_diag,
                                                        c_diag,
                                                        mass_diag)
    ds_list['LLDDS+MJB'] = sk.LagrangianLinearDiagonalDS(q0, v0, k_diag,
                                                         c_diag,
                                                         mass_diag)
    # no mass (i.e. implicitely equal to Id)
    ds_list['LLDDS+MJB2'] = sk.LagrangianLinearDiagonalDS(q0, v0,
                                                          k_diag, c_diag)

    nb_ds = len(ds_list)
    for ds in ds_list.values():
        ds.computeForces(0., q0, v0)

    assert np.allclose(ds_list['LTIDS+MJ'].forces(),
                       ds_list['LTIDS+MJ'].forces())

    # --- Interactions ---
    cor = 0.9

    nslaw = sk.NewtonImpactNSL(cor)
    hmat = np.zeros((1, ndof), dtype=np.float64)
    hmat[0, 0] = 1.
    relation = sk.LagrangianLinearTIR(hmat)

    interactions = []
    for k in range(nb_ds):
        interactions.append(sk.Interaction(nslaw, relation))

    # --- Model ---
    tinit = 0.
    tend = 3.
    model = sk.Model(tinit, tend)

    # - insert ds into the model and link them with their interaction -
    nsds = model.nonSmoothDynamicalSystem()
    ninter = 0
    for ds in ds_list.values():
        nsds.insertDynamicalSystem(ds)
        nsds.link(interactions[ninter], ds)
        ninter += 1

    # --- Simulation ---

    # - (1) OneStepIntegrators --
    theta = 0.5000001
    standard = sk.MoreauJeanOSI(theta)
    bilbao = sk.MoreauJeanBilbaoOSI()
    #-- (2) Time discretisation --
    time_step = 1e-4
    td = sk.TimeDiscretisation(tinit, time_step)
    # -- (3) one step non smooth problem
    lcp = sk.LCP()
    # -- (4) Simulation setup with (1) (2) (3)
    simu = sk.TimeStepping(td, standard, lcp)
    # extra osi must be explicitely inserted into simu and linked to ds
    simu.prepareIntegratorForDS(bilbao, ds_list['LLDDS+MJB'], model, tinit)
    simu.prepareIntegratorForDS(bilbao, ds_list['LLDDS+MJB2'], model, tinit)

    # link simu and model, initialize
    model.setSimulation(simu)
    model.initialize()

    positions = []
    velocities = []
    for ds in ds_list.values():
        positions.append(ds.q())
        velocities.append(ds.velocity())

    # number of time steps and buffer used to save results
    nb_steps = int((tend - tinit) / time_step) + 1
    data = np.zeros((nb_steps, 1 + 2 * len(ds_list)), dtype=np.float64)
    data[0, 0] = tinit

    for k in range(nb_ds):
        data[0, k * 2 + 1] = positions[k][0]
        data[0, k * 2 + 2] = velocities[k][0]

    current_iter = 1
    # --- Time loop ---
    while simu.hasNextEvent():
        simu.computeOneStep()
        data[current_iter, 0] = simu.nextTime()
        for k in range(nb_ds):
            data[current_iter, k * 2 + 1] = positions[k][0]
            data[current_iter, k * 2 + 2] = velocities[k][0]
        simu.nextStep()
        current_iter += 1

    # -- check results
    ref_pos = data[:, 1]
    ref_vel = data[:, 2]
    for k in range(1, nb_ds):
        assert np.allclose(ref_pos, data[:, k * 2 + 1], atol=time_step)
        assert np.allclose(ref_vel, data[:, k * 2 + 2], atol=time_step)