1
votes

I have created the following simulink model with two blocks one with direct addition and the other block with a unit delay. The simulink configuration parameters are fixed step solver with 0.2 fixed step size. Now my doubt is for the blocks without unit delay the output is available at 0th simulation time which is 2 but in case of unit delay the output is 0 at 0th simulation time. Why? simulink model sorry but i am unable to attch the model.

1
Are you sure that the output of the unit delay model is 0 at t=0? From the picture you've uploaded it should be 1 (i.e. the value of the constant) at t=0.Phil Goddard
Sorry I verified again it is 1.rajesh
Most probably you work in discrete time solver, and in discrete time solver, it needs to estimate/calculate values at t=0 for initializtion.Yusuf Selim KARATAS

1 Answers

4
votes

You can think of your Simulink diagrams as of the discrete linear dynamical systems with inputs and outputs. Using the transfer function approach, such systems can be represented via

(1) Y(z)=G(z)X(z),

where Y(z) is the out of the system, X(z) is the input and G(z) is the transfer function (note: I omitted the initial conditions at this stage for the simplicity of explanation). Each individual block of the system can also be treated as the system of the form (1).

Consider your first diagram. The constant block expressed in the input output form (1) is

(2) Y1(z) = G1(z)X(z),

with: G1(z) = 1, i.e.

(3) Y1(z) = X(z).

Each Simulink 'unit delay' block can be treated as a system of the form (1) with the transfer function of the form Gu(z) = z^(-1). Denote the transfer function associated with the 'unit delay' block in the middle of the diagram as G2(z) and the one at the bottom of the diagram as G3(z). In this case, we have G3(z) = G2(z) = Gu(z) = z^(-1). Note that the input to the system associated with G2 is the output of the system (3) and the input to the system associated with G3 is the output of the system associated with G2. Taking into account the considerations above, the systems that correspond to the unit delay blocks associated with G1 and G2 are given by (4) and (5), respectively.

(4) Y2(z) = G2(z)*Y1(z) = z^(-1)*Y1(z) = z^(-1)*G1(z)*X(z) = z^(-1)*X(z)

(5) Y3(z) = G3(z)Y2(z) = z^(-1)*z^(-1)*X(z) = z^(-2)*X(z)

Assuming that the output of the system associated with the entire model is denoted Y(z) and corresponds to the output of the summation block, the transfer function of the entire system can be expressed as

(6) Y(z) = Y1(z) + Y2(z) + Y3(z)

To summarise:

(7a) Y1(z) = X(z)

(7b) Y2(z) = z^(-1)*Y1(z)

(7c) Y3(z) = z^(-1)*Y2(z)

(7d) Y(z) = Y1(z) + Y2(z) + Y3(z)

The system above corresponds to a difference equation of the form

(8a) y1(k) = x(k)

(8b) y2(k) = y1(k-1)

(8c) y2(k) = y2(k-1)

(8d) y(k) = y1(k) + y2(k) + y3(k)

To see this, you can apply Z-transform to the equation (8) above. You can assume that in Simulink, the simulation always starts at k=0 (to obtain the 'physical time' that associated with the output you would need to use t(k) = k*T, where T is the sampling time set in the solver properties). Thus, you would need to provide the values of y1(k) and y2(k) for k=-1 to be able to solve the system for all k>=0.

All Simulink blocks that represent transfer functions (be it discrete or continuous) allow the assignment of initial conditions. For discrete systems, the initial conditions are assumed to be valid for all k<=0 (or t<=0 if you consider physical time). The default initial condition for the blocks that represent transfer functions is 0. Thus, when you simulate the system (8), Simulink assumes that y1(-1)=0, y2(-1)=0. The constant block assigns x(k) = 1 for all k>=0.

Given what is stated above, let us calculate the values of the system (8) at time steps k=0,1,2.

At k=0:

y1(0) = x(0) = 1, y2(0) = y1(-1) = 0, y3(0) = y2(-1) = 0, y(0) = 1

At k=1:

y2(1) = x(1) = 1, y2(1) = y1(0) = 1, y3(1) = y2(0) = 0, y(0) = 2

At k=2:

y2(2) = x(2) = 1, y2(2) = y1(1) = 1, y3(2) = y2(1) = 1, y(0) = 3