Engee documentation

Weighted Sample Time

Calculations involving a calculation step.

Weighted Sample Time Math

weight sample time math

Weighted Sample Time

weight sample time math 1

Description

The Weighted Sample Time Math block adds, subtracts, multiplies or divides its input signal ( ) by a weighted calculation step ( ). If the input signal is continuous, is the calculation step of the model. Otherwise, is the sampling step of the input signal. If the input signal is constant, the block is assigned a final calculation step based on its connection and context.

The block icon changes depending on the operation selected in the Operation parameter and the value of the Weight value parameter.

The mathematical operation is specified by the Operation parameter. The block can also output either a weighted calculation step (Ts Only) or a weighted sampling rate (1/Ts Only).

The weighting factor is specified by the Weight value parameter. If the weight is 1.0, this value is not displayed in the equation on the block icon.

You can use the Weighted Sample Time Math block to extract the calculation step from the signal. To do this, set the Operation parameter to Ts Only and the Weight parameter to 1.0. In this configuration, the unit outputs the calculation step of the input signal.

The block calculates the output signal value using the priority rules for operators. For example, if the Operation parameter is +, the block calculates the output signal as follows:

However, if the Operation parameter is /, the block calculates the output signal as follows:

Ports

Input

Port_1 - input signal
scalar | vector | matrix

Input signal ; scalar, vector or matrix. Depending on the value of the Operation parameter, the block can add, subtract, multiply or divide the input signal by a weighted calculation step, or simply output a weighted calculation step or weighted sampling rate.

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

Output

Port_1 - output signal
scalar | vector | matrix

weighted calculation step, sampling rate of the input signal or the result of calculations involving weighted calculation step ( ). If the input signal is continuous, is the computation step of the model. Otherwise, is the sampling step of the input signal. If the input signal is constant, the block is assigned a final calculation step based on its connection and context.

Data types: Float64.

Parameters

Main

Operation - mathematical operation
+ (by default) | - | * | / | Ts Only | 1/Ts Only

A mathematical operation applied to an input signal.

Usage in program code

Block Parameter

TsampMathOp

Values

+ | - | * | / | Ts Only | 1/Ts Only

By default

+

Weight value - calculation step weighting factor
1.0 (by default) | real-valued scalar

Calculation step weighting factor; scalar with real value.

Usage in program code

Block parameter

weightValue

Values

real-valued scalar

* By default*

1.0

Additional options

C code generation: Yes