**Documentation Home Page** ◇ **RT-LAB Home Page**

Pour la **documentation en FRANÇAIS**, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

# RTE Logical Operator

# Library

RT-EVENTS Math Operations

# Block

# Description

The RTE Logical Operator blocks perform the following logical operations on their inputs with compensation for transitions occurring between the time steps: and, or, not, n, and, nor, xor.

The number of input ports is specified with the Number of input ports parameters.

**The size of the output depends on input vector size and the selected operator:**

- If the block has more than one input, any nonscalar inputs must have the same dimensions. For example, if any input is a 2-by-1 vector, all other inputs must also be 2-by-1 vectors.
- If the block has more than one input, the output has the same dimensions as the inputs and each output element is the result of applying the specified logical operation to the corresponding input elements. For example, if the specified operation is AND and the inputs are 2-by-1 vectors, the output is a 2-by-1 vector whose first element is the result of applying the AND to the first elements of the inputs, etc.
- For a single vector input, the block applies the operation (except the NOT operator) to all elements of the vector. The output is always a scalar.
- The NOT operator accepts only one input, which can be a scalar or a vector. If the input is a vector, the output is a vector of the same size containing the logical complements of the input vector elements.

The Maximum number of events parameters is used to determine the maximum number of transitions that can occur during one calculation step and that can be stored in the output signals. For example, if the specified operations is OR and the number of ports is 2 and the port widths are 1.

**Also, suppose that both input signals contain two events during one calculation step as in the following figure:**

- By specifying a maximum number of four events, all transitions above will be output.
- By specifying a maximum number of three events, only the first three transitions above will be output and RT-EVENTS will add or remove, at the next step, a transition to keep the output valid.

# Mask

# Parameters

| The logical operator to be applied to the block inputs. Valid choices are the operators listed previously. |
---|---|

| The number of block inputs. The value must be appropriate for the selected operator. |

| The maximum number of events or transitions that can occur during a single step. Over this number, events are skipped and the block tries to resolve the conflict at the next simulation step. |

# Input

| The input signals to process logical operations. |
---|

# Output

| The output signal of the logical operator. |
---|

# Characteristics

| Yes |
---|---|

| Inherited and fixed discrete |

| Yes |

| Yes |

# Example

The rte_basic1.mdl model shows how to do simple operations on RTE signals. It also demonstrates how to use the RTE Logical Operator block.

The rte_pwm_generation.mdl model demonstrates how to use RT-EVENTS blocks to generate PWM signals of different type. In this example the RTE Logical Operator block is used to generate PWM signals by comparing two signals : the carrier and the modulation signal.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323