Page 1 of 1

Calculation components (e.g RGB color calculation)

Posted: Sat May 11, 2013 12:25 pm
by hyperion007
I would like to see "components" or macros for different algorithms and calculations. For example RGB color cycle function, or a temperature control macro, that calculates and "learns" when and for how long it should turn on an output controlling a fan for example, to keep a constant and stable temperature. Maybe incorporating some fuzzy logic.

So basically, function macros, that are not for a physical component. Or just more example programs and tutorials. I'm not that great at math so I have a really hard time figuring out these kinds of things.
I mean, I can do the basic things like changing RGB color from 0,0,0 to 255,255,255 but if I want to take things like human perception of colors vs light intensity etc into consideration I struck out :)

Or things like this (see attached picture):
tempcontrol.jpg
tempcontrol.jpg (104.5 KiB) Viewed 14180 times

Re: Calculation components (e.g RGB color calculation)

Posted: Tue May 21, 2013 3:38 pm
by Benj
Hello,

Like your suggestion will have a think about if we can do something like this with v6.

PID is fairly straight forward and can be expressed much simpler then that. I have a nice fluffy version of the equation somewhere I developed at Uni. Have a look at some of the equations relating to Laplace, Z-plane and Inverse Kinematics etc, there's some serious maths!

PID equates to something like this as taken from the DSP control component.

%a_OUTPUT_NAME[idx] = %a_PROPORTIONAL * (error - errorm1 + (error / %a_INTEGRAL) + %a_DIFFERENTIAL * (error - (2 * errorm1) + errorm2));

Where error is the current error, errorm1 is the error from the last cycle and errorm2 is the cycle before that. The inputs P, I and D are then constants which are used to tweak the system into giving the correct optimum response.