myProcessRelation = sk.FirstOrderLinearR(C, B)
myProcessRelation.setComputeEFunction('plugins', 'computeE')
# myProcessRelation.setDPtr(D)

myProcessInteraction = sk.Interaction(myNslaw, myProcessRelation)

# NSDS
simplerelay = sk.NonSmoothDynamicalSystem(t0, T)
simplerelay.insertDynamicalSystem(process)
simplerelay.link(myProcessInteraction, process)

# myProcessRelation.computeJachx(0, x0, x0 , x0, C)

# Simulation
s = sk.TimeStepping(simplerelay, sk.TimeDiscretisation(t0, h),
                    sk.EulerMoreauOSI(theta), sk.Relay())
# s.setComputeResiduY(True)
# s.setComputeResiduR(True)

# matrix to save data
dataPlot = np.empty((N + 1, 7))
k = 0
dataPlot[k, 0] = t0
dataPlot[k, 1:3] = process.x()
dataPlot[k, 3] = myProcessInteraction.lambda_(0)[0]
dataPlot[k, 4] = myProcessInteraction.lambda_(0)[1]
dataPlot[k, 5] = myProcessInteraction.y(0)[0]
dataPlot[k, 6] = myProcessInteraction.y(0)[1]
# time loop
k = 1
print('start computation')
Exemple #2
0
# 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)
act.setB(B)
control.addActuatorPtr(act, tActuator)
Exemple #3
0
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)

filippov.setSimulation(simu)
filippov.initialize()

# -- Get the values to be plotted --
output_size = 1 + ndof + 2 * ninter
nb_time_steps = int((T - t0) / h) + 1
data_plot = np.empty((nb_time_steps, output_size))
data_plot[0, 0] = filippov.t0()
data_plot[0, 1:4] = particle.x()