**Written by: Sas Harrison – Systems Engineer**

## Introduction

This article introduces several ideas that provide foundations for stability analysis in DYMOLA.

Those ideas have several applications, including the creation of ** root locus** diagrams, which provide information about transient behaviour (and therefore stability) and assessment of

**that details how well an input is translated to an output, in terms of the constituent frequencies of the input.**

*frequency-response*The methods illustrated have most bearing on controller design & signal processing, in practice – but initially, simpler systems which contain no feedback will be examined to maintain the greatest simplicity.

The DYMOLA software includes considerable professionally engineered, largely open-source tools for stability analysis, including inbuilt linear analysis toolset & the contributions by Europe’s premier aerospace research centre *Deutsches Zentrum für Luft- und Raumfahrt e.V.*

## Summary

This article contains information about:

- Transfer functions
- Application of Laplace Transforms
- The significance of transfer function poles (characteristic equation roots)

## Why Use Dymola for Stability Analysis?

As Dymola can easily redefine the known & unknown quantities in models without modification to the model architecture, and because the software can linearise the dynamical system in a fast & appropriate way, the assessment of stability characteristics in Dymola can be quick, effective & accessible to non-experts in CAE / coding, or those simply unfamiliar with (parts of) the model.

Occasionally it is suggested that the speed & effectiveness of the software is not critical, due to the power of modern computing. However, if one considers the use of Design of Experiment approaches one may need a large number of (possibly sequential!) model executions & the convenience of having software that does not require a high-spec workstation.

So: Running in 2sec rather than 5sec is significant!

## Representing a Plant Model

In this section we establish transfer functions as a way to characterise a physical system. We observe that there are theorems which let us judge the stability based on certain qualities of these functions.

### Map of a Simple Dynamical System

We begin with the RC circuit discussed in the ‘A State-Space Model of simple RC Network in Dymola & potential Applications’ blog post to illustrate^{1}.

*Figure 1: Model in DYMOLA GUI divided into different parts of a control architecture*

### Transfer Functions

Transfer functions describe the way in which an output signal responds to any input signal. They contain a complex variable, giving insight into both amplitude and phase^{2} of the output relative to the input. Transfer function just means:

“how an output responds to an input”

In principle the output might not respond at all (transfer function 0) or it might mean ‘exactly’; i.e. the input comes straight out precisely as it came in, (transfer function 1). Under many circumstances, though, the output might (amongst other properties) lag significantly behind the input. This creates scope for control systems that act too late, and therefore counterproductively.

Transfer functions describe the response using the complex variable that results from using the Laplace transform. In the Laplace domain, common inputs, like a step function, correspond to algebraic (and continuous) functions, as do linear operators like differentiation.

Because of these properties, block-diagrams can be created, and simplified to illustrate what is going on, then converted back to the time-domain. As with many aspects of control by the transfer function approach, one important advantage of this is just “visualising” & being able to work intuitively, using simple arithmetic operations.

Transfer functions contain useful information about:

- The transient response
- The steady-state response

- It can be a challenge to ensure the initial behaviour of a system after a sudden input (gust of wind, impact by an object, wave, puddle) is satisfactory.
- Unstable outputs are a form of transient outputs which grow, instead of dying away.

### Laplace Representation

We now return to the simple example of the RC circuit in Figure 1 and reach the Laplace domain transfer function of the system for now, without any feedback or other extra complications.

Take the equations relating the quantities of interest:

The goal is to find a characterisation of the ratio of a reference signal to a chosen output. We apply the Laplace transformation with the assumption of zero initial conditions. If you are not already familiar with this integral transform, note that integration becomes 1/s.

We can divide Equation 3 by Equation 4.

By multiplying both numerator & denominator by Cs and eliminating I(s) we simplify the expression.

## Stability: Poles (Roots) of The Transfer Function

### What is a Pole

From a transfer function one can factorise the denominator & create a sum of terms using partial fractions (Stewart, 2015). The separate terms can be easily transformed back into the time domain.

After partial-fraction expansion, the transfer function becomes terms that each have ** a linear factor** like (s + 3) or an

**(**

*indivisible quadratic factor***s**+

^{2}**1**), or a

**as the denominatore**

*“repeated factor”*^{3}like (3s + 1)

^{3}. From middle-school algebra we know these factors point us to roots, also known as poles.

For the above, we refer to a “pole” at s=-3+0j for the (s+3) factor, a pair of complex poles at s= ±j for (s^{2}+1) and three coincident poles at -1/3+0j for (3s+1)^{3}.

### What Poles Say About Stability

**Fundamental Facts**

With the help of some particularly pertinent inverse transforms we can obtain the time-dependent response to any input.

*Figure 2: Some commonly needed Laplace transforms*

Using this information, we observe that:

For reference, we note the final value theorem (Ogata, 2002) stating:

**Review of the RC Example**

The RC circuit we have constructed so far, has neither complicated behaviour, nor any feedback control system. As a result, the analysis won’t be too difficult.

What we know is:

Therefore, when considering the response of to there is a single pole at:

This pole always has negative real parts^{4}.

Unsurprisingly, the transients always die away in this system.

### Getting Information from Transfer Functions

Despite the easy example, we only need to calculate the transfer function, in order to examine the transient behaviour. Consider the response with a Sine input:

On very careful inspection, referring to our knowledge of partial fractions & the Laplace table printed in the foregoing text, one can surmise that once expanded into partial fractions & inverse-transformed:

## Using Block Diagrams

Because of the conversion by Laplace Transform, linear, time-invariant physical systems or LTIs can be represented by block diagrams. Along with a scheme for systematically rearranging the blocks, this serves as a form of visualised algebra.

It is particularly useful for dealing with control systems & signals, because it is orientated towards causal systems, where a signal is sequentially operated on by processes that change the signal and pass it on.

In the world of CAE, however, some fields have arguably come to be unnecessarily dominated by such an approach, as there is little benefit in modelling the physics of machines this way, for analysis – it is simply a useful way to represent physics in the context of feedback controllers!

### Block Diagram Reduction

Textbooks (Ogata, 2002), describe the simplification of block diagrams. The reader is referred to such textbooks or the resources available as online courtesy of leading technical institutions (Massachusetts Institute of Technology, 2001).

The derivation in the following section represents a simple example of this mechanistic process, which can be mastered by following a set of fairly logical^{6} rules.

### Closed Loop Transfer Function

This illustrates the use of algebra to establish the equivalent transfer function of a feedback loop. We have not yet discussed the idea of feedback, but this serves as an initial example of how we can use the block diagrams to visualise the logic of feedback controllers, for linear or linearised systems, also known as “PID” controllers (proportional, integral, differential) and available in block form in the DYMOLA libraries.

Consider a plant with transfer function G(s), with a reference input signal R(s) & output signal C(s).

*Figure 3: A block diagram with a feedback loop to be reduced.*

To reduce this diagram, we note:

Also:

Equating these through E(s) gives us:

Rearranging this leads to the form:

Because this expression shows what to expect to happen in the response, C(s) of a closed loop system under the effects of the reference input R(s) it represents the whole as a single block.

## Key Points

We have established the idea of the use of the Laplace domain to create transfer functions, and the block-diagram signal approach. This opens up a way to establish equivalent transfer functions to networks of simpler functions, as illustrated above.

We have also underlined some of the ways in which the “poles” of a transfer function are significant to the transient response.

Now that we know what the location of poles means, we can look at ways to find out:

- How they change if we vary parameters in models.
- How we can use the knowledge to inform controller design.
- How we can modify the way in which we feed signals to controllers
- How to specify properties of the instruments we need to use to facilitate control.

Similarly, using knowledge of transfer functions, we will be able to partly anticipate how well periodic signals (wanted or unwanted) are transmitted, without carrying out painstaking analysis or tests, and without needing to understand coding, by way of DYMOLA’s linear analysis capabilities.

**Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion.**

## References

Boyce, W. E. & DiPrima, R. C., 2001. *Elementary Differential Equations & Boundary Value Problems. *7th ed. Troy, NY: John Wiley & Sons Inc..

Massachusetts Institute of Technology, 2001. *MIT OPENCOURSEWARE. *[Online]

Available at: https://ocw.mit.edu/courses/aeronautics-and-astronautics/16-06-principles-of-automatic-control-fall-2012/lecture-notes/MIT16_06F12_Lecture_2.pdf

[Accessed 13 December 2016].

Ogata, K., 2002. *Modern Control Engineering. *4th ed. Upper Saddle River: Prentice-Hall.

Stewart, J., 2015. *Calculus – The Early Transcendentals. *7th ed. s.l.:Cengage Learning.

^{1 }*The physical system in this case may deceptively look a little bit like a “loop” already, because of the nature of a circuit! Below, the model is illustrated to help discern the “plant” a word used to mean the physical process under consideration, the reference input, which means “a signal to which the physical system responds” and elements that aren’t really part of the system.*

^{2 }*Complex numbers have one particular use that arises repeatedly in engineering science, which is to help represent phase differences in signals, namely due to the property whereby multiplication by an imaginary number rotates, but does not alter the magnitude of some vector in the complex plane.*

^{3 }*Consult (Stewart, 2015) to investigate the details of this.*

^{4} *There’s only one pole so it must actually always be on the real axis. With real coefficients you cannot have complex poles that aren’t conjugate pairs.*

^{5} The indivisible quadratic factor corresponding to Sine excitation will result in a term of the form (As+B)/(s^{2}+ω^{2}) on partial fraction decomposition, which is in fact a Sine term & a Cosine term when returned to the time domain. See Laplace table to verify this!

^{6} Fairly logical is subjective.