hrc - rebuilding this one to ruby
Posted: Fri May 24, 2013 9:19 pm
Recently I created a tool for calculating harmonic resonances in multi-freq setup. Consider this as my contribution to FS community.
While the calculator itself works fine, the problem begins in living schematics (calculations are made on static values of course). Calculation points are made via loop generator, and loop generator is made of green stuff. Which means, under even not too heavy load - the whole things slows down, and affects the application.
I have no idea whether this thing could be done on greens only, so I guess this is a task for rubyists.
Can someone help?
Speedy Trog?
*
Things to do.
There are two concepts related to harmonic points. Midpoint based resonance, and interval based resonance. These two things are calculated separately.
1. Midpoint based part.
a)
Calculate all midpoints between all freqs according to formula: (f1+f2)/2.
Exclude self-calculations (i.e. like f1 and f1) and reversed ones (use abs; f1 with f2 = f2 with f1).
Track labels for all calculations. (f4+f5)/2 <=> "f4~f5" string.
Track ratios between border freqs (=<2, =<4, =<8) and differences (=<br, >=br) and assign additional markings (o1, o2, o3+ for ratios, and br for =<br)
Result: two equal arrays, one made of midpoint numbers, second made of strings/labels
b)
Compare midpoints with freqs.
Exclude self-comparisons (i.e. things like f4 with f4~f6 midpoint).
Track labels of these comparisons. (will give a form of like: "f5 in f7-f9")
End results are according to fomula: X = 2* abs (fN-mid)
[yup, resulting vibration is 2x higher than difference]
2. Interval based part
a)
Create for each freq an interval series (you may exclude fractionals; they duplicate in reversed calc):
x1, x2, x3, x4
x3/2, x5/2, x7/2
x4/3, x5/3, x7/3, x8/3, x10/3, x11/3
x5/4, x7/4, 9/4, x11/4, x13/4, x15/4
[these 4 sets are important, because each one has different recalc ratio]
Use similar formula for label tracking (see how the example works) and ratio based markings.
b)
Compare each input freq with all intervals.
Exclude self comparisons (like f1 with f1-based intervals)
Track labels in similar way like before
The end values however depend on interval series.
for N = x1, for N/2 = 2, for N/3 = 3, for N/4 = 4.
3. Consolidate all, and combine (somehow) with fliterings according to range and type.
If I missed something - everything else is in greens and via example.
p.s.: array size is/was semi-fixed by purpose.
To change it - just add notes, click once to get recalc, and refresh inputs.
*
I know it may sound as "big project", but it isn't. It is complicated only in greens (the difficult part here are array operations, and filters).
While the calculator itself works fine, the problem begins in living schematics (calculations are made on static values of course). Calculation points are made via loop generator, and loop generator is made of green stuff. Which means, under even not too heavy load - the whole things slows down, and affects the application.
I have no idea whether this thing could be done on greens only, so I guess this is a task for rubyists.
Can someone help?
Speedy Trog?
*
Things to do.
There are two concepts related to harmonic points. Midpoint based resonance, and interval based resonance. These two things are calculated separately.
1. Midpoint based part.
a)
Calculate all midpoints between all freqs according to formula: (f1+f2)/2.
Exclude self-calculations (i.e. like f1 and f1) and reversed ones (use abs; f1 with f2 = f2 with f1).
Track labels for all calculations. (f4+f5)/2 <=> "f4~f5" string.
Track ratios between border freqs (=<2, =<4, =<8) and differences (=<br, >=br) and assign additional markings (o1, o2, o3+ for ratios, and br for =<br)
Result: two equal arrays, one made of midpoint numbers, second made of strings/labels
b)
Compare midpoints with freqs.
Exclude self-comparisons (i.e. things like f4 with f4~f6 midpoint).
Track labels of these comparisons. (will give a form of like: "f5 in f7-f9")
End results are according to fomula: X = 2* abs (fN-mid)
[yup, resulting vibration is 2x higher than difference]
2. Interval based part
a)
Create for each freq an interval series (you may exclude fractionals; they duplicate in reversed calc):
x1, x2, x3, x4
x3/2, x5/2, x7/2
x4/3, x5/3, x7/3, x8/3, x10/3, x11/3
x5/4, x7/4, 9/4, x11/4, x13/4, x15/4
[these 4 sets are important, because each one has different recalc ratio]
Use similar formula for label tracking (see how the example works) and ratio based markings.
b)
Compare each input freq with all intervals.
Exclude self comparisons (like f1 with f1-based intervals)
Track labels in similar way like before
The end values however depend on interval series.
for N = x1, for N/2 = 2, for N/3 = 3, for N/4 = 4.
3. Consolidate all, and combine (somehow) with fliterings according to range and type.
If I missed something - everything else is in greens and via example.
p.s.: array size is/was semi-fixed by purpose.
To change it - just add notes, click once to get recalc, and refresh inputs.
*
I know it may sound as "big project", but it isn't. It is complicated only in greens (the difficult part here are array operations, and filters).