0
votes

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

Input Signal: Input Signal

Model: Model Output Output

2
What do you mean by "capture it"? How does the output of the model you current have not do what you want?Phil Goddard
my model detects the first and 2nd crossing i want the 2nd crossing to 20user183060
Saying "the 2nd crossing to 20" is meaningless. Be very specific about what you want to see. Do you want to count the crossings? Do you want a signal that has a rising edge every second crossing? Perhaps draw a picture to show what you want. At the moment nobody's going to be able to help because it's just not clear what you expect to see.Phil Goddard
I want a rising edge only after the 2nd crossing ignoring the first crossing. Please check the image i just uploaded. thanks for clarificationuser183060

2 Answers

1
votes

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.

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. 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.

enter image description here

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.

0
votes

Using the answer above by Phil, i was able to create my version without using triggered subsystem

Sample answer