Engee documentation

Second-Order Integrator

Second-order integrator.

blockType: SecondOrderIntegrator

Path in the library:

/Basic/Continuous/Integrator, Second-Order

Description

The block Second-Order Integrator performs second order integration. The behaviour of the block is described by the following equations:

where is the input signal. Thus, the block represents a dynamic system with two continuous states: and .

These two states have a mathematical relationship, is the derivative of . To fulfil this relationship during simulation, Engee imposes various constraints on the parameters and behaviour of the block.

These equations describe the exact dependence of output on 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 compute the output of a block. Each solver has its own advantages depending on the specific problem.

The selected solver calculates the output of the block Second-Order Integrator at the current time step using the current input value and the state value at the previous time step.

The initial values and can be set in the block parameters dialogue box.

Restriction of states

When modelling a second-order system, you may need to constrain the states of the blocks. For example, the motion of a piston inside a cylinder is governed by Newton’s second law and has constraints on the piston position . In a block Second-Order Integrator you can constrain the states and independently of each other. An important rule to follow is that the upper limit must be strictly greater than the corresponding lower limit.

Limit only x

You can restrict the state of , by selecting the checkbox Limit x and entering the restrictions in the corresponding parameters.

The block defines the state values as follows:

  • When is less than or equal to the lower limit, the value of is held at the lower limit and is set to zero.

  • When is between the lower and upper limits, both states correspond to a given second-order ODU.

  • When is greater than or equal to its upper limit, the value of is held at its upper limit and is set to zero.

You can reinitialise with a new value while reaches its limit.

Limit dx/dt only

You can restrict the state of , by selecting the check box Limit dx/dt and entering the restrictions in the corresponding parameters.

If you restrict only the state , the block defines the values of as follows:

  • When is less than or equal to the lower limit, the value of is held at the lower limit.

  • When is between the lower and upper limits, both states correspond to a given second-order ODU.

  • When is greater than or equal to its upper limit, the value of is held at its upper limit.

  • When the state is held at its upper or lower limit, the value of is determined by the first-order initial value task:

,

,

where

  • - is the limit (upper or lower);

  • - the time when reaches this limit;

- the value of state at the moment .

Limit of both states

When you constrain both states, Engee maintains mathematical consistency between states by constraining the allowable upper and lower limit values for . Such constraints are necessary to satisfy the following constraints:

  • When is within the constraints, the value of must be zero.

  • For to go beyond the upper limit, the value of must be strictly negative.

  • For to be outside the lower limit, the value of must be strictly positive.

In such cases, the upper limit of must be strictly positive and the lower limit of must be strictly negative.

When both states are bounded, the block determines the states as follows:

  • Whenever reaches its limits, the resulting behaviour is the same as described in section Limit only x.

  • Whenever reaches one of its limits, the resulting behaviour includes computing by usage of a first-order ODE when is held at one of its limits. In such cases, whenever reaches one of its limits, it is held at that limit and is set to zero.

  • Whenever both reach their respective limits at the same time, the state behaviour of overrides the behaviour of to maintain state consistency.

When you limit both states, you can choose to re-initialise at the time the state reaches saturation. If the re-initialised value falls outside the specified limits , then is re-initialised to the nearest valid value and a consistent set of initial conditions is calculated.

Ports

Input

# u — input signal
scalar | vector | matrix

Details

The input signal u to the integrator as a scalar, vector or matrix.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

Complex numbers support

No

Output

# x — output signal
scalar | vector | matrix

Details

The output of the x state signal as a scalar, vector or matrix.

Data types

Float64.

Complex numbers support

No

# dx — output signal
scalar | vector | matrix

Details

The output of the dx state signal as a scalar, vector or matrix.

Data types

Float64.

Complex numbers support

No

Parameters

Parameters

# Initial condition x — initial state value x
Scalar / array of real numbers

Details

Initial state value of x block.

Default value

0.0

Program usage name

ICX

Tunable

No

Evaluatable

Yes

# Limit x — state limit values x
Logical

Details

Limit the block output to a value between the parameters Lower limit x and Upper limit x. By default, this checkbox is unchecked.

Default value

false (switched off)

Program usage name

LimitX

Tunable

No

Evaluatable

No

# Upper limit x — upper limit of state value x
Scalar / array of real numbers

Details

Specify the upper limit of the status value x.

The upper limit for the state x must be strictly greater than the lower limit.

Dependencies

To use this parameters, select the checkbox Limit x.

Default value

Inf

Program usage name

UpperLimitX

Tunable

No

Evaluatable

Yes

# Lower limit x — lower limit of state value x
Scalar / array of real numbers

Details

Specify the lower limit of the status value x.

The lower limit for the state x must be strictly less than the upper limit.

Dependencies

To use this parameters, select the checkbox Limit x.

Default value

-Inf

Program usage name

LowerLimitX

Tunable

No

Evaluatable

Yes

# Wrap x — transfer switch on x
Logical

Details

Enable carry states x between the parameters Wrapped upper value x and Wrapped Lower value x. Enabling carry states eliminates the need for zero crossing detection, reduces the number of solver resets, improves solver performance and accuracy, and increases simulation time when modelling rotational and cyclic state trajectories.

If you specify Wrapped upper value x as inf and Wrapped Lower value x as -inf, no carryover will occur.

Default value

false (switched off)

Program usage name

WrapX

Tunable

No

Evaluatable

No

# Wrapped upper value x — upper transfer value x
Scalar / array of real numbers

Details

Specify the upper value to carry x. The upper value for the carry x must be greater than the lower value.

Dependencies

To use this parameters, select the check box Wrap x.

Default value

pi

Program usage name

WrappedUpperValueX

Tunable

No

Evaluatable

Yes

# Wrapped lower value x — lower value for transfer x
Scalar / array of real numbers

Details

Specify the lower value to carry x. The lower value for the carry x must be less than the upper value.

Dependencies

To use this parameters, tick the checkbox Wrap x.

Default value

-pi

Program usage name

WrappedLowerValueX

Tunable

No

Evaluatable

Yes

Parameters

# Initial condition dx/dt — initial state value dx/dt
Scalar / array of real numbers

Details

Initial state value dx/dt.

Default value

0.0

Program usage name

ICDXDT

Tunable

No

Evaluatable

Yes

# Limit dx/dt — state limit values dx/dt
Logical

Details

Limit the block output to a value between the parameters Lower limit dx/dt and Upper limit dx/dt. By default, this checkbox is unchecked.

If the state limits are set x, the interval defined by the parameters Lower limit dx/dt and Upper limit dx/dt must contain zero.

Default value

false (switched off)

Program usage name

LimitDXDT

Tunable

No

Evaluatable

No

# Upper limit dx/dt — upper limit of state value dx/dt
Scalar / array of real numbers

Details

Specify the upper limit of the status value dx/dt.

Dependencies

If you limit x, this parameter must have a strictly positive value.

To use this parameter, tick the checkbox Limit dx/dt.

Default value

Inf

Program usage name

UpperLimitDXDT

Tunable

No

Evaluatable

Yes

# Lower limit dx/dt — lower limit of condition dx/dt
Scalar / array of real numbers

Details

Specify the lower status limit dx/dt.

Dependencies

If you limit x, this parameter must have a strictly negative value.

To use this parameter, tick the checkbox Limit dx/dt.

Default value

-Inf

Program usage name

LowerLimitDXDT

Tunable

No

Evaluatable

Yes