Skip to content

Commit 330443a

Browse files
authored
Update model.js
1 parent 89ad084 commit 330443a

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

docs/model.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ export function simulate() {
1313
/* =========================
1414
Electrical parameters
1515
========================= */
16-
const Cpiezo = 2e-9; // [F] 圧電等価容量
17-
const Rloss = 5e5; // [Ohm] 誘電損失
18-
const tr = 0.5e-6; // [s] 立上り・立下り時間
16+
const Cpiezo = 2e-9; // [F] piezo capacitance
17+
const Rloss = 5e5; // [Ohm] dielectric loss
18+
const tr = 0.5e-6; // [s] rise / fall time
1919

2020
for (let i = 0; i < N; i++) {
2121
const ti = i * DT;
2222
t.push(ti);
2323

2424
/* =========================
25-
1. Drive Voltage (finite slope)
25+
1. Drive Voltage (Primary)
2626
========================= */
2727
let v_drive = 0;
2828

@@ -40,18 +40,22 @@ export function simulate() {
4040
V.push(v);
4141

4242
/* =========================
43-
2. Current (capacitive + loss)
43+
2. Current (Result) [mA]
4444
========================= */
4545
const dv = (v - v_prev) / DT;
46-
const ii = gains.I * (Cpiezo * dv + v / Rloss);
47-
I.push(ii);
46+
47+
// A → mA conversion (IMPORTANT)
48+
const ii_mA =
49+
gains.I * 1e3 * (Cpiezo * dv + v / Rloss);
50+
51+
I.push(ii_mA);
4852
v_prev = v;
4953

5054
/* =========================
5155
3. Piezo Displacement
5256
Δx ← V
5357
========================= */
54-
const tau_x = 5e-6; // 機械応答
58+
const tau_x = 5e-6;
5559
const x_target = gains.x * v;
5660
const xx = x_prev + (DT / tau_x) * (x_target - x_prev);
5761
x.push(xx);
@@ -61,7 +65,7 @@ export function simulate() {
6165
4. Cavity Pressure
6266
P ← Δx
6367
========================= */
64-
const tau_p = 8e-6; // 音響応答
68+
const tau_p = 8e-6;
6569
const p_target = gains.P * xx;
6670
const pp = p_prev + (DT / tau_p) * (p_target - p_prev);
6771
P.push(pp);

0 commit comments

Comments
 (0)