本文整理汇总了Python中PyDSTool.makeModelInfoEntry方法的典型用法代码示例。如果您正苦于以下问题:Python PyDSTool.makeModelInfoEntry方法的具体用法?Python PyDSTool.makeModelInfoEntry怎么用?Python PyDSTool.makeModelInfoEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyDSTool
的用法示例。
在下文中一共展示了PyDSTool.makeModelInfoEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_model
# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import makeModelInfoEntry [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
示例2: create_model
# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import makeModelInfoEntry [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