這時鐘項目一年前完成的。 這是一個新專案的開始,該專案可能會變成某種功率監視器。
這是 1990 年左右老式示波器上的兩個波形的圖片。
Sine wave is volts, pulse is amps正弦波是伏特,脈衝是安培
如果單位和比例正確,則伏特 * 安培的積分就是負載使用的實際功率。 我照做了,目測了一下,結果是 47 瓦。 這有點令人失望,因為這是正在測試的設備。
30W CFL bulb30W CFL 燈泡
如果這是一個白熾燈泡,那麼伏特和安培的波形將非常相似,並且排列整齊。 但現今大多數電子產品在電壓週期的一小部分內都需要電力。
看更多...我的筆記
current: peak is 85 mv on 30 ohms. e/r=i, .085/30 = .0028 amp
x500 -> 1.4Amp
That max current is when Volts = 4, current ramps to zero as volts ramps to 6.
The volts are actually (xformer ratio 230/8.6 no load) x26.75, so 4*26.75 = 107V to 6*26.75 = 160.5V
the ramp is about 1/4 of the cycle.
treat the sine wave as a linear ramp too.
begin of ramp is .0028A * 107V
end of ramp is 0.0A * 160V
average is 1.4A * 133.5V = 186.9 volt-amps (watts)
but only 25% duty cycle
187/4 = 47W
所有這些數字都是螢幕外或資料表外的估計值。 有些會改變,如下。
這是我用來數位化一些點的 JSL。 資料數組最初沒有填充;這些就是我的答案。 這是一次性代碼;我走了一條捷徑,使第一點和最後一點具有特殊意義,如下所示。
看更多...
img = New Image( "z:/scope.jpg" );
img << rotate( 1 );
{nx, ny} = img << size;
New Window( "", gb = Graph Box( framesize( 900, 600 ) ) );
volts=[ 24.6814218645205 25, 39.4366197183099 58.0851063829787, 42.186452045607
65.531914893617, 44.1985244802146 69.3617021276596, 46.2776659959759
72.6595744680851, 48.692152917505 73.2978723404255, 51.5090543259557
72.6595744680851, 56.8075117370892 61.3829787234043, 74.6478873239437
25.8510638297872];
amps=[ 42.713423397528 50.5777501131734, 43.1254191817572 62.5531914893617,
43.7865286959854 59.4881167949298, 45.0384848775191 58.3055681303757,
45.8433138513621 55.4454504300589, 46.8908690236658 53.6853779990946,
48.4238765928907 51.1827750113173, 50.1229599821149 50.7702580353101,
51.7102615694165 50];
gb[framebox(1)]<<ADDGRAPHICSSCRIPT></ADDGRAPHICSSCRIPT>旋轉一度讓影像 xy 與螢幕對齊。
Scope traces as image in a JMP graph. The tiny black square boxes on the traces are the handles.範圍追蹤為 JMP 圖形中的影像。 痕跡上的黑色小方框就是手柄。
將點拖曳到位後,第一個和最後一個電壓點定義了一個完整的週期,第一個和最後一個電流點定義了脈衝長度,我使用了這個。
看更多...
vmax = Max( volts[0, 2] ); // sine top
vmin = Min( volts[0, 2] ); // sine bottom
vrange = vmax - vmin; // sine range
amax = Max( amps[0, 2] ); // similar for pulse
amin = Min( amps[0, 2] );
arange = amax - amin;
minx = Min( volts[0, 1] ); // length of sine cycle
maxx = Max( volts[0, 1] ); // because point 1 and 9 at begin and end
pulselength = amps[9, 1] - amps[1, 1]; // length of 1 of 2 pulses
pulseduty = 2 * pulselength / (maxx - minx); // 2 pulses per cycle
dt = pulselength / 16384; // small dt improves answer
n = 0; // count the dt intervals
sum = 0;
For( t = amps[1, 1], t < amps[9, 1], t += dt, // step thru the pulse
y = Interpolate( t, volts[0, 1], volts[0, 2] ); // get the volts
v = 125 * 1.414 * (2 * (y - vmin) / vrange - 1); // map the volts
y = Interpolate( t, amps[0, 1], amps[0, 2] ); // get the amps
a = 1.4 * ((y - amin) / arange); // map the amps
sum += a * v; // watts for this dt
n += 1;
);
sum = sum / n;
sum = sum * pulseduty;
Show( sum );
要得到
總和= 25.8513297218601;
我們需要重新思考一下;我沒有使用變壓器定義不明確的匝數比和示波器古老的校準,而是假設我的房屋電壓為 125V rms,並使用 1.414 係數來獲得正弦波應匹配的峰峰值電壓。 這似乎夠接近了。 現在讓 ESP32 直接將點數位化...
一路插著。 ESP32 將 FFT 頻域樣本串流傳輸到 JMP 圖。 到目前為止,60Hz 是主要頻率,其次是前幾個奇次諧波。
版本 0 板於今年底前發布,並已達到其目的。 我期待明天發布第 1 版主機板。 這是版本 0 板,在 240x320 2.8 吋顯示器和額外的板上顯示電壓正弦波。 瓶蓋用於刻度;看黃色圓圈中的小電容器。 PCB供應商安裝它;我很確定我不能。
The display is mounted to the red card, which plugs in to a connector mounted to the vertical row of holes at bottom left-center.顯示器安裝在紅卡上,紅卡插入安裝在左下中心垂直排孔上的連接器。
在等待版本 1 板時測試 WiFi 連接表明,每秒 40K 到 50K 位元組是該計算機需要執行的所有其他操作的可持續數據速率。 我想查看電壓和電流通道,因此每個數位化波形大約為 20KB/秒。 在某些時候,我想對資料使用 FFT,我開始考慮緩衝區大小。 FFT 確實喜歡 2 的冪。 多少? 這是一些測試程式碼:
dt = New Table( "Untitled", "invisible", New Column( "size" ), New Column( "time" ) );
dt << New Column( "factors",
character,
formula(
primes = [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113
127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257
263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409
419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571
577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 719 727 733
739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 877 881 883 887 907
911 919 929 937 941 947 953 967 971 977 983 991 997 1009];
start = size;
ip = 1;
q = primes[ip];
result = "";
While( start > 1,
If( Mod( start, q ) == 0,
result = result || Char( q ) || ",";
start = start / q;//
, //
ip += 1;
q = primes[ip];
If( q * q > size, Break() );
)
);
If( start > 1,
result = result || Char( start )
);
result;
)
);
For( i = 2, i <= 2 ^ 19, i += 1,
x = 0;
x = J( i, 1, Random Uniform() );
start = HP Time();
FFT( {x} );
end = HP Time();
dt << addrows( 1 );
dt:size[N Rows( dt )] = i;
dt:time[N Rows( dt )] = (end - start) / 1e6;
If( i == 10,
dt << Graph Builder(
Size( 1709, 424 ),
Show Control Panel( 0 ),
Variables( X( :size ), Y( :time ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Marker Size( 0 ), Marker Drawing Mode( "Normal" )}
)
)
);
Wait( .1 );
);
If( Mod( i, 100 ) == 0,
Wait( 0 )
);
);
該表如下所示:
2 is great,3 and 5 nice, maybe 7.2 很好,3 和 5 不錯,也許 7。
它製作了一個漂亮的圖表:
The fast buffer sizes, near the bottom, don't have large factors.接近底部的快速緩衝區大小沒有很大的因素。
9500 左右那一堆奇怪的點數裡面有什麼? 選擇、子集、檢視...
Bigger factors更大的因素
看起來如果我使用 1024 或 2048 樣本緩衝區,JMP 將能夠製作即時儀表板。
Very fast.非常快。
即使每秒 60 次,也低於 1%。 我可以在 esp32 上執行 FFT。 然後,可能只發送前 N 個頻率段和幅度,而不是發送完整的波形。 需要考慮一系列權衡。