Sei sulla pagina 1di 4

Dynamics and simulation of engineering systems

Simulink Exercise 3 - State-space equations and the role of initial


conditions
Dr. M. Turner (mct6@sun.engg.le.ac.uk)

1 State-space equations

We have seen that high-order differential equations can be written in terms of a set of coupled first
order differential equations, and that these can be solved easily within the Simulink evironment. In
particular, when these equations are linear, they can be written in matrix-vector form which can be
represented by one state-space block in Simulink.
To be more specific, if we consider the (linear) state-space realisation,

   
(1)
  (2)

it transpires that the state equation (1) has a solution of a very similar form to a simple scalar first-order
differential equation:

!#"$ &% "('*),+ 


-/.01. (3)

2
Note that the right hand side of this equation consists of two distinct parts: the first term which repre-
sents the free response of the system and is a function of the initial state of the system, x ; the second

 
term is the forced response of the system and is dependent on all inputs to the system applied over the
interval from to to . A similar, although less uniform, partition can be made for systems described
in nonlinear state-space form. Thus far we have made the assumption that the initial conditions of the
system have been zero, that is the state evolves over time purely as a function of its inputs. To some
extent there is some justification to this assumption: often when measurements are taken, we refer
them to a situation corresponding to the system at rest (i.e. zero initial conditions); also, it is often easy
to redefine the co-ordinates of a system so that, in the new set of co-ordinates, the initial conditions are
zero. However, in other cases, particularly cases where we are required to have an absolute value for

3 4265
the states/outputs of the system, this justification disappears. For example consider starting a particle

3 2785
moving from a nonzero initial position, say . Then the subsequent motion of the particle will
depend from where it was started i.e. . The same is true in many situations: assuming zero
initial conditions only gives part of the solution to our state, and hence output, equations.
It is also important to point out that when nonlinear systems are considered, the value of the initial con-
dition not only adjusts the off-set correctly, it plays an important role of determining the subsequent
behaviour of the system - the initial condition determines the initial dynamic behaviour of the system.
2 Simulink

As well as being able to caluculate the forced response of a system, Simulink is able to calculate the
free response of a system, and more importantly can combine these responses to obtain the complete
response of a system. There are two main ways the effect of initial conditions are accounted for in the
Simulink environment.
State-space block. Entering initial conditions requires one to have a vector of initial conditions (obvi-
ously of the same dimension as the state vector) and then to enter this vector in the block diagram by
double-clicking on the block and inserting the vector in the appropriate place. This is relatively easy,
but one must be careful about the order in which the initial conditions are entered in this vector - it
must be coincide with the order of states.
Integrator. This can be useful for initialising nonlinear equations, which cannot be built out of state-
space blocks. In a similar manner to the state-space block, one can double-click on the integrator block
and enter its initial condition in the appropriate place.
The procedure for simulating systems with non-zero initial conditions is otherwise excactly the same
as for the standard simulation procedure. It is frequently convenient, particularly when considering
large systems, to enter the initial conditions using a Matlab script.

3 Introduction to stability

The subject of stability is, by and large, beyond the scope of this course, although some basic ideas
of stability can be help to understand the dynamics of systems. Roughly speaking a system is termed
stable if it settles down to some equilibrium condition after a certain period of time, assuming zero
or constant input is applied. Converesly, it is described as unstable if its time history explodes or
diverges. Obviously there are cases which fall somewhere between these two extremes as well.
In detail:

A system is stable if all of the eigenvalues of  have negative real parts (corresponds to a system
settling down).

A system is unstable if one or more of the eigenvalues of have positive real parts (there will
be exponential divergence of one or more of the systems states).

A system is marginally stable if all the eigenvalues of have negative real parts excepts at least
one which has zero real part (this situation can correspond to oscillators where all eigenvalues
have purely imaginary parts).
4 Example

Consider the Wien Bridge oscillator circuit shown below.





   
  




 

Using the voltages across the capacitors as states and the voltage $ as the output, it can be shown that
state-space matrices for this system can be obtained as:

   
  
 
  
       
   
  
' (4)

       (5)

Note that the system is not driven by any input signal.


Not surprisingly, the Wien Bridge oscillator is a circuit designed to produce oscillations, the frequency

 !
of which are determined by the value of the resistors and the capacitors
 !"  . In order for this to happen
(prove this!) the ratio of the resistors must be set at - in stability terms this means we
have set the eigenvalues of # to be purely imaginary, resulting in an oscillation.
In Matlab construct a Simulink diagram for the above system using State-space and To Workspace
  block.
blocks. Attatch the input of the state-space block to a Constant
  Write a Matlab script to ini-
  
$&% and the state-space  
tialise the model with the following values:   
3    
matrices which correspond to these values. Enter the state-space matrices into the state-space block
and also enter the initial condition
 '  .
Simulate the system for ten seconds and see what happens. When you plot the output response you
should find that there is no output from the system. This is because, we have used zero initial conditions
and furthermore, as both the ( and ) matrices of the system have all elements being zero, the state-
vector and output variable remain zero for all time.
Next enter the intial condition
   '  and simulate the system. You should now find that the system
has become oscillatory. This is because the free-response of the system is now non-zero (although the
forced response is still zero) and these initial conditions are enough to start off the oscillations. Note
in practice, even if we had zero initial conditions, these oscillations would start naturally from the noise
present in the system - the key point to take from this example is that the presence of non-zero initial
conditions can have a dramatic effect on the behaviour of a system.

4.1 Changing the simulation parameters

It can be shown that the frequency of the oscillation in the Wien Bridge circuit is inversely proportional

to , that is for smaller value of , the frequency of oscillations increases.

Try changing the frequency of oscillation by reducing the value of to one tenth of its previous value.
Your simulation results should show you that the frequency of oscillations has indeed increased but that
the output graph is difficult to view. To rectify this try reducing the length of the simulation time in the
Simulation/Parameters/Solver tab. However, also notice that we are solving our differential equations
using the standard variable step solver which can sometimes be unreliable, particularly for systems

 
with fast time constants. Try changing the solver properties to Dormand-Price and make sure that the
solver deals with continuous variables. For the time step, choose something relatively small like  $ .
There is a trade-off with the value of this time step: small time steps can ensure that the system is
simulated as accurately as possible - minimising the interpolation errors. However, the smaller the


time step, the longer it will take to simulate the system. To simulate a system for one second using a
 $
 
time-step of requires 10 loops of the solver algorithm; to simulate the same length of time using
a time step of  $ requires 1000 loops - an increase of a factor of 100. For small systems, such
as our Wien Bridge oscillator, this is not noticeable, but for larger, more realistic systems, the choice
of this time step can be important. As a general rule, the choice of the time step is determined by the
systems smallest time constant - the smaller the time constant the smaller the time step.

4.2 A further exercise

We have mainly been considering linear systems so far and the dynamics of these systems are not de-
pendent on the initial condition - the initial condition gives a reference point from which motion can be
measured and contributes to the complete response of the system, but it does not determine the initial
dynamics of the system. For nonlinear systems the initial dynamics of the system are set by the initial
condition. In the last exercise we considered a pendulum and found that for small angular displace-
ments the linear and nonlinear models were similar - but this assumed an initial angular displacement
of zero. Compare the responses of the linear and nonlinear models now assuming an initial angular
displacement of  radians.

Potrebbero piacerti anche