c - Bounded numerical integration -
Please note that I do not ask for code but for insights, maybe someone who already The same problem was facing.
I am transitioning the code that runs in the embedded system in real time. A new check should be applied for security reasons.
This check is based on the integrated value of a certain variable. The integral needs the last "T-seconds", that is, on each new cycle, I have to delete the value that was T_s seconds in the variable and connects one at present.
Innocent Approach
Running at 62.5Hz, it makes a lot of waste of precious and limited memory fast.
Is there a known approach, which is clear expenditure on accuracy, reduces the memory footprint of such checks significantly?
The value is a measurement coming from a real system, it is not generated by any function.
I thought that N average, integrated with each M digit and then N average, will reduce the memory requirement of N + M numbers, which can be significantly reduced by T_s * frequency, but I wonder:
-
If it has been studied and found a "optimum" point (for example, as the function of M) I searched, but apparently My Google-Fu has broken down, because losing anything, including "numerical integration" What does not cause me to do.
-
If there is a better way
I tagged this post with C because it is the official language of the project Unfortunately, no solution that does not work in ANSI-C is unfortunately not feasible for me.
Hey, if you do not need 100% accuracy but can stay with the average value, then you can do something like this:
average = (average * 0.95) + ((newview - average) * 0.05);
This will give you an estimated average of the old values where the most recent one (
newValue ) is not greater than 1/20; The result of multiplication by 20 is basically your average integral. Of course, for any value of
1- (1 / N) and
1 / n respectively, you can assign two constants to any number,
N To consider the sample.
Edit:
and
There may be some useful answers, too.
Comments
Post a Comment