SIMULINK模型的上升沿或下降沿触发延迟器 [英] Rising or Falling Edge-Triggered Delayer for SIMULINK models

查看:3783
本文介绍了SIMULINK模型的上升沿或下降沿触发延迟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题

我想为一个名为"confirmer"的块建模.规范是输出将基于边沿(上升/下降)简单地成为输入的延迟版本.为了澄清,我将尝试将时序图放在下面:

I want to model a block called "confirmer". The specification is that the output will SIMPLY be the delayed version of input based on an edge (rising/falling). To clarify, I will try to put the timing diagrams below:

                 ___________________________ 
                |                           |
Input    _______|                           |____________________________

               (Tdelay) _____________________
                       |                    | 
Output   ______________|                    |____________________________

还有

                        ____________________________
                        |                           |
Input    _______________|                           |____________________________
                                                      (Tdelay)                           
                        ______________________________________
                        |                                     | 
Output   _______________|                                     |_____________________

当我尝试在上方绘制时,上升沿意味着我的输出将仅跟随Tdelay之后的更改输入.但是,当它从1变回0时,就没有延迟了.这是一个上升沿触发的确认程序块的图.

As I tried to draw above, the rising edge means that my output will simply follow the change input after Tdelay. But when it changes back from 1 to 0, there is no delay. This is the diagram for a confirmer block that is rising edge triggered.

对于下降沿触发的确认器,情况恰恰相反.当出现下降沿时,输出将在Tdelay秒后跟随输入的变化,即保持Tdelay的最后一个输入.

For a falling-edge triggered confirmer, it is the opposite. When there is a falling edge, the output will follow the change in input after Tdelay seconds i.e. hold the last input for Tdelay.

我的目标平台

SIMULINK和MATLAB.

SIMULINK and MATLAB.

我的初始解决方案

我知道,有一种方法可以通过使用触发的子系统块来触发某些动作.但是我正在努力使用SIMULINK中的delay/unit-delay块来实现带触发器的延迟.我设法使用了另一个称为可复位延迟器的模块,但是当它是上升沿复位时它不能正常工作.它只是基于边缘进行重置.

I know that there is way to trigger for certain actions by using a triggered subsystem block. But I am struggling to use the delay/unit-delay block in SIMULINK to implement the delay with the trigger. I have managed to use another block called resettable delayer but it does not work properly when it is a rising-edge reset; it simply resets based on an edge.

以前有人尝试过这种问题吗?

Has anyone tried this kind of problem before?

自@PhilGoddard回答以来更新

我认为这应该可行,因为我已经设法重现了问题中的时序图.

I think this should work as I have managed to reproduce the timing diagrams in the question.

我是如何设计的:

1)使用重复序列楼梯作为我的输入.

1) Used the repeating sequence stair as my input.

2)配置了单位延迟块,以便在上升沿或下降沿启用复位.这将允许以下任何一个"

2) configured the unit delay block such that the reset is enabled at rising edge or fallling edge. This will allow either of the following"

i)输入(下降沿)=输出(下降沿)[上升沿被Tdelay延迟 ii)输入(上升沿)=输出(上升沿)[失效边缘被Tdelay延迟]

i) Input (falling edge) = Output (falling edge) [rising edge is delayed by Tdelay ii) input (rising edge) = Output (rising edge) [failling edge is delayed by Tdelay]

除非我丢了大理石,否则我认为此解决方案还可以吗?

Unless I am losing my marbles, I think that this solution is okay?

推荐答案

使用已启用和触发的子系统.

Use an Enabled and Triggered Subsystem.

从Ports and Subsystems库中拖动该块,并仅对其属性进行两项更改:打开子系统,打开输出端口(称为Out1),并将禁用时输出"属性更改为重置",然后将初始输出"为0.

Drag that block from the Ports and Subsystems library, and make only two changes to its properties: Open the subsystem, open the outport (called Out1), and change the "Output when disabled" property to "reset" and the "Initial Output" to 0.

然后,将您的输入输入到启用端口;将输入的延迟版本输入触发端口(默认情况下设置为上升沿);并将一个恒定的块(值= 1)送入信号输入口. 子系统的输出应该是期望的.

Then, feed your input into the enable port; feed a delayed version of your input into the trigger port (which by default is set to be rising edge); and feed a constant block (with value=1) into the signal inport. The output of the subsystem should be as desired.

这篇关于SIMULINK模型的上升沿或下降沿触发延迟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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