• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python kernel.Model类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中siconos.kernel.Model的典型用法代码示例。如果您正苦于以下问题:Python Model类的具体用法?Python Model怎么用?Python Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Model类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: NewtonImpactNSL

#
# Interactions
#

# ball-floor
H = [[1, 0, 0]]

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

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

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

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


#
# Simulation
#

# (1) OneStepIntegrators
OSI = MoreauJeanOSI(theta)
OSI.insertDynamicalSystem(ball)
开发者ID:yushuiqiang,项目名称:siconos,代码行数:30,代码来源:BouncingBallTS.py


示例2: zeros

# Matrix declaration
A = zeros((ndof, ndof))
x0 = [Xinit, -Xinit]
sensorC = eye(ndof)
Csurface = [[0, 1.0]]

# Simple check
if h > hControl:
    print "hControl must be bigger than h"
    exit(1)

# Declaration of the Dynamical System
processDS = FirstOrderLinearDS(x0, A)
processDS.setComputebFunction("RelayPlugin", "computeB")
# Model
process = Model(t0, T)
process.nonSmoothDynamicalSystem().insertDynamicalSystem(processDS)
# time discretisation
processTD = TimeDiscretisation(t0, h)
tSensor = TimeDiscretisation(t0, hControl)
tActuator = TimeDiscretisation(t0, hControl)
# Creation of the Simulation
processSimulation = TimeStepping(processTD, 0)
processSimulation.setName("plant simulation")
# Declaration of the integrator
processIntegrator = ZeroOrderHoldOSI(processDS)
processSimulation.insertIntegrator(processIntegrator)
# Actuator, Sensor & ControlManager
control = ControlManager(process)
sens = LinearSensor(tSensor, processDS, sensorC)
control.addSensorPtr(sens)
开发者ID:fperignon,项目名称:siconos,代码行数:31,代码来源:SMCExampleImplicitOT2.py


示例3: test_serialization4

def test_serialization4():
    from siconos.kernel import LagrangianLinearTIDS, NewtonImpactNSL, \
        LagrangianLinearTIR, Interaction, Model, MoreauJeanOSI, TimeDiscretisation, LCP, TimeStepping

    from numpy import array, eye, empty

    t0 = 0       # start time
    T = 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 = 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 = LagrangianLinearTIDS(x, v, mass)

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

    #
    # Interactions
    #

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

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

    #
    # Model
    #
    first_bouncingBall = Model(t0, T)

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

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

    #
    # Simulation
    #

    # (1) OneStepIntegrators
    OSI = MoreauJeanOSI(theta)

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

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

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

    # end of model definition

    #
    # computation
    #

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

    #
    # save and load data from xml and .dat
    #
    from siconos.io.io_base import save, load
    save(first_bouncingBall, "bouncingBall.xml")

    bouncingBall = load("bouncingBall.xml")

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

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

    dataPlot = empty((N, 5))

    #
    # numpy pointers on dense Siconos vectors
    #
    q = ball.q()
#.........这里部分代码省略.........
开发者ID:radarsat1,项目名称:siconos,代码行数:101,代码来源:test_serialization.py


示例4: NonSmoothDynamicalSystem

B = [[0.0],
     [0.0],
     [1.0]]

LTIRRelayOscillator=FirstOrderLinearTIR(C,B)
LTIRRelayOscillator.setDPtr(D)

nslaw=RelayNSL(1)
InterRelayOscillator=Interaction(1, nslaw,LTIRRelayOscillator,1)


#
# Model
#
RelayOscillator=Model(t0,T,Modeltitle)

#   add the dynamical system in the non smooth dynamical system
myNSDS = NonSmoothDynamicalSystem()
myNSDS.insertDynamicalSystem(LSRelayOscillator)


#   link the interaction and the dynamical system
myNSDS.link(InterRelayOscillator,LSRelayOscillator)

RelayOscillator.setNonSmoothDynamicalSystemPtr(myNSDS)


#
# Simulation
#
开发者ID:yushuiqiang,项目名称:siconos,代码行数:30,代码来源:RelayOscillator.py


示例5: FirstOrderLinearDS

# dynamical systems
process = FirstOrderLinearDS(x0, A)
myProcessRelation = ZhuravlevTwistingR(C,B)

myNslaw = RelayNSL(2)
myNslaw.display()

myProcessInteraction = Interaction(ninter, myNslaw,
        myProcessRelation)
myNSDS = NonSmoothDynamicalSystem()
myNSDS.insertDynamicalSystem(process)
myNSDS.link(myProcessInteraction,process)


filippov = Model(t0,T)
filippov.setNonSmoothDynamicalSystemPtr(myNSDS)

td = TimeDiscretisation(t0, h)
s = TimeStepping(td)

myIntegrator = EulerMoreauOSI(process, theta)
s.insertIntegrator(myIntegrator)


#TODO python <- SICONOS_RELAY_LEMKE
# access dparam

osnspb = Relay()
s.insertNonSmoothProblem(osnspb)
s.setComputeResiduY(True)
开发者ID:fperignon,项目名称:siconos,代码行数:30,代码来源:ZhuravlevTwisting.py


示例6: FirstOrderLinearDS

# dynamical systems
process = FirstOrderLinearDS(x0, A)
myProcessRelation = ZhuravlevTwistingR(C,B)

myNslaw = RelayNSL(2)
myNslaw.display()

myProcessInteraction = Interaction(ninter, myNslaw,
        myProcessRelation)
myNSDS = NonSmoothDynamicalSystem()
myNSDS.insertDynamicalSystem(process)
myNSDS.link(myProcessInteraction,process)


filippov = Model(t0,T)
filippov.setNonSmoothDynamicalSystemPtr(myNSDS)

td = TimeDiscretisation(t0, h)
s = TimeStepping(td)

myIntegrator = EulerMoreauOSI(theta)
s.insertIntegrator(myIntegrator)


#TODO python <- SICONOS_RELAY_LEMKE
# access dparam

osnspb = Relay()
s.insertNonSmoothProblem(osnspb)
s.setComputeResiduY(True)
开发者ID:radarsat1,项目名称:siconos,代码行数:30,代码来源:ZhuravlevTwisting.py


示例7: FirstOrderLinearTIR

     [0.,        1.,         0.,  0.]]

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

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

nslaw = ComplementarityConditionNSL(4)
InterDiodeBridge = Interaction(4, nslaw, LTIRDiodeBridge, 1)


#
# Model
#
DiodeBridge = 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
gamma = 0.5
aOSI = EulerMoreauOSI(theta, gamma)
开发者ID:yushuiqiang,项目名称:siconos,代码行数:31,代码来源:DiodeBridge-ThetaGammaSchemes.py


示例8: FirstOrderLinearTIR

     [0.,         1.,         0.,  0.]]

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

LTIRDiodeBridgeCapFilter = FirstOrderLinearTIR(C, B)
LTIRDiodeBridgeCapFilter.setDPtr(D)

nslaw = ComplementarityConditionNSL(4)
InterDiodeBridgeCapFilter = Interaction(4, nslaw, LTIRDiodeBridgeCapFilter, 1)

#
# Model
#
DiodeBridgeCapFilter = Model(t0, T, Modeltitle)

#   add the dynamical system in the non smooth dynamical system
DiodeBridgeCapFilter.nonSmoothDynamicalSystem().insertDynamicalSystem(LS1DiodeBridgeCapFilter)
DiodeBridgeCapFilter.nonSmoothDynamicalSystem().insertDynamicalSystem(LS2DiodeBridgeCapFilter)

#   link the interaction and the dynamical system
DiodeBridgeCapFilter.nonSmoothDynamicalSystem().link(InterDiodeBridgeCapFilter, LS1DiodeBridgeCapFilter, LS2DiodeBridgeCapFilter)

#
# Simulation
#

# (1) OneStepIntegrators
theta = 0.5
gamma = 1.0
开发者ID:xhub,项目名称:siconos,代码行数:31,代码来源:DiodeBridgeCapFilter-ThetaGammaSchemes.py


示例9: FirstOrderLinearTIR

D = [[Rvalue]]

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

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

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


#
# Model
#
CircuitRLCD = Model(t0, T, Modeltitle)

#   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.5
aOSI = EulerMoreauOSI(theta)
aOSI.insertDynamicalSystem(LSCircuitRLCD)
开发者ID:xhub,项目名称:siconos,代码行数:30,代码来源:CircuitRLCD.py


示例10: makeBox

                    [0, 0, pos, 1., 0, 0, 0],
                    [0, 0, vel, 0., 0., 0.])
    
    # set external forces
    weight = [0, 0, - box1.mass() * g]
    body.setFExtPtr(weight)

    return body

# Initial box body
body = makeBox()

#
# Model
#
bouncingBox = Model(t0, T)

# add the dynamical system to the non smooth dynamical system
bouncingBox.nonSmoothDynamicalSystem().insertDynamicalSystem(body)

#
# Simulation
#

# (1) OneStepIntegrators
osi = MoreauJeanOSI(theta)
osi.insertDynamicalSystem(body)

ground = btCollisionObject()
ground.setCollisionFlags(btCollisionObject.CF_STATIC_OBJECT)
groundShape = btBoxShape(btVector3(30, 30, .5))
开发者ID:yushuiqiang,项目名称:siconos,代码行数:31,代码来源:BulletBouncingBoxDynamic.py


示例11: test_diode_bridge

def test_diode_bridge():
    """Build diode bridge model"""
    # dynamical system
    bridge_ds = FirstOrderLinearDS(init_state, A)
    # interaction
    diode_bridge_relation = FirstOrderLinearTIR(C, B)
    diode_bridge_relation.setDPtr(D)

    nslaw = ComplementarityConditionNSL(4)
    bridge_interaction = Interaction(4, nslaw, diode_bridge_relation, 1)

    # Model
    diode_bridge = Model(t0, total_time, model_title)

    #  add the dynamical system in the non smooth dynamical system
    diode_bridge.nonSmoothDynamicalSystem().insertDynamicalSystem(bridge_ds)

    #   link the interaction and the dynamical system
    diode_bridge.nonSmoothDynamicalSystem().link(bridge_interaction, bridge_ds)

    # Simulation

    # (1) OneStepIntegrators
    theta = 0.5
    integrator = EulerMoreauOSI(theta)
    # (2) Time discretisation
    time_discretisation = TimeDiscretisation(t0, time_step)

    # (3) Non smooth problem
    non_smooth_problem = LCP()

    # (4) Simulation setup with (1) (2) (3)
    bridge_simulation = TimeStepping(time_discretisation,
                                     integrator, non_smooth_problem)

    # simulation initialization
    diode_bridge.setSimulation(bridge_simulation)
    diode_bridge.initialize()
    k = 0
    h = bridge_simulation.timeStep()
    # Number of time steps
    N = (total_time - t0) / h

    # Get the values to be plotted
    # ->saved in a matrix dataPlot
    data_plot = empty([N, 8])

    x = bridge_ds.x()
    print("Initial state : ", x)
    y = bridge_interaction.y(0)
    print("First y : ", y)
    lambda_ = bridge_interaction.lambda_(0)

    # For the initial time step:
    # time
    data_plot[k, 0] = t0

    #  inductor voltage
    data_plot[k, 1] = x[0]

    # inductor current
    data_plot[k, 2] = x[1]

    # diode R1 current
    data_plot[k, 3] = y[0]

    # diode R1 voltage
    data_plot[k, 4] = - lambda_[0]

    # diode F2 voltage
    data_plot[k, 5] = - lambda_[1]

    # diode F1 current
    data_plot[k, 6] = lambda_[2]

    # resistor current
    data_plot[k, 7] = y[0] + lambda_[2]

    k += 1
    while k < N:
        bridge_simulation.computeOneStep()
        #non_smooth_problem.display()
        data_plot[k, 0] = bridge_simulation.nextTime()
        #  inductor voltage
        data_plot[k, 1] = x[0]
        # inductor current
        data_plot[k, 2] = x[1]
        # diode R1 current
        data_plot[k, 3] = y[0]
        # diode R1 voltage
        data_plot[k, 4] = - lambda_[0]
        # diode F2 voltage
        data_plot[k, 5] = - lambda_[1]
        # diode F1 current
        data_plot[k, 6] = lambda_[2]
        # resistor current
        data_plot[k, 7] = y[0] + lambda_[2]
        k += 1
        bridge_simulation.nextStep()

#.........这里部分代码省略.........
开发者ID:radarsat1,项目名称:siconos,代码行数:101,代码来源:test_diode_bridge.py


示例12: test_smc1

def test_smc1():
    from siconos.kernel import FirstOrderLinearDS, Model, TimeDiscretisation, \
        TimeStepping, ZeroOrderHoldOSI, TD_EVENT
    from siconos.control.simulation import ControlManager
    from siconos.control.sensor import LinearSensor
    from siconos.control.controller import LinearSMCOT2
    from numpy import eye, empty, zeros
    import numpy as np
    from math import ceil, sin

    # Derive our own version of FirstOrderLinearDS
    class MyFOLDS(FirstOrderLinearDS):
        def computeb(self, time):
            t = sin(50*time)
            # XXX fix this !
            u = [t, -t]
            self.setb(u)

    # variable declaration
    ndof = 2   # Number of degrees of freedom of your system
    t0 = 0.0   # start time
    T = 1    # end time
    h = 1.0e-4  # time step for simulation
    hControl = 1.0e-2  # time step for control
    Xinit = 1.0  # initial position
    N = ceil((T-t0)/h + 10)  # number of time steps
    outputSize = 4  # number of variable to store at each time step

    # Matrix declaration
    A = zeros((ndof, ndof))
    x0 = [Xinit, -Xinit]
    Brel = np.array([[0], [1]])
    sensorC = eye(ndof)
    sensorD = zeros((ndof, ndof))
    Csurface = [[0, 1.0]]

    # Simple check
    if h > hControl:
        print("hControl must be bigger than h")
        exit(1)

    # Declaration of the Dynamical System
    processDS = MyFOLDS(x0, A)
    # XXX b is not automatically created ...
#    processDS.setb([0, 0])
    # Model
    process = Model(t0, T)
    process.nonSmoothDynamicalSystem().insertDynamicalSystem(processDS)
    # time discretization
    processTD = TimeDiscretisation(t0, h)
    tSensor = TimeDiscretisation(t0, hControl)
    tActuator = TimeDiscretisation(t0, hControl)
    # Creation of the Simulation
    processSimulation = TimeStepping(processTD, 0)
    processSimulation.setName("plant simulation")
    # Declaration of the integrator
    processIntegrator = ZeroOrderHoldOSI()
    process.nonSmoothDynamicalSystem().setOSI(processDS, processIntegrator)
    processSimulation.insertIntegrator(processIntegrator)
    # Actuator, Sensor & ControlManager
    control = ControlManager(processSimulation)
    sens = LinearSensor(processDS, sensorC, sensorD)

    control.addSensorPtr(sens, tSensor)
    act = LinearSMCOT2(sens)
    act.setCsurface(Csurface)
    act.setB(Brel)
    control.addActuatorPtr(act, tActuator)

    # Initialization.
    process.initialize(processSimulation)
    control.initialize(process)
    # This is not working right now
    # eventsManager = s.eventsManager()

    # Matrix for data storage
    dataPlot = empty((3*(N+1), outputSize))
    dataPlot[0, 0] = t0
    dataPlot[0, 1] = processDS.x()[0]
    dataPlot[0, 2] = processDS.x()[1]
    dataPlot[0, 3] = act.u()[0]

    # Main loop
    k = 1
    while processSimulation.hasNextEvent():
        if processSimulation.eventsManager().nextEvent().getType() == TD_EVENT:
            processSimulation.computeOneStep()
        dataPlot[k, 0] = processSimulation.nextTime()
        dataPlot[k, 1] = processDS.x()[0]
        dataPlot[k, 2] = processDS.x()[1]
        dataPlot[k, 3] = act.u()[0]
        k += 1
        processSimulation.nextStep()
    #    print processSimulation.nextTime()
    # Resize matrix
    dataPlot.resize(k, outputSize)
开发者ID:xhub,项目名称:siconos,代码行数:96,代码来源:test_smc.py


示例13: run

    def run(self,
            with_timer=False,
            time_stepping=None,
            space_filter=None,
            body_class=None,
            shape_class=None,
            face_class=None,
            edge_class=None,
            length_scale=1,
            t0=0,
            T=10,
            h=0.0005,
            multipoints_iterations=True,
            theta=0.50001,
            Newton_max_iter=20,
            set_external_forces=None,
            solver=Numerics.SICONOS_FRICTION_3D_NSGS,
            itermax=100000,
            tolerance=1e-8):
        """
        Run a simulation from inputs in hdf5 file.
        parameters are:
          with_timer : use a timer for log output (default False)
          length_scale : gravity is multiplied by this factor.
                         1.     for meters (default).
                         1./100 for centimeters.
                         This parameter may be needed for small
                         objects because of Bullet collision margin (0.04).

          t0 : starting time (default 0)
          T  : end time      (default 10)
          h  : timestep      (default 0.0005)
          multiPointIterations : use bullet "multipoint iterations"
                                 (default True)
          theta : parameter for Moreau-Jean OSI (default 0.50001)
          Newton_max_iter : maximum number of iterations for
                          integrator Newton loop (default 20)
          set_external_forces : method for external forces
                                (default earth gravity)
          solver : default Numerics.SICONOS_FRICTION_3D_NSGS
          itermax : maximum number of iteration for solver
          tolerance : friction contact solver tolerance

        """

        from siconos.kernel import \
            Model, MoreauJeanOSI, TimeDiscretisation,\
            GenericMechanical, FrictionContact, NewtonImpactFrictionNSL

        from siconos.numerics import SICONOS_FRICTION_3D_ONECONTACT_NSN_AC

        from siconos.mechanics.contact_detection.bullet import \
            btConvexHullShape, btCollisionObject, \
            btBoxShape, btQuaternion, btTransform, btConeShape, \
            BulletSpaceFilter, cast_BulletR, \
            BulletWeightedShape, BulletDS, BulletTimeStepping

        if set_external_forces is not None:
            self._set_external_forces = set_external_forces

        if time_stepping is None:
            time_stepping = BulletTimeStepping

        if space_filter is None:
            space_filter = BulletSpaceFilter

        # Model
        #
        model = Model(t0, T)

        # (1) OneStepIntegrators
        joints = list(self.joints())

        self._osi = MoreauJeanOSI(theta)

        # (2) Time discretisation --
        timedisc = TimeDiscretisation(t0, h)

        if len(joints) > 0:
            osnspb = GenericMechanical(SICONOS_FRICTION_3D_ONECONTACT_NSN_AC)
        else:
            osnspb = FrictionContact(3, solver)

        osnspb.numericsSolverOptions().iparam[0] = itermax
        osnspb.numericsSolverOptions().dparam[0] = tolerance
        osnspb.setMaxSize(16384)
        osnspb.setMStorageType(1)
        #osnspb.setNumericsVerboseMode(False)

        # keep previous solution
        osnspb.setKeepLambdaAndYState(True)

        # (5) broadphase contact detection
        self._broadphase = space_filter(model)
        if not multipoints_iterations:
            print("""
            ConvexConvexMultipointIterations and PlaneConvexMultipointIterations are unset
            """)
        else:
            if hasattr(self._broadphase, 'collisionConfiguration'):
#.........这里部分代码省略.........
开发者ID:xhub,项目名称:siconos,代码行数:101,代码来源:mechanics_io.py


示例14: test_diodebridge1

def test_diodebridge1():
    from siconos.kernel import FirstOrderLinearDS, FirstOrderLinearTIR, \
                               ComplementarityConditionNSL, Interaction,\
                               Model, EulerMoreauOSI, TimeDiscretisation, LCP,  \
                               TimeStepping
    from numpy import empty
    from siconos.kernel import SimpleMatrix, getMatrix
    from numpy.linalg import norm

    t0 = 0.0
    T = 5.0e-3       # Total simulation time
    h_step = 1.0e-6  # Time step
    Lvalue = 1e-2  # inductance
    Cvalue = 1e-6   # capacitance
    Rvalue = 1e3    # resistance
    Vinit = 10.0    # initial voltage
    Modeltitle = "DiodeBridge"

    #
    # dynamical system
    #

    init_state = [Vinit, 0]

    A = [[0,          -1.0/Cvalue],
         [1.0/Lvalue, 0          ]]

    LSDiodeBridge=FirstOrderLinearDS(init_state, A)

    #
    # Interactions
    #

    C = [[0.,   0.],
         [0,    0.],
         [-1.,  0.],
         [1.,   0.]]

    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=FirstOrderLinearTIR(C, B)
    LTIRDiodeBridge.setDPtr(D)

    LTIRDiodeBridge.display()
    nslaw=ComplementarityConditionNSL(4)
    InterDiodeBridge=Interaction(4, nslaw, LTIRDiodeBridge, 1)


    #
    # Model
    #
    DiodeBridge=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 = EulerMoreauOSI(LSDiodeBridge, theta)

    # (2) Time discretisation
    aTiDisc = TimeDiscretisation(t0, h_step)

    # (3) Non smooth problem
    aLCP = LCP()

    # (4) Simulation setup with (1) (2) (3)
    aTS = TimeStepping(aTiDisc, aOSI, aLCP)

    # end of model definition

    #
    # computation
    #

    # simulation initialization
    DiodeBridge.initialize(aTS)

    k = 0
    h = aTS.timeStep()
    print("Timestep : ", h)
    # Number of time steps
    N = (T-t0)/h
    print("Number of steps : ", N)

    # Get the values to be plotted
    # ->saved in a matrix dataPlot
#.........这里部分代码省略.........
开发者ID:fperignon,项目名称:siconos,代码行数:101,代码来源:test_diode_bridge.py



注:本文中的siconos.kernel.Model类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python kernel.TimeStepping类代码示例发布时间:2022-05-27
下一篇:
Python Show.Show类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap