Spice Model Package 6/7 Relays

.subckt relay vt_plus vt_minus in1 in2 out
+params: p_lind=100u p_cind=20p p_rind=60
rrel 10 vt_minus {p_rind}
crel vt_plus vt_minus {p_cind}
lrel vt_plus 10 {p_lind}
s1 vt_plus 11 vt_plus vt_minus smod
s2 11 0 vt_minus 0 smod
s3 vt_plus 12 vt_plus 11 smod
s4 12 0 11 0 smod
s5 out in1 11 0 smod
s6 out in2 12 0 smod
.model smod vswitch (ron=1e-4 roff=1meg von=5 voff=1m)
.ends relay

.subckt dual_relay vt_plus vt_minus in1 in2 out1 in3 in4 out2
+params: p_lind=100u p_cind=20p p_rind=60
rrel 10 vt_minus {p_rind}
crel vt_plus vt_minus {p_cind}
lrel vt_plus 10 {p_lind}
s1 vt_plus 11 vt_plus vt_minus smod
s2 11 0 vt_minus 0 smod
s3 vt_plus 12 vt_plus 11 smod
s4 12 0 11 0 smod
s5 out1 in1 11 0 smod
s6 out1 in2 12 0 smod
s7 out2 in3 11 0 smod
s8 out2 in4 12 0 smod
.model smod vswitch (ron=1e-4 roff=10000meg von=5 voff=1m)
.ends dual_relay

.SUBCKT Sw_tClose 1 2 PARAMS:
+ tClose=0 ; time at which switch begins to close
+ ttran=1u ; time required to switch states (must be realistic, not 0)
+ Rclosed=0.01 ; Closed state resistance
+ Ropen=10Meg ; Open state resistance (Ropen/Rclosed < 1E10)
V1 3 0 pulse(0 1 {tClose} {ttran} 1 10k 11k)
S1 1 2 3 0 Smod
.model Smod Vswitch(Ron={Rclosed} Roff={Ropen})
.ends

.SUBCKT Sw_tOpen 1 2 PARAMS:
+ tOpen=0 ; time at which switch begins to close
+ ttran=1u ; time required to switch states (must be realistic, not 0)
+ Rclosed=0.01 ; Closed state resistance
+ Ropen=10Meg ; Open state resistance (Ropen/Rclosed < 1E10)
V1 3 0 pulse(1 0 {tOpen} {ttran} 1 10k 11k)
S1 1 2 3 0 Smod
.model Smod Vswitch(Ron={Rclosed} Roff={Ropen})
.ends

Leave a comment