Integrator
Integration of the input signal.
blockType: Integrator
Path in the library:
|
Description
Block Integrator calculates the value of the integral of the input signal over time.
Block Integrator It can be considered as a dynamic system with one state. The block behavior is described by the following equations:
where
-
— input signal;
-
— output signal;
-
— condition;
-
— initial state .
These equations describe the exact dependence of the output on the input in continuous time; numerical approximation methods are used to estimate them with finite accuracy. In Engee, there are several types of solvers that implement different numerical integration methods to calculate the block output. Each solver has its own advantages depending on the specific task.
The selected solver calculates the block output Integrator at the current time step, using the current input value and the state value at the previous time step. To do this, block Integrator saves the value of the output signal in the current time step for use by the solver in the next step. The block also provides the solver with an initial state to calculate the state of the block at the beginning of the simulation. By default, the initial state value is `0'. Using the block parameters window, you can set a different value for the initial state.
To create a fully discrete system, it is recommended to use the block Discrete-Time Integrator.
Determination of initial states
You can define the initial states as a parameter in the dialog box of the block or enter them from an external signal.:
-
To define the initial states as a block parameter, specify Initial condition source how
internal
and enter the value in the field Initial condition. -
To get the initial states from an external source, specify Initial condition source how
external
. An additional input port appears under the input port.
If the integrator limits its output signal (see Limitation of the integrator), the initial state must be within the saturation range of the integrator. If the initial state exceeds the saturation limit of the block, the block displays an error message. |
Limitation of the integrator
To ensure that the output data does not exceed the specified levels, check the box Limit output and enter the restrictions in the appropriate parameter fields. This action results in the block functioning as a limited integrator. When the output reaches the limit values, the integrator operation ends.
During the simulation, you can change the constraints, but you cannot turn on or off the integrator constraints. The block defines the output data as follows:
-
When the integral is less than or equal to Lower saturation limit, the output signal is held at Lower saturation limit.
-
When the integral is between Lower saturation limit and Upper saturation limit, the output is an integral.
-
When the integral is greater than or equal to Upper saturation limit, the output signal is held at Upper saturation limit.
To generate a signal indicating when the state is limited, check the box Show saturation port. The saturation port appears under the block output port.
The signal takes one of three values:
-
1
indicates that the upper limit is applied. -
'0` indicates that the integral is not limited.
-
The
-1
indicates that a lower limit is applied.
When this check box is selected, the block has three zero crossings.:
-
To determine when it enters the upper saturation limit.
-
To determine when it enters the lower saturation limit.
-
To determine when it leaves the saturation zone.
Resetting cyclic states
Some physical phenomena are cyclical, periodic, or rotational in nature. Modeling of these phenomena involves integrating the rate of change of periodic or cyclic signals to obtain a state variable.
The disadvantage of this approach is that over long periods of simulation time, states representing periodic or cyclic signals are integrated to very large values. In addition, the calculation of the sine or cosine of these signals takes more and more time. Large signal values also negatively affect the solver’s performance and accuracy.
One approach to overcome this disadvantage is to reset the angular state to 0
when it reaches (or before When it reaches , for numerical symmetry) using additional algorithms in the model. This approach improves the accuracy of the sine and cosine calculations. But keep in mind that this resets the solver, which slows down the simulation for a variable-pitch solver, especially in large models.
To avoid resetting the solver at the time of resetting the output value, block Integrator It contains a built-in state reset mechanism that you can enable by checking the box. Wrap state in the block parameters dialog box.
When you enable the parameter Wrap state, the block icon changes, indicating that cyclic state reset is enabled for the block.
If cyclic state reset is enabled, the state value is determined by the following expressions:
where:
-
— lower limit of the state value;
-
— the upper limit of the state value;
-
— result (condition).
Resetting cyclic states has the following advantages:
-
Eliminates modeling instability when the model approaches large angles and large state values.
-
Reduces the number of solver resets during simulation, which reduces simulation time.
-
Eliminates large angle values, speeding up the calculation of trigonometric functions based on angular states.
-
Improves solver accuracy and performance and provides unlimited simulation time.
Reset the status
The block resets its state to the initial state on an external signal. The type of reset trigger is determined by the parameter External reset. When selecting a value other than none
the unit has a reset port, next to which the type of reset trigger is indicated.
Types of reset triggers
The External reset parameter allows you to define the reset signal attribute that is the reset trigger. The following triggers are possible:
-
rising
— resets the state when the reset signal passes the edge, i.e. increases from a negative or zero value to a positive one. -
falling
— resets the state when the reset signal is cut off, i.e. it drops from a positive value to zero or a negative value. -
either
— resets the state when the reset signal rises or falls, i.e. it changes from zero to a non-zero value, from a non-zero value to zero, or changes sign. -
level
— resets and holds the output in its initial state until the reset signal is zero, i.e. it is different from zero at the current time step or changes from a non-zero value at the previous time step to zero at the current time step. -
level hold
— Resets the output signal to its initial state when the reset signal is non-zero.
The reset port has a direct input. If the output signal of the block is sent back to this port, either directly or through a series of direct transmission blocks, an algebraic loop is obtained. Use the block status port Integrator for feedback on block output without creating an algebraic loop.
About the status port
Check the box Show state port in the block parameters dialog box Integrator This results in an additional output port, the status port, at the top of the integrator unit.
The output data of the status port is the same as the output data of the standard output port of the block, except in the following case. If the block is reset at the current time step, the status port output represents the value that would have appeared on the standard block output if the block had not been reset.
The output data of the status port appears earlier in the time step than the output data of the output port of the integrator unit. Use the status port to open algebraic circuits in these simulation scenarios.:
-
Self-resetting integrators (see Creating self-canceling integrators).
-
Transfer of state from one enabled subsystem to another (see Transfer of states between enabled subsystems).
Creating self-canceling integrators
The block status port Integrator helps you avoid an algebraic loop when creating an integrator that resets itself based on the value of its output. Consider the following model.
This model attempts to create a self-aligning integrator by feeding the integrator’s output signal, subtracted from `1', back to the integrator’s reset port. However, the model creates an algebraic loop. To calculate the output of the integrator unit, the software must know the value of the unit reset signal, and vice versa. Since these two values are interdependent, the software cannot determine either of them. Therefore, an error message appears when trying to simulate or update this model.
The following model uses the integrator’s state port to avoid the occurrence of an algebraic loop.
In this version, the value of the reset signal depends on the value of the status port. The value of the status port is available earlier in the current time step than the value of the output port of the integrator unit. Therefore, it can determine whether to reset the block before calculating the block output, thereby avoiding an algebraic loop.
Transfer of states between enabled subsystems
The status port helps to avoid the occurrence of an algebraic loop when transferring state between two enabled subsystems. Consider, for example, the following model.
The enabled subsystems A
and B
contain the following blocks:
Subsystem A |
Subsystem B |
---|
In this model, a constant input signal drives two included subsystems that integrate the signal. The pulse generator generates a resolution signal that alternates execution between subsystems. The Enabled port of each subsystem is set to reset
, which causes the subsystem to reset its integrator when it becomes active. Resetting the integrator causes the integrator to read the value of its initial state port. The initial state port of the integrator in each subsystem is connected to the output port of the integrator in the other subsystem.
This connection is designed to provide continuous integration of the input signal while alternating execution between the two subsystems. However, the connection creates an algebraic loop. To calculate the output of A', you need to know the output of `B
, and vice versa. Because the output data is interdependent, it is not possible to calculate the output values. Therefore, an error message appears when trying to simulate or update this model.
This version of the same model uses the integrator’s state port to avoid creating an algebraic loop during state transfer.
The enabled subsystems A
and B
contain the following blocks:
Subsystem A |
Subsystem B |
---|
In this model, the initial state of the integrator in A
depends on the value of the port state of the integrator in B
, and vice versa. The status port values are updated earlier in the simulation time step than the values of the integrator output ports. Therefore, it is possible to calculate the initial state of any integrator without knowing the final output value of another integrator.
Ports
Output
#
OUT_1
—
output signal
scalar
| vector
| matrix
Details
Integration result.
Data types |
|
Complex numbers support |
No |
#
OUT_2
—
output signal limitation sign
scalar
| vector
| matrix
Details
A saturation output signal, specified as a scalar, vector or matrix, which indicates when the output signal is bounded by an upper or lower saturation limit.
-
If the integral is bounded at Upper saturation limit, the output signal is
1
. -
If the integral is bounded at Lower saturation limit, the output signal is
-1
. -
If the integral is between these limits, the output signal is
0
. For more information, refer to Integrator Limit.
Data types |
|
Complex numbers support |
No |
#
OUT_3
—
state
scalar
| vector
| matrix
Details
Outputs the status of the block. For more information, refer to About the Status Port.
Dependencies
To use this port, select the check box for the parameters Show state port.
Data types |
|
Complex numbers support |
No |
Input
#
IN_1
—
input signal
scalar
| vector
| matrix
Details
The signal to be integrated.
Data types |
|
Complex numbers support |
No |
#
x0
—
initial state
scalar
| vector
| matrix
Details
The initial state of the block specified by an external signal. Refer to Defining initial states.
Dependencies
To use this port, set the Initial condition source parameters to . external
.
Data types |
|
Complex numbers support |
No |
#
External Reset
—
reset
scalar
| vector
| matrix
Details
Resets the state of the unit to the preset initial state by an external signal. Refer to Reset Status.
Dependencies
To use this port, set the parameters External reset to any value other than none
.
Data types |
|
Complex numbers support |
No |
Parameters
Main
#
External reset —
reset to initial state
none
| rising
| falling
| either
| level
| level hold
Details
Specify the type of trigger to be used for the external reset signal.
-
rising
- resets the state when the reset signal passes the edge. -
falling
- resets the state when the reset signal passes the slice. -
either
- resets the state when the reset signal is rising or falling (passing an edge or a slice). -
level
- resets and holds the output in the initial state when the reset signal is different from zero at the current time step or changes from a non-zero value at the previous time step to zero at the current time step. -
level hold
- resets the output to the initial state when the reset signal is different from zero at the current time step.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Initial condition source —
selecting the source of the initial state
internal
| external
Details
Select the source of the initial state:
-
internal
- get initial states from the parameters Initial condition. -
external
- receiving initial states from an external source via input port x0.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Initial condition —
initial state
Scalar / array of real numbers
Details
Initial state of block Integrator.
Dependencies
To use this parameter, set the Initial condition source parameters to internal
.
Default value |
|
Program usage name |
|
Tunable |
Yes |
Evaluatable |
Yes |
#
Limit output —
Limiting the output values of the block to the specified range
Logical
Details
Limit the block output to a value between the parameters Lower saturation limit and Upper saturation limit.
-
Checking this box limits the block output to a value between the parameters Lower saturation limit and Upper saturation limit.
-
Clearing this check box does not limit the block output values.
Dependencies
Selecting this option includes the parameters Lower saturation limit and Upper saturation limit.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Upper saturation limit —
upper limit for the integral
Scalar / array of real numbers
Details
State the upper limit for an integral in the form of a scalar, vector, or matrix.
Dependencies
To use this parameter, select the checkbox Limit output.
Default value |
|
Program usage name |
|
Tunable |
Yes |
Evaluatable |
Yes |
#
Lower saturation limit —
lower bound for the integral
Scalar / array of real numbers
Details
State the lower limit for an integral in the form of a scalar, vector, or matrix.
Dependencies
To use this parameter, select the checkbox Limit output.
Default value |
|
Program usage name |
|
Tunable |
Yes |
Evaluatable |
Yes |
#
Wrap state —
cycle reset
Logical
Details
Reset cyclic states between parameters Wrapped state upper value and Wrapped state lower value. Enabling this parameters reduces the number of solver resets, improves the performance and accuracy of calculations, and increases the allowable simulation time for rotational and cyclic states.
If you specify Wrapped state upper value as inf
and Wrapped state lower value as -inf
, no reset will occur.
Dependencies
Selecting this parameter allows you to set the parameters Wrapped state upper value and Wrapped state lower value.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Wrapped state upper value —
upper limit for resetting cyclic states
Scalar / array of real numbers
Details
Upper limit of the block output signal (for resetting cyclic states).
Dependencies
To use this parameter, select the check box Wrap state.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Wrapped state lower value —
lower limit for resetting cyclic states
Scalar / array of real numbers
Details
The lower limit of the block output signal (for resetting cyclic states).
Dependencies
To use this parameter, select the check box Wrap state.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Show saturation port —
switching on the saturation output port
Logical
Details
Select this check box to add a saturation output port to the block.
Dependencies
Selecting this parameter enables the saturation output port.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Show state port —
switching on the status output port
Logical
Details
Select this check box to add a status output port to the block.
Dependencies
Selecting this parameter enables the status output port.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |