Signal Latch

Write input signal value to memory and read memory to output signal upon events

Library

Signal Management

Description

The Signal Latch block is a versatile block for manipulating event-based signals. You can use it to delay or resample signals based on events, not time. This block stores and outputs the values of the in input signal based on events:

This block is useful for modeling feedback loops in discrete-event systems in which an output from one component is an input to another component. Because the two components work separately in such a system, the updates of the input and output signals are independent in both causality and timing. This block lets you control the causality and timing associated with storing the output from one component and updating the value received by the other component. For an example that uses this block in a feedback loop, see the Dynamic Voltage Scaling Using Online Gradient Estimation demo.

Ports

Signal Input Ports

LabelDescription
wtsSignal whose updates cause write events. This port appears only if you set Write to memory upon to Sample time hit from port wts.
wtrTrigger signal whose edges cause write events. This port appears only if you set Write to memory upon to Trigger from port wtr.
wvcSignal whose numerical changes in value cause write events. This port appears only if you set Write to memory upon to Change in signal from port wvc.
wfcnFunction-call signal that causes write events. This port appears only if you set Write to memory upon to Function call from port wfcn.
rtsSignal whose updates cause read events. This port appears only if you set Read from memory upon to Sample time hit from port rts.
rtrTrigger signal whose edges cause read events. This port appears only if you set Read from memory upon to Trigger from port rtr.
rvcSignal whose numerical changes in value cause read events. This port appears only if you set Read from memory upon to Change in signal from port rvc.
rfcnFunction-call signal that causes read events. This port appears only if you set Read from memory upon to Function call from port rfcn.
inSignal to be resampled and/or delayed.

Signal Output Ports

LabelDescriptionTime of Update When Statistic Is OnOrder of UpdateInitial Value
st0 or 1, depending on whether the block more recently processed a read or write event.Upon write events and upon read events10
memThe value of the block's internal memory when a write event occurs.Upon write events1Value of Initial memory value parameter
outThe value of the block's internal memory when a read event occurs.Upon read events1

Output signals having the same number in the Order of Update column in the table above are updated in an arbitrary sequence relative to each other; you should not rely on a specific sequence for your simulation results.

The initial value is in effect from the start of the simulation until the first update by the block.

Dialog Box

Write Tab

Initial memory value

The value in the block's internal memory before the first write event occurs.

Write to memory upon

The type of signal-based event or function call that causes a write event.

Trigger type

Determines whether rising, falling, or either type of trigger edge causes a write event. This field appears only if you set Write to memory upon to Trigger from port wtr.

Type of change in signal value

Determines whether rising, falling, or either type of value change causes a write event. This field appears only if you set Write to memory upon to Change in signal from port wvc.

Resolve simultaneous signal updates according to event priority

Select this option to control the sequencing of the write event, relative to other simultaneous events in the simulation. If you do not select this option, the application executes the write event immediately upon detecting the signal-based event that causes it. For details, see Choosing How to Resolve Simultaneous Signal Updates.

Event priority for writing to memory

The priority of the write event, relative to other simultaneous events in the simulation. For details, see Specifying Event Priorities to Resolve Simultaneous Signal Updates. This field appears only if you select Resolve simultaneous signal updates according to event priority on this tab.

Read Tab

Read from memory upon

The type of signal-based event, function call, or internal write event that causes a read event.

Trigger type

Determines whether rising, falling, or either type of trigger edge causes a read event. This field appears only if you set Read from memory upon to Trigger from port rtr.

Type of change in signal value

Determines whether rising, falling, or either type of value change causes a read event. This field appears only if you set Read from memory upon to Change in signal from port rvc.

Resolve simultaneous signal updates according to event priority

Select this option to control the sequencing of the read event, relative to other simultaneous events in the simulation. If you do not select this option, the application executes the read event immediately upon detecting the signal-based event that causes it. For details, see Choosing How to Resolve Simultaneous Signal Updates. This field appears only if you set Read from memory upon to an option other than Write to memory event.

Event priority for reading from memory

The priority of the read event, relative to other simultaneous events in the simulation. For details, see Specifying Event Priorities to Resolve Simultaneous Signal Updates. This field appears only if you select Resolve simultaneous signal updates according to event priority on this tab.

Status Tab

Report state of the block

Controls the presence of the signal output port labeled st.

Report memory value upon write event

Controls the presence of the signal output port labeled mem.

Report memory value upon read event

Controls the presence of the signal output port labeled out.

Examples

Reading from Memory Upon Each Write Event

In the plot below, the output signal reflects values of the input signal upon each rising or falling value of the wvc signal. Between successive write events, the output signal maintains the value from the most recent write event. Before the first write event, the output signal is 0 because of the initial memory value.

Independent Read and Write Events

In the plot below, the mem signal reflects values of the input signal upon each rising or falling value of the wvc signal, while the out signal reflects values of the mem signal upon each rising or falling value of the rvc signal.

For examples showing the use of this block in a model, see

See Also

Data Store Memory, Data Store Read, Data Store Write

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS