#! /bin/sh # Skin-Effect SPICE Model (Kouichi Hirabayashi, 2015-09) awk ' BEGIN { note = "5C-2V 1000 m" A = 0.126 # 減衰(dB/m) at F(Hz) F = 200e6 # 減衰指定周波数 (Hz) Z0 = 50 # 特性インピーダンス Fmax = 200e6 # モデルの適用可能上限周波数 L = 1000 # 長さ (m) (省略時 1 m) Vr = 0.659 # 速度係数 (省略時遅延なしモデル) PI = atan2(0, -1) g = 5.8e7 # 導電率 (Cu) u = 4e-7 * PI # 透磁率 (Cu) a = radius(A, F, Z0) # 等価半径 Rdc = 1 / g / PI / a^2 # 直流抵抗 N = 2 # Ri / Ri+1 高精度 # N = 3 # 標準精度 # N = 4 # 低精度 M = _M(a, N, Fmax, u, g) # 層数 if (L == 0) len = 1 else len = L Ri = Rdc * (N^M - 1) / (N - 1) # R1 ri = a # 層半径 Gt = 1 / Ri i = 1 print "*", note if (Vr == "") print ".SUBCKT TLINE 1 2" else printf ".SUBCKT TLINE 1 %d\n", M + 2 printf "R%d 1 2 %g\n", 1, Ri * len for (i = 2; i <= M; i++) { rj = ri ri = sqrt(ri ^ 2 - 1 / PI / g / Ri) Ri = Ri / N Li = u * (rj - ri) / 2 / PI / ri printf "L%d %d %d %g\n", i, i, i + 1, Li * len printf "R%d %d %d %g\n", i, 1, i + 1, Ri * len Gt += 1 / Ri } x = Gt * Rdc if (x < 0.99 || 1.01 < x) { print "等価回路異常" exit 1 } if (Vr != "") { if (Vr == 0) Vr = 1 / sqrt(2.3) # PE 絶縁 Td = L / (2.99792458e8 * Vr) printf "T1 2 0 %d 0 Z0=%g Td=%g\n", M + 2, Z0, Td } print ".ENDS TLINE" exit 0 } # 導体等価半径(m)を求める a (dB/m), f (Hz) function radius(a, f, Z0, g, u, w) { a *= log(10) / 20 # dB -> neper g = 5.80e7 # 導電率 u = 4e-7 * PI # 透磁率 w = 2 * PI * f return sqrt(f * u / PI / g) / (4 * Z0 * a) } function _M(a, N, fmax, u, g, m, x, w) { w = 2.0 * atan2(0.0, -1.0) * fmax d = sqrt(2 / (w * u * g)) x = (N - 1) / (1 - (1 - 3 * d / a)^2) m = log(x) / log(N) + 1 return int(m + 0.999) } '