myProcessInteraction = Interaction(myNslaw, myProcessRelation) filippov = NonSmoothDynamicalSystem(t0, T) filippov.insertDynamicalSystem(process) filippov.link(myProcessInteraction, process) td = TimeDiscretisation(t0, h) s = TimeStepping(filippov, td) myIntegrator = EulerMoreauOSI(theta) s.insertIntegrator(myIntegrator) #TODO python <- SICONOS_RELAY_LEMKE # access dparam osnspb = Relay() s.insertNonSmoothProblem(osnspb) s.setComputeResiduY(True) s.setComputeResiduR(True) s.setNewtonMaxIteration(30) s.setNewtonTolerance(1e-14) # matrix to save data dataPlot = empty((N + 1, 5)) control = empty((N + 1, )) dataPlot[0, 0] = t0 dataPlot[0, 1:3] = process.x() dataPlot[0, 3] = myProcessInteraction.lambda_(0)[0] dataPlot[0, 4] = myProcessInteraction.lambda_(0)[1] # time loop k = 1
# link the interaction and the dynamical system relayOscillator.link(InterRelayOscillator, LSRelayOscillator) # # Simulation # # (1) OneStepIntegrators theta = 0.5 aOSI = EulerMoreauOSI(theta) # (2) Time discretisation aTiDisc = TimeDiscretisation(t0, h_step) # (3) Non smooth problem aRelay = Relay() # (4) Simulation setup with (1) (2) (3) aTS = TimeStepping(relayOscillator, aTiDisc, aOSI, aRelay) # end of model definition # # computation # k = 0 h = aTS.timeStep() print("Timestep : ", h) # Number of time steps N = (int)((T - t0) / h)