如何检测到第二条交叉点到Simulink [英] how to detect 2nd crossing to point simulink

查看:113
本文介绍了如何检测到第二条交叉点到Simulink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在到达第二点时检测第二下降交叉点.第二次穿越后,信号将再次上升,然后重复. 每次信号降到20(第二次)时,我都想像图像中的输出信号一样通过关系块捕获它

How to detect the 2nd falling crossing when it reaches the 2nd point. The signal will rise again after the 2nd crossing and then repeats. Each time the signal falls at 20(2nd time) i want to capture it via relational block like the output signal in the image

输入信号:

型号: 输出

推荐答案

有多种方法可以完成此操作.一种方法是使用触发子系统,如果计数试图超过2,计数器将自动重置.

There are multiple ways this could be done. One approach is to create a triggered counter, using a Triggered Subsystem, with the counter resetting itself if the count tries to go above 2.

下面是一个示例.通过将您的输入与一个常量(在本例中为20)进行比较,并基于该触发器的上升沿来递增计数器,来生成触发器.将计数器初始化为1,然后选择

An example of this is shown below. The trigger is generated by comparing your input to a constant (in this case 20) and incrementing the counter based on a rising edge of that trigger. Initialize the counter to 1, then either

    如果计数值当前小于1,则
  1. 增加计数器.
  2. 如果计数器已经位于2,则
  3. 将计数器重置为1.
  1. increment the counter if the count value is currently less than 1.
  2. reset the counter to 1 if the counter is already at 2.

在此示例中,计数器每隔第二个阈值就会重置一次.

In this example the counter resets every second crossing of the threshold.

如果数据类型很重要,也可以使用逻辑/布尔值(即TrueFalse)来代替示例中使用的12.

If data typing is important this could also be done using logical/boolean values (i.e. True and False), rather than the 1 and 2 used in the example.

这篇关于如何检测到第二条交叉点到Simulink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆