关于Stateflow中chart输入事件的激活

1. 问题描述

在 State 中的 chart 中,放置了两个输入事件,在运行的时候报错。

  1. 放置事件如下:
    在这里插入图片描述

  2. Matlab 给出的错误提示:

Chart ‘Chart’ has both function call triggered and edge triggered input events. This is not allowed.

在这里插入图片描述

2. 问题分析

2.1 官方链接

官方给出的文档链接为:Activate a Stateflow Chart by Sending Input Events

2.2 文档值得留意的地方

  1. 不能同时使用事件触发函数调用作为 chart 的输入事件;

An input event can activate a Stateflow chart through a change in a control signal (an edge trigger) or a function call from a Simulink block.
To specify an edge-triggered input event, set the Trigger property to one of these options:
Rising
Falling
Either
To specify a function-call input event, set the Trigger property to Function call.
You cannot mix edge-triggered and function-call input events in the same Stateflow chart. Mixing these input events results in an error during parsing and simulation.

2.2.1 Activate a Stateflow Chart by Using Edge Triggers

  1. When to Use Edge-Triggered Input Events

Use an edge-triggered input event to activate a chart when your model requires regular or periodic chart execution.

  1. Behavior of Multiple Edge-Triggered Input Events

At any given time step, input events are checked in ascending order based on their port numbers. The chart awakens once for each valid event.For edge-triggered input events, multiple edges can occur in the same time step, waking the chart more than once in that time step. In this situation, the events wake the chart in ascending order based on their port numbers.

2.2.2 Activate a Stateflow Chart by Using Function Calls

A function-call input event causes a Stateflow chart to execute during the current time step of simulation. With this type of input event, you must also define a function-call output event for the block that calls the Stateflow chart.

  1. When to Use Function-Call Input Events

Use a function-call input event to activate a chart when your model requires access to output data from the chart in the same time step as the function call.

  1. Behavior of Multiple Function-Call Input Events

For function-call input events, only one trigger event exists. The caller of the event explicitly calls and executes the chart. Only one function call is valid in a single time step.

2.2.3 Association of Input Events with Control Signals

When you define one or more input events in a chart, a single trigger port appears on the top side of the chart block. Multiple external Simulink blocks can trigger the input events through a vector of signals connected to the trigger port. The Port property of an input event specifies the index into the control signal vector that connects to the trigger port.

By default, Port values appear in the order that you add input events. You can change these assignments by modifying the Port property of the events. When you change the Port property for an input event, the Port values for the remaining input events automatically renumber.

2.2.4 Data Types Allowed for Input Events

For multiple input events to a trigger port, all signals must have the same data type. Using signals of different data types as input events results in an error during simulation.

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值