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

Objects

expand all

RequirementsTableConfigure Requirements Table blocks (Since R2022a)
SymbolConfigure data in Requirements Table blocks (Since R2022a)
RequirementRowWork with requirements in Requirements Table block (Since R2022a)
AssumptionRowWork with assumptions 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
getPreviousPrevious value of data
isStartupWhether simulation time is 0
tElapsed time of simulation

Change Detection

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

Create, Concatenate, and Convert Strings

str2doubleConvert string to double-precision value
stringConvert value to string
plusConcatenate strings

Determine Properties of Strings

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

Find and Replace String Characters

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

Edit Strings

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

Compare Strings

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

Topics

Create and Manage Requirements

Configure Requirement Data

Test Model with Requirements

Troubleshooting

Identify Inconsistent and Incomplete Formal Requirement Sets

Use Simulink Design Verifier™ to find inconsistent and incomplete requirement sets and read-before-write issues. (Since R2022a)

Debug Requirements Table Blocks

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