- •Block Reference
- •Commonly Used
- •Continuous
- •Discontinuities
- •Discrete
- •Logic and Bit Operations
- •Lookup Tables
- •Math Operations
- •Model Verification
- •Model-Wide Utilities
- •Ports & Subsystems
- •Signal Attributes
- •Signal Routing
- •Sinks
- •Sources
- •User-Defined Functions
- •Additional Math & Discrete
- •Additional Discrete
- •Additional Math: Increment — Decrement
- •Run on Target Hardware
- •Target for Use with Arduino Hardware
- •Target for Use with BeagleBoard Hardware
- •Target for Use with LEGO MINDSTORMS NXT Hardware
- •Blocks — Alphabetical List
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Settings Pane
- •Measurements Pane
- •Signal Statistics Measurements
- •Settings Pane
- •Transitions Pane
- •Overshoots/Undershoots
- •Cycles
- •Settings Pane
- •Peaks Pane
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Command-Line Information
- •Function Reference
- •Model Construction
- •Simulation
- •Linearization and Trimming
- •Data Type
- •Examples
- •Main Toolbar
- •Command-Line Alternative
- •Command-Line Alternative
- •Command-Line Alternative
- •Command-Line Alternative
- •Command-Line Alternative
- •Command-Line Alternative
- •Mask Icon Drawing Commands
- •Simulink Classes
- •Model Parameters
- •About Model Parameters
- •Examples of Setting Model Parameters
- •Common Block Parameters
- •About Common Block Parameters
- •Examples of Setting Block Parameters
- •Block-Specific Parameters
- •Mask Parameters
- •About Mask Parameters
- •Notes on Mask Parameter Storage
- •Simulink Identifier
- •Simulink Identifier
- •Model Advisor Checks
- •Simulink Checks
- •Simulink Check Overview
- •See Also
- •Identify unconnected lines, input ports, and output ports
- •Description
- •Results and Recommended Actions
- •Capabilities and Limitations
- •Tips
- •See Also
- •Check root model Inport block specifications
- •Description
- •Results and Recommended Actions
- •See Also
- •Check optimization settings
- •Description
- •Results and Recommended Actions
- •Tips
- •See Also
- •Description
- •Results and Recommended Actions
- •See Also
- •Check for implicit signal resolution
- •Description
- •Results and Recommended Actions
- •See Also
- •Check for optimal bus virtuality
- •Description
- •Results and Recommended Actions
- •Capabilities and Limitations
- •See Also
- •Description
- •Results and Recommended Actions
- •Capabilities and Limitations
- •See Also
- •Identify disabled library links
- •Description
- •Results and Recommended Actions
- •Capabilities and Limitations
- •Tips
- •See Also
- •Identify parameterized library links
- •Description
- •Results and Recommended Actions
- •Capabilities and Limitations
- •Tips
- •See Also
- •Identify unresolved library links
- •Description
- •Results and Recommended Actions
- •Capabilities and Limitations
- •See Also
- •Results and Recommended Actions
- •Capabilities and Limitations
- •See Also
- •Results and Recommended Actions
- •Capabilities and Limitations
- •See Also
- •Check usage of function-call connections
- •Description
- •Results and Recommended Actions
- •See Also
- •Check signal logging save format
- •Description
- •Results and Recommended Actions
- •See Also
- •Description
- •Results and Recommended Actions
- •See Also
- •Description
- •Results and Recommended Actions
- •Tips
- •See Also
- •Check data store block sample times for modeling errors
- •Description
- •Results and Recommended Actions
- •See Also
- •Check for potential ordering issues involving data store access
- •Description
- •Results and Recommended Actions
- •Tips
- •See Also
- •Check for partial structure parameter usage with bus signals
- •Description
- •Results and Recommended Actions
- •Tips
- •See Also
- •Check for calls to slDataTypeAndScale
- •Description
- •Results and Recommended Actions
- •Tips
- •See Also
- •Check for proper bus usage
- •Description
- •Results and Recommended Actions
- •Action Results
- •Tips
- •See Also
- •Description
- •Results and Recommended Actions
- •See Also
- •Description
- •Results and Recommended Actions
- •See Also
- •Check for proper Merge block usage
- •Description
- •Input Parameters
- •Results and Recommended Actions
- •See Also
- •Description
- •Results and Recommended Actions
- •Action Results
- •See Also
- •Check for non-continuous signals driving derivative ports
- •Description
- •Results and Recommended Actions
- •See Also
- •Runtime diagnostics for S-functions
- •Description
- •Results and Recommended Actions
- •See Also
- •Check file for foreign characters
- •Description
- •Results and Recommended Actions
- •Tips
- •See Also
- •Check model for known block upgrade issues
- •Description
- •Results and Recommended Actions
- •Action Results
- •See Also
- •Description
- •Results and Recommended Actions
- •Action Results
- •See Also
- •Check that the model is saved in SLX format
- •Description
- •Results and Recommended Actions
- •Tips
- •See Also
- •Check Model History properties
- •Description
- •Results and Recommended Actions
- •See Also
- •Analyze model hierarchy for upgrade issues
- •Description
- •Results and Recommended Actions
- •Tips
- •See Also
- •Description
- •Results and Recommended Actions
- •See Also
- •Simulink Performance Advisor Checks
- •Simulink Performance Advisor Check Overview
- •See Also
- •Baseline
- •See Also
- •Check Preupdate Items
- •See Also
- •Checks that need Update Diagram
- •See Also
- •Checks that require simulation to run
- •See Also
- •Check Accelerator Settings
- •See Also
- •Create Baseline
- •See Also
- •Identify resource intensive diagnostic settings
- •See Also
- •Check optimization settings
- •See Also
- •Identify inefficient lookup table blocks
- •See Also
- •Identify Interpreted MATLAB Function blocks
- •See Also
- •Check MATLAB Function block debug settings
- •See Also
- •Check Stateflow block debug settings
- •See Also
- •Identify simulation target settings
- •See Also
- •Check model reference rebuild setting
- •See Also
- •Check Model Reference parallel build
- •See Also
- •Check solver type selection
- •See Also
- •Select normal or accelerator simulation mode
- •See Also
- •Simulink Limits
- •Maximum Size Limits of Simulink Models
- •Index
- •Filter Structures and Filter Coefficients
- •Valid Initial States
- •Number of Delay Elements (Filter States)
- •Frame-Based Processing
- •Sample-Based Processing
- •Valid Initial States
- •Frame-Based Processing
- •Sample-Based Processing
- •Model Parameters in Alphabetical Order
- •Common Block Parameters
- •Continuous Library Block Parameters
- •Discontinuities Library Block Parameters
- •Discrete Library Block Parameters
- •Logic and Bit Operations Library Block Parameters
- •Lookup Tables Block Parameters
- •Math Operations Library Block Parameters
- •Model Verification Library Block Parameters
- •Model-Wide Utilities Library Block Parameters
- •Ports & Subsystems Library Block Parameters
- •Signal Attributes Library Block Parameters
- •Signal Routing Library Block Parameters
- •Sinks Library Block Parameters
- •Sources Library Block Parameters
- •User-Defined Functions Library Block Parameters
- •Additional Discrete Block Library Parameters
- •Additional Math: Increment - Decrement Block Parameters
- •Mask Parameters
2
Blocks — Alphabetical List
Abs
Purpose
Library
Description
Output absolute value of input
Math Operations
The Abs block outputs the absolute value of the input.
For signed-integer data types, the absolute value of the most negative value is not representable by the data type. In this case, the Saturate on integer overflow check box controls the behavior of the block:
|
If you... |
The block... |
And... |
|
|
Select this |
Saturates to the |
• For 8-bit signed integers, |
|
|
check box |
most positive value |
-128 maps to 127. |
|
|
|
of the integer data |
• For 16-bit signed integers, |
|
|
|
type |
-32768 maps to 32767. |
|
|
|
|
|
|
|
|
|
• For 32-bit signed integers, |
|
|
|
|
-2147483648 maps to |
|
|
|
|
2147483647. |
|
|
Do not select |
Wraps to the most |
• For 8-bit signed integers, |
|
|
this check box |
negative value of |
-128 remains -128. |
|
|
|
the integer data |
• For 16-bit signed integers, |
|
|
|
type |
|
|
|
|
-32768 remains -32768. |
|
|
|
|
|
|
|
|
|
|
• For 32-bit signed integers, |
|
|
|
|
-2147483648 remains |
|
|
|
|
-2147483648. |
|
The Abs block supports zero-crossing detection. However, when you select Enable zero-crossing detection on the dialog box, the block does not report the simulation minimum or maximum in the Fixed-Point Tool. If you want to use the Fixed-Point Tool to analyze a model, disable zero-crossing detection for all Abs blocks in the model first.
2-2
Abs
Data Type The Abs block accepts real signals of the following data types:
Support
•Floating point
•Built-in integer
•Fixed point
The block also accepts complex floating-point inputs. For more information, see “Data Types Supported by Simulink” in the Simulink documentation.
Parameters The Main pane of the Abs block dialog box appears as follows:
and Dialog Box
2-3
Abs
Enable zero-crossing detection
Select to enable zero-crossing detection. For more information, see “Zero-Crossing Detection” in the Simulink documentation.
Sample time (-1 for inherited)
Enter the time interval between sample time hits or specify another appropriate sample time such as continuous. By default, the block inherits its sample time based upon its context within the model. For more information, see “Sample Time”.
The Signal Attributes pane of the Abs block dialog box appears as follows:
2-4
Abs
Output minimum
Specify the minimum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:
•Simulation range checking (see “Signal Ranges”)
•Automatic scaling of fixed-point data types
2-5
Abs
Output maximum
Specify the maximum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:
•Simulation range checking (see “Signal Ranges”)
•Automatic scaling of fixed-point data types
Output data type
Specify the output data type. You can set it to:
•A rule that inherits a data type, for example, Inherit: Inherit via back propagation
•The name of a built-in data type, for example, single
•The name of a data type object, for example, a
Simulink.NumericType object
•An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the
Output data type parameter.
See “Specify Block Output Data Types” in Simulink User’s Guide for more information.
Lock output data type setting against changes by the fixed-point tools
Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see “Use Lock Output Data Type Setting”.
Integer rounding mode
Specify the rounding mode for fixed-point operations. For more information, see “Rounding”. in the Simulink Fixed Point™ documentation.
2-6
Abs
Saturate on integer overflow
Action |
Reason for Taking |
What Happens |
Example |
|
This Action |
|
|
Select this |
Your model has |
Overflows saturate to |
The number 130 does |
check box. |
possible overflow and |
the maximum value |
not fit in a signed 8-bit |
|
you want explicit |
that the data type can |
integer and saturates |
|
saturation protection |
represent. |
to 127. |
|
in the generated code. |
|
|
Do not select |
You want to optimize |
Overflows wrap to the |
The number 130 does |
this check |
efficiency of your |
appropriate value that |
not fit in a signed 8-bit |
box. |
generated code. |
is representable by the |
integer and wraps to |
|
|
data type. |
-126. |
When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.
Examples Usage as an Input to a MinMax Block
The sldemo_hardstop model shows how you can use the Abs block as an input to the MinMax block.
2-7
Abs
In the sldemo_hardstop model, the Abs block is in the Friction Model subsystem.
2-8
Abs
Usage as an Input to a Switch Block
The sldemo_zeroxing model shows how you can use the Abs block as an input to the Switch block.
Characteristics |
Direct Feedthrough |
Yes |
|
Sample Time |
Specified in the Sample time parameter |
|
Dimensionalized |
Yes |
|
Multidimensionalized |
Yes |
|
Zero-Crossing Detection |
Yes, if enabled |
|
|
|
2-9
Action Port
Purpose |
Implement Action subsystems used in if and switch control flow |
|
statements |
Library |
Ports & Subsystems |
Description |
Action Port blocks implement Action subsystems used in if and switch |
|
control flow statements. The Action Port block is available in the If |
|
Action Subsystem and the Switch Case Action Subsystem. |
|
Use Action Port blocks to create Action subsystems as follows: |
1Place a subsystem in the system containing the If or Switch Case block.
You can use an ordinary subsystem or an atomic subsystem. In either case, the resulting Action subsystem is atomic.
2Add an Action Port to the new subsystem.
This block adds an input port named Action to the subsystem, which is now an Action subsystem.
Action subsystems execute their programming in response to the conditional outputs of an If or Switch Case block. Use Action subsystems as follows:
1Create an Action subsystem for each output port configured for an If or Switch Case block.
2Connect each output port to the Action port on an Action subsystem.
•if, else, or elseif ports for the If block
•case or default ports for the Switch Case block
When you make a connection, the icon changes for the subsystem and the Action Port block it contains to the name of the output port for the If or Switch Case block (for example, if{ }, else{ }, elseif{ },
case{ }, or default{ }).
2-10
Action Port
Data Type
Support
Parameters and Dialog Box
3Open the new subsystem and add the diagram that you want to execute in response to the condition this subsystem covers.
Note All blocks in an Action subsystem driven by an If or Switch Case block must run at the same rate as the driving block.
Action Port blocks do not have data inputs or outputs.
•“States when execution is resumed” on page 2-11
•“Propagate sizes of variable-size signals” on page 2-14
States when execution is resumed
Specify how to handle internal states when a subsystem with an Action Port block reenables.
Settings
Default: held
2-11
Action Port
held
When the subsystem reenables, retains the states of the Action subsystem with their previous values. Retains the previous values of states between calls even if calling other member Action subsystems of an if-else or switch control flow statement.
reset
Reinitializes the states of the Action subsystem to initial values when the subsystem reenables.
Reenablement of a subsystem occurs when called and the condition of the call is true after having been previously false. In the following example, the Action Port blocks for both Action subsystems A and B have the States when execution is resumed parameter set to reset.
If case[1] is true, call Action subsystem A. This result implies that the default condition is false. When later calling B for the default condition, its states are reset. In the same way, Action subsystem A states are reset when calling A right after calling Action subsystem B.
Repeated calls to the Action subsystem of a case does not reset its states. If calling A again right after a previous call to A, this action does not reset the states of A. This behavior is because the
2-12