How to Apply a Time-Based Conditional Filter in Dewesoft?

  • Software
  • How to Apply a Time-Based Conditional Filter in Dewesoft?
emre karataş

Posted on 18.06.2025 12:41

Hi everyone,

I'm trying to apply a conditional logic in Dewesoft where a threshold must be exceeded continuously for a certain amount of time before any data is flagged or shown.

Example:

I want to display or mark only the data where the voltage stays above 28V for at least 0.5 seconds.

So far, I’ve tried using the If() function inside the Math module, like:

plaintext
CopyEdit
If(Voltage > 28, 1, 0)

But this only evaluates the instantaneous value, not the duration for which the condition is met.


My Questions:

  1. Is there a native way to implement such time-based logic in Dewesoft?
  2. Can I achieve this using any existing functions (like integration, pulse width, counters, etc.)?
  3. Would this require a Lua script or a plugin?
  4. If not supported directly, what would be the best workaround?

Thanks in advance for any guidance.

Best regards,

Emre Karataş

Staš Jevševar

Posted on 23.06.2025 06:54

Dear Emre,


thank you for reaching out to us.

If I understand correctly, you would like to output a signal after a certain condition has been specified for a preselected amount of time.


My immediate idea would be to expand the If statements you have already made by incorporating a Live stopwatch, with which we will monitor how long the channel's value is within the limits we would like to observe. I made a simple example to highlight my idea:

To make matters easier, I will create 3 User inputs, which will serve as specific conditions:

  • Condition_Channel
  • I will use this channel as a trigger at which I will start and stop observing data
  • Actual_Condition
  • I will use this channel to set limits for Condition_Channel, at which I will observe the data
  • I set it at 20 -> I want my data to be visible when Condition_Channel is above or equal to 20.
  • TimeCondition​
  • I will use this channel to set for how long the Condition_Channel must fulfil Actual_Condition before I observe my data.
  • I set this value to 5(s)



In maths, I create a sine channel. This channel will mark the data I want to observe.



I then start making my stopwatch.

I first want to calculate the offset, that is, how much time has passed before Condition_Channel reached and surpassed Actual_Condition. To do so, I use the hold function. I additionally set a rearm condition. That Is, I want to be able to get new offset values after the Condition_Channel falls below Actual_Condition.



I then calculate a live stopwatch- I want the equation to display the actual time since we started acquisition, but it has to be subtracted by the time between acquisition started and hold condition was fulfilled. 



I then want to calculate how much time has elapsed since the hold condition (Condition_Channel >= Actual_Condition) was fulfilled. If the condition is fulfilled, we therefore want to display the value off of the stopwatch, otherwise, we do not want to have a value:



This bring us to the final point- data display. If the Elapsed time reached or surpassed the value, specified by TimeCondition, we output the value from our Sine channel, otherwise, we want no value:



I attached a setup file and a video of the behaviour for your convenience.

Please do let me know if you have any follow-up questions.


Regards, Dewesoft support


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