当前位置: 首页>>代码示例>>Python>>正文


Python PyDSTool.makeZeroCrossEvent方法代码示例

本文整理汇总了Python中PyDSTool.makeZeroCrossEvent方法的典型用法代码示例。如果您正苦于以下问题:Python PyDSTool.makeZeroCrossEvent方法的具体用法?Python PyDSTool.makeZeroCrossEvent怎么用?Python PyDSTool.makeZeroCrossEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyDSTool的用法示例。


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

示例1: event1

# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import makeZeroCrossEvent [as 别名]
def event1(params):

    event_args = {'name': 'event_melt_begin',
                  'eventtol': params.RelTol,
                  'active': True,
                  'term': True}

    event_melt_begin = PyDSTool.makeZeroCrossEvent('Tmelt - Tp', 0, event_args, varnames=['Tp'], parnames=['Tmelt'])

    return event_melt_begin
开发者ID:blopperman,项目名称:swhs,代码行数:12,代码来源:event.py

示例2: event2

# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import makeZeroCrossEvent [as 别名]
def event2(params):

    event_args = {'name': 'event_melt_end',
                  'eventtol': params.RelTol,
                  'active': True,
                  'term': True}

    event_melt_end = PyDSTool.makeZeroCrossEvent('Qp / (Hf * Mp) - 1', 0, event_args, varnames=['Qp'], parnames=['Hf', 'Mp'])

    return event_melt_end
开发者ID:blopperman,项目名称:swhs,代码行数:12,代码来源:event.py

示例3: create_model

# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import makeZeroCrossEvent [as 别名]
def create_model():
    pars = {'g': 9.8}#, 'pi': np.pi}

    #ODE
    ode_def = {
           'x': 'vx',
           'y': 'vy',
           'vx': '-(pi**2)*x',
           'vy': '-g',
           'tt': '1.0',
            }
    event_bounce = dst.makeZeroCrossEvent(
            'x-y', 1,
            {'name': 'bounce',
             'eventtol': 1e-3,
             'term': True,
             'active': True,
             'eventinterval': 1,
             'eventdelay': 1e-2,
             'starttime': 0,
             'precise': True
             },
            varnames=['x', 'y'],
            targetlang='python')  # targetlang is redundant (defaults to python)

    DSargs = dst.args(name='bball_sin')  # struct-like data
    DSargs.events = [event_bounce]
    #DSargs.pars = pars
    #DSargs.tdata = [0, 10]
    #DSargs.algparams = {'max_pts': 3000, 'stiff': False}
    DSargs.algparams = {'stiff': False, 'init_step': 0.01}
    DSargs.varspecs = ode_def
    DSargs.pars = pars
    #DSargs.xdomain = {'y': [0, 100]}

    DS_fall = dst.embed(dst.Generator.Vode_ODEsystem(DSargs))
    DS_fall_MI = dst.intModelInterface(DS_fall)

    # Reset
    ev_map = dst.EvMapping({'y': 'x+0.001', 'vy': '0.9*(vx-vy)'}, model=DS_fall)
    #ev_map = dst.EvMapping({'y': '10', 'x': '20'}, model=DS_fall)

    DS_BBall = dst.makeModelInfoEntry(DS_fall_MI, ['bball_sin'],
                                      [('bounce', ('bball_sin', ev_map))])

    modelInfoDict = dst.makeModelInfo([DS_BBall])
    bball_sin_model = dst.Model.HybridModel(
            {'name': 'Bouncing_Ball_Sinusiodal', 'modelInfo': modelInfoDict})
    return bball_sin_model
开发者ID:zutshi,项目名称:S3CAMR,代码行数:51,代码来源:bball_sin1_pdst.py

示例4: create_model

# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import makeZeroCrossEvent [as 别名]
def create_model():
    pars = {'g': 1}
    icdict = {'y': 5, 'vy': 0}

    y_str = 'vy'
    vy_str = '-g'

    event_bounce = dst.makeZeroCrossEvent('y', 0,
                                {'name': 'bounce',
                                 'eventtol': 1e-3,
                                 'term': True,
                                 'active': True},
                        varnames=['y'],
                        parnames=['g'],
                        targetlang='python')  # targetlang is redundant (defaults to python)

    DSargs = dst.args(name='bball')  # struct-like data
    DSargs.events = [event_bounce]
    #DSargs.pars = pars
    #DSargs.tdata = [0, 10]
    #DSargs.algparams = {'max_pts': 3000, 'stiff': False}
    DSargs.algparams = {'stiff': False}
    DSargs.varspecs = {'y': y_str, 'vy': vy_str}
    DSargs.pars = pars
    #DSargs.xdomain = {'y': [0, 100], 'vy': [-100, 100]}

    DSargs.ics = icdict

    DS_fall = dst.embed(dst.Generator.Vode_ODEsystem(DSargs))
    DS_fall_MI = dst.intModelInterface(DS_fall)

    ev_map = dst.EvMapping({'y': 0, 'vy': '-0.75*vy'}, model=DS_fall)

    DS_BBall = dst.makeModelInfoEntry(DS_fall_MI, ['bball'],
                                      [('bounce', ('bball', ev_map))])

    modelInfoDict = dst.makeModelInfo([DS_BBall])
    bball_model = dst.Model.HybridModel({'name': 'Bouncing_Ball', 'modelInfo': modelInfoDict})
    return bball_model
开发者ID:zutshi,项目名称:S3CAMR,代码行数:41,代码来源:bball_2dim.py

示例5: redundant

# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import makeZeroCrossEvent [as 别名]
import PyDSTool as dst
from PyDSTool import args
import numpy as np
from matplotlib import pyplot as plt


pars = {'eps': 1e-2, 'a': 0.5}
icdict = {'x': pars['a'],
          'y': pars['a'] - pars['a']**3/3}
xstr = '(y - (x*x*x/3 - x))/eps'
ystr = 'a - x'

event_x_a = dst.makeZeroCrossEvent('x-a', 0,
                            {'name': 'event_x_a',
                             'eventtol': 1e-6,
                             'term': False,
                             'active': True},
                    varnames=['x'], parnames=['a'],
                    targetlang='python')  # targetlang is redundant (defaults to python)

DSargs = args(name='vanderpol')  # struct-like data
DSargs.events = [event_x_a]
DSargs.pars = pars
DSargs.tdata = [0, 3]
DSargs.algparams = {'max_pts': 3000, 'init_step': 0.02, 'stiff': True}
DSargs.varspecs = {'x': xstr, 'y': ystr}
DSargs.xdomain = {'x': [-2.2, 2.5], 'y': [-2, 2]}
DSargs.fnspecs = {'Jacobian': (['t','x','y'],
                                """[[(1-x*x)/eps, 1/eps ],
                                    [ -1,  0 ]]""")}
DSargs.ics = icdict
开发者ID:F-A,项目名称:pydstool,代码行数:33,代码来源:Tutorial_VdP.py

示例6: redundant

# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import makeZeroCrossEvent [as 别名]
import PyDSTool as dst
from PyDSTool import args
import numpy as np
from matplotlib import pyplot as plt


pars = {"eps": 1e-2, "a": 0.5}
icdict = {"x": pars["a"], "y": pars["a"] - pars["a"] ** 3 / 3}
xstr = "(y - (x*x*x/3 - x))/eps"
ystr = "a - x"

event_x_a = dst.makeZeroCrossEvent(
    "x-a",
    0,
    {"name": "event_x_a", "eventtol": 1e-6, "term": False, "active": True},
    varnames=["x"],
    parnames=["a"],
    targetlang="python",
)  # targetlang is redundant (defaults to python)

DSargs = args(name="vanderpol")  # struct-like data
DSargs.events = [event_x_a]
DSargs.pars = pars
DSargs.tdata = [0, 3]
DSargs.algparams = {"max_pts": 3000, "init_step": 0.02, "stiff": True}
DSargs.varspecs = {"x": xstr, "y": ystr}
DSargs.xdomain = {"x": [-2.2, 2.5], "y": [-2, 2]}
DSargs.fnspecs = {
    "Jacobian": (
        ["t", "x", "y"],
        """[[(1-x*x)/eps, 1/eps ],
开发者ID:harishbabu007,项目名称:compneuro,代码行数:33,代码来源:WC_2D_needs_finishing.py


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