-
Notifications
You must be signed in to change notification settings - Fork 10
Channel statespace #102
Extended statespace systems
An ExtendedStateSpace system represents a two-input, two-output system.
A ChannelStateSpace represents a statespace system with open and closed input-output channels, like the example shown in the block diagram below. There is one open channel, AbstractBlock. The blocks in the diagram are just examples. The ChannelStateSpace type represents the entire structure in the block diagram, including
z ┌─────────┐ w
◄─────────┤ │◄────────── # Performance channel (open)
│ │
┌─────────┤ │◄─────────┐
│ │ │ │
│ ┌───────┤ P │◄───────┐ │
│ │ │ │ │ │
│ │ ┌─────┤ │◄─────┐ │ │
│ │ │ │ │ │ │ │
│ │ │y┌───┤ │◄───┐u│ │ │
│ │ │ │ └─────────┘ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ ┌───┐ │ │ │ │
│ │ │ └─────►│ K ├───────┘ │ │ │ # Feedback channel
│ │ │ └───┘ │ │ │
│ │ │ │ │ │
│ │ │ ┌───┐ │ │ │
│ │ └───────►│ Δ ├─────────┘ │ │ # Uncertainty channel
│ │ └───┘ │ │
│ │ │ │
│ │ ┌───┐ │ │
│ └─────────►│ τ ├───────────┘ │ # Delay channel
│ └───┘ │
│ │
│ ┌───┐ │
└───────────►│LPV├─────────────┘ # Linear parameter-varying channel
└───┘
Internally, ChannelStateSpace maintains a vector of IOChannels.
Channels
An IOChannel represents a mapping from inputs to outputs through a dynamical system
- A type parameter
TinIOChannel{T}that specifies the type of the channel. - A name (
Symbol) for the entire group of inputsu, and one name for the group of outputsy. - A vector of the names of all individual inputs
usand one vector for the outputsys. - A vector of
blocksthrough which the channel is closed. If the channel is open, this vector is empty.
Use isopen, isclosed to figure out if a channel is open or closed.
Channels are always sorted internally such that channels that are open are stored first, and closed channels last (technicalities applies, see below). In this way, the ChannelStateSpace type can be seen as a specialization of ExtendedStateSpace where there is an additional partitioning of the two input and output channels.
The following channels are defined in this package
subtypes(AbstractChannelType)
A channel does not include the connection and dynamics matrices, i.e., the tuple ExtendedStateSpace type, that could not be represented like this. Instead, the ChannelStateSpace maintains an inner ExtendedStateSpace object, and the channels are placed in the upper or lower channel of the ExtendedStateSpace based on their algebraic properties, more on this in Algebraic behavior of channels
Alternatively a single matrix is stored, from which the A matrix is obtain by looking at the integrator channel or the unit delay channel respectively (continuous / discrete).
Blocks
A closed channel is closed through an AbstractBlock. Typical examples include
- Uncertainty channel, closed through an
UncertainElement. - Delay channel, closed through pure delay elements (no type for delay element exists yet).
- Integrating channel closed through integrator
- Nonlinear channel (
HammersteinWienerSystem)
Algebraic behavior of channels
When two systems s1,s2 are connected in series s1*s2, standard statespace systems connect the outputs of s2 to the inputs of s1, and the resulting product system has the outputs of s1 and the inputs of s2. In the ChannelStateSpace type, this type of behavior is represented by the DefaultChannel. This is an open channel that behaves just like an ordinary StateSpace system.
Closed-channels, on the other hand, do not behave like this, rather, if two systems with closed channels of the same type are connected in series, the closed channel grows in size to include the input-output mappings of both systems, and the corresponding channel of the product system contains the blocks from both systems.
Typically, open channels behave like the standard StateSpace type, and closed channels "append" rather than series, but there are some exceptions:
- A
ConstrainedChannelrepresents outputs that a constrained to lie within some constraint set, e.g., for MPC applications. AConstrainedChannelis not closed around anything, and is thus to be considered open, but when two systems are connected, all constrained outputs should be outputs of the connected system.
An example of when this situation comes up is given below.
The system
which, if StateSpace, would have new inputs and outputs
Since the open/closedness of a channel doesn't always indicate the algebraic properties of a channel, we instead make use of a trait-based solution. Each channel type defines an implementation of the function algebraic_trait which returns either SeriesTrait or AppendTrait, indicating its behavior when systems are multiplied. The inner ExtendedStateSpace of a ChannelStateSpace is thus technically not partitioned based on open and closed channels, rather, it's partitioned based on the algebraic_trait.
Promotion
Before two systems can interact through algebraic operations, they must be promoted to a common supertype. In this case, the supertype is the ChannelStateSpace that contains the union of all the channel types of both systems. The channels that were added in the promotion step are simply empty, i.e., contains no signals and no blocks.
LTISystem objects that are not instances of ChannelStateSpace are promoted to a ChannelStateSpace with the DefaultChannel type.
LFT on ChannelStateSpace
The literature commonly talks about "upper" and "lower" linear fractional transforms. The terminology upper/lower comes from the TITO system view (ExtendedStateSpace) where the lower LFT (lft(P, K, :l)) closes the lower loop around K. For ChannelStateSpace types, the terms upper and lower have no meaning since we do no longer have the TITO convention, instead, channels are typed and we refer to the type of the channel we want to close in the LFT, e.g.,
lft(P, K, DefaultChannel)closes the default channel over DefaultChannel is a bit special, since K is a regular LTISystem, the resulting "closed-loop" system no longer has a DefaultChannel (we never keep standard LTISystems as blocks of a ChannelStateSpace). You can only call lft on open channels, since closed channels are by definition already a closed LFT, lft(P, block, ch).
Creating ChannelStateSpace
Any LTISystem can be converted to a ChannelStateSpace by calling the constructor shorthand css(sys), this gives them a DefaultChannel. Special kinds of ChannelStateSpace systems have their own constructors, such as an uncertain statespace model, with the constructor uss.
If you would like to manually create a ChannelStateSpace system with specified channels, call
css(sys, channels...)
where channels::IOChannel... contain indices into the system sys. Indices that are not present in any of the channels will be placed in the default channel.
Case studies
QUESTION: is connect the interface we want, where all subsystems are specified and blocks etc. as well? Avoids having to work out default algebra rules for all channel types, that may or may not align with what people expect. Maybe channles for which it is ambiguous do not have rules defined, instead, all algebra must be done on those before they are added to the ChannelStateSpace. UncertaintyChannel etc. must have algebra defined though, otherwise W2*P*W1 will not work
QUESTION: make the interface such that it works well for when we have a block-diagram editor
Let sys denote a system model of type StateSpace.
Add a performance output to a system model
To add all outputs of sys as performance outputs, do
performance(I)*sys
to add all inputs to the performance mapping, e.g., indicating references, do
sys*performance(I)
MISC ideas
SHould the continuous-time integrator channel and various discrete-time delay channels also be represented? IF we do, we could represent multi-rate hybrid systems.