Switch Blocks

Direct the flow by design.

Review switching components and their interfaces. Follow selection and output rules when routing values through a model.

Switches


True_N_Times

TrueNTimes

File: general_blocks/Switches/True_N_Times.sim
Description
Each input data structure is sent out only one of the two outputs depending on the number
of times the model has executed. The first N (parameter) inputs will go out the true output,
and then any more inputs will go out the false output.
Ports

Input Ports

  • input                       Data Type: DATA STRUCTURE

Output Ports

  • true
    Data Type:**DATA STRUCTURE
  • false
    Data Type:**DATA STRUCTURE

Parameters

  • N
    Data Type: INTEGER

T_GT_Startup

TGTStartup

File: general_blocks/Switches/T_GT_Startup.sim
Description
Data Structures pass to one of the two outputs dependent upon the value of  Tnow
relative to the parameter StartupTime. The model will generally be used to allow a
startup time to pass before passing the data structures to the TnowGTstartup output
port where statistics will be collected.
Ports

Input Ports

  • input                                   Data Type: DATA STRUCTURE

Output Ports

  • TnowGTstartup
    Data Type: DATA STRUCTURE
  • TnowLEstartup
    Data Type: DATA STRUCTURE

Parameters

  • StartupTime
    Data Type: REAL

T_GE_Param

TGEParm

File: general_blocks/Switches/T_GE_Param.sim
Description
Each input data structure is sent out only one of the two outputs depending on the
comparison of the current simulation clock (TNow) with the value of the BoundaryTime
parameter.
Ports

Input Ports

  • input                       Data Type:**DATA STRUCTURE

Output Ports

  • true
    Data Type:**DATA STRUCTURE
  • false
    Data Type:**DATA STRUCTURE

Parameters

  • BoundaryTime
    Data Type: REAL

Switch_5way

Switch 5way

File: general_blocks/Switches/Switch_5way.sim

Description
The model sends an input data structure to one of the output ports. The value of the switch input and the four parameters will determine which output the input will be switched to. If the value of the switch input matches one of the A, B, C, D, or E parameters, then the input data structure will be sent out the corresponding output. If the switch input matches none of the five parameters the the input data structure will be sent out the no_match output.

Ports

Input Ports

  • input                 Data Type:**DATA STRUCTURE
  • switch               Data Type: INTEGER

Output Ports

  • A_out
    Data Type:**DATA STRUCTURE
  • B_out
    Data Type:**DATA STRUCTURE
  • C_out
    Data Type:**DATA STRUCTURE
  • D_out
    Data Type:**DATA STRUCTURE
  • E_out
    Data Type:**DATA STRUCTURE
  • no_match
    Data Type:**DATA STRUCTURE

Parameters

  • A           Data Type: INTEGER
  • B           Data Type: INTEGER
  • C           Data Type: INTEGER
  • D           Data Type: INTEGER
  • E           Data Type: INTEGER

Switch_4way

Switch4way

File: general_blocks/Switches/Switch_4way.sim
Description
The model sends an input data structure to one or more of the output ports.
The value of the switch input and the four parameters will determine which
outputs the input should be switched to. If the value of  the switch input matches
any of the A, B, C, or D parameters, then the input data structure will be sent out
the corresponding output. If the switch input matches none of the four parameters
the the input data structure will be sent out the no_match output.
Ports

Input Ports

  • input                       Data Type:**DATA STRUCTURE
  • switch                     Data Type: INTEGER

Output Ports

  • A_out
    Data Type:**DATA STRUCTURE
  • B_out
    Data Type:**DATA STRUCTURE
  • C_out
    Data Type:**DATA STRUCTURE
  • D_out
    Data Type:**DATA STRUCTURE
  • no_match
    Data Type:**DATA STRUCTURE

Parameters

  • A
    Data Type:
    INTEGER
  • B
    Data Type:
    INTEGER
  • C
    Data Type:
    INTEGER
  • D
    Data Type:
    INTEGER

Switch

File: general_blocks/Switches/Switch.sim
Description
Model to pass an input data structure to one of the two output ports. The value
of the switch input determines which output is to be enabled. If the value of the
switch input is zero, the input data structure is placed on the false_out output
port. The input data structure is placed on the true_out output port for nonzero
values of the switch input.
Ports

Input Ports

  • input                       Data Type:**DATA STRUCTURE
  • switch                     Data Type: INTEGER

Output Ports

  • true_out
    Data Type:**DATA STRUCTURE
  • false_out
    Data Type:**DATA STRUCTURE

Parameters

  • none

Real_Within_Boundaries

RealWiBoundaries

File: general_blocks/Switches/Real_Within_Boundaries.sim

Description
The model filters the input REAL value and passes it to one of the outputs based
on the values of the two parameters. If the input value is greater than the Lower_Bound
parameter and less than the Upper_Bound parameter (or equal for both) then the value
will come out in the within output. If the input value is greater than the Upper_Bound , the
output will come out the above port. The output will come out the below port if the value
is less than the Lower_Bound parameter.
Ports

Input Ports

  • input                       Data Type: REAL

Output Ports

  • above
    Data Type: REAL
  • below
    Data Type: REAL
  • within
    Data Type: REAL

Parameters

  • Upper_Bound
    Data Type: REAL
  • Lower_Bound
    Data Type: REAL

Rand_Switch_Param

RandSwitchParm

File: general_blocks/Switches/Rand_Switch_param.sim

Description
Random Switch where the probability of going to one output is a parameter of the module.
Model which randomly switches the in_DS to one of two outputs. The in_DS
will be placed on the output out_p with the Probability parameter, and will be
placed on the output out_p-1 with probability 1-p.
Ports

Input Ports

  • in_DS                       Data Type: DATA STRUCTURE

Output Ports

  • out_p
    Data Type:**DATA STRUCTURE
  • out_p-1
    Data Type:**DATA STRUCTURE

Parameters

  • seed = -1
    Data Type: INTEGER
  • Probability = 0.5
    Data Type: REAL

Rand_Switch

RandSwitch

File: general_blocks/Switches/Rand_Switch.sim

Description
Random Switch where the probability of going to one output is an input to the module.
Model which randomly switches the  in_DS to one of two outputs. The in_DS
will be placed on the output out_p with the in_prob input, and will be placed on the
output out_p-1 with probability 1-p.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • in_prob                       Data Type: REAL

Output Ports

  • out_p
    Data Type:**DATA STRUCTURE
  • out_p-1
    Data Type:**DATA STRUCTURE

Parameters

  • seed = -1
    Data Type: INTEGER

R_LT_C

RLTC

File: general_blocks/Switches/R_LT_C.sim

Description
Model which compares a REAL Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the result
of the comparison is true. The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • Value                       Data Type: REAL

Output Ports

  • True
    Data Type:**DATA STRUCTURE
  • False
    Data Type:**DATA STRUCTURE

Parameters

  • Constant = 0
    Data Type: REAL

R_LE_C

RLEC

File: general_blocks/Switches/R_LE_C.sim

Description
Model which compares a REAL Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the result

of the comparison is true. The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • Value                       Data Type: REAL

Output Ports

  • True
    Data Type:**DATA STRUCTURE
  • False
    Data Type:**DATA STRUCTURE

Parameters

  • Constant = 0
    Data Type: REAL

R_GT_C

RGTC

File: general_blocks/Switches/R_GT_C.sim

Description
Model which compares a REAL Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the result

of the comparison is true. The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • Value                       Data Type: REAL

Output Ports

  • True
    Data Type:**DATA STRUCTURE
  • False
    Data Type:
    DATA STRUCTURE

Parameters

  • Constant = 0
    Data Type: REAL

R_GE_C

RGEC

File: general_blocks/Switches/R_GE_C.sim

Description
Model which compares a REAL Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the result

of the comparison is true. The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • Value                       Data Type: REAL

Output Ports

  • True
    Data Type:**DATA STRUCTURE
  • False
    Data Type:
    DATA STRUCTURE

Parameters

  • Constant = 0
    Data Type: REAL

R_EQ_C

REQC

File: general_blocks/Switches/R_EQ_C.sim

Description
Model which compares a REAL Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the result

of the comparison is true. The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • Value                       Data Type: REAL

Output Ports

  • True
    Data Type:**DATA STRUCTURE
  • False Data Type: DATA STRUCTURE

Parameters

  • Constant = 0 Data Type: REAL

Memory Switch

MemSwitch

File: general_blocks/Switches/MemorySwitch.sim
Description
Model to pass an input data structure to one of the two output ports. The value of the switch input determines which output is to be enabled. Unlike the basic switch, Memory Switch retains the value of the switch input and immediately routes all incoming data structures based on the last switch value received. If the value of the switch input is zero, the input data structure is placed on the false_out output port. The input data structure is placed on the true_out output port for nonzero values of the switch input.
Ports

Input Ports

  • input                       Data Type:**DATA STRUCTURE
  • switch                     Data Type: INTEGER

Output Ports

  • true_out
    Data Type:**DATA STRUCTURE
  • false_out
    Data Type:**DATA STRUCTURE

Parameters

  • state       Data Type: INTEGER (0=false, 1=true)

I_LT_C

ILTC

File: general_blocks/Switches/I_LT_C.sim

Description
Model which compares a INTEGER Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the result

of the comparison is true. The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • Value                       Data Type: INTEGER

Output Ports

  • *True

Data Type:* DATA STRUCTURE - *False

Data Type:* DATA STRUCTURE

Parameters

  • Constant = 0 Data Type: INTEGER

I_LE_C

ILEC

File: general_blocks/Switches/I_LE_C.sim

Description
Model which compares a INTEGER Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the Integer Value
is <= Constant (parameter). The False output is chosen otherwise.
Ports

Input Ports

  • *in_DS

Data Type:*DATA STRUCTURE - *Value

Data Type: INTEGER*

Output Ports

  • *True

    Data Type:* DATA STRUCTURE - *False

Data Type:* DATA STRUCTURE

Parameters

  • Constant = 0 Data Type: INTEGER

I_GT_C

IGTC

File: general_blocks/Switches/I_GT_C.sim
Description
Model which compares  INTEGER Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the Integer Value
is greater than the Constant (parameter). The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • *Value

Data Type: INTEGER*

Output Ports

  • True
    Data Type:
    DATA STRUCTURE
  • False
    Data Type:
    DATA STRUCTURE

Parameters

  • Constant = 0          Data Type: INTEGER

I_GE_C

I GE C

File: general_blocks/Switches/I_GE_C.sim
Description
Model which compares  INTEGER Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The Trueoutput is chosen if the Integer Value
is greater thanor equal to the Constant (parameter). The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • Value                       Data Type: INTEGER

Output Ports

  • True
    Data Type:
    DATA STRUCTURE
  • False
    Data Type:
    DATA STRUCTURE

Parameters

  • Constant = 0          Data Type: INTEGER

I_EQ_C

IEQC

File: general_blocks/Switches/I_EQ_C.sim

Description
Model which compares a INTEGER Value with a Constant (parameter) and switches the input data
structure (in_DS) according to result of the comparison. The True output is chosen if the Integer Value
is equal to the Constant (parameter). The False output is chosen otherwise.
Ports

Input Ports

  • in_DS                       Data Type:**DATA STRUCTURE
  • Value                       Data Type: INTEGER

Output Ports

  • True
    Data Type:
    DATA STRUCTURE
  • False
    Data Type:
    DATA STRUCTURE

Parameters

  • Constant = 0          Data Type: INTEGER

Enabled_Switch

Enabled Switch

File: general_blocks/Switches/Enabled_Switch.sim
Description
The model will pass the input to either out1 or out2 depending upon
the running state. The running state is controlled via two alarms,
Alarm_GO and Alarm_STOP. At power up, the state is TRUE, and any inputs
are passed to out1. When an Alarm_STOP is received, the state is changed
to FALSE, and inputs are sent out port out2.

Ports

Input Ports

  • in                           Data Type: ANY

Output Ports

  • out1
    Data Type:**ANY
  • out2
    Data Type:**ANY

Parameters

  • Alarm_GO                     Data Type: CHARACTER
  • Alarm_STOP                   Data Type: CHARACTER

Bypass

File: general_blocks/Switches/Bypass.sim
Description
The model will pass the input to either out1 or out2 depending upon
whether Param1 and Param2 are identical or not. If Param1 and Param2
are identical, the input is passed to out1; otherwise, to out2.
Ports

Input Ports

  • in                           Data Type: ANY

Output Ports

  • out1
    Data Type:**ANY
  • out2
    Data Type:**ANY

Parameters

  • Param1                       Data Type: CHARACTER
  • Param2                       Data Type: CHARACTER

This page is an editorial rewrite of source documentation. Historical status, availability, and platform notes are not independently verified for a current release. Technical examples are reference material, not a live simulator.