Calculation components (e.g RGB color calculation)

Moderator: Benj

Post Reply
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden

Calculation components (e.g RGB color calculation)

Post 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 (104.5 KiB) Viewed 3404 times

User avatar
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd

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

Post by Benj »


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.

Post Reply