MATLAB Answers

Sorted Execution Order, Initial Conditions, PID

7 views (last 30 days)
Daniel Gelman
Daniel Gelman on 11 Aug 2017
Commented: Aniruddha Katre on 11 Aug 2017
Below is a closed-loop system of plant Gp(z) with unity gain. I also enabled to display the sorted execution order.
According to the image, the order of execution is:
1. Reference, r, is initialized to 20.
2. Plant calculates output, y.
3. The error, e, is calculated.
Please correct me if I am wrong. If this is correct, at time 0 shouldn't e have an initial value of 0 since the error calculation hasn't occurred yet?
When designing a PID controller, will e = 0 when t = 0? I want to understand this because it ultimately affects the closed-loop response of the system.

Answers (1)

Aniruddha Katre
Aniruddha Katre on 11 Aug 2017
In this case, the value of e is 20 at the initial time step because of the sorted execution order and the fact that you are using a Continuous Transfer Function block. If you look at the execution order, the constant source block generates an output first, then the transfer function block, followed by the sum block, followed by the error display block.
The outputs are generated as follows:
  1. Const Source block - output = 20
  2. Transfer function block - output = 0
  3. Sum block - output = 20 - 0 = 20
  4. Display block then displays the value 20
The reason why the transfer function block generates an initial output value of 0 is because of the initial conditions set on that block. The continuous transfer function will have a set of internal states that need to be initialized. This specific block is configured to always initialize these internal states to zero. Therefore, at t = 0 in the simulation, the output of the continuous transfer function block will always be zero. This in turn will make it so that the constant source value minus the output of the T.F. block will be non-zero.
For information on why the initial conditions for the Continuous T.F. block are always set to zero, see the "Specifying Initial Conditions" section of this documentation link:
Aniruddha Katre
Aniruddha Katre on 11 Aug 2017
Correct, when the simulation starts, at t = 0 the blocks will generate their outputs in determined execution order.
The general process that the Simulink solver follows is to generate outputs from all blocks in the sorted execution order, and then update the states of any blocks that have states before proceeding to the next time step of the simulation.
And sorry for the confusion about the T.F. block. The discrete T.F. block allows you to provide the initial conditions. The edit box is called "Initial States". If that value is set to zero, then I would expect the results you see in the screenshot. The reasoning for that is still the same from my previous post.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!