Main Content

Formalize Requirements in Simulink Models

Evaluate logic before and during simulation with Requirements Table blocks

Define formal requirements in Simulink® models by using the Requirements Table block to evaluate logic before and at run time. Use formal requirements to check the outputs of your model or execute block outputs.

Configure the formal requirements directly in the block, in the Requirements Editor, or with programmatic commands in MATLAB®.

Blocks

Requirements TableModel formal requirements with input conditions (Since R2022a)

Functions

expand all

slreq.modeling.createCreate new model with Requirements Table block (Since R2022a)
slreq.modeling.findFind Requirements Table blocks (Since R2022a)
slreq.loadLoad requirement set or link set
anyValueSuppress incompleteness issues for output in Requirements Table block (Since R2024a)

Objects

expand all

RequirementsTableConfigure Requirements Table blocks (Since R2022a)
SymbolConfigure data in Requirements Table blocks (Since R2022a)
RequirementRowRequirements in Requirements Table block (Since R2022a)
AssumptionRowAssumptions in Requirements Table block (Since R2022a)

Object Functions

expand all

Manage Block Data

addSymbolAdd data to Requirements Table block
findSymbolRetrieve data in Requirements Table block

Manage Block Rows

addAssumptionRowAdd assumption to Requirements Table block
addRequirementRowAdd requirement to Requirements Table block
addChildAdd child requirement or assumption to Requirements Table block
getRequirementRowsRetrieve requirements in Requirements Table block
getAssumptionRowsRetrieve assumptions in Requirements Table block
getChildrenRetrieve child requirements and assumptions in Requirements Table block
slreq.getCurrentObjectGet selected objects in Requirements Editor, Requirements Browser, or Requirements Table block
clearClear row in Requirements Table block
removeRowRemove Requirements Table block row

Manage Block Columns

hideAssumptionColumnHide Precondition column in Assumptions tab
hideRequirementColumnHide columns in Requirements tab
showAssumptionColumnShow Precondition column in Assumptions tab
showRequirementColumnShow columns in Requirements tab

Operators

expand all

Temporal Logic

durationTime during which condition is valid in Requirements Table block
getPreviousPrevious value of data in Requirements Table block
isStartupWhether simulation time is 0 in Requirements Table block
tElapsed time of simulation in Requirements Table block

Change Detection

hasChangedDetect change in data since last time step in Requirements Table block
hasChangedFromDetect change in data from specified value in Requirements Table block
hasChangedToDetect change in data to specified value in Requirements Table block

Create, Concatenate, and Convert Strings

str2doubleConvert string to double-precision value in Requirements Table block
stringConvert value to string in Requirements Table block
plusConcatenate strings in Requirements Table block

Determine Properties of Strings

isletterDetermine which characters are letters in Requirements Table block
isspaceDetermine which characters are spaces in Requirements Table block
isstringDetermine if input is string in Requirements Table block
strlengthDetermine length of string in Requirements Table block
containsDetermine if string contains substring in Requirements Table block

Find and Replace String Characters

containsDetermine if string contains substring in Requirements Table block
endsWithDetermine if string ends with substring in Requirements Table block
matchesDetermine if two strings match in Requirements Table block
replaceFind and replace substrings in Requirements Table block
replaceBetweenReplace substrings between start and end points in Requirements Table block
startsWithDetermine if string starts with substring in Requirements Table block
strfindFind substring within a string in Requirements Table block
strrepFind and replace substrings in Requirements Table block

Edit Strings

eraseDelete substrings within strings in Requirements Table block
eraseBetweenDelete substring between start and end points in Requirements Table block
extractAfterExtract substring after position in Requirements Table block
extractBeforeExtract substring before position in Requirements Table block
insertAfterInsert string after substring in Requirements Table block
insertBeforeInsert string before substring in Requirements Table block
lowerConvert string to lowercase in Requirements Table block
upperConvert a string to uppercase in Requirements Table block
reverseReverse order of characters in strings in Requirements Table block
stripRemove leading and trailing characters from string in Requirements Table block
strtrimRemove leading and trailing white space from string in Requirements Table block

Compare Strings

matchesDetermine if two strings match in Requirements Table block
strcmpCompare strings in Requirements Table block (case sensitive)
strcmpiCompare strings in Requirements Table block (case insensitive)
strncmpCompare first N characters of strings in Requirements Table block (case sensitive)
strncmpiCompare first N characters of strings in Requirements Table block (case insensitive)

Topics

Create and Manage Requirements

Configure Requirement Data

Test Model with Requirements

Troubleshooting

Debug Requirements Table Blocks

Debug Requirements Table block requirements during simulation. (Since R2023a)