Stataflow与simulink之间的调用
附赠自动驾驶最全的学习资料和量产经验:链接
Stataflow与simulink之间的调用
之前我门讲了如何定义数据与事件,这一讲谈谈如何进行状态之间的调用以及状态和simulink之间的调用
打开sf_loop_scheduler模型,该模型为matlab2019自带
如图所示
打开该模型后再View/model explore中查看两个stateflow模块与simulink模块定义的数据类型与事件
首先看Edge to Function中
双击进入该状态后View/model explore
一共两个事件,一个输入一个输出
放大显示后看到输入为上升沿触发事件,输出为函数调用事件
同样的方法查看下一个状态机中定义的输入输出事件
可以发现他的输入输出都为函数调用
接下来看最后一个simulink模块
也是一个函数调用模块
通过这一讲学会如何通过边缘触发调用simulink模块,stateflow模块,使用函数调用触发simulink模块
When to Use an Edge-Triggered Event
何时使用边缘触发事件
Use an edge-triggered input event to activatea chart when your model requires regular or periodic chart execution. Forexample, in the model sf_loop_scheduler, an edge-triggered input event activates the Edge to Function chartat regular intervals. For more information, see “Schedulea Subsystem Multiple Times in a Single Step” onpage 27-14.
当模型需要定期或周期表执行时,使用边缘触发的输入事件来激活图表。例如,在modelsf循环调度程序中,边缘触发的输入事件定期激活EdgetoFunction图表。有关详细信息,请参阅第27-14页的“在一个步骤中多次安排子系统”(帮助手册)。
When to Use a Function-CallInput Event
何时使用函数调用输入事件
Use afunction-call input event to activate a chart when your model requires accessto output data from the chart in thesame time step as the function call. For example, in the model sf_loop_scheduler,a function-call input event activates the Looping Scheduler chart. For moreinformation, see “Schedule a Subsystem Multiple Timesin a Single Step” on page 27-14.
当模型需要在函数调用的同一时间步骤中访问图表中的输出数据时,使用函数调用输入事件激活图表。例如,在模型sf循环调度程序中,函数调用输入事件激活循环调度程序图表。有关详细信息,请参阅第27-14页的“在一个步骤中多次安排子系统”(帮助手册)。