Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Threshold checking for a realtime signal
Forum Updated to NodeBB v4.3 + New Features

Threshold checking for a realtime signal

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 280 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SruDom
    wrote on last edited by
    #1

    Hi
    I have a realtime signal from a sensor. I need logic to implement a masking time once the signal is above a threshold. Here, masking time is a time period masked for any threshold checking. This is how I can differentiate positive and negative pulse As shown below:
    182b6d31-d590-4316-b35f-d0278193a6e3-image.png
    (during a postive pulse there is a negative-going side but it should not detect as a "negative pulse").

    Lets say the masking time period is 0.5 seconds in my case. How do I implement this logic in Qt.
    I can get the current time and compare for a threshold as shown below, but don't know how to mask for threshold checking for a period of time (say 0.5sec)

    static QTime time(QTime::currentTime());
    // calculate two new data points:
    double key = time.elapsed()/1000.0; // time elapsed since start of demo, in seconds
    
    
    if(a_vertical> onThreshold) // is this check correct for masking time?
        {
       
            ui->rdo_btn_vertical->setStyleSheet(StyleSheetOn1); // On  LED
            lastKey = key;
        }
        else
        {
            ui->rdo_btn_vertical->setStyleSheet(StyleSheetOff1); // Off LED
        }
    
    
    

    Any ideas / feedbacks are welcome

    1 Reply Last reply
    0
    • artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      Let's start with the basics: do you get any measurable values from the port the signaling device is connected?
      If so, based on your drawings, knowing the threshold value:

      • assume threshold is zero.
      • treat all the values below the threshold (zero) as negative in relation to threshold.
      • accordingly, all the values above threshold (zero) as positive in relation to threshold.
      • sum all those up.
      • if value is positive you have negative pulse, otherwise negative.

      But that assumes that you have measurable values from the sensor + that drawings represent accurate tendencies.

      For more information please re-read.

      Kind Regards,
      Artur

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved