Introduction to state-space models in LTPDA

Introducing state-space models in LTPDA

State-space models in LTPDA are encapsulated by the ssm class. Building state-space models by hand, while possible, is complicated and beyond the scope of this training session. The most useful class constructor we can use for building ssm objects is the one that builds from built-in models.

For the purposes of this training session, we can treat the resulting state-space models as black boxes. They have inputs and outputs and describe a system in terms of a state-space realisation of the system's dynamical response. More details about the implementation is provided in the main LTPDA user manual.

State-space model objects in LTPDA are structured in the following way. Each model has a number of

Each block has a number of ports. The exact numbers of blocks and ports depends on the underlying state-space structure of the system, but they need to properly match in order to allow the model to be consistent. The structure of a model is shown in the following figure:

Building a state-space model in LTPDA

LTPDA comes with some example built-in models for the ssm class. One such example is a simple 1D harmonic oscillator. To build this model we use the 'built-in' model constructor of the ssm class. (Note: the 'built-in' model constructor can be used for all the different user classes in LTPDA.)

To see a list of the ssm built-in models available to you, you can do

  % Get a list of available built-in ssm models

Or you can use the graphical interface for browsing models:
  % Use the model browser

To build one of these models, for example, the 1D Harmonic Oscillator, you can do:
  % Build a Harmonic Oscillator model
  sys = ssm(plist('built-in', 'HARMONIC_OSC_1D'))

You should then see details of the model on the terminal. To get a nicer view of the inputs and outputs for this model, you can do:
  % View details of the model

You should then see a window like the following:
This should show details about the different blocks (inputs, states, outputs) and then the ports within those blocks.
In this case, the system has two input blocks, called ''command'' and ''noise'', that can be used to respectively the external force acting on the particle, and the additive noise of the readout observing the position of the particle itself. Each input block has a name, a description, and (in this case) only one port. Each port has an index, a name, a description, and some physical units for the quantity in input. The system has one state block, with two states (position and velocity of the particle). Each state has an index, a name, a description, and some physical units for the quantity it represents. In this case, the system has one output block, called ''position'', that represents the particle position as observed via the readout (meaning, with the readout noise added). The output block has a name, a description, and (in this case) only one port. Each port has an index, a name, a description, and some physical units for the quantity in output.
Additionally, the report includes a description of the parameters, if any, that can be adjusted to characterize the system, and are represented in symbolic or numeric form.

Assembling state-space models in LTPDA

If you build multiple ssm objects, you can assemble them together using the ssm/assemble method. Although we don't need to do that in this training session, it may be useful to know the rules in case you want to build your own models, and because the LPF models we will be using are built in this way, assembling simpler subsystems. Essentially, if you ask LTPDA to assemble 2 or more models, then it will look for matching input and output blocks and connect them together. Here, matching means that the input block name matches the output block name, and that they both have the same number of ports. The ports are then connected in numerical order. The inputs of any block which gets connected to an output block will not appear in the final composite model.

Using state-space models in LTPDA

Once you have built your ssm model in LTPDA, you can go on and use it in various ways. The most common ways are to produce transfer functions (using ssm/bode) responses of the system or to simulate the time-domain system response to different inputs (using ssm/simulate). Both of these topics will be covered in later sections.

©LTP Team