diff --git a/.gitignore b/.gitignore index 5d990fa..35642a2 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,4 @@ ehthumbs.db Desktop.ini # Agent Skills -.agent/ \ No newline at end of file +.agents/ \ No newline at end of file diff --git a/static/app.js b/static/app.js index 5906843..b252f19 100644 --- a/static/app.js +++ b/static/app.js @@ -12,6 +12,7 @@ createApp({ "Bandpass (帶通)", "Notch (陷波器)", "1P1Z (一極一零)", "2P2Z (二極二零)", "PID 控制器", "SOGI-Alpha (帶通)", "SOGI-Beta (低通)" ], + systemGainDB: 0.0, params: { fc: 1000.0, order: 1, bp_f_low: 500.0, bp_f_high: 2000.0, bp_order: 1, @@ -38,6 +39,9 @@ createApp({ } }, computed: { + linearSystemGain() { + return Math.pow(10, this.systemGainDB / 20.0); + }, maxLogB() { if (this.sense_b === '1%') return Math.log10(1.01); if (this.sense_b === '2x') return Math.log10(2.0); @@ -50,7 +54,7 @@ createApp({ }, fixedPointCoeffs() { const scale = Math.pow(2, this.shiftBits); - const b_raw = this.parseCoeffs(this.b_str); + const b_raw = this.parseCoeffs(this.b_str).map(x => x * this.linearSystemGain); const a_raw = this.parseCoeffs(this.a_str); const b = b_raw.map((x, i) => ({ label: `b${i}`, val: Math.round(x * scale) })); @@ -59,8 +63,8 @@ createApp({ return { b, a }; }, floatingCoeffs() { - const b = this.parseCoeffs(this.b_str).map((x, i) => ({ label: `b${i}`, val: x })); - const a = this.parseCoeffs(this.a_str).map((x, i) => ({ label: `a${i}`, val: x })); + const b = this.parseCoeffs(this.b_str).map((x, i) => ({ label: `b${i}`, val: parseFloat((x * this.linearSystemGain).toPrecision(6)) })); + const a = this.parseCoeffs(this.a_str).map((x, i) => ({ label: `a${i}`, val: parseFloat(x.toPrecision(6)) })); return { b, a }; } }, @@ -185,7 +189,7 @@ createApp({ this.loadingBode = true; this.globalError = null; try { - let b = this.parseCoeffs(this.b_str); + let b = this.parseCoeffs(this.b_str).map(val => val * this.linearSystemGain); let a = this.parseCoeffs(this.a_str); if (b.length === 0) b = [1.0]; if (a.length === 0) a = [1.0]; @@ -334,8 +338,9 @@ createApp({ this.loadingFilter = true; this.globalError = null; const formData = new FormData(); + const final_b_str = this.parseCoeffs(this.b_str).map(val => val * this.linearSystemGain).join(', '); formData.append('file', this.csvFile); - formData.append('b', this.b_str); + formData.append('b', final_b_str); formData.append('a', this.a_str); formData.append('col_idx', this.selectedColumn); try { @@ -373,8 +378,9 @@ createApp({ async downloadCsv() { if (!this.csvFile) return; const formData = new FormData(); + const final_b_str = this.parseCoeffs(this.b_str).map(val => val * this.linearSystemGain).join(', '); formData.append('file', this.csvFile); - formData.append('b', this.b_str); + formData.append('b', final_b_str); formData.append('a', this.a_str); formData.append('col_idx', this.selectedColumn); try { diff --git a/static/index.html b/static/index.html index ef36148..8136a5c 100644 --- a/static/index.html +++ b/static/index.html @@ -15,6 +15,7 @@ + @@ -22,9 +23,12 @@
-

- 差分方程式分析 (Difference Equation Analyzer)

+
+ Logo +

+ 差分方程式分析 (Difference Equation Analyzer)

+