test_numeric_switchedsystem.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:simupy 作者: sixpearls 项目源码 文件源码
def test_event_equation_function(switch_fixture):
    sys = SwitchedSystem(
        dim_output=1,
        event_variable_equation_function=event_variable_equation_function,
        event_bounds=switch_fixture[0],
        state_equations_functions=switch_fixture[1],
        output_equations_functions=switch_fixture[2],
    )

    assert sys.state_update_equation_function == full_state_output

    for x in np.linspace(bounds_min, bounds_max):
        if not np.any(np.isclose(x, switch_fixture[0])):
            assert ~np.any(np.isclose(
                sys.event_equation_function(x, x),
                0
            ))

    for zero in switch_fixture[0]:
        npt.assert_allclose(
            sys.event_equation_function(len(switch_fixture[0]), zero),
            0
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号