You are on page 1of 114

RT-EVENTS 3.

7
Block Library Reference
Guide

CHAPTER 1: INTRODUCTION
CHAPTER 2: BLOCK REFERENCE
RTE Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
RTE Conversion OP5110-5120 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
RTE Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
RTE Events Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
RTE Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
RTE Frequency Meter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
RTE Ground . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
RTE Insert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
RTE Integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
RTE Latch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
RTE Latch Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
RTE Logical Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
RTE Period Meter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
RTE Probe Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
RTE PWM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
RTE Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
RTE Rate Transition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
RTE Relational Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
RTE Remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
RTE Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
RTE Signal Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
RTE SPWM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
RTE Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
RTE Sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
RTE-Drive ABC-DQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
RTE-Drive Full Park D-Q PMSM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
RTE-Drive Park D-Q PMSM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
RTE-Drive Phase Domain PMSM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
RTE-Drive Phase Domain PMSM Inductance. . . . . . . . . . . . . . . . . . . . . . . . . . 86
RTE-Drive Quadrature Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

RTE-Drive 2-Level TSB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91


RTE-Drive 3-Level TSB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
RTE-Drive 2-Level TSB with High-Impedance and Rectification Modes . . . . . . 103
RTE-Drive 3-Level TSB with High-Impedance and Rectification Modes . . . . . . 107
RTE STATUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

Introduction

Overview
RT-Events is a Simulink blockset for the fixed-time-step simulation of hybrid systems
involving dynamics and discrete events asynchronous with respect to the simulation clock.
As the RT-Events is designed for and works with a fixed step size, it is therefore compatible
with the Real Time Workshop (RTW) and RT-LAB, and is usually used for real-time simulation
and control.
The RT-Events blockset is the solution to the following problems encountered in the
simulation of event-based systems.
Problem 1: Very long simulation time
The simulation time of mixed mode (event triggered / discrete / continuous) is increasing
drastically with system complexity and the number of discrete events involved in the
simulations. This kind of simulations traditionally require time-consuming variable stepsolver.
The actual visual simulation tools are limited to code generators that do not support
variable-step algorithms and are also limited to run in interpretative mode on a single CPU.
Problem 2: Imprecise hard-real-time simulation
Time-consuming variable time solver are usually required to compensate for errors
introduced by event occuring between two time samples. This technique cannot be applied
for hard real-time applications requiring fixed time step solver.
The actual discrete simulation algorithms suffer of intrinsic limitations. They introduced
errors in the solutions of mixed-mode system when events occur between the sampling
instants and they require sampling periods and/or interrupt response latencies smaller than
the specified timing precision of critical events; for example, 10s for a combustion engine.
Models with sampling periods smaller than 10 s are not practical with actual commercial
processors and I/O technologies.
Features
The problems describe above justify the utilisation of RT-Events blockset. Here are the major
features of the RT-Events blockset:
RT-Events blockset allows precise simulation of event-based or mixed mode systems by
compensate for the errors introduced by events occurring between the sampling instants.
The precision obtained with the RT-Events blocks depends on the step size selected with
respect to the frequency content of the signals involved.
RT-Events blockset also allows fast simulation of event-based or mixed mode systems. The
use of a fixed step size renders the RT-Events blocks suitable for hard real-time simulations
and are faster simulations than those performed with variable step algorithms. The RTEvents blockset is also adaptable to distributed real-time simulations with RT-LAB (TM)
RT-Events is of course compatible with Simulink and with RTW code generator.
RTEVENTS-UG-37

RTE Data Type


RT-Events support two signal data type: RTE Boolean and RTE Double. They are used to
store respectively the values of boolean and double discrete signals. In both case, the
change in the value can occur during a calculation step.

RTEVENTS_3_7_Q042011

Block Reference

RT-Events provides two sets of blocks in Simulink stored in two libraries: RT-Events and RTEDrive. To open the RT-Events or the RTE-Drive libraries, type the following commands at the
Matlab prompt:
>> rtevents
or
>> rtedrive
These libraries are also available from the Simulink browser.

The following figures show the main page of these libraries.

RTEVENTS-UG-37

The next section presents all block available inside the RT-EVENTS and the RTE-Drive
libraries.

RT-Events
Discrete
RTE Delay

Delays the input by a variable amount of time.

RTE Integrator

Integrates the input signal and compensates for the discretetime error.

RTE Latch

Latchs the input signal each time an event occurs.

RTE Latch Delay

Latchs the input signal each time an event occurs but delay it
by one step.

Math Operations

RTEVENTS_3_7_Q042011

RTE Filter

Removes small pulses from the input signal.

RTE Insert

Inserts N pulses in the input signal.

RTE Logical Operator

Performs logical operations on their inputs with compensation.

RTE Queue

Stores in memory the times and states of all events.

RTE Relational

Performs a relational operation on its two inputs.

Operator
RTE Remove

Removes N pulses of the input.

RTE Sum

Adds or substracts inputs.

Signal Attributes
RTE Conversion

Converts an input signal to the specified data type.

RTE Conversion

Convers input signals to the required data type of the RT-LAB

OP5110-5120

Event Detector and Event Generator blocks.

RTE Frequency Meter

Measures the frequency and the duty cycle of its input signals.

RTE Period Meter

Measures the period, the frequency and the duty cycle of its
input signals.

RTE Probe Events

Outputs event's attributes, including time, state, initial state,


number of events and status of the inputs.

RTE Signal Attributes

Outputs the specified attribute of the input signal.

Signal Routing
RTE Switch

Passes through the first input or the third input based on the
value of the second control input.

Sinks
RTE Scope

Displays signals generated during a simulation.

Sources
RTE Events Generator

Generates square pulses.

RTE Ground

Outputs an empty RTE Boolean-type signal.

RTE PWM

Generates square wave pulses at regular time intervals.

RTE SPWM

Generates square wave pulses at regular time intervals.

RTE-Drive
Machines
RTE-Drive Full Park D-

Implements a 3-phase permanent magnet synchronous

Q PMSM

machine with sinusoidal flux distribution using the full park D-Q
reference frame.

RTE-Drive Park D-Q

Implements a 3-phase permanent magnet synchronous

PMSM

machine with sinusoidal flux distribution using the park D-Q


reference frame.

RTEVENTS_3_7_Q042011

RTE-Drive Phase

Implements a permanent magnet synchronous machine model

Domain PMSM

using a phase domain representation model.

RTE-Drive Phase

Computes the phase domain time varying inductance matrix of

Domain PMSM

a permanent magnet synchronous machine.

Inductance
Measurements
RTE-Drive ABC-DQ

Performs the abc to dq transformation on a set of three-phase


signals.

RTE-Drive Quadrature

Outputs the relative angular position of a quadrature

Decoder

incremental encoder.

Power Electronics
RTE-Drive 2-Level TSB

RTEVENTS_3_7_Q042011

Implements a 2-level (2-switch) bridge.

RTE Conversion
Library
RT-Events Signal Attributes

Block

Figure 1:RTE Conversion Block

Description
The RTE Conversion block converts an input signal to the data type specified by the block's
Data Types parameter.
The following table explains all output data type conversion available:

Double

Convert the input signal in a Double signal. The output is Low


when the input is less than 0.5. Otherwise the output is High.
The changes of the input cause only transitions at the
beginning of the calculation step. Only one transition can be
output at each calculation step.

Double with

Convert the input signal in a Double signal. The output is equal

Compensation

to average of the input signal.

RTE Boolean

Convert the input signal in an RTE Boolean. The output is Low


when the input is less than 0.5. Otherwise the output is High.
The changes of the input cause only transitions at the
beginning of the calculation step. Only one transition can be
output at each calculation step.

RTE Boolean with

Convert the input signal in a RTE Boolean signal.

Compensation

- If the input signal is a Double signal, the output is Low when


when the input is less than 0.5. Otherwise the output is High.
Also note that the transition between High and Low state
depends on the level value of the input signal, i.e that ehe
average of the output during a calculation step is equal to the
input signal.
- If the input signal is a RTE Double, the output is Low when
the input is less than 0.5. Otherwise the output is High. Events
during calculation step are supported.

RTE Double

Convert the input signal in an RTE Double. The output is equal


to the input signal at the end of the last event. The changes of
the input cause only transitions at the beginning of the
calculation step. Only one transition can be output at each
calculation step.

RTEVENTS_3_7_Q042011

RTE

RTE Double with

Convert the input signal in a RTE Double signal.

Compensation

- If the input signal is a Double signal, the output is equal to


the input signal at the end of the last step. The changes of the
input cause only transitions at the beginning of the calculation
step. Only one transition can be output at each calculation
step.
- If the input signal is a RTE Boolean, the output is 1 when the
input is High. Otherwise the output is Low. Events during
calculation step are supported.

Mask

Figure 2:RTE Conversion Mask

Parameters

Input Data Type

Specified the input data types of the input ports: double, RTE
Boolean or RTE Double.

Output Data Type

Specified the output data types of the output ports: Double,


RTE Boolean, RTE Double.

RT-Events

Specified if the RT-Events compensation is enabled or disabled.

Compensation

When enabled, event can occur between two calculation steps.

Maximum number of

The maximum number of events or transitions that can occur

events

during a single step. Over this number, events are ignored and
not outputed.

Sample Time [s]

The time interval between samples in seconds. Only available


when the input data type is double.

RTEVENTS_3_7_Q042011

RTE

Input

Input

The signal to convert. The data type of this signal must Double,
RTE Boolean or RTE Double.

Output

Output

The converted signals. The data type of this signal must match
the data type specified in the Output Data Type parameters.

Characteristics

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete

Work offline

Yes

Dimensionalized

Yes

Example
The rte_basic1.mdl model shows how to do simple operations on RTE signals. It also
demonstrates how to use the RTE Conversion block to convert a RTE Boolean signal to a RTE
Double signal.

Related Items
RTE Conversion OP5110-5120

RTEVENTS_3_7_Q042011

RTE

RTE Conversion OP5110-5120


Library
RT-Events Signal Attributes

Block

Figure 3:RTE Conversion OP5110-5120 Event Generator/Detector Block

Description
This block converts:
Double-type signals output by the RT-LAB OP5110-5120 Event Detector block to RTE Booleantype signals or
RTE Boolean-type signals to double-type signals receive by the RT-LAB OP5110-5120 Event
Generator block.
The RT-LAB OP5110-5120 Event Detector/Generator block makes use of the Opal-RT
OP5110 or OP5120 reconfigurable digital input/output boards to read digital signals and
detect the transitions that occur on these signals during one calculation step. For more
information see RT-LAB documentation or contact Opal-RT Technologies support.

RTEVENTS_3_7_Q042011

RTE

10

Mask

Figure 4:RTE Conversion OP5110-5120 Event Generator/Detector

Parameters

Conversion Type

Specifies if the conversion is made from the OP5110-5120


Event detector block to the RTE Boolean data type, or from the
RTE Boolean data type to the OP5110-5120 Event Generator
block.

Number of OP5110-

The number of input/output OP5110-5120 lines.

5120 Event Lines


Maximum number of

The maximum number of events or transitions that can occur

events

during a single step. Over this number, events are ignored and
not outputed.

Time Unit

Select whether the time values will be specified as a ratio of


the transition time over the duration of the step, or in seconds.

Consider time factor

When this checkbox is checked, the RT-Lab time factor is


applied to the time values of this block. Only available when
the Time Unit is Seconds.

Sample Time

The time interval between samples in seconds. Only available


when the conversion type is OP5110-5120 Event Detector to
RTE Boolean.

Show Initial States

When this checknox is checked, the input Initial States is

input

added to the block. See the description of this input in the


Inputs section below. Only available when the conversion type
is OP5110-5120 Event Detector to RTE Boolean.

RTEVENTS_3_7_Q042011

RTE

11

Input

Initial States

The initial state of each input vector. Only available when the
conversion type is RTE Boolean to OP5110-5120 Event
Generator.

State Vector (Double)

The state vector output from the RT-LAB OP5110-5120 Event


Detector block. Only available when the conversion type is
OP5110-5120 Event Detector to RTE Boolean.

Time Vector (Double)

The time vector output from the RT-LAB OP5110-5120 Event


Detector block. Only available when the conversion type is
OP5110-5120 Event Detector to RTE Boolean.

Status (Double)

The status output from the RT-LAB OP5110-5120 Event


Detector. Only available when the conversion type is OP51105120 Event Detector to RTE Boolean.

Input (RTE Boolean)

RTE Boolean signal to send to the RT-LAB OP5110-5120 Event


Generator. Only available when the conversion type is RTE
Boolean to OP5110-5120 Event Generator.

Output

Output (RTE Boolean)

The equivalent RTE Boolean-type signal. Only available when


the conversion type is OP5110-5120 Event Detector to RTE
Boolean.

State Vector (Double)

The state vector sent to the RT-LAB OP5110-5120 Event


Generator. Only available when the conversion type is RTE
Boolean to OP5110-5120 Event Generator.

Time Vector (Double)

The time vector sent to the RT-LAB OP5110-5120 Event


Generator block. Only available when the conversion type is
RTE Boolean to OP5110-5120 Event Generator.

Characteristics

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete

Work offline

Yes.
Please note that the RT-LAB OP5110-5120 Event Generator/
Detector block doesn't receive/send events from the RT-LAB
OP5100 cards in offline simulation.

Dimensionalized

Yes

Example
The rte_event_detector.mdl and the rte_event_generator.mdl models shows how to connect
the RTE Conversion OP5110-5120 blocks to the Opal-RT OP5110-5120 event detector and
event generator blocks.

Related Items
RTE Conversion

RTEVENTS_3_7_Q042011

RTE

12

RTE Delay
Library
RT-Events Discrete

Block

Figure 5:RTE Delay Block

Description
The RTE Delay block delays the RTE Boolean-type input by a variable amount of time. The
block accepts two inputs: the first input is the signal that passes through the block; the
second input is the time delay.
The Buffer size parameter defines the maximum number of events that can be store in the
internal buffer. The block clips events of the delay that exceed this size. The Buffer size must
be greater than or equal to zero.
During the simulation, the block stores events in an internal buffer. At the start of the
simulation, the block outputs the Initial state condition parameter until the simulation time
exceeds the time delay input. Then, at each simulation step the block outputs the signal at
the time that corresponds to the current simulation time minus the delay time.
The RTE Delay block also allows you to:
Ignore / Allow multiple output of same Event
Compensate for skipped events
Ignoring / Allowing multiple output of same event
The RTE Delay block, as mentionned above, outputs the input signal delayed by a variable
amout of time. When the time delay increase rapidly, it can occurs that some events are
output multiple time. By enabling the Ignore event output multiple times parameter, the
block can ignore events that should be output multiple time. Suppose for example a delay
block with an initial time delay of 0 second. Ater 2 seconds of simulation, the time delay
increase to 2 seconds. The following figure illustrates the effect of the parameter on the
output.

RTEVENTS_3_7_Q042011

RTE

13

Figure 6:Effect of the Ignore Events Output Multiple Time Parameter on the RTE Delay Block.

Compensating skipped events


When the time delay decrease rapidly, it can occurs that some events stored in memory are
never output and that the output state is invalid for the next event that will occurs. By
enabling the Skipped events compensation parameter, the block can compensate for these
events and add a new event (rising or falling) to toggle the output state in a valid state.
Suppose for example a delay block with an initial delay of 2 seconds. After 3 seconds of
simulation, the time delay decrease to 0 second. The following figure illustrates the effect of
the compesation. When the compensation is enabled, the block add a falling event. When
the compensation is disabled, the block skip the first event to be output.

Figure 7:Effect of the Skipped Events Compensation on the RTE Delay Block.

Mask

Figure 8:RTE Delay Mask

RTEVENTS_3_7_Q042011

RTE

14

Parameters

Ignore event output

When enabled, the block ignores event that should be output

multiple times

multiple time.

Skipped events

When enabled, the block compensate for skipped event.

compensation
Initial Condition

Initial state condition output before the first event is detected.

Buffer size

Number of events the block can store in memory.

Maximum number of

The maximum number of events or transitions that can occur

events

during a single step. Over this number, events are ignored and
not outputed.

Input

Input (RTE Boolean)

RTE Boolean signal to delay

Delay (Double)

Delay signal

Output (RTE Boolean)

Delayed RTE Boolean signal

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete

Work offline

Yes

Dimensionalized

Yes

Output

Characteristics

Examples
The rte_encoder.mdl model demonstrates how to use RT-Events blocks to simulate an
incremental encoder connected to a rotating object. This example also shows how to use
blocks of the library to insert fault, to filter noise and to measure some characterics of RTE
Boolean signal. In this example the RTE Delay block is used to generate channel B of the
incremental encoder by delaying the channel A.
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 Delay block is used to generate dead
time on the rising and falling edges of the two complementary signal of the PWM.

Related Items

RTEVENTS_3_7_Q042011

RTE

15

RTE Events Generator


Library
RT-Events Sources

Block

Figure 9:RTE Events Generator Block

Description
The RTE Events Generator block generates square pulses. At each calculation step, the block
must receive the following information about events: the number of events that occur, the
times and the values (transitions) of each event.

Mask

Figure 10:RTE Events Generator Mask

Parameters

RTEVENTS_3_7_Q042011

Outport Data Type

Specified if the output is a RTE Boolean or RTE Double signal.

Maximum number of

The maximum number of events or transitions that can occur

events

during a single step. Above this number, events are not output.

Sample Time

The output sample time in second.

RTE

16

Input

Time Vector (Double)

The vector of each event's time within the model sample time.
The values of time must be in the following range : [0 to
Sample Time].

State Vector (Double)

The vector of each event's state.

Initial condition

The state of the RTE output signal before the first event.

(Double)
Number of events

The number events in each calculation step.

(Double)

Output

Output (RTE)

RTE generated signal.

Status (Double)

The status of the RTE signal. See RT-Events Status

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete

Work offline

Yes

Dimensionalized

No

Characteristics

Examples
The rte_basic1.mdl model shows how to do simple operations on RTE signals. It also
demonstrates how to use the RTE Events Generator block to generate a repetitive sequence
of pulses.

Related Items

RTEVENTS_3_7_Q042011

RTE

17

RTE Filter
Library
RT-Events Math Operations

Block

Figure 11:RTE Filter Block

Description
The RTE Filter block removes, from the input signal, pulses (pairs of opposite transitions)
that are smaller than a fixed width. The block can remove only high pulses (low-to-high and
high-to-low transitions), only low pulses (high-to-low and low-to-high transitions) or both
kinds of pulse. The following example demonstrates the effect of the filter block.

Figure 12:Typical Example of RTE Filter Block

Limitation
The pulse width limit must be smaller than the inherited sample time of the block. Generally,
the filter block can correctly manage the removal of pulses with a witdh 10 times smaller
than the sample time.
When the filter block is set to remove only high pulses or low pulses, the block must delay
the first event if first event of a pulse occurs in the last T seconds of the calculation step,
where T is smaller than the pulse width, and the pulse is larger than pulse width limit.
This limitation is caused by the fact that the block cannot predict if a pulse with a transition
so close to the end of the step will be larger or smaller than the pulse width limit. The
following figure shows this effect on the output signal.

RTEVENTS_3_7_Q042011

RTE

18

Figure 13:Limitation of the RTE Filter Block

Mask

Figure 14:RTE Filter Mask

Parameters

Pulse Type

Determine the kind of pulse to remove from the input signals.

Pulse Width Limit

Minimum size of pulse. Below this limit, pulses are removed.

Maximum Number of

The maximum number of events or transitions that can occur

Events

during a single step. Events above this number are not output.

Input (Double)

RTE Boolean signal to filter

Output (Double)

Filtered RTE Boolean signal

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

Yes

Input

Output

Characteristics

Example
The rte_encoder.mdl model demonstrates how to use RT-Events blocks to simulate an
incremental encoder connected to a rotating object. This example also shows how to use

RTEVENTS_3_7_Q042011

RTE

19

blocks of the library to insert fault, to filter noise and to measure some characterics of RTE
Boolean signal. In this example the RTE Filter block is used to remove noise that occurs on
real analog signals.

Related Items

RTEVENTS_3_7_Q042011

RTE

20

RTE Frequency Meter


Library
RT-Events Signal Attributes

Block

Figure 15:RTE Frequency Meter Block

Description
The RTE Frequency Meter block measures the frequency and the duty cycle of its input
signals. The duty cycle is the ratio of the time where the signal in High (Ton) on the signal
period.
The frequency and the duty cycle output signals can be measured between consecutive
rising edges or consecutive falling edges. When rising edge are selected, the measurement
starts and ends on rising edge. However, when falling edge are selected, the measurement
starts and ends on falling edge. The measurement between consecutive parameter allows to
select one of these two modes.
The minimum frequency parameter is used when the inputs signal is at very low frequency.
When the block didnt detect edges since a time greater than the specified period, the
frequency is set to zero and the duty cycle cycle.
When the frequency of the input signal is lower than the minimum frequency parameter and
the state of the input changes between Low or High value, the value of the duty cycle
change between 0 and 1 only if the input signal stay in the same state a time longer than
the minimum frequency. Moreover, depending on the Edge type for detection of minimum
frequency parameter and measurement between consecutive parameter, the reference time
tx where the inactive period start to be calculated is different:
When the edge type for detection parameter is either, the reference time is fixed at the time
of the last event of any type (rising or falling).
When the edge type for detection is automatic and the measurement is performed between
rising edge, the reference time is fixed at the time of the last rising edge.
When the edge type for detection is automatic and the measurement is performed between
falling edge, the reference time is fixed at the time of the last falling edge
In some systems this behavior can cause problem. The RTE Period Meter block has a
different algorithm to treat the duty cycle when the frequency is lower than the minimum
frequency.

RTEVENTS_3_7_Q042011

RTE

21

Mask

Figure 16:RTE Frequency Meter Mask

Parameters

Measurement between Determines if the period and frequency outputs are measure
consecutive

between consecutive rising or falling edges

Initial duty cycle

Determines the initial value of the duty cycle. When automatic


is selected, the block select automatically the value depending
of the current state (Low or High) of the input signals.
Otherwise, the initial duty cycle is 0 or 1.

Minimum frequency

When the input signal frequency is lower than this value, the
frequency is 0 and the duty cycle is set to 0 or 1 depending of
the current state (Low or High) of the input signal.

Edge type for

Determines the edge type to be used to calculated if the

detection of minimum

minimum frequency condition has been reached. When either

frequency

is selected, the inactive period is calcaluted since the last event


occurs (rising or falling). When automatic is selected, the type
of edge used to calculate the inactive period depends on the
measurement between consecutive parameter. If rising is
selected, the measurement is calculated since the last rising
edge. If falling is selected, the measurement is calculated since
the last falling edge.

Input

Input (RTE Boolean)

RTE Boolean signals to measure.

Frequency (Double)

Signal frequencies in Hz.

Duty Cycle (Double)

The duty cycle in the range: [0..1].

Output

RTEVENTS_3_7_Q042011

RTE

22

Characteristics

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete.

Work Offline

Yes

Dimensionalized

Yes

Examples
None

Related Items
RTE Period Meter

RTEVENTS_3_7_Q042011

RTE

23

RTE Ground
Library
RT-Events Source

Block

Figure 17:RTE Ground Block

Description
The RTE Ground block outputs an empty RTE Boolean-type signal. This signal contains no
events and is initialized with an undefined state.
This block can be used to connect blocks whose inport ports of RTE Boolean data type are
not connected to other blocks. If you run a simulation with blocks having unconnected input
ports, Simulink issues warning messages. Using this blocks to ground those blocks avoids
warning messages.

Mask

Figure 18:RTE Ground Mask

Parameters

Sample Time

The time interval between samples.

Input

RTEVENTS_3_7_Q042011

RTE

24

Output

Output (RTE Boolean)

Empty RTE Boolean signals

Direct Feedthrough

No

Sample time

Fixed discrete

Work offline

Yes

Dimensionalized

Yes

Characteristics

Example
Related Items

RTEVENTS_3_7_Q042011

RTE

25

RTE Insert
Library
RT-Events Math Operations

Block

Figure 19:RTE Insert Block

Description
The RTE Insert block inserts N pulses in an RTE Boolean signal. The pulses are inserted
between N+1 consecutives pulses of the input signal. The offset parameter determines
where the pulses are inserted relative to the beginning of the cycle. The insertion is repeated
at every cycle of M pulses.
The pulse width and delay parameters characterize the inserted pulses. These parameters
are measured in percent of the last input signal period. The delay parameters is relative to
the end of the last pulse.
Here is a small example where the parameters N, M, width and delay are respectively
2,4,16% and 16%.

Figure 20:Typical Example of the RTE Insert Block Behaviour

The RTE Insert block enables you to:


Define a trigger type
Define an offset
Reset (or restart) the cycle
Defining Trigger Type
The Insert block count the pulses each time an edge of the selected type occurs. By
selecting a rising trigger, high pulses will be insert in the input. By selection a falling trigger,
low pulses will be insert in the input.
Defining an offset

RTEVENTS_3_7_Q042011

RTE

26

The Insert block allow to choose where the pulses should be insert in the input signal. The
offset parameter determine an offset in pulses from the beginning of the cycle where the
pulse are inserted.
Reseting the cycle
The Insert block determine where the pulses should be insert relative to the first pulse of a
cycle. The external reset signal can reset the internal counter that determine the beggining
of a cycle. Each time an specified edge occur on the trigger input signal, the counter is
reseted to zero. The reset can be perform on rising edge, falling edge, or either.
Limitations
One of the limitation of this block occurs when the frequency of the input signal increases
rapidly and the next rising edge of the input signal occurs before the new pulses was
inserted. In this case, the input signal and the new pulse are combined with a logical AND.
Example:

Figure 21:Limitation of the RTE Insert Block When Frequency Increase Rapidly

In the extreme case where the time of the events of the new pulses exceed the time of the
falling edge of the next input pulse, the events are skipped.
Example:

Figure 22:Limitation of the RTE Insert Block When Frequency Increase Extremely Rapidly

RTEVENTS_3_7_Q042011

RTE

27

Mask

Figure 23:RTE Insert Mask

Parameters

Trigger type

Determine the kind of edges used to count pulses.

Number of pulses to

The number of pulses to insert at each cycle.

insert
Number of pulses by

The number of pulses to complete a cycle.

cycle
Offset

Relative offset to the beggining of the cycle where the pulses


are inserted.

Pulse width
Delay

Pulse width in percent of the input signal period.


Pulse delay in percent of the input signal period relative to the
end of the pulse.

External Reset

Edge type use to reset the cycle.

Maximum Number of

The maximum number of events or transitions that can occur

events

during a single step. Over this number, events are skipped.

Input (RTE Boolean)

RTE Boolean signal (pulse waveform) to modify

Input

RTEVENTS_3_7_Q042011

RTE

28

External Reset

RTE Boolean signal use to reset a cycle

(Double)

Output

Output (RTE Boolean)

Modified RTE Boolean signal

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

Yes

Characteristics

Example
The rte_encoder.mdl model demonstrates how to use RT-Events blocks to simulate an
incremental encoder connected to a rotating object. This example also shows how to use
blocks of the library to insert fault, to filter noise and to measure some characterics of RTE
Boolean signal. In this example the RTE Insert block is used to insert fault in the generated
pulse of the encoder.

Related Items
RTE Remove

RTEVENTS_3_7_Q042011

RTE

29

RTE Integrator
Library
RT-Events Discrete

Block

Figure 24:RTE Integrator Block

Description
The RTE Integrator block integrates the input signal and compensates for the discrete-time
error that takes place because of the occurrences of discrete reset events between the
sampling points. The output of the integrator is the result of the integration.
The integrator block also allows you to:
Select the integration methods.
Reset the integrator depending on a reset input.
Define the initial conditions and the source of the initial conditions in the
block dialog box.
Define upper and lower limits on the integral.
Selecting the integration methods
The block can integrate using these methods: Trapezoidal or RT-Events. For a given step k,
Simulink updates its output y(k) and state x(k+1). Ts is the sampling period. Values are
clipped according to upper or lower limits. In all cases, the initial output of the block is
always the initial condition.
Trapezoidal method. For this method, the integration 1/s is approximated by Ts/2*(z+1)/(z-1)
and the input ports have a direct feedthrough.
RT-Events method. For this method, the integration 1/s is approximated using a proprietary
relation. With this method, input ports have non-direct feedthrough. This method allows the
block to directly connect its outputs to inputs without using another block that has non-direct
feedthrough in the loop.
Resetting the State
The block can reset its state to zero (or to initial condition) based on an RTE Boolean reset
signal. To cause the block to reset its state, select one of the reset choices available in the
block dialog box.
Select rising to trigger the state reset when the reset signal has a rising edge. Select falling
to trigger the state reset when the reset signal has a falling edge. Select either to trigger the
reset when either a rising or a falling signal occurs.

RTEVENTS_3_7_Q042011

RTE

30

Defining Initial Conditions


You can define initial conditions as a parameter in the block's mask or you can input them as
an external signal. To define the initial conditions as a block parameter, specify the Initial
condition source parameter as internal and enter the value in the Initial condition parameter
field. To provide the initial conditions from an external source, specify the Initial condition
source parameter as external. An additional input port appears under the block input.
Limiting the Integral
To prevent the output from exceeding specific levels, select the Limit output checkbox and
enter the limits in the appropriate parameter fields. Doing so causes the block to function as
a limited integrator. When the output is outside the limits, the integral action is turned off to
prevent integral windup.

Mask

Figure 25:RTE Integrator Mask

Parameters

Integrator Method

The integration method. The default is Trapezoidal

External Reset

Resets the states to zero or to their initial conditions when a


trigger event (rising, falling, either, level) occurs in the RTE
Boolean reset signal.

RTEVENTS_3_7_Q042011

RTE

31

Initial Condition
Source

Gets the states' initial conditions from the Initial condition


parameter (if set to internal) or from an external block (if set
to external)

Initial Condition

The states' initial conditions. Set the Initial condition source


parameter value to internal.

Limit Output

If checked, limits the block's output to a value between the


Lower saturation limit and Upper saturation limit parameters.

Upper Saturation Limit The upper limit for the integral. The default is inf.
Lower Saturation Limit The lower limit for the integral. The default is -inf.
Sample time

The time interval between samples.

Input (Double)

Signal to integrate.

Reset (RTE Boolean)

RTE Boolean signal used to reset the state of the integrator.

Initial Condition

The states' initial condition. Set the Initial condition source

(Double)

parameter value to external

Output (Double)

Integral of the input.

Direct Feedthrough

Yes for trapezoidal method. No for RT-Events method.

Sample Time

Fixed discrete.

Work offline

Yes

Dimensionalized

Yes

Input

Output

Characteristics

Example
The rte_resetwalk.mdl model shows the difference between a compensated event-based
discrete system, an uncompensated simulated event-based discrete system and a
continuous system and demonstrates the accuracy of the RTE blocks compare to the
equivalent discrete block.

Related Items

RTEVENTS_3_7_Q042011

RTE

32

RTE Latch
Library
RT-Events Discrete

Block

Figure 26:RTE Latch Block

Description
The RTE Latch block stores in memory the value of the input signal each time an event
occurs in the trigger signal. The latch block outputs the last value stored in memory. The
value is held until the occurence of the next trigger event. The block compensates the error
due to events occuring between two samples.
The RTE Latch block enables you to:
Define initial condition of the output signal.
Latch on a rising, a falling or either edge.
Defining Initial Conditions
You can define initial condition as a parameter in the block dialog box or you can input them
from an external signal. To define the initial condition as a block parameter, specify the
Initial condition source parameter as internal and enter the value in the Initial condition
parameter field. To provide the initial condition from an external source, specify the Initial
condition source parameter as external. An additional input port appears under the block
input.
Trigger Type
The block can stores in memory its inputs only when specific event occur in the trigger
signal. The trigger type parameter allow to select the type of edge that cause the block to do
the storage:
Select rising to store the input when rising edges are detected.
Select falling to store the input when falling edges are detected.
Select eitherto store the input when rising or falling edges are detected.

RTEVENTS_3_7_Q042011

RTE

33

Mask

Figure 27:RTE Latch Mask

Parameters

Trigger Type

Determine if the latch occurs on rising, falling or either edge.

Initial condition

Specify the source of the initial condition as internal or as

source

external.

Initial Condition

Value outputs before the first edge is detected.

Sample Time

The time interval between samples.

Input (Double)

Input signal to be latched.

Trigger (RTE Boolean)

RTE Boolean signal use to trigger the storage.

Initial Condition

Value outputs before the first edge is detected.

Input

(Double)

Output

Output (Double)

Latched signal.

Direct Feedthrough

Yes

Sample time

Fixed discrete

Work offline

Yes

Dimensionalized

Yes

Characteristics

RTEVENTS_3_7_Q042011

RTE

34

Example
The rte_engine.mdl model demontrates the precision of the RTE blocks compare to the
Simulink discrete blocks in the context of a combustion engine. The firing of the combustion
is an events based behaviour and necessitate the use of RT-Events to be simulated correctly
in discrete sample time.
In this example the RTE Latch block is used to simulated the compression phase of the
combustion cycle of the engine.

Related Items
RTE Latch Delay

RTEVENTS_3_7_Q042011

RTE

35

RTE Latch Delay


Library
RT-Events Discrete

Block

Figure 28:RTE Latch Delay Block

Description
The RTE Latch Delay block stores in memory the value of the input signal each time an event
occurs in the trigger signal. The latch block outputs the value stored in memory when the
events that preceds the last event occurs. The output value is held until the occurence of the
next trigger event. The block compensates the error due to events occuring between
samples.
The RTE Latch Delay block enables you to:
Define initial conditions in the block dialog box or as an input to the block.
Latch on rising, falling or either edge.
Defining Initial Conditions
You can define initial conditions as parameters in the block dialog box or you can input them
from an external signals. To define the initial condition as block parameters, specify the
Initial condition source parameter as internal and enter the value in the Initial condition
parameter fields. To provide the initial condition from external sources, specify the Initial
condition source parameter as external. Additional input ports appears under the block
input.
Trigger Type
The block can stores in memory its inputs only when specific edge occur in the trigger signal.
The trigger type parameter allow to select the type of edge that cause the block to do the
storage:
Select rising to store the input when rising edges are detected.
Select falling to store the input when falling edges are detected.
Select eitherto store the input when rising or falling edges are detected.

RTEVENTS_3_7_Q042011

RTE

36

Mask

Figure 29:RTE Latch Delay Mask

Parameters

Trigger Type

Determine if the latch occurs on rising, falling or either edge.

Initial condition

Specify the source of the initial condition as internal or as

source

external.

Initial Condition 1

Value outputs before the first edge is detected.

Initial Condition 2

Values outputs after the first edge is detected and before the
second edge is detected.

Sample Time

The time interval between samples.

Input (Double)

Input signal to be latched.

Trigger (RTE Boolean)

RTE Boolean signal use to trigger the storage.

Initial Condition 1

Value outputs before the first edge is detected.

Input

(Double)
Initial Condition 2

Value outputs after the first edge is detected and before the

(Double)

second edge is detected.

Ouput (Double)

Latch signal.

Output

RTEVENTS_3_7_Q042011

RTE

37

Characteristics

Direct Feedthrough

Yes

Sample time

Fixed discrete

Work offline

Yes

Dimensionalized

Yes

Example
The rte_engine.mdl model demontrates the precision of the RTE blocks compare to the
Simulink discrete blocks in the context of a combustion engine. The firing of the combustion
is an events based behaviour and necessitate the use of RT-Events to be simulated correctly
in discrete sample time.
In this example the RTE Latch block is used to simulated the compression phase of the
combustion cycle of the engine.

Related Items
RTE Latch

RTEVENTS_3_7_Q042011

RTE

38

RTE Logical Operator


Library
RT-Events Math Operations

Block

Figure 30:RTE Logical Operator Block

Description
The RTE Logical Operator blocks performs the following logical operations on their inputs
with compensation for transitions occurring between the time steps: and, or, not, nand, 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 vector, 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 element 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 parameter is used to determine the maximum number of
transition that can occurs during one calculation step and that can be store 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 transition above
will be output.

RTEVENTS_3_7_Q042011

RTE

39

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

Figure 31:RTE Logical Operator Mask

Parameters

Operator

The logical operator to be applied to the block inputs. Valid


choices are the operators listed previously.

Number of input ports

The number of block inputs. The value must be appropriate for


the selected operator.

Maximum Number of
events

The maximum number of events or transitions that can occur


during a single step. Over this number, events are skipped and
the block try to resolve the conflict at the next simulation step.

Input

Inputs (RTE Boolean)

The input signals to process logical operations.

Output

Outputs (RTE Boolean) The output signal of the logical operator.

Characteristics

RTEVENTS_3_7_Q042011

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete

Work offline

Yes

Dimensionalized

Yes

RTE

40

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.

Related Items

RTEVENTS_3_7_Q042011

RTE

41

RTE Period Meter


Library
RT-Events Signal Attributes

Block

Figure 32:RTE Period Meter Block

Description
The RTE Period Meter block measures the period and frequency of its input signals. It can
also measures the duty cycle and the duration of its high state (Ton) or low state (Toff).
The period and frequency output signals can be measured between consecutive rising edges
or consecutive falling edges. The measurement between consecutive parameter allows to
select one of these two modes.
The duty cycle, Ton and Toff outputs can be calculated during one calculation step or during
one signal period interval. When calculation step is selected, the times Ton and Toff are
values between 0 and the calculation step. The duty cycle is the ratio of the time Ton on the
calculation step. When signal period interval is selected, the Ton and Toff outputs are values
between 0 and the signal period. The duty cycle is the ratio of the time Ton on the signal
period. The measurement during one parameter allows the selection of these two modes.
The following two figures present the difference between Signal Period and Calcultaiton Step
modes.

Figure 33:Signal Period Operation Mode of the RTE Period Meter Block

Figure 34:Calculation Step Operation Mode of the RTE Period Meter Block

The minimum frequency parameter is used when the inputs signal is at very low frequency.
When the block has not detect edges since a time greater than the inactive period condition,
the measured period and frequency are set respectively to infinite and zero.
RTEVENTS_3_7_Q042011

RTE

42

When the frequency of the input is lower than the minimum frequency parameter, also note
that the value of the duty cycle changes instantaneously between 0 and 1 depending of the
logic level (Low or High) of the input signal. In some systems this behavior can cause
problem. The RTE Frequency Meter block has a different algorithm to treat the duty cycle
when the frequency is lower than the minimum frequency.

Mask

Figure 35:RTE Period Meter Mask

Parameters

Display Period

If selected, output the period of the input signal.

Display Frequency

If selected, output the frequency of the input signal.

Measurement between Determines if the period and frequency outputs are measure
consecutive

between consecutive rising or falling edges

Display Ton

If selected, output the duration of the high state.

Display Toff

If selected, output the duration of the low state.

Display Duty Cycle

If selected, output the duty cycle

Measurement during

Determines if the Ton, Toff and Duty Cycle are calculated

one

relative to one calculation step or relative to one completed


signal period.

Minimum frequency

When the input signal frequency is lower than this value, the
output frequency and period are 0 and Inf.

RTEVENTS_3_7_Q042011

RTE

43

Input

Input (RTE Boolean)

RTE Boolean signals to measure.

Period (Double)

Signal periods in seconds.

Frequency (Double)

Signal frequencies in Hz.

Ton (Double)

Duration of its high state in seconds.

Toff (Doule)

Duration of its low state in seconds.

Duty Cycle (Double)

The duty cycle in the range: [0..1].

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete.

Work Offline

Yes

Dimensionalized

Yes

Output

Characteristics

Examples
The rte_encoder.mdl model demonstrates how to use RT-Events blocks to simulate an
incremental encoder connected to a rotating object. This example also shows how to use
blocks of the library to insert fault, to filter noise and to measure some characterics of RTE
Boolean signal. In this example the RTE Period Meter block is used to measure the frequency
of the incremental encoder.

Related Items
RTE Signal Attributes, RTE Probe Events, RTE Frequency Meter

RTEVENTS_3_7_Q042011

RTE

44

RTE Probe Events


Library
RT-Events Signal Attributes

Block

Figure 36:RTE Probe Events Block

Description
The RTE Probe Events block outputs event's attributes, including time, state, initial state,
number of events and status.The outputs of this block are the information from RTE signals
in the last calculation step.
The block allows displaying the state and time of any events that occur during a calculation
step. The element indices specify which events will be output. This output is a vector with a
dimension ranging from 1 to the maximum number of events contained in an RTE signal.

Mask

Figure 37:RTE Probe Events Mask

Parameters

Input data type

Specified if the input is a RTE Boolean or RTE Double signal.

Source of element

Determines if the indices of output events are specified on the

indices

mask (internal) or as input signals (external).

Element Indices

Vector of the events to output. Only available when the source


of element is internal.

RTEVENTS_3_7_Q042011

RTE

45

Input

Inputs (RTE)

RTE-type signal to convert into doubles.

Element Indices

Vector of the events to output. Only available when the source

(Double)

of element is external.

Time Vector (Double)

The times of each event relative to the last calculation step.

Output

The values of the time vector range from 0 to the mode


sample time.
State Vector(Double)

The states of each event.

Initial Condition

Initial condition of the RTE signal at the beginning of the last

(Double)

calculation step.

Number of events

The number of events that occurred. This corresponds to the

(Double)

number of elements of the time and state vectors which are


not undefined.

Status (Double)

The status of the RTE signal. See RT-Events Status

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

No

Characteristics

Example
The rte_basic1.mdl model shows how to do simple operations on RTE signals. It also
demonstrates how to use the RTE Probe Events to display some event properties of an RTE
signal.

Related Items
RTE Signal Attributes, RTE Period Meter

RTEVENTS_3_7_Q042011

RTE

46

RTE PWM
Library
RT-Events Source

Block

Figure 38:RTE PWM Block

Description
The RTE PWM block generates square wave pulses at regular time intervals. The frequency
and duty cycle input signals determine the shape of the output waveform.
The RTE PWM block can output scalar, vector, or matrix signals. To cause the block to output
a scalar signal, use scalars input signals. To cause the block to output a vector or matrix
signal, use vectors or matrices inputs signals, respectively. Each element of the input signals
affects the corresponding element of the output signal. All the input signals must have the
same dimensions after scalar expansion. The following figure presents the main
characteristics of the generates square wave pulses.

Figure 39:Square Wave Characteristics of the Generated Signals of the RTE PWM Block

The Maximum number of events parameter is used to determine the maximum number of
transition that can occurs during one calculation step and the maximum frequency that can
be output. The following formula determine the maximum frequency:
Fmax = Num / ( 2 *Ts),
where Num and Ts are the maximum number of events and the block sample time.
Shifted transitions
In normal operation, the frequency changes will be update from the previous value when the
active period (cycle) is completed. This gives very precise results without frequency spikes.
However, at low frequencies, this slows down the update time as we need to wait for the first
(slow) period to finish before moving to the next frequency value.
When shifting is enabled, the output of the RTE PWM block will be similar to real-world
sensors in that the transition will happen as soon as possible in order to move to the new

RTEVENTS_3_7_Q042011

RTE

47

frequency value. This might be interpreted as a shift from the old value to the new one with
a half period at one intermediate frequency. This is closer to the behavior of real sensors and
provides faster updates at low frequency, but can confuse some hardware devices.
As an example, suppose a Simulink model containing a pulse generator with a frequency of
250 Hz running at a sample time of 1ms. When the shifted transition is disabled and the
frequency is increased to 1000 Hz, the block waits until the next transition at 250 Hz to
update the frequency. The next transition is set as the reference. If the shifted transition is
enabled, the blocks use instead the previous transition as reference.

Figure 40:Effect of the Shifted Transition Parameter of the RTE PWM block

Mask

Figure 41:RTE PWM Mask

Parameters

Shifted transition

The shifted transition for this block: disabled, enabled.

Maximum number of

The maximum number of events or transitions that can be

events

output during a single step.

Sample time

The time interval between samples in seconds.

Frequency (Double)

The pulse frequency specified in Hz.

Input

RTEVENTS_3_7_Q042011

RTE

48

Duty Cycle (Double)

The duty cycle specified as the percentage of the pulse period


that the signal is on.

Output

Output (RTE Boolean)

RTE Boolean signal generated by the PWM block.

Direct Feedthrough

No

Sample Time

Fixed discrete.

Work Offline

Yes

Dimensionalized

Yes

Characteristics

Examples
The rte_pwm_generation.mdl model demonstrates how to use RT-Events blocks to generate
PWM signals of different type. This example also shows how to add dead time to the PWM
and also shows how to generate Space Vector PWM using this block. It also compares many
method to generate PWM using RTE Logical Operator block, or RTE SVPWM block.

Related Items
RTE SPWM

RTEVENTS_3_7_Q042011

RTE

49

RTE Queue
Library
RT-Events Math Operations

Block

Figure 42:RTE Queue Block

Description
The RTE Queue block stores in memory the times and states of all events that occur on the
RTE Boolean-type input signal. It can also stores values of Double-type input signals when
events occur on the RTE Boolean signal. The block capacity is set by Queue size.
When a value of 1 is received at the Pop port, the block pops all elements off the queue at
the next simulation step and holds the outports at that values until the next pop trigger.
The following figure shows how the queue works.

RTEVENTS_3_7_Q042011

RTE

50

Figure 43:Pushing and Poping Operations of the RTE Queue Block

A value of 1 at the optional Clr port (enabled by the Clear queue input check box) empties
the queue contents at the next simulation step.
When two or more of the control input ports are triggered at the same time step, the
operations are executed in the following order: Push, Clr, Pop.
The block allows to output signals indicating the states of the queue. When the Empty Queue
Output parameter is selected the block output 1 when the queue is empty. When the Full
Queue Output parameter is selected the block output 1 when the queue is full. When the
Output Number of Queued Events is selected the block output the number of events store in
the queue.
The block can stores the values of Double-type input signals when the value of the Number
of Input parameter is greather than 0. The block can interpolate the inputs at the time that
occurs the events (enabled by the Interpolate Input check box). If this option is not selected
the block store the value of the input signal at the beginning of the time step.

Mask

Figure 44:RTE Queue Mask

Parameters

RTEVENTS_3_7_Q042011

Queue Size

The size of the queue.

Empty Queue Output

When selected, outputs the empty state of the queue.

Full QueueOutput

When selected, outputs the full state of the queue.

RTE

51

Number of queued

When selected, outputs the number of events stored in the

events

queue.

Clear queue input

When selected, add a port to clear the queue.

Number of Inputs

Number of Double-type signals to store in the queue with event


properties.

Interpolate Inputs

When selected, interpolates the inputs at the time of each


events.

Input

RTE (RTE Boolean)

RTE Boolean signals to store in the queue.

Pop (Double)

Trigger signal used to pop out all events of the queue (1=Pop,
0=No effect).

Clr (Double)

Trigger signal used to clear all events of the queue (1=Clear,


0=No effect).

Signal N (Double)

Input signal N to store in the queue when events occur.

Times (Double)

The times of the events stored in the queue.

States (Double)

The states of the events stored in the queue.

Empty (Double)

The empty state of the queue.

Full (Double)

The full state of the queue.

Num (Double)

The number of events stored in the queue.

Signal N (Double)

The values of the input signal N stored in the queue.

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

No

Output

Characteristics

Examples
Related Items

RTEVENTS_3_7_Q042011

RTE

52

RTE Rate Transition


Library
RT-Events Signal Attribute

Block

Figure 45:RTE Rate Transition Block

Description
The RTE Rate Transition block handles transfer of data between blocks operating at different
rates. It transfers data from the output of a block operating at one rate to the input of
another block operating at a different rate. This block is used to exchange data between two
real-time subsystems working at different rates in RT-LAB simulator. See the first two
examples in the example section.
The behaviour of the Rate Transition block depends on the sample times of the ports
between which it is connected. The block acts as a zero-order hold block or acts as a unit
delay block. In the zero-order hold block mode, the block transfers data from a fast rate to a
slow rate. In the unit delay mode, the block transfers data from a slow rate to a fast rate.
The following figure illustrates the two general cases.

Figure 46:RTE Rate Transition - Sample Time Color

The color scheme in Figure 46 comes from Simulink software's sample-time colors feature
(select Sample Time Colors from the Format menu). When the option is activated, the blocks
and lines in the model are colored according to the sample rates at which the blocks operate.
The table below lists this color code:

RTEVENTS_3_7_Q042011

Color

Use

Black

Continuous blocks

RTE

53

Magenta

Constant blocks

Yellow

Hybrid (subsystems grouping blocks, Mux or Demux blocks


grouping signals with varying sample times, Data Store
Memory blocks updated and read by different tasks)

Red

Fastest discrete sample time

Green

Second fastest discrete sample time

Blue

Third fastest discrete sample time

Light Blue

Fourth fastest discrete sample time

Dark Green

Fifth fastest discrete sample time

Orange

Sixth fastest discrete sample time

Cyan

Blocks in triggered subsystems

Grey

Fixed in minor step

Compensation for skipped event


The RTE Rate Transition block supports compensation for skipped events.
When the number of events int the input RTE signal is greater than the maximum number of
events specified (MaxEvent), the extra events stored in memory are ignored, and it can
occur that the last output state is different from the output state that would be output if all
events were taken into account. By enabling the Skipped events compensation parameter,
the block can compensate for these events and add a new event (rising or falling) to toggle
the output state so that the last state provided by the block matches the state that would be
reached if all events were taken into account.
Suppose for example a "Fast to Slow" transition with the MaxEvent parameter set to 5. The
fast rate is set to 1 second and the slow rate is set to 2 seconds. The following figure
illustrates the effect of compensation. When the compensation is enabled, the fourth event
(falling edge) of the second fast step is compensated at the beginning of second slow step.
When the compensation is disabled, the block skips the first event to be output since the
output is already in that state.

Figure 47:Effect of the Skipped Events Compensation on the RTE Delay Block.

Suppose now a "Slow to Fast" transition with the MaxEvent parameter set to 3. The fast rate
is set to 1 second and the slow rate is set to 2 seconds. The following figure illustrates the
effect of the compensation. When the compensation is enabled, the sixth event (falling
edge) of the input (corresponding to fourth event of the of the second step of the output) is
compensated at the beginning of the third "fast" time step. When the compensation is
disabled, note also that the block skips the first event to be output in the third step since the
output is already in this state.

RTEVENTS_3_7_Q042011

RTE

54

In Slow-to-Fast transition, data transfers occur as soon as new data is available from the
source block and the receiving block is ready to receive the data. Data are available at the
next fast step.

Mask

Figure 48:RTE Rate Transition Mask

Parameters

Skipped events

When enabled, the block compensates for skipped event. It is

compensation

useful when the maximum number of events is reached. By


default this parameter is set to Disable. (See Compensation of
skipped event section)

Maximum number of
events

The maximum number of events or transitions that can be


output during a single step. Over this number, events are
ignored and not output. This parameter must be an integer. By
default it is set to 4.

RTEVENTS_3_7_Q042011

RTE

55

Output sample time

Specifies the output rate to which the input rate is converted. It


must be a multiple of the model sample time (or real-time
subsystem sample time). By default, this parameter is set to
Ts.

Input

Input (RTE Boolean)

RTE Boolean signal


Size of input : Dynamical
Input Rate : Inherit

Output

Output (RTE Boolean)

RTE Boolean signal


Size of input : Same as Input
Input Rate : Multiple of model sample time

Characteristics

Direct Feedthrough

No for slow-to-fast transitions. Yes for fast to slow transition.

Sample time

Fixed discrete

Work offline

Yes

Dimensionalized

Yes

Examples
The next two examples show how to exchange RT-Events signals between two real-time
subsystems running with RT-LAB. The example illustrates data exchange from fast-to-slow
rate and slow-to-fast rate respectively.
Fast to Slow transition
The following example illustrates Fast-to-Slow transition between 2 subsystems (Also
available on MatLab demos). Consider the model below:

RTEVENTS_3_7_Q042011

RTE

56

Figure 49:RTE Rate Transition - Example Fast-to-Slow transition

In this figure, the Master sample time is set to 1 seconds and the Slave sample time is set to
2 second.

Figure 50:RTE Rate Transition - Fast to slow in nominal case.

Slow to Fast transition


The following example illustrates Slow-to-Fast transition between 2 subsystems (Also
available on MatLab demos). Consider the model below:

RTEVENTS_3_7_Q042011

RTE

57

Figure 51:RTE Rate Transition - Example Slow-to-Fast transition

In the first figure, the Master sample time is set to 2 seconds and the Slave sample time is
set do 1 second.

Figure 52:RTE Rate Transition - Slow to Fast in nominal case (TsMaster = 2TsSalve)

In the second figure, the Master sample time is set to 3 seconds and the Slave sample time
is set do 1 second.

Figure 53:RTE Rate Transition - Slow to Fast in nominal case (TsMaster = 3TsSalve)

RTEVENTS_3_7_Q042011

RTE

58

Related Items
N/A

RTEVENTS_3_7_Q042011

RTE

59

RTE Relational Operator


Library
RT-Events Math Operations

Block

Figure 54:RTE Relational Operator Block

Description
The RTE Relational Operator block performs a relational operation on its two inputs and
outputs the results as an RTE Boolean-type signal. The logical operation on the inputs can be
selected, e.g. one can choose among <, >, >= and <=. It should be noted that the output
signal is high when the condition is true. The RTE Boolean signal contains information to
allow the blocks to compensate the discrete-time error that takes place because discrete
events occur between the sampling instants.

Mask

Figure 55:RTE Relational Operator Mask

Parameters

Operator

The relational operator to be applied to the block inputs: <, >,


<= or >=.

RTEVENTS_3_7_Q042011

RTE

60

Maximum Number of
events

The maximum number of events (or transitions) that can occur


during a single step. This value should normally be set to 1
because the block cant detect more than one transition.

Sample Time

The time interval between samples.

Inputs (Double)

Input signals to be compared.

Input

Output

Outputs (RTE Boolean) RTE logical signal which is high when the condition is true.

Characteristics

Direct Feedthrough

Yes

Sample time

Fixed discrete.

Work offline

Yes

Dimensionalized

Yes

Example
The rte_resetwalk.mdl model shows the difference between a compensated event-based
discrete system, an uncompensated simulated event-based discrete system and a
continuous system and demonstrates the accuracy of the RTE blocks compare to the
equivalent discrete block.

Related Items

RTEVENTS_3_7_Q042011

RTE

61

RTE Remove
Library
RT-Events Math operations

Block

Figure 56:RTE Remove Block

Description
The RTE Remove block removes N pulses of an RTE Boolean-type signal. The deletion is
repeated at every cycle of M pulses.
Here is a small example where the parameters N and M are respectively 2 and 4.

Figure 57:Behaviour of the RTE Remove block

The RTE Remove block enables you to:


Define upper and lower limits on the integral
Define a trigger type
Define an offset
Reset (or restart) the cycle
Defining Trigger Type
The RTE Remove block counts pulses each time an edge of the selected type occurs. By
selecting a rising trigger, high pulses will be remove from the inputs. By selection a falling
trigger, low pulses will be remove from the inputs.
Defining an offset
The RTE Remove block allows to choose which pulses should be remove from the input
signal. The offset parameter determine an offset in pulses from the beginning of the cycle
where we must remove pulses
Reseting the cycle

RTEVENTS_3_7_Q042011

RTE

62

The RTE Remove block determines which pulses it should remove relative to the first pulse of
a cycle. The external reset signal can reset the internal counter that determine the beggining
of a cycle. Each time an specified edge occur on the trigger input signal, the counter is
reseted to zero. The reset can be perform on rising edge, falling edge, or either.

Mask

Figure 58:RTE Remove Mask

Parameters

Trigger type

Determine the kind of edge use to count pulses

Number of pulses to

The number of pulses to remove at each cycle

remove
Number of pulses by

The number of pulses to complete a cycle

cycle
Offset

Relative offset to the beggining of the cycle where the pulses


are remove

External Reset

Edge type use to reset the cycle

Maximum Number of

The maximum number of events or transitions that can occur

events

during a single step. Over this number, events are skipped.

Inputs (RTE Boolean)

RTE Boolean signals (or pulse waveform) to modify

External Reset

Signal use to reset a cycle

Input

(Double)

RTEVENTS_3_7_Q042011

RTE

63

Output

Output (RTE Boolean)

Modified RTE Boolean signal

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete

Work offline

Yes

Dimensionalized

Yes

Characteristics

Example
The rte_encoder.mdl model demonstrates how to use RT-Events blocks to simulate an
incremental encoder connected to a rotating object. This example also shows how to use
blocks of the library to insert fault, to filter noise and to measure some characterics of RTE
Boolean signal.
The RTE Insert block is very similar to the RTE Remove block and is used to insert fault in
the generated pulse of the encoder.

Related Items
RTE Insert

RTEVENTS_3_7_Q042011

RTE

64

RTE Scope
Library
RT-Events Sink

Block

Figure 59:RTE Scope Block

Description
The RTE Scope block displays signals generated during a simulation. The block can have
multiple axes (one per port); all axes have a common time range with independent y-axes.
The scope allows you to adjust the amount of time and the range of input values displayed.
You can move and resize the scope window.
If the signal is continuous, the scope produces a point-to-point plot. If the signal is discrete,
the Scope produces a stair-step plot.
To provide a more stable display, the block has an option called the trigger. This options
causes the scope to pause after reaching the right hand side of the screen, and wait for a
specified event before returning to the left hand side of the screen and drawing the next
trace. The effect is to resynchronise the timebase to the input signal, preventing horizontal
drift of the scope. Trigger scope allow the display of nonperiodic signals such as single
pulses, as well as periodic signals such as sine waves and square waves.
The Scope provides toolbar buttons that enable you to zoom in on displayed data, display all
the data input to the Scope, preserve axis settings from one simulation to the next, limit
data displayed, save data to the workspace and select and display specific time range. The
toolbar buttons are labeled in this figure, which shows the Scope window as it appears when
you open a Scope block. For more help on these features see the Simulink Scope
documentation.

Figure 60:RTE Scope toolbar buttons


RTEVENTS_3_7_Q042011

RTE

65

Mask

Figure 61:RTE Scope Mask

Parameters

External Trigger

Set the kind of trigger use to trigger the scope. Select None to
disable this feature or any other values to activate this feature.
Double or RTE Boolean signal can be use to trigger the scope.
When RTE Boolean signal is used to trigger the scope, the
synchronization can occur anywhere in the calculation step.

Number of Axes

Set the number of y-axes in this data field. There is a limit of 6


axes the block can contain. All axes share the same time base
(x-axis), but have independent y-axes. Note that the number
of axes is equal to the number of input ports.

Time Range

Change the x-axis limits by entering a number. Entering a


number of seconds causes each screen to display the amount
of data that corresponds to that number of seconds.

Save Data to

You can automatically save the data collected by the block at

Workspace

the end of the simulation by selecting the Save data to


workspace check box. If you select this option, the Variable
name becomes active.

RTEVENTS_3_7_Q042011

RTE

66

Variable Name

Enter a variable name in the Variable name field. The specified


name must be unique among all data logging variables being
used in the model. Other data logging variables are defined on
other Scope blocks, To Workspace blocks, and simulation
return variables such as time, states, and outputs. Being able
to save Scope data to the workspace means that it is not
necessary to send the same data stream to both a Scope block
and a To Workspace block.

Format

Data can be saved in only one format: Structure with time.

Limits Data Points to

You can limit the number of data points saved to the workspace

Last Events

by selecting the Limit data points to last N events check box


and entering a value in its data field. The Scope relies on its
data history for zooming and autoscaling operations. If the
number of data points is limited to 1,000 events and the
simulation generates 2,000 events, only the last 1,000 events
are available for regenerating the display.

Number of Points

Number of data points to store in memory

Signal Name Format

You can choose to display none, short or long signal labels.

Discretization of

When checked, display continuous signal as a stair-step plot

Continuous Signals

instead of a point-to-point plot.

Inputs

Signals to display.

External Trigger

External signal that trigger the scope.

Direct Feedthrough

No

Sample Time

No

Work Offline

Yes

Dimensionalized

Yes

Input

Output
Characteristics

Example
The rte_encoder.mdl model demonstrates how to use RT-Events blocks to simulate an
incremental encoder connected to a rotating object. This example also shows how to use
blocks of the library to insert fault, to filter noise and to measure some characterics of RTE
Boolean signal.
In this example, the RTE Scope block is used to display simulated signals. For more
examples consult RT-Events demos.

Related Items

RTEVENTS_3_7_Q042011

RTE

67

RTE Signal Attributes


Library
RT-Events Signal Attributes

Block

Figure 62:RTE Signal Attributes Block

Description
The RTE Signal Attributes block outputs the specified attribute of the input signal. The
available attributes are: width, size, number of events, maximum number of events, initial
state, final state and status.

Mask

Figure 63:RTE Signal Attributes Mask

Parameters

Attribute

Attribute to output. Available values are width, size, number of


events, maximum number of events, initial state, final state or
signal status.

Input

Input (RTE Boolean)

RTEVENTS_3_7_Q042011

RTE Boolean signal to probe.

RTE

68

Output

Attribute (Double)

Selected probe attribute.

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

Yes

Characteristics

Example
The rte_basic1.mdl model shows how to do simple operations on RTE signals. It also
demonstrates how to use the RTE Signal Attributes block to display the number of events
that occur on an RTE signal.

Related Items
RTE Period Meter, RTE Probe Events

RTEVENTS_3_7_Q042011

RTE

69

RTE SPWM
Library
RT-Events Source

Block

Figure 64:RTE SPWM Block

Description
The RTE SPWM block generates square wave pulses at regular time intervals. The frequency
and duty cycle of the input signals determine the shape of the output waveform.
The figure below shows the main characteristics of the generated square wave pulses. T,
Ton, Toff, D and f are the period, the time on, the time off, the duty cycle, and the frequency
of the PWM signal respectively.

Figure 65:Square Wave Characteristics of the Generated PWM Signals

The RTE SPWM block outputs scalar or vector signals depending on the number of phases
selected in the parameters dialog box. When multiple phases are selected, the duty cycle
must be provided for all the phases, and the duty cycle inport takes a vector of the same
width as the number of phases. Also note that the frequency input is applied to all the
phases.
Center alignement mode
The RTE SPWM block lets you specify to choose the PWM pulses alignement. Depending on
the application, it may be important to output the pulse at the beginning of the period, or to
output the pulse centered relatively to the PWM period. The figure below shows the 2
supported modes. The parameters dialog box allows to select the alignment mode using the
Center alignment mode parameter.

RTEVENTS_3_7_Q042011

RTE

70

Figure 66:Center alignment mode effect

Space Vector PWM


The RTE SPWM block allows the output of space vector PWM based on the space vector
representation of the carrier signal (or duty cycle signals) in the d-q plane. This option is
very useful for controlling inverter output voltage in power electric applications.
Note that this option is only available when the number of phases is three.
Rise time delay
The RTE SPWM block allows the output of PWM pulse with a delay applied on the rising edge
of the pulse. The figure below shows the effect of the delay on the normal and
complementary PWM signals. Note that the rise time delay value must be smaller than half
the minimum period of the PWM.

Figure 67:Rise time delay effect

Note that this option is only available when complementary mode is selected.
Maximum number of events
The Maximum number of events parameter is used to determine the maximum number of
transitions that can occur during one calculation step and the maximum frequency that can
be output by the PWM block. The following formula determines the maximum frequency:
Fmax = Num / ( 2 * Ts),
where Num and Ts are the maximum number of events and the block sample time.

RTEVENTS_3_7_Q042011

RTE

71

Mask

Figure 68:RTE SPWM MaskParameters

Number of phases

The number of phases to be output. The PWM block supports


up to 6 phases.

Center alignment

When disabled, the pulse starts at the beginning of the period.

mode

When enabled, the pulse is centered relatively to the current


period.

Maximum frequency

The maximum frequency output by the PWM block.

Minimum frequency

The minimum frequency output by the PWM block.

Show enabling port

If selected, the PWM block adds a control input port that


determines when the block is executed. When the control
signal has a value of one, the block executes at each simulation
step. When the control signal has a value of zero (0), the block
holds on the last output value.

Complementary PWM

If selected, the PWM block adds an output port that contains


the complementary PWM signals of each phases.

Space vector PWM

If selected, the PWM outputs are generated from space vector


representation of carrier signals.

Rise time delay

The time delay, in seconds, that is inserted between the fall


and rise events of the PWM signal and its complementary part.
The rise time delay is also related to the dead time or the dead
band parameters.

RTEVENTS_3_7_Q042011

RTE

72

Maximum Number of
events

The maximum number of events or transitions that can occur


during a single step. Above that value, next events are
skipped.

Sample time

The time interval between samples, in seconds.

Frequency (Double)

The pulse frequency, in Hz. This parameter applies to all the

Input

phases.
Duty Cycle (Double)

The duty cycle of each phase specified as the percentage of the


pulse period during which the signal is on. Valid values are
between 0 and 1.

Enable port (Double)

The enable port controls when the block is executed. See Show
enabling port parameter above.

Output

PWM (RTE Boolean)

RTE Boolean signal generated by the PWM block.

Complementary PWM

RTE Boolean complementary signal generated by the PWM

(RTE Boolean)

block.

Direct Feedthrough

No

Sample Time

Fixed discrete.

Work Offline

Yes

Dimensionalized

No

Characteristics

Examples
The rte_pwm_generation.mdl model demonstrates how to use RT-Events blocks to generate
PWM signals of different type. This example also shows how to add dead time to the PWM
and also shows how to generate Space Vector PWM using this block. It also compares many
method to generate PWM using RTE Logical Operator block, or RTE PWM block.

Related Items
RTE PWM

RTEVENTS_3_7_Q042011

RTE

73

RTE Switch
Library
RT-Events Signal Routing

Block

Figure 69:RTE Switch

Description
The RTE Switch block passes through the first input or the third input based on the value of
the second control input. When the control input is an RTE signal, the switch also
compensates for events that occur during calculation step.The second input is called the
control input.
You select the conditions under which the first input is passed with the Criteria for passing
first input parameter. You can make the block check whether the control input is greater
than or equal to the threshold value, purely greater than the threshold value, or nonzero. If
the control input meets the condition set in the Criteria for passing first input parameter,
then the first input is passed. Otherwise, the third input is passed.

Mask

Figure 70:RTE Switch Mask

RTEVENTS_3_7_Q042011

RTE

74

Parameters

Port data types

Select the port data type.

Criteria for passing

Select the conditions under which the first input is passed. You

first input

can make the block check whether the control input is greater
than or equal to the threshold value, purely greater than the
threshold value, or nonzero. If the control input meets the
condition set in this parameter, then the first input is passed.
Otherwise, the third input is passed.

Threshold

Assign the switch threshold that determines which input is


passed to the output.

Interpolate

When checked, allow to interpolate the value outputed

Maximum number of

The maximum number of events or transitions that can occur

events

during a single step. Over this number, events are ignored and
not outputed.

Input

u1

Outputed when the second input meets the criteria.

u2

Control signal that select which input is output.

u3

Outputed when the second input doesnt meet the criteria.

Output

Output signal

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete

Work offline

Yes

Dimensionalized

Yes

Output

Characteristics

Examples
The rte_resetwalk.mdl model shows the difference between a compensated event-based
discrete system, an uncompensated simulated event-based discrete system and a
continuous system and demonstrates the accuracy of the RTE blocks compare to the
equivalent discrete block.
In this example, the RTE Switch block is used to activate or desactivate the RT-Events
compensation. When the compensation is enabled, the RT-Events system give the same
result as the continuous system. When the compensation is disabled, the RT-Events system
give the same erronous result as the discrete system.

Related Items

RTEVENTS_3_7_Q042011

RTE

75

RTE Sum
Library
RT-Events Math Operations

Block

Figure 71:RTE Sum

Description
The RTE Sum blocks adds or substracts inputs. This block can add or subtract scalar or
vector. You specify the operations of the block with the List of Signs parameter. Plus (+) and
minus (-) characters indicate the operations to be performed on the inputs:
If there are two or more inputs, then the number of characters must equal the number of
inputs. For example, "+-+" requires three inputs and configures the block to subtract the
second (middle) input from the first (top) input, and then add the third (bottom) input.
All nonscalar inputs must have the same dimensions.
If only one vector is input, then a single "+" or "-" will collapse the vector using the specified
operation.

Mask

Figure 72:RTE Sum Mask

Parameters

List of signs

Enter as many plus (+) and minus (-) characters as there are
inputs.

RTEVENTS_3_7_Q042011

RTE

76

Maximum number of

The maximum number of events or transitions that can occur

events

during a single step. Over this number, events are ignored and
not outputed.

Input

Input (RTE Double)

RTE Double signals to sum.

Sum (RTE Double)

Summed RTE Double signal.

Direct Feedthrough

Yes

Sample time

Inherited and fixed discrete

Work offline

Yes

Dimensionalized

Yes

Output

Characteristics

Examples
The rte_basic1.mdl model shows how to do simple operations on RTE signals. It also
demonstrates how to use the RTE Sum block to perform a sum of two RTE Double signal.

Related Items

RTEVENTS_3_7_Q042011

RTE

77

RTE-Drive ABC-DQ
Library
RTE-Drive Measurements

Block

Figure 73:RTE-Drive ABC-DQ Block

Description
The RTE-Drive ABC-DQ block performs the abc to dq transformation on a set of three-phase
signals. It computes the direct axis Vd and quadratic axis Vq quantities in a two axis rotating
reference frame according to the following transformation:
Vd = [ cos() * (2*Vab+Vbc) + sqrt(3) * Vbc *sin()] / 3
Vq = [ sin() * (2*Vab+Vbc) - sqrt(3) * Vbc *cos()] / 3
The transformation is the same for the case of a three-phase current; you simply replace the
Va, Vb, Vc, Vd and Vq variables with the Ia, Ib, Ic, Id, and Iq variables.

Mask

Figure 74:RTE-Drive ABC-DQ Mask

Parameters

RTEVENTS_3_7_Q042011

RTE

78

Input

abc (RTE Double)

Three phases input voltages (or currents).

(Double)

Rotating reference phase .

sin, cos (Double)

Sinus and cosinus of the rotating reference phase.

q,d (Double)

q and d voltage (or current) components.

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete.

Work Offline

Yes

Dimensionalized

Yes

Output

Characteristics

Example

Related Items

RTEVENTS_3_7_Q042011

RTE

79

RTE-Drive Full Park D-Q PMSM


Library
RTE-Drive Machines

Block

Figure 75:RTE-Drive Full Park D-Q PMSM Block

Description
This block implements a 3-phase permanent magnet synchronous machine with sinusoidal
flux distribution. The machine is modelled in the park D-Q rotor reference frame. Stator
windings are connected in wye to an internal neutral point.

Mask

Figure 76:RTE-Drive Park D-Q PMSM Mask

Parameters

Sample Time [s]

Sample time of the block.

Vabc [V]

Stator input voltage.

Input

we (rad/s)

Electrical speed
(= mechanical speed x number_of_poole_pair).

the (rad)

RTEVENTS_3_7_Q042011

rotor electric angle.

RTE

80

Rs_Ld_Lq_Flux (ohms, Rs_Ld_Lq_Flux: 4-rank vector containing the Resistance Ld, Lq


H, H, Wb)

and magnet flux.

Iabc (A)

Motor currents.

Iq, Id (H)

Motor currents in the rotor reference frame.

Vq, Vd (V)

stator voltage in the rotor reference frame.

Direct Feedthrough

No

Sample Time

Inherited and fixed discrete.

Work Offline

Yes

Dimensionalized

No

Output

Characteristics

Example
None

Related Items
RTE-Drive Park D-Q PMSM

RTEVENTS_3_7_Q042011

RTE

81

RTE-Drive Park D-Q PMSM


Library
RTE-Drive Machine

Block

Figure 77:RTE-Drive Park D-Q PMSM Block

Description
This block implements a 3-phase permanent magnet synchronous machine with sinusoidal
flux distribution. The machine is modelled in the park D-Q rotor reference frame. Stator
windings are connected in wye to an internal neutral point.
Note that the mathematical model is valid for fixed Lq and Ld parameters. The RTE-Drive
Full Park D-Q PMSM provided a mathematical model that solves this problem.

Mask

Figure 78:RTE-Drive Park D-Q PMSM Mask

Parameters

Sample Time [s]

RTEVENTS_3_7_Q042011

Sample time of the block.

RTE

82

Input

Vabc [V]
we (rad/s)

Stator input voltage.


Electrical speed
(= mechanical speed x number_of_poole_pair).

the (rad)

rotor electric angle.

Rs_Ld_Lq_Flux (ohms, Rs_Ld_Lq_Flux: 4-rank vector containing the Resistance Ld, Lq


H, H, Wb)

and magnet flux.

Iabc (A)

Motor currents.

Iq, Id (H)

Motor currents in the rotor reference frame.

Vq, Vd (V)

stator voltage in the rotor reference frame.

Direct Feedthrough

No

Sample Time

Inherited and fixed discrete.

Work Offline

Yes

Dimensionalized

No

Output

Characteristics

Example
None

Related Items
RTE-Drive Full Park D-Q PMSM

RTEVENTS_3_7_Q042011

RTE

83

RTE-Drive Phase Domain PMSM


Library
RTE-Drive Machines

Block

Figure 79:RTE-Drive Phase Domain PMSM block

Description
This block implements a permanent magnet synchronous machine model using a phase
domain representation model.

Mask

Figure 80:RTE-Drive Phase Domain PMSM Mask

Parameters

Voltage base [V]


RTEVENTS_3_7_Q042011

The model base voltage.


RTE

84

Current base [A]

The model base current.

Electric frequency

The model base frequency. Note that the base choice will not

base [Hz]

affect this model but are used to corrolate to similar model.

Number of Pair of

The machine number of pole pair.

Poles
Open phase resistance

The stator winding resistance when it is forced open using the

[ohms]

OpenStator input signal. This resistance cannot be set


arbitrarily to high value because of numerical stability
concerns. Smaller time step allows higher open phase
resistance.

Sample Time [s]

The model sample time.

Vabc [V]

The machine terminal voltages.

Bemf [V]

Internal BackEMF of the machine. Minimum torque generation

Input

occurs when the Back-EMF is in phase with terminal voltage.


With regards to the rotor position, the Back-EMF is 90 degree
(electric)in advance of the direct axe of the rotor.
Lx [pu]

Inverse of the reduced inductance matrix [2x2], which is timevarying.

Rstator [ohms]

The stator resistance [3x1].

OpenStator

Logic signal which control the resistance of the stator. When


equal to 1, the stator resistance is set equal to the <Open
phase resistance> parameter. When equal to 0, the stator
resistance is set equal to the Rstator input signal.

Output

Iabc [A]

The machine currents.

Vneutral [V]

The machine neutral voltage.

Direct Feedthrough

No

Sample Time

Inherited and fixed discrete.

Work Offline

Yes

Dimensionalized

No

Characteristics

Example
None

Related Items
RTE-Drive Phase Domain PMSM Inductance

RTEVENTS_3_7_Q042011

RTE

85

RTE-Drive Phase Domain PMSM Inductance


Library
RTE-Drive Machines

Block

Figure 81:RTE-Drive Phase Domain PMSM Inductance Block

Description
This block computes the phase domain time varying inductance matrix of a permanent
magnet synchronous machine corresponding to the Ld Lq Park transform inductances and
rotor angle.

Mask

Figure 82:RTE-Drive Phase Domain PMSM Inductance Mask

Parameters

Voltage base [V]

RTEVENTS_3_7_Q042011

The model base voltage.

RTE

86

Current base [A]

The model base current.

Electric frequency

The model base frequency. Note that the base choice must be

base [Hz]

the same as in the RTE-Drive Phase Domain PMSM block.

Number of Pair of

The machine number of pole pair.

Poles
Sample Time [s]

The model sample time.

Lq [H]

Q-axis inductance in the Park referential.

Ld [H]

D-axis inductance in the Park referential.

SinCos

The sinus and cosinus of the rotor electrc angle.

Input

Note: The Ld and Lq value correspond to the Krause Park transformation in which, for
positive speed, the q-axis is ahead of the d-axis and the Park transform has 2/3 factor and
all positive sign (no negative row).

Output

Lx [pu]

Inverse of the reduced inductance matrix [2x2], which is timevarying.

Characteristics

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete.

Work Offline

Yes

Dimensionalized

No

Example
None

Related Items
RTE-Drive Phase Domain PMSM

RTEVENTS_3_7_Q042011

RTE

87

RTE-Drive Quadrature Decoder


Library
RTE-Drive Measurements

Block

Figure 83:RTE-Drive Quadrature Decoder Block

Description
The RTE-Drive Quadrature Decoder block outputs the relative angular position of a
quadrature incremental encoder using its signals A and B. This block also outputs the
direction of rotation of the rotating object.
The optional Z input signals is an indication that the rotating object has passed through a
reference point. This signal is used to reset the relative angular position to zero degree. This
signal is not yet available.

Figure 84:Behaviour of the RTE-Drive Quadrature Decoder Block

RTEVENTS_3_7_Q042011

RTE

88

Mask

Figure 85:RTE-Drive Quadrature Decoder Mask

Parameters

Number of pulses by

The number of pulses generated by the encoder during a

revolution

complete revolution.

Angle units

The relative angular position units: degrees or radians.

Use channel Z

Use channel Z as reference. When channel Z is not used, the


initial zero angle position is set as reference.

Input

Channel A (RTE

Channel A of the incremental encoder.

Boolean)
Channel B (RTE

Channel B of the incremental encoder.

Boolean)
Channel Z (RTE

Optional channel Z of the incremental encoder.

Boolean)

Output

Position (Double)

Relative angular position of the rotating object in radians or


degrees.

Direction (Double)

Direction of rotation of the rotating object [-1, 0, 1].

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete.

Work Offline

Yes

Dimensionalized

Yes

Characteristics

RTEVENTS_3_7_Q042011

RTE

89

Example
The rte_basic_quadrature_decoder.mdl model simulated the behaviour of an incremental
encoder and shows the relative position of the rotating object.

Related Items
The rte_encoder.mdl model demonstrates how to use RT-Events blocks to simulate an
incremental encoder connected to a rotating object. This example also shows how to use
blocks of the library to insert fault, to filter noise and to measure some characterics of RTE
Boolean signal. In this example the RTE Quadrature decoder block is used to measure the
angular position and direction of the rotating object.

RTEVENTS_3_7_Q042011

RTE

90

RTE-Drive 2-Level TSB


Library
RTE-Drive Power Electronics

Block

Figure 86:RTE-Drive 2-Level TSB Block

Description
The RTE-Drive 2-Level Time Stamped Bridge (TSB) block implements a 2-level (2-switch)
bridge for which the gates are controlled by RTE Boolean signals. The number of arms in
parallel can by selected from 1 to 3. The bridge models IGBT/GTO/MOSFET devices
controlled by ideal switch with their anti parallel diode. The following figure presents the
equivalent electrical circuit of the RTE-Drive TSB 2- Level block.

Figure 87:Equivalent Electrical Circuit of the RTE-Drive 2-Level TSB Block

The switch model is simulated as a resistor Ron and a DC voltage source Vf, connected in
series with a switch. The switch is controlled by the gate signal g.

When the upper switch or upper anti-parallel diode conducts, the Vabc output equals the Vdc
input (minus internal voltage drops). When the lower switch or diode of the leg conducts,
the Vabc output is equal to 0 (plus internal voltage drops). This load, that has a voltage-input
current-output causality (like an inductance), outputs a current which in fed to the Iabc
input.
The Idc output is computed from all the upper switches or diodes conduction times.
RTEVENTS_3_7_Q042011

RTE

91

Mask

Figure 88:RTE-Drive 2-Level TSB Mask

Parameters

Number of bridge

The number of arms of the bridge.

arms
Voltage output data

Select the data type of the outputed voltage:

type

- When Simulink double is selected the output is the average


voltage of the last calculation step. Moreover the output can be
directly connected to Simulink blocks.
- When SimPowerSystem PM is selected the output is the
average voltage of the last calculation step. Moreover the
output can be directly connected to SimPowerSystem blocks.

Ron

Internal resistance of the selected device, in ohms

Forward voltage Vf

Forward voltage, in volts (V), across the device when it is


conducting.

Maximum number of

The maximum number of events or transitions that the block

events

consider during the simulation. Over this number, events are


ignored and do not affect the output.

Input
The following table presents the input signals of the block when the voltage output data type
parameter is Simulink.

Pulses (RTE Boolean)

RTE Boolean signals that controlled the switch gates. 1 signal


per arm. A signal value of 1 indicates the switch is conducting,
while a value of zero indicates the switch is OFF.

Vdc (Double)

RTEVENTS_3_7_Q042011

Voltage of the DC-link.

RTE

92

Iabc(Double)

Current outputted in the load.

The following table presents the input signals of the block when the voltage output data type
parameter is SimPowerSystems.

Pulses (RTE Boolean)

RTE Boolean signals that controlled the switch gates. 1 signal


per arm. A signal value of 1 indicates the switch is conducting,
while a value of zero indicates the switch is OFF.

dc + (SPS)

Positive DC-link.

dc - (SPS)

Negative DC-link

Output
The following table presents the input signals of the block when the voltage output data type
parameter is Simulink.

Vabc (Double,
RTE Double)

The voltage at the middle point of the bridge which feeds the
load. The signal data type depends on the output data type
parameter.

Idc (Double)

Current of the DC-link.

The following table presents the input signals of the block when the voltage output data type
parameter is SimPowerSystems.

A, B, C (SPS)

The A, B, and C connectors at the middle point of the bridge


which feeds the load.

Characteristics

Direct Feedthrough

Yes

Sample Time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

Yes

Limitations
Absence of switch gate signals
The block is not accurate when simulating the effect of completely shutting off all IGBT gate
pulses, like in emergency shutdown for example. This has the effect of letting the antiparallel diode turn on/off naturally, a case for which the Time Stamped Bridge is not
designed.
Input to output delay

RTEVENTS_3_7_Q042011

RTE

93

Since RT-Events version 3.3.x, optimizations in Time-Stamp Bridges have been made to
reduce the input to output delay due to Simulink-SPS interfacing. This optimization does
concern the TSB when the Output Data Type parameter is SimPowerSystems.
Because the Time-Stamp Bridge has a switching function for which the outputs are directly
dependant on the inputs, algebraic loops need to be broken when connecting it in the
SimPowerSystems mode, which is obtained through forcing single time-step delays at the
input(s) or the output(s) of the model. The optimization implies the displacement of the
simulation delays from the output AC voltage(s) and DC current(s) to the input DC
voltage(s) and AC current. This modification allows for better simulation of a strong majority
of applications where a constant voltage is found on the DC bus(ses) (or the time constant
of the DC voltage is small compare to the time step), due to a fixed voltage source or control
actions.

Example
The following figures presentes a simple 2-level chopper circuit and its Simulink
implementation. Refer to the rte_2level_chopper.mdl example file. The IGBT are driven at
fixed frequency of 10kHz and the simulation time step is 10 s. The upper part of the
Simulink model is the time stamped bridge implementation of the chopper while the bottom
part is the SimPowerSystem implementation.

Figure 89:2-Level Chopper Circuit

RTEVENTS_3_7_Q042011

RTE

94

Figure 90:Simulink Implementation of the 2-Level Chopper Circuit

With those parameters, the duty cycle of the chopper has been scanned, that is the ratio of
the upper IGBT conduction time by the chopper frequency. The following figure shows the
result of scanning the duty-cycle of the chopper for the time stamping technique vs.
SimPowerSystem blockset technique. While both techniques have the same response at 0.1
s simulation time step, they differ a lot at 10 s: the SimPowerSystem exhibits strong nonlinearity (red curve) while the time stamped bridge model is still linear (blue curve). The
time stamped bridge is as precise as reference simulations made at 0.1 s.

RTEVENTS_3_7_Q042011

RTE

95

Figure 91:Current Load versus Duty Cycle of the 2-Level Chopper Circuit

Also note that the rte_dc_dc_converter.mdl, rte_dc_ac_inverter.mdl and


rte_dc_ac_3ph_inverter.mdl models demonstrate how to realize DC-DC converter, and DCAC Inverter using RT-Events.

Related Items
RTE-Drive 3-Level TSB

RTEVENTS_3_7_Q042011

RTE

96

RTE-Drive 3-Level TSB


Library
RTE-Drive Power Electronics

Block

Figure 92:RTE-Drive 3-Level TSB Block

Description
The RTE-Drive 3-Level Time Stamped Bridge (TSB) block implements a 3-level (3-switch)
bridge for which the gates are controlled by RTE Boolean signals. The number of arms in
parallel can by selected from 1 to 3. The bridge models IGBT/GTO/MOSFET devices
controlled by ideal switch with their anti-parallel diode. The following figure presents the
equivalent electrical circuit of the RTE-Drive TSB 3- Level block with 3 arms.

Figure 93:Equivalent Electrical Circuit of the RTE-Drive 3-Level TSB Block

The switch model is simulated as a resistor Ron and a DC voltage source Vf, connected in
series with a switch. The switch is controlled by the gate signal g.

RTEVENTS_3_7_Q042011

RTE

97

When the upper switch or upper anti-parallel diode conducts, the Vabc output equals the V+
input (minus internal voltage drops). When the lower switch or diode of the leg conducts,
the Vabc output is equal to V- (plus internal voltage drops). This load, that has a voltageinput current-output causality (like an inductance), outputs a current which in fed to the Iabc
input.
The I+ output is computed from all the upper switches or diodes conduction times. The Ioutput is computed from all the lower switches or diodes conduction times.

Mask

Figure 94:RTE-Drive 3-Level TSB Mask

Parameters

Number of bridge

The number of arms of the bridge.

arms
Voltage output data

Select the data type of the outputed voltage:

type

- When RT-Events RTE Double is selected the output use an


higher precision because. However, the output can only be
connected to RT-Events blocks.
- When Simulink double is selected the output is the average
voltage of the last calculation step. Moreover the output can be
directly connected to Simulink blocks.
- When SimPowerSystem PM is selected the output is the
average voltage of the last calculation step. Moreover the
output can be directly connected to SimPowerSystem blocks.

Ron

RTEVENTS_3_7_Q042011

Internal resistance of the selected device, in ohms

RTE

98

Forward voltage Vf

Forward voltage, in volts (V), across the device when it is


conducting.

Maximum number of

The maximum number of events or transitions that the block

events

consider during the simulation. Over this number, events are


ignored and do not affect the output.

Input
The following table presents the input signals of the block when the voltage output data type
parameter is RT-Events or Simulink.

Pulses g (RTE

RTE Boolean signals that controlled the switch gates. 1 signal

Boolean)

per arm. A signal value of 1 indicates the switch is conducting,


while a value of zero indicates the switch is OFF.

V+ (Double)

Voltage of the positive DC-link.

V- (Double)

Voltage of the negative DC-link.

Iabc(Double)

Current outputted in the load.

The following table presents the input signals of the block when the voltage output data type
parameter is SimPowerSystems.

Pulses g (RTE

RTE Boolean signals that controlled the switch gates. 1 signal

Boolean)

per arm. A signal value of 1 indicates the switch is conducting,


while a value of zero indicates the switch is OFF.

dc + (SPS)

Positive DC-link.

dc - (SPS)

Negative DC-link

N (SPS)

Neutral.

Output
The following table presents the input signals of the block when the voltage output data type
parameter is RT-Events or Simulink.

Vabc (Double,
RTE Double)

The voltage at the middle point of the bridge which feeds the
load. The signal data type depends on the output data type
parameter.

I+ (Double)

Current of the positive DC-link.

I- (Double)

Current of the negative DC-link.

The following table presents the input signals of the block when the voltage output data type
parameter is SimPowerSystems.

A, B, C (SPS)

The A, B, and C connectors at the middle point of the bridge


which feeds the load.

RTEVENTS_3_7_Q042011

RTE

99

Characteristics

Direct Feedthrough

No

Sample Time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

Yes

Limitations
Absence of switch gate signals
The block is not accurate when simulating the effect of completely shutting off all IGBT gate
pulses, like in emergency shutdown for example. This has the effect of letting the antiparallel diode turn on/off naturally, a case for which the Time Stamped Bridge is not
designed.
Input to output delay
Since RT-Events version 3.3.x, optimizations in Time-Stamp Bridges have been made to
reduce the input to output delay due to Simulink-SPS interfacing. This optimization does
concern the TSB when the Output Data Type parameter is SimPowerSystems.
Because the Time-Stamp Bridge has a switching function for which the outputs are directly
dependant on the inputs, algebraic loops need to be broken when connecting it in the
SimPowerSystems mode, which is obtained through forcing single time-step delays at the
input(s) or the output(s) of the model. The optimization implies the displacement of the
simulation delays from the output AC voltage(s) and DC current(s) to the input DC
voltage(s) and AC current. This modification allows for better simulation of a strong majority
of applications where a constant voltage is found on the DC bus(ses) (or the time constant
of the DC voltage is small compare to the time step), due to a fixed voltage source or control
actions.

Example
The following figures presentes a simple 3-level chopper circuit and its Simulink
implementation. Refer to the rte_3level_chopper.mdl example file. The IGBT are driven at
fixed frequency of 2 kHz and the simulation time step is 50s. The upper part of the Simulink
model is the RTE-Drive TSB implementation of the chopper while the bottom part is the
SimPowerSystem implementation.

RTEVENTS_3_7_Q042011
RTE 100

Figure 95:3-Level Chopper Circuit

Figure 96:Simulink Implementation of the 3-Level Chopper Circuit

With those parameters, the duty cycle of the chopper has been scanned, that is the ratio of
the upper IGBT conduction time by the chopper frequency. The duty cycle concept is the
same then for the 2-Level bridge except that the modulation index goes from 0 [%] to 100
[%] for the 2-level modulation while it goes from -100 [%] to 100 [%] in the 3-level
modulation. This is possible with back-to-back (one positive and one negative) PWM
carriers upper and lower IGBTs of chopper circuit.
The following figure shows the result of scanning the duty-cycle of the chopper for the time
stamping technique vs. SimPowerSystem blockset technique. While both techniques have
the same response at 0.5 s simulation time step, they differ a lot at 50 s: the
SimPowerSystem exhibits strong non-linearity (red curve) while the time stamped bridge
model is still linear (blue curve). The time stamped bridge is as precise as reference
simulations made at 0.5 s.

RTEVENTS_3_7_Q042011
RTE 101

Figure 97:Current Load versus Duty Cycle of the 3-Level Chopper Circuit

Also note that the rte_dc_dc_converter.mdl, rte_dc_ac_inverter.mdl and


rte_dc_ac_3ph_inverter.mdl models demonstrate how to realize DC-DC converter, and DCAC Inverter using RT-Events.

Related Items
RTE-Drive 2-Level TSB

RTEVENTS_3_7_Q042011
RTE 102

RTE-Drive 2-Level TSB with High-Impedance and Rectification Modes


Library
RTE-Drive Power Electronics

Block

Figure 98:RTE-Drive 2-Level TSB highZ Rect Block

Description
The RTE-Drive 2-Level Time Stamped Bridge (TSB) block implements a 2-level bridge. The
bridge models IGBT/GTO/MOSFET devices controlled by ideal switch with their anti-parallel
diode. The following figure presents the equivalent electrical circuit of one phase of the RTEDrive TSB 2- Level block.

Figure 99:Equivalent Electrical Circuit of one arm the RTE-Drive 2-Level TSB Block

NOTE: The model is only available for 3-phase output. If less phases are required, the user
can leave the unused phases open.
The working principle of the model is the one of an average model. In the normal continuous
conduction mode, the output voltage of each phase is set equal to either V+ or V- input
voltage multiplied by the conduction time of the gate signal at each time step.

RTEVENTS_3_7_Q042011
RTE 103

When no pulse are present for BOTH IGBT, the output of the model is set in high-impedance
mode at the next current zero-crossing.
In this high-impedance mode, if the load voltage becomes higher/lower than the DC-link
voltages, the model enters into rectification mode, that is it will simulate the effect of the
anti-parallel diodes.

Mask

Figure 100:RTE-Drive 2-Level TSB HighZ Rect Mask

RTEVENTS_3_7_Q042011
RTE 104

Parameters

Number of bridge

Currently set to 3.

arms
Ron (ohms)
Forward Voltage (V)

Internal resistance and forward voltage drop of either IGBT or


anti-parallel devices, in Ohms or V.

High impedance in

This is the value of the output impedance of the inverter output

non-conducting

when it enters in the high impedance mode. This value cannot

state(Ohms)

be made arbitrarily high because of numerical stability


concerns.

Nominal DC link
voltage

This value is required for the calculation of the DC-link input


current. When input voltage is at least 25% of the nominal
voltage, the input current is computed with power balance
(Vabc*Iabc=Vdc*Idc). Below 25%, the input current is
computed from load currents multiplied by IGBT conduction
times.

Disable natural

Disable the internal algorithm that enables the natural

rectification mode

rectification by anti-parallel diodes. This may be useful to


optimize real-time performances.

Disable DC-link

Disable the internal algorithm that computes the DC-link

current calculations

currents. This may be useful to optimize real-time


performances.

Inputs and Outputs signals


g (RTE) (size 6)

RT-Events signals that control the switch gates.

V + (SPS)

Positive DC-link SimPowerSystems connection.

V- (SPS)

Negative DC-link SimPowerSystems connection.

OpenPhase (size 3)

When set to 1, creates an open-circuit fault at the output of the


phase of the inverter.

A,B,C (SPS)

Inverter output connection points (phases A, B and C) for


SimPowerSystems.

sw (size 3)

This signal indicates that the inverter phase is open when equal
to one. The signal can be used to compensate for the noninfinite high-impedance value by forcing load current to zero
for example.

Vabc_inv (size 3)

Voltage measurement of the middle point of the inverter. This


value is normally equal to the inverter output voltage value
except when OpenPhase is set to 1. In that case, this signal is
the voltage in front of the open phase fault.

Characteristics

RTEVENTS_3_7_Q042011
RTE 105

Direct Feedthrough

No

Sample Time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

No

Limitations
Fault insertion
The RTE-Drive 2-Level TSB Block internal model allows certain faults to be made with it. In all cases,
the fault impedance can be limited by numerical stability issues because of the RTE-Drive 2-Level TSB
Block introduces a delay between the input and the output of the model.

Fault type
AC-side open phase

Supported. Made internally in SPS. The Open_phase input of


the block controls this type of fault.

AC-side short-circuit

Supported. Made internally in SPS.

Open DC-link input

Not supported.

DC-link short circuit

Supported. Made internally in SPS.

Internal IGBT open-

Supported through IGBT gating signal.

phase fault
Internal IGBT short-

Not supported.

circuit.
Diode opencircuit/short-circuit

Example

Related Items

RTEVENTS_3_7_Q042011
RTE 106

Not supported.

RTE-Drive 3-Level TSB with High-Impedance and Rectification Modes


Library
RTE-Drive Power Electronics

Block

Figure 101:RTE-Drive 3-Level TSB HighZ Rect Block

Description
The RTE-Drive 3-Level Time Stamped Bridge (TSB) block implements a 3-level NeutralClamped bridge with support for high-impedance and free-wheeling diode rectification
modes. The bridge models IGBT/GTO/MOSFET devices controlled by ideal switch with their
anti-parallel diode. The following figure presents the equivalent electrical circuit of the RTEDrive TSB 3- Level block with 3 arms.

Figure 102:Equivalent Electrical Circuit of the RTE-Drive 3-Level TSB Block

RTEVENTS_3_7_Q042011
RTE 107

The working principle of the model is the one of an average model. In the normal continuous
conduction mode, the output voltage of each phase is set equal to either V+, Vneutral or Vinput voltage multiplied by the conduction time of the gate signal at each time step.

High-Impedance mode:
When no pulses are present for the TWO middle IGBT, the output of the model is set in highimpedance mode at the next current zero-crossing.
Anti-parallel diode Rectifying mode:
In this high-impedance mode, if the load voltage becomes higher/lower than the DC-link
voltages, the model enters into rectification mode, that is it will simulate the effect of the
anti-parallel diodes.

Mask

Figure 103:RTE-Drive 3-Level TSB Mask

RTEVENTS_3_7_Q042011
RTE 108

Parameters

Number of bridge

Currently set to 3.

arms
Active Switch Ron

Internal resistance and forward voltage drop of either IGBT or

(ohms)

anti-parallel devices, in Ohms or V.

Active Switch Forward


Voltage (V)
Diode Ron (Ohms)
Diode Forward Voltage
(V)
Hi impedance value

This is the value of the output impedance of the inverter output

(Ohms)

when it enters in the high impedance mode. This value cannot


be made arbitrarily high because of numerical stability
concerns.

DC link current

The option removes any residual common mode in the DC-link

Common Mode

input currents. When the bridge is fed by a floating rectification

Removal

device for example, this common mode should be non-existent


(i.e. the sum of input current should be null). But because the
input and output sides of the model are not algebraically linked
(they are controlled current and voltage sources), a small
residue may be present that may corrupt the simulation
accuracy.

Dead Time current

This parameter specifies the minimum load current required to

Threshold (A)

turn on anti-parallel diodes when no IGBT pulses are present.

Inputs and Outputs signals

g (double) (size 12)

Signals that controlled the switch gates. A signal value of 1


indicates the switch is conducting, while a value of zero
indicates the switch is OFF. A value between 0 and 1 indicates a
ratio of conduction time during the time step.

V + (SPS)

Positive DC-link SimPowerSystems connection.

Vn (SPS)

Neutral DC-link SimPowerSystems connection.

V- (SPS)

Negative DC-link SimPowerSystems connection.

gnd_in (SPS)

Ground connection point forSimPowerSystems

gnd_out (SPS)

Ground connection point forSimPowerSystem. This connection


is electrically connected to gnd_in. However,
SimPowerSystems/ARTEMiS will recognize this as a separate
connection to ground and create 2 distinct state-space systems
for circuits connected to the input and output sides of the
inverter, thus resulting in much faster real-time computations.

A,B,C (SPS)

Inverter output connection points (phases A,B and C) for


SimPowerSystems

RTEVENTS_3_7_Q042011
RTE 109

Vn_delay (SPS)

Neutral connection point for circuits connected to the inverter


outputs (ex: LC filter)s. This connection has a delay equal to
the A,B and C connection and this equilibrium of delays is
important in some cases.

Ineut_meas (size 1)

Measurement of the Neutral Input point. This output is used to


measure the real input current of the Vn connection point when
a circuit is connected to the Vn_delay connection. In this case,
if a SPS measurement is taken at the Vn input of the inverter,
the measured current will include the current flowing through
the Vn_delay point, which may not be what is desired.

Characteristics

Direct Feedthrough

No

Sample Time

Inherited and fixed discrete.

Work offline

Yes

Dimensionalized

No

Limitations
Fault insertion
The RTE-Drive 3-Level TSB Block internal model allow certain faults to be made with it. In all cases, the
fault impedance can be limited by numerical stability issues because of the RTE-Drive 3-Level TSB
Block introduces a delay between the input and the output of the model.

Fault type
AC-side open phase

Supported. Made internally in SPS.

AC-side short-circuit

Supported. Made internally in SPS.

Open DC-link input

Not supported.

DC-link short circuit

Supported. Made internally in SPS.

Internal IGBT open-

Supported through IGBT gating signal.

phase fault
Internal IGBT short-

Not supported.

circuit.
Diode opencircuit/short-circuit

Example

Related Items

RTEVENTS_3_7_Q042011
RTE 110

Not supported.

RTE STATUS
Description
Contains RT-Events Status information.

Usage
See Elements.

Elements
eRTE_NoError (0)

No Error.

eRTE_ExceedMax_Ev0 (1)

The maximum number of events is exceeded. Last


event was falling.

eRTE_ExceedMax_Ev1 (2)

The maximum number of events is exceeded. Last


event was rising.

eRTE_InvalidIndex (4)

The index vector contains values that exceed the


maximum number of events.

eRTE_InvalidTimeVector (8)

Some elements of the time vector are not in


chronological order.

eRTE_InvalidIC (16)

The initial condition does not match the first event


state.

eRTE_ConsecutiveSameEvent There are some consecutive events of the same type.


(32)

Events was removed.

eRTE_EventInThePast (64)

One or more events are in the past. Events were


removed.

eRTE_MaxFrequency (128)

Frequency exceeds the maximum frequency.

eRTE_HW_InitializeError

Set by RT-LAB OpFcnMultiEventCapt block : Hardware

(67592)

not found.

eRTE_HW_OverrunError

Set by RT-LAB OpFcnMultiEventCapt block : FIFO

(66048)

overrun.

eRTE_HW_DataLostError

Set by RT-LAB OpFcnMultiEventCapt block : Data loss

(66560)

detected in input FIFO.

eRTE_HW_InvalidDataError

Set by RT-LAB OpFcnMultiEventCapt block : Invalid

(67584)

data formatting detected in input FIFO.

eRTE_HW_TSBData (69632)

Set by RT-LAB OP5142 TSB In block : The RTE signal


contains data obtained from firing pulses measurement
and is intended to be connected to a TSB block.

eRTE_UndefinedError

Block/application specific error that does not match any

(4294967295)

of the previously defined code.

Examples
None

Related Items
RTE Probe Events , RTE Events Generator

RTEVENTS_3_7_Q042011
RTE 111

You might also like