Types

This section describes types implemented in HybridSystems.jl.

Hybrid systems

HybridSystems.HybridSystemType
HybridSystem{A, S, R, W, SV<:AbstractVector{S}, RV<:AbstractVector{R}, RW<:AbstractVector{W}} <: AbstractHybridSystem

A hybrid system modelled as a hybrid automaton.

Fields

  • automaton – hybrid automaton of type A.
  • modes – vector of modes of type S indexed by the discrete states, both the domain and the dynamic are stored in this field. See stateset to access the domain.
  • resetmaps – vector of reset maps of type R indexed by the label of the transition, the guard is stored as constraint of the map in this field. See stateset to access the guard.
  • switchings – vector of switchings of type W indexed by the label of the transition, see AbstractSwitching.
  • ext – dictionary that can be used by extensions.

Notes

The automaton automaton of type A models the different discrete states and the allowed transitions with corresponding labels.

The mode dynamic and domain are stored in a continuous dynamical system of type S in the vector modes. They are indexed by the discrete states of the automaton.

The reset maps and guards are given as a map or a discrete dynamical system of type R in the vector resetmaps. They are indexed by the labels of the corresponding transition.

The switching of type W is given in the switchings vector, indexed by the label of the transition.

Additional data can be stored in the ext field.

Examples

See the Thermostat example.

source

Automata

HybridSystems.GraphAutomatonType
GraphAutomaton{GT, ET} <: AbstractAutomaton

A hybrid automaton that uses the Graphs backend. See the constructor GraphAutomaton(::Int).

Fields

  • G – graph of type GT whose vertices determine the states
  • Σ – dictionary mapping the edges to their labels
source
HybridSystems.GraphAutomatonMethod
GraphAutomaton(n::Int)

Creates a GraphAutomaton with n states 1, 2, ..., n. The automaton is initialized without any transitions, use add_transition! to add transitions.

Examples

To create an automaton with 2 nodes 1, 2, self-loops of labels 1, a transition from 1 to 2 with label 2 and transition from 2 to 1 with label 3, do the following:

julia> a = GraphAutomaton(2);

julia> add_transition!(a, 1, 1, 1) # Add a self-loop of label 1 for state 1
HybridSystems.GraphTransition{Graphs.SimpleGraphs.SimpleEdge{Int64}}(Edge 1 => 1, 1)

julia> add_transition!(a, 2, 2, 1) # Add a self-loop of label 1 for state 2
HybridSystems.GraphTransition{Graphs.SimpleGraphs.SimpleEdge{Int64}}(Edge 2 => 2, 2)

julia> add_transition!(a, 1, 2, 2) # Add a transition from state 1 to state 2 with label 2
HybridSystems.GraphTransition{Graphs.SimpleGraphs.SimpleEdge{Int64}}(Edge 1 => 2, 3)

julia> add_transition!(a, 2, 1, 3) # Add a transition from state 2 to state 1 with label 3
HybridSystems.GraphTransition{Graphs.SimpleGraphs.SimpleEdge{Int64}}(Edge 2 => 1, 4)
source
HybridSystems.GraphTransitionIteratorType
struct GraphTransitionIterator{GT, ET, VT}
    automaton::GraphAutomaton{GT, ET}
    edge_iterator::VT
end

Iterate over the transitions of automaton by iterating over the edges edge of edge_iterator and the ids id of automaton.Σ[edge] for each one. Its elements are GraphTransition(edge, id).

source

Switchings