* test ASRC temperature coeff

v1  1 0  dc=100 ac=1

b2  2 0  i=v(1) tc1=0.001
v2  0 2  0

b3  3 0  v=v(1) tc1=0.001

.temp 127.0

.control
op
let idc2_gold = 100 * (1 + 100*0.001)
let vdc3_gold = 100 * (1 + 100*0.001)
let idc2=i(v2)
let vdc3=v(3)

* print idc2 vdc3 idc2_gold vdc3_gold

let err1 = idc2/idc2_gold - 1
let err2 = vdc3/vdc3_gold - 1

if abs(err1) > 1e-9 or abs(err2) > 1e-9
  echo "ERROR: dc test failed, err1 = $&err1 err2 = $&err2"
  quit 1
end

ac dec 1 1kHz 1kHz
let iac2_gold = 1.0 * (1 + 100*0.001)
let vac3_gold = 1.0 * (1 + 100*0.001)
let iac2=i(v2)
let vac3=v(3)

* print iac2 vac3 iac2_gold vac3_gold

let err3 = iac2/iac2_gold - 1
let err4 = vac3/vac3_gold - 1

if abs(err3) > 1e-9 or abs(err4) > 1e-9
  echo "ERROR: ac test failed, err3 = $&err3 err4 = $&err4"
  quit 1
end

echo "INFO: success"
quit 0

.endc
