Hybrid Systems Simulation Toolbox for Matlab/Simulink (HyEQ)
The Hybrid Equation (HyEQ) Toolbox provides MATLAB and Simulink libraries for the simulation of hybrid dynamical systems. The HyEQ Toolbox supports definitions of hybrid systems with inputs, allowing for the creation of interconnected hybrid systems in modular configurations. The hybrid arcs produced by simulations can be transformed and plotted with a suite of tools that allow easy customization. Stable and beta releases of the HyEQ toolbox are available via the MathWorks File Exchange or through the built-in MATLAB add-on browser. Detailed documentation and numerous examples are provided in the MATLAB Help browser or at hyeq.github.io.
Mathematical Model
A hybrid system is a dynamical system with continuous and discrete dynamics. Several mathematical models for hybrid systems have appeared in the literature. In these files, we consider the framework for hybrid systems used in [3,4], where a hybrid system is defined by a set C called the flow set, a function f called the flow map, a set D called the jump set, a function g called the jump map, and a set O called the state space. This can be written mathematically as
Requirements:
MATLAB R2014b or newer, Simulink (optional), C-compiler (optional).
Downloads
Current stable version (v2.04): http://www.mathworks.com/matlabcentral/fileexchange/41372-hybrid-equations-toolbox-v2-04
New beta version: https://www.mathworks.com/matlabcentral/fileexchange/102239-hybrid-equations-toolbox-beta
Other Resources:
1) Online HyEQ Toolbox Webinar at Mathworks website: http://www.mathworks.com/videos/hyeq-a-toolbox-for-simulation-of-hybrid-dynamical-systems-81992.html
2) The Hybrid Simulator blog: https://hybridsimulator.wordpress.com
3) SummerSim 2014 paper on a symbolic hybrid simulator: The files associated with the examples in our SummerSim 2014 paper are available here: SummerSim14Examples.zip
4) HSCC paper 74 on the hybrid simulator: The files associated with the examples in our HSCC 2013 paper (see 74) are available here
Previous versions of the HyEQ Toolbox not posted at Matlab Central:
Changelog:
10/15/2024: Version 3.0. Extensive updates. See the changelog here.
05/17/17: Version 2.04. Hybrid Equations Simulator.
A new version of the simulator is available! The main new features are:
1) Compatibility issues with matlab 2014-2016 are now solved.
2) Instructions file updated.
3) New examples and html files.
4) Now is possible to solve DAE equations as a flow maps.
04/10/16: Version 2.03. Hybrid Equations Simulator.
The main new features of this new version are:
1) New zero events code in the lite HyEQ simulator
2) Instructions file updated
3) New help html files
4) Smaller installation file
5) Cyber-Physical Systems CPS blocks in the Simulink library (interconnected systems)
6) CPS examples
7) Problems in installation for 2014b are now solved
8) Now is possible to select which ode solver the lite HyEQsolver is going to use
9) New plot functions for pre and post-2014 b plot behaviour
04/29/14: version 2.01. Hybrid Equations Simulator.
The main changes from 2.0 to 2.01 are:
1) Added two new plotting functions plotHarcColor and plotHarcColor3D
2) All functions have now the standard head (H1) help line (which is required to search functions such as "lookfor", e.g., >> lookfor HyEQ, or >> lookfor hybrid)
3) Functions plotC and plotD were removed (none of examples uses those functions)
4) New help environment for all functions were created (with examples inclued), e.g.,
>> help HyEQ_Toolbox_V201
>> help HyEQsolver
>> help plotflows
>> help plotHarc
>> help plotHarcColor
>> help plotHarcColor3D
>> help plotHybridArc
>> help plotjumps
>> helpwin HyEQ_Toolbox_V2_01
5) Some of the postprocessig files in the examples (simulink) were edited to include the new plotting functions.
04/18/12: version 2.0. Hybrid Equations Simulator.
Additions from previous version:
1) Elimination of the maxStepCoefficient variable for the lite simulator.
2) Fixed bugs in HyEQsolver.m.
3) New simulink library for hybrid systems with and without inputs.
4) Three hybrid system blocks are defined in the library: i) A hybrid system without input and without embedded C code blocks, ii) A hybrid system without inputs and with embedded C code blocks (for fast computation time), and iii) A hybrid system with inputs and with embedded C code blocks.
5) Examples added in the Simulink library and help files for each case.
6) New install file that copies the required files, such as plot scripts and simulation scripts, to Matlab's path.
7) New function (plotHarc) for plotting and segmentation of hybrid arcs.
8) The "u(3) block" inside the Integrator system has been removed.
9) Initialization and plot buttons have been changed to allow the users to select initialization and postprocessing scripts.
01/10/12: version 1.0. Hybrid Equations Simulator. Additions from previous version:
1) deleted global variables, now set as inputs/parameters 2) added "u" as an input into each embedded function 3) jump logic and update logic implemented using only Simulink blocks 4) masked integrator system 5) added option of not saving flowSet and jumpSet variables 6) removed "O" globally
08/09/11: version 0.6. Additions from previous version:
1) Deleted 'sim' command in initialization.m. 2) Variables for solver tolerances in initialization.m. 3) Changed u- to u.
02/16/11: version 0.5. Additions from previous version:
1) Embedded functions. 2) Initialization and postprocessing double-click blocks. (initialization.m and postprocessing.m)(Got rid of run.m) 3) Changed ' notation to - (e.g. x' is now x-). 4) Lite simulator
12/31/10: version 0.4. Additions from previous version:
1) Interconnection example.
04/21/08: version 0.3. Additions from previous version:
1) Blocks renamed.
10/22/07: version 0.2. Additions from previous version:
1) Global variables.
05/25/07: version 0.1. Additions from previous version:
1) Stop Logic. 2) Rules for priority of flows and jumps.
References:
[74] Sanfelice, R. G., Copp, D., Nanez, P. A Toolbox for Simulation of Hybrid Systems in Matlab/Simulink: Hybrid Equations (HyEQ) Toolbox In Proceedings of Hybrid Systems: Computation and Control Conference, 2013.
[2] http://control.ee.ethz.ch/~ifaatic/ex/example1.m. Institut für Automatik - Automatic Control Laboratory, ETH Zurich, 2011.
[3] R. Goebel, R. G. Sanfelice, and A. R. Teel, Hybrid dynamical systems. IEEE Control Systems Magazine, 28-93, 2009.
[4] R. G. Sanfelice and A. R. Teel, Dynamical Properties of Hybrid Systems Simulators. Automatica, 46, No. 2, 239--248, 2010.
[5] Ricardo G. Sanfelice, Interconnections of Hybrid Systems: Some Challenges and Recent Results. 2011.
Research supported by NSF, ARO, AFOSR, Mathworks, and Honeywell.
Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.