Is it possible to create a cycle counter that only increments within a specified signal range?

  • Software
  • Is it possible to create a cycle counter that only increments within a specified signal range?
Lemmy Atom

Posted on 31.03.2026 23:00

I'm able to create a cycle counter as explained in THIS post.

But want to expand on this by having the counter only increment when my signal's peak-maximums are between the range of 1000-1100lbs.


This is a cyclic fatigue test with varying loads, its important to capture not only total cycles but more crucially, a target number of cycles the specimen sees loads between 1000-1100lbs.

Furthermore I'd like to be able to export ONLY the portions of data where those loads were achieved. We need to prove those targets loads were achieved XX number of times.


I'm not very skilled with the statistics function.

Pika Kreča Šmid

Posted on 02.04.2026 09:13

Dear Lemmy,


thank you for reaching out to us.

I went through your request, but would kindly ask for some more clarification.

  • Are you currently working with a Sequencer, or are you using mathematics as you noted in your last post?
  • Cold you please make a usecase clarification on the process you would like to achieve?

In your initial thread, your requirements were as follows:

  • make a counter that increments at each reversal of the cyclic load
  • store data for the following cycles:
  • 1-10
  • 5,000-5,010
  • 10,000-10,010

Our colleague presented a solution using the Sequencer, but I understand that you were, up to now, working with mathematics instead of the sequencer.

If I understand you correctly, you would now like to achieve the following (completely disregarding everything in the previous thread):

  • check when the signal's peak-maximums are between 1000-1100lbs
  • make a counter whose count will increase only when it detects a signal's peak-maximum to be between 1000-1100lbs
  • store each count in a new datafile - this will ensure that we only store the data where the signal's peaks are between 1000-1100lbs


I understand that the above is what you mean by "export ONLY the portions of data where those loads were achieved".


If this is correct, then I believe the actual implementation isn't that straightforward, especially if we're looking to implement everything while in measure mode. The key problem is this requirement

  • have the counter only increment when the signal's peak-maximums are between the range of 1000-1100lbs

because we have to look for a maximum of a signal during each reversal of the cyclic load, and any such calculation will be at least slightly delayed, since we have to wait for all the samples in the calculation to come. From the get go, my thoughts went to two options to calculate the peak:

1. Use basic statistics to calculate the maximum of a signal during each reversal of the cyclic load, then generate a pulse only if the maximum value is within 1000 lbs and 1100 lbs. After that, count every instance where the max peak within this instance is detected.


here's what this would look like:


However, basic statistics works with quite a large delay, so you would have to use a pre-trigger during storing to ensure that the whole reversal of the cyclic load, where the load fits the requirements, is recorded:



2. The other option would be to calculate maximums using the .data() command, like on the image below, but the need for a future

(.data(1)) sample might cause issues down the road (since the future sample hasn't been recorded yet). I believe this option would

work better in Analysis mode where all our samples are already recorded. We would then, again, check if the peak fits the lbs

requirements, and count if this works. Here's what this would look like:




I intentionally didn't go further than this, as I would first like to know if I'm going in the right direction with this - would either of these options fit what you are looking for?


Best regards,

Pika


Login to reply to this topic. If you don't have account yet, you can signup for free account .