Strange SmoothValue results

Post Reply
User avatar
seal58
Posts: 377
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Strange SmoothValue results

Post by seal58 »

Hi,

I've already used SmoothValue() without any problems. But at the moment I get strange results with it.

Until yesterday my code used two smoothed values. For both I set same rate and initial value as

Code: Select all

levelSmoothedValue.ResetValue( 0 );
levelSmoothedValue.SetFixedTime( smoothRate, 1.0 );
averageSmoothedValue.ResetValue( 0 );
averageSmoothedValue.SetFixedTime( smoothRate, 1.0 );
While levelSmoothedValue.GetSmootheValue() worked as expected, slew rate of averageSmoothedValue.GetSmootheValue() was 120 times as long as first one.

Today I added a testSmoothValue() to the code. Now it's getting worse. All three values are different and their slew rate is much too long.
different_smoothvalues_logs.jpg
different_smoothvalues_logs.jpg (17.65 KiB) Viewed 2673 times
Additional information:
- VMD 2.7.0 on a Windows 10 PC
- Target values levelSmoothedValue.SetValue( value ) are set within ProcessSample()
- Smoothed values levelSmoothedValue.GetSmoothValue( value ) are used in a void method, that is called from Notification()-GUI_Update_Timer
- This strange behaviour is also whith the published module in VM

Does anybody have any idea what is wrong with my code?
I'd be happy when getting a hint because I'm looking for a fault for two days now. :(

Roland

By the way: Today I had another issue for second time: VMD debugging client seems to start normal, but there isn't any operation.
With the help of Log() I found: Neither ProcessSample() nor Notify() are executed while VM is running. After VM is shut down, VMD works fine.
User avatar
utdgrant
Posts: 624
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Strange SmoothValue results

Post by utdgrant »

Are you constantly setting a new target value before the slew time has fully elapsed? It will calculate a new slope and reset the timeout counter if you do that.
______________________
Dome Music Technologies
User avatar
utdgrant
Posts: 624
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Strange SmoothValue results

Post by utdgrant »

This thread covers a lot of discussion about SmoothValue timing issues.
______________________
Dome Music Technologies
User avatar
seal58
Posts: 377
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: Strange SmoothValue results

Post by seal58 »

Hi Grant,

thanks for the link. In that dialogs I did not find any helpful new information. As I wrote before, I alreday used SmoothValue() with no problems.

Your worries about using SetValue() too frequently are a good hint. So I checked this and reduced that method calls to intervals of 5,000 and even 50,000 samples. That didn't fix it.

However I cannot understand, why 3 different smooth objects provide different slew rates when all of them are set with same parameters at same time.

Now I reduced my test code to only one SmoothValue() and used this parameters:
- SetFixedTime( 1.0, 1.0 ) (only once)
- SetValue( x ) in intervals of 50,000 samples
- test value 0 to 5.0 dc or vica versa

Resulting slew rate: 1 min/V instead of 1 ms/V :!: !!!
That's even worse than before. :?:

I must find a solution. Though my actual test module is rather simple, I'll code a further one with even less content.

Roland
UrbanCyborg
Posts: 625
Joined: Mon Nov 15, 2021 9:23 pm

Re: Strange SmoothValue results

Post by UrbanCyborg »

I know this was mentioned in the thread Grant quoted, Roland, but are you making sure to access GetSmoothValue() once, and only once per sample? That can certainly make a difference in how it behaves, as that's the only time it gets updated, as I understand it (and without re-reading the other thread).

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
ColinP
Posts: 998
Joined: Mon Aug 03, 2020 7:46 pm

Re: Strange SmoothValue results

Post by ColinP »

Roland, rather than spend days trying to get CA's hidden code to work why not just write your own solution?

As I hinted in the other thread the SmoothValue class implementation is probably extremely simple. The example code I posted does the job.

We all like to use ready-built solutions when doing so saves time but sometimes we waste more time trying to figure out how someone else's obscured code works than it would take to write our own solution.
User avatar
seal58
Posts: 377
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: Strange SmoothValue results

Post by seal58 »

Hi Reid,

you hit it!

My understanding of SmoothValue was, that it gets calculated continuously in the background.

Now I read the thread again and now understood Colin's explanation. This means, that only a GetValue() initiates an update calculation.

Thanks a lot, guys. You saved me from getting crazy. :D
User avatar
seal58
Posts: 377
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: Strange SmoothValue results

Post by seal58 »

Colin wrote:
Roland, rather than spend days trying to get CA's hidden code to work why not just write your own solution?
Colin,
you're right. That's why I'm just coding my own solution for another Voltage object. But nevertheless I try to understand basic use of Voltage elements. As several times before, a dialog in this forum braught the light into darkness in my brain.

So many thanks again.
Post Reply

Return to “Module Designer”