本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

状态和转移的语法

通过使用动作和条件来表达图行为

通过指定状态转移时间以及动作执行时间来控制 Stateflow® 图的执行。通过广播事件同步状态执行。检测数据值的变化,并检查在图执行期间有哪些状态为活动状态。

模块

ChartImplement control logic with finite state machine

Stateflow 语法

全部展开

更改检测

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

时序逻辑

afterExecute chart after event broadcast or specified time
atExecute chart at event broadcast or specified time
beforeExecute chart before event broadcast or specified time
countChart executions during which condition is valid
durationTime during which condition is valid
elapsedTime since state became active
everyExecute chart at regular intervals
temporalCountNumber of events, chart executions, or time since state became active

主题

Eliminate Redundant Code by Combining State Actions

Combine entry, during, and exit actions in a state.

Control Function-Call Subsystems by Using bind Actions

Bind a function-call output event to the activity of a state.

连接结点

创建备选转移路径之间的决策点。

支持的 Stateflow 图数据运算

在 Stateflow 图中执行数学计算。

Supported Symbols in Actions

Special symbols available for state and transition actions.

Call Extrinsic MATLAB Functions in Stateflow Charts

Access MATLAB® functions that are not supported for code generation.

Access MATLAB Functions and Workspace Data in C Charts

Call built-in MATLAB functions by using the ml operator.

在 C 语言状态图中调用 C 库函数

在状态和转移标签中访问 C 函数。

Check State Activity by Using the in Operator

Determine if a state is active during chart execution.

检测数据值更改

定义数据更改值时的图行为。

使用时序逻辑控制图的执行

使用基于事件的和绝对时间的时序逻辑运算符。

Control Chart Behavior by Using Implicit Events

Trigger chart actions by changes in data values and state activity.

Control Oscillations by Using the duration Operator

Simplify debouncing logic in charts that have transient signals.

Count Events by Using the temporalCount Operator

Count occurrences of explicit and implicit events.

特色示例