• No results found

The Integrator Block

In document Simulink Engineering Applications (Page 75-79)

The Commonly Used Blocks Library

2.14 The Integrator Block

The Integrator block integrates its input and it is used with continuoustime signals. As shown in the Configuration Parameters dialog box which is displayed after selecting the Integrator block and clicking on Simulation in the model window, we can use different numerical integration methods to compute the Integrator block's output. The Configuration Parameters window that appears when we doubleclick on the Integrator block and then on Simulation shown in Figure 2.24.

Figure 2.24. The configuration parameters window for the Integrator block

Simulink treats the Integrator block as a dynamic system with one state, its output. The Integra-tor block's input is the state's time derivative. The selected solver computes the output of the Integrator block at the current time step, using the current input value and the value of the state at the previous time step. The block also provides the solver with an initial condition for use in computing the block's initial state at the beginning of a simulation run. The default value of the initial condition is .

75 1 7 0

6 x 75

0

SOFTbank E-Book Center Tehran, Phone: 66403879,66493070 For Educational Use.

Introduction to Simulink with Engineering Applications 221 Copyright © Orchard Publications

The Function Block Parameter dialog box shown in Figure 2.25 allows us to specify another value for the initial condition or create an initial value input port on the block. It also allows us to specify the upper and lower limits of integration, create an input that resets the block's output (state) to its initial value, depending on how the input changes, and create an optional state out-put that allows us to use the value of the block's outout-put to trigger a block reset. Depending on the options selected, the Integrator block appears in any of the nine forms shown in Figure 2.26.

Figure 2.25. Function Block Parameters for the Continuous Integrator block

The Integrator 1 block in Figure 2.26 is the default block. This block appears when the Function Block Parameters in the dialog box are in their default states. The appearance of the Integrator 2 through Integrator 9 blocks depends on the settings in the block’s parameter dialog box. Thus, Integrator 2 block Initial condition source: external. All other parameters in their default states.

Integrator 3 block Limit output: check mark. All other parameters in their default states.

Integrator 4 block External reset: rising. All other parameters in their default states.

SOFTbank E-Book Center Tehran, Phone: 66403879,66493070 For Educational Use.

222 Introduction to Simulink with Engineering Applications

Copyright © Orchard Publications

Figure 2.26. Different configurations for the Integrator block

Integrator 5 block External reset: falling. All other parameters in their default states.

Integrator 6 block External reset: either. All other parameters in their default states.

Integrator 7 block External reset: level. All other parameters in their default states.

Integrator 8 block Show state port: check mark. All other parameters in their default states.

Integrator 9 block External reset: rising.

Initial condition source: external.

Limit output: check mark

Show saturation port: check mark Show state port: check mark

The Integrator block's state port allows us to avoid creating algebraic loops when creating an integrator that resets itself based on the value of its output. An algebraic loop is formed when two or more blocks with direct feedthrough (the output of the block at time t, is a function of the input at time t) form a feedback loop. The basic problem with algebraic loops is that the output, y, at time, t, is a function of itself. An algebraic loop generally occurs when an input port with direct feedthrough is driven by the output of the same block, either directly, or by a feedback path through other blocks with direct feedthrough. An example of an algebraic loop is the simple loop shown in Figure 2.27.

For the model of Figure 2.27, or .

Another example of a model with algebraic loops is the model of Figure 1.19, Solution of 3 equa-tions with 3 unknowns, Chapter 1, Page 119.

y = 10 y y = 5

SOFTbank E-Book Center Tehran, Phone: 66403879,66493070 For Educational Use.

Introduction to Simulink with Engineering Applications 223 Copyright © Orchard Publications

Figure 2.27. An example of an algebraic loop

For further discussion on algebraic loops, please refer to Simulink’s User Manual, Help menu for the Integrator block, and MATLAB Technical Report 7.1 Algebraic Loops and SFunctions, http://www.utexas.edu/math/Matlab/Manual/tec7.1.html. SFunctions are described in Chapter 15.

The Integrator block's state port makes it possible to avoid creating algebraic loops when creating an integrator that resets itself based on the value of its output. The state port shown in Integrators 8 and 9 in Figure 2.26 is intended to be used specifically for self-resetting integrators (see Creating Self-Resetting Integrators), and Handing off a state from one enabled subsystem to another (see Handing Off States Between Enabled Subsystems) in Simulink’s Help menu. The state port should only be used in these two scenarios. When updating a model, Simulink checks to ensure that the state port is being used in one of these two scenarios. If not, Simulink signals an error.

Example 2.14

The model of Figure 2.28 simulates the differential equation

subject to the initial conditions and .

The Constant 1 and Constant 2 blocks represent the initial conditions.

d2vC dt2

--- 4dvC --- 3vdt C

+ + = 3u0( )t

vC( )0 = 0.5 v'C( )0 = 0

SOFTbank E-Book Center Tehran, Phone: 66403879,66493070 For Educational Use.

224 Introduction to Simulink with Engineering Applications

Copyright © Orchard Publications

Figure 2.28. Model for Example 2.14

In document Simulink Engineering Applications (Page 75-79)