Results 1 to 5 of 5

Thread: Qwt curve fitting takes a lot of time

  1. #1
    Join Date
    May 2012
    Posts
    136
    Thanks
    2
    Thanked 27 Times in 24 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Qwt curve fitting takes a lot of time

    This is how my graph should work:
    My graph shows realtime the data collected from a plc. The plc generates a sample for the graph every 500ms (the graph redraws every 1000ms)
    the graph is auto scaling in x and y direction

    The problem:
    the job that the plc needs to complete can take several days, so it is collecting a lot of data. when the data pool is getting large the pc can't cope redrawing the graph so the HMI stops responding (and then can't keep the connection between the pc and plc alive)

    What I tried:
    (disabled all the nice effects like antialliassing)
    1. applying a curve fitter on the qwtcurve, but this still took a lot of time (tried both of the fitters)
    2. using an unfitted buffer and fit it every 20 sec and replace the data in the graph with the fitted data. during the 20 seconds (when the data is not getting fitted) the new data is added to both the unfitted buffer and the graph (so it still gets updated every second). The fitting was done by QwtWeedingCurveFitter but this fitter is realy slow at large data sets (takes about 2.5sec for a set of 100K and i got three sets of 100K)
    3. the same as point 2 but using the QwtSplineCurveFitter, this one is fast but it changes the graph too much

    Is there anyone who can help me

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt curve fitting takes a lot of time

    Quote Originally Posted by StrikeByte View Post
    using an unfitted buffer and fit it every 20 sec and replace the data in the graph with the fitted data. during the 20 seconds (when the data is not getting fitted) the new data is added to both the unfitted buffer and the graph (so it still gets updated every second). The fitting was done by QwtWeedingCurveFitter but this fitter is realy slow at large data sets (takes about 2.5sec for a set of 100K and i got three sets of 100K)
    Douglas-Peucker is an expensive algorithm, but you don't have to apply it on all data again and again. It's enough to do it for the points of the last increment and to add them to the points that are already fitted from the previous increments.

    Uwe

  3. #3
    Join Date
    May 2012
    Posts
    136
    Thanks
    2
    Thanked 27 Times in 24 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qwt curve fitting takes a lot of time

    Thanks for the quick reply

    I was working on that, but I didn't know if it was gonna work
    does it reduce it as much as when i apply it to the subsets of data instead of the entire set?

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt curve fitting takes a lot of time

    Quote Originally Posted by StrikeByte View Post
    does it reduce it as much as when i apply it to the subsets of data instead of the entire set?
    When you include the last 2 points of the previous subset - probably yes.

    Uwe

  5. The following user says thank you to Uwe for this useful post:

    StrikeByte (31st July 2012)

  6. #5
    Join Date
    May 2012
    Posts
    136
    Thanks
    2
    Thanked 27 Times in 24 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qwt curve fitting takes a lot of time

    This realy works well
    The repaint time was 2319ms and after the refitting it went down to 273ms

Similar Threads

  1. How to use curve fitting
    By nightroad in forum Qwt
    Replies: 0
    Last Post: 30th June 2011, 13:43
  2. QTextEdit loading takes long time
    By sreedhar in forum Qt Programming
    Replies: 12
    Last Post: 21st March 2011, 10:29
  3. Curve Fitting Not Always Applied
    By Mannion in forum Qwt
    Replies: 3
    Last Post: 16th March 2011, 08:11
  4. QGraphicsScene sorting takes a lot of time
    By f-r-o-s-t in forum Qt Programming
    Replies: 6
    Last Post: 23rd May 2010, 16:24
  5. QGraphicsItem.setPos takes a lot of time
    By ricofe25 in forum Qt Programming
    Replies: 2
    Last Post: 8th December 2009, 19:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.