Documentation Center

  • 評価版
  • 製品アップデート

Signal-Based Function-Call Generator

Convert signal-based events into function calls

Library

Generators/Function-Call Generators

Description

This block converts a signal-based event or a function-call input into one or two function calls that you can use to invoke function-call subsystems, Stateflow® blocks, or other blocks that accept function-call inputs. You specify the type of event the block translates and whether the block suppresses its output under certain conditions. You can also delay the output function calls by an amount of time that you specify via a parameter or an input signal.

Criteria for Generating Function Calls

The primary criterion, based on the Generate function call only upon parameter, is a signal-based event or a function call. By default, the block generates a function call upon each event of the type you specify.

To generate up to two function calls upon each event, select Generate optional f2 function call. If the block generates function calls at both the f1 and f2 output ports, then it generates the f1 call first and generates the f2 call as a subsequent part of the same operation.

To make the f1 or f2 output function call contingent upon a secondary criterion, select Suppress function call f1 if enable signal e1 is not positive or Suppress function call f2 if enable signal e2 is not positive. The block acquires an additional signal input port, labeled e1 or e2, to which you connect a control signal. If the control signal is zero or negative when the block is about to generate the function call, then the block suppresses the function call. The e1 and e2 ports operate independently of each other as secondary criteria for their respective function-call output ports.

Ports

Signal Input Ports

LabelDescription
tThe delay, in seconds, between the input event and the output function call. A positive value schedules the function call in the future, while a value of zero schedules the function call at the current simulation time. This signal must be an event-based signal. You see this port only if you select Resolve simultaneous signal updates according to event priority, and then set Function-call delay from to Signal port t.
tsWhen this signal has an update, the primary criterion is satisfied. This signal must be an event-based signal. You see this port only if you set Generate function call only upon to Sample time hit from port ts.
trWhen this signal has a rising or falling edge, depending on the Trigger type parameter, the primary criterion is satisfied. This signal must be an event-based signal. You see this port only if you set Generate function call only upon to Trigger from port tr.
vcWhen this signal increases or decreases, depending on the Type of change in signal value parameter, the primary criterion is satisfied. This signal must be an event-based signal. You see this port only if you set Generate function call only upon to Change in signal from port vc.
fcnWhen this signal carries a function call, the primary criterion is satisfied. This signal must be an event-based function call. You see this port only if you set Generate function call only upon to Function call from port fcn. Do not connect this port to an output port from the same instance of this block.
e1When this signal is 0 or negative, the block does not generate a function call at the f1 output port. This signal must be an event-based signal. You see this input port only if you select Suppress function call f1 if enable signal e1 is not positive.
e2When this signal is 0 or negative, the block does not generate a function call at the f2 output port. This signal must be an event-based signal. You see this input port only if you select Suppress function call f2 if enable signal e2 is not positive.

Signal Output Ports

LabelDescriptionOrder of Update
f1Function call, possibly contingent on e1 input signal1
f2Function call, possibly contingent on e2 input signal2
#f1Number of function calls the block has generated at the f1 port during the simulation3
#f2Number of function calls the block has generated at the f2 port during the simulation3

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 output value for the numerical signals, which is in effect from the start of the simulation until the first update by the block, is 0.

Dialog Box

Function Call Tab

Generate function call only upon

The primary criterion for determining when the block generates a function call. Optional secondary criteria are established by the Suppress function call... parameters below.

Trigger type, Type of change in signal value

Trigger type determines whether rising, falling, or either type of trigger edge causes the block to generate a function call. You see this field only if you set Generate function call only upon to Trigger from port tr.

Type of change in signal value determines whether rising, falling, or either type of value change causes the block to generate a function call. You see this field only if you set Generate function call only upon to Change in signal from port vc.

Suppress function call f1 if enable signal e1 is not positive

Selecting this option causes f1 function calls to be contingent upon a positive value at the e1 signal input port.

Generate optional f2 function call

Selecting this option causes the block to generate a function call at the optional f2 output port when appropriate criteria are satisfied.

Suppress function call f2 if enable signal e2 is not positive

Selecting this option causes f2 function calls to be contingent upon a positive value at the e2 signal input port. You see this field only if you select Generate optional f2 function call.

Timing Tab

Resolve simultaneous signal updates according to event priority

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

    Note:   If this block has both a function-call input and a signal input, you might need to select this option to prevent latency in the signal.

Event priority

The priority of the function-call event, relative to other simultaneous events in the simulation. For details, see Specify Event Priorities to Resolve Simultaneous Signal Updates.

Use of this parameter depends on the following:

  • You see this field only if you select Resolve simultaneous signal updates according to event priority.

  • If you select the configuration parameter Prevent duplicate events on multiport blocks and branched signals in your model, the software uses the Event priority parameter to sort blocks in the model. In this case, the software does not schedule an event that you can view on the event calendar.

Function-call delay from

Determines whether the delay between the input event and the output function call is computed from a parameter in this dialog box or from an input signal. You see this field only if you select Resolve simultaneous signal updates according to event priority.

Function-call time delay

The delay, in seconds, between the input event and the output function call. A positive value schedules the function call in the future, while a value of zero schedules the function call at the current simulation time. You see this field only if you select Resolve simultaneous signal updates according to event priority, and then set Function-call delay from to Dialog.

Statistics Tab

Number of f1 function calls

Allows you to use the signal output port labeled #f1.

Number of f2 function calls

Allows you to use the signal output port labeled #f2. This field is active only if you select Generate optional f2 function call on the Function Call tab of this dialog box.

Was this topic helpful?