This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Optotriac in older spice format

Other Parts Discussed in Thread: TINA-TI

I found a suitable model for an optotriac in the Yahoo LTSpice user group.   Tina-TI chokes on the B2 element which contains an IF conditional.  It seems that syntax is okay in earlier versions of spice, but not in Tina's version.  

I'm not sure how to modify this and was hoping for some pointers.

The offensive line is B2 ctrl1 4 V=IF(V(ctrl10,4)>1.45 & abs(V(34)) < 12, 2, 0).

Thanks!

m

* OPTO TRIAC With Zero Crossing Switching
* Helmut Sennewald 11/23/2008
* 04/12/2009, change in B-sources: V(ctrl10) -> V(ctrl10,4)
*
*
* MOC3081 I_trig=15mA
* D+ D- MT2 MT1
*
.subckt moc3081 1 2 3 4
.PARAM Itrig=15m
.PARAM RH1=20k
.PARAM RH2=20k
.PARAM RH3=16.7k
Q1 vb1p vb1 4 0 NPN1
Q2 vb1 vb1p vd1 0 PNP1
R3 vb1 4 {RH2}
D1 1 2 DL
R1 ctrl10 4 1
C1 ctrl10 4 10µ
R2 ctrl1 vb1 {RH1}
R4 vd1 vb1p {RH3}
B1 ctrl10 4 I=-500*I(D1)*3m/Itrig
R7 vb2p 4 {RH3}
R6 vd2 vb2 {RH2}
Q3 vb2p vb2 vd2 0 NPN1
Q4 vb2 vb2p 4 0 PNP1
D3 vd2 3 D1
D2 3 vd1 D1
R5 N001 vb2 {RH1}
E1 vd2 N001 ctrl1 4 -1
R34 3 4 100MEG
R12 ctrl1 4 1
B2 ctrl1 4 V=IF(V(ctrl10,4)>1.45 & abs(V(34)) < 12, 2, 0)
C2 ctrl1 4 1µ
B3 34 0 I=-V(3,4)/1000
R13 34 0 1k
C3 34 0 .1µ
.MODEL PNP1 PNP(Is=1e-15 BF=10 Cjc=10p Cje=20p Tf=0.1u Ise=1e-12)
.MODEL NPN1 NPN(Is=1e-15 BF=10 Cjc=10p Cje=20p Tf=0.1u Ise=1e-12)
.MODEL D1 D(Is=0.1u Rs=2 Cj0=50p)
.MODEL DL D(Is=1e-20 Rs=5)
.ends moc_3081

  • I may have answered my own question already - I am trying to replace that line with the following voltage sourece -

    *B2 ctrl1 4 V=IF(V(ctrl10,4)>1.45 & abs(V(34)) < 12, 2, 0)
    Etest ctrl1 4 Value={IF(V(ctrl10,4) > 1.45 & abs(V(34)) < 12, 2, 0)}

    I will let you know if it works.
  • Matt,

    I was going to post some information about the B sources, but you found part of the answer. B sources are generic and can be voltage or current controlled sources. So, the first line you showed corrected should work. This is a voltage controlled voltage source. However, another B source line will need to begin with a F:

    B1 ctrl10 4 I=-500*I(D1)*3m/Itrig

    becomes

    FB1 ctrl10 4 Value={-500*I(D1)*3m/ltrig}

    Also, the final B source is converted to a G source:

    B3 34 0 I=-V(3,4)/1000

    becomes

    GB3 34 0 Value={-V(3,4)/1000}

    These changes should make the older model PSpice compatible (which is what TINA-TI requires).

  • Thanks Britt. There is also the H source for CCCS, for completion.

    I'm having difficulty with the E source, and am getting the error from TINA-TI "Current variable number out of range."

    I made sure to upgrade to the latest TINA version. There was another thread with a similar error message about node number being out of range which recommended an updated TINA version.

    Thanks,
    m

    Here's the full netlist again...

    * MOC3081 I_trig=15mA
    * D+ D- MT2 MT1
    *
    .subckt moc3081 1 2 3 4
    .PARAM Itrig=15m
    .PARAM RH1=20k
    .PARAM RH2=20k
    .PARAM RH3=16.7k
    Q1 vb1p vb1 4 0 NPN1
    Q2 vb1 vb1p vd1 0 PNP1
    R3 vb1 4 {RH2}
    D1 1 2 DL
    R1 ctrl10 4 1
    C1 ctrl10 4 10µ
    R2 ctrl1 vb1 {RH1}
    R4 vd1 vb1p {RH3}
    B1 ctrl10 4 I=-500*I(D1)*3m/Itrig
    R7 vb2p 4 {RH3}
    R6 vd2 vb2 {RH2}
    Q3 vb2p vb2 vd2 0 NPN1
    Q4 vb2 vb2p 4 0 PNP1
    D3 vd2 3 D1
    D2 3 vd1 D1
    R5 N001 vb2 {RH1}
    E1 vd2 N001 ctrl1 4 -1
    R34 3 4 100MEG
    R12 ctrl1 4 1
    * B2 ctrl1 4 V=IF(V(ctrl10,4)>1.45 & abs(V(34)) < 12, 2, 0)
    E2 ctrl1 4 Value={IF(V(ctrl10,4) > 1.45 & abs(V(34)) < 12, 2, 0)}
    C2 ctrl1 4 1µ
    B3 34 0 I=-V(3,4)/1000
    R13 34 0 1k
    C3 34 0 .1µ
    .MODEL PNP1 PNP(Is=1e-15 BF=10 Cjc=10p Cje=20p Tf=0.1u Ise=1e-12)
    .MODEL NPN1 NPN(Is=1e-15 BF=10 Cjc=10p Cje=20p Tf=0.1u Ise=1e-12)
    .MODEL D1 D(Is=0.1u Rs=2 Cj0=50p)
    .MODEL DL D(Is=1e-20 Rs=5)
    .ends moc_3081
  • Matt,

    Try this one. I have attached a .lib file that I think will work (it should import). The F source translation is not an ABM like one. I forgot that about the F and H sources...

    I think that the u (micro) symbol was giving TINA-TI a little bit of an issue (C3, C2, etc.). Hopefully, I have found all of the issues.

    moc3081.lib

  • That worked brilliantly.  Many thanks.

    That error message was esoteric.  Good catch with that micro symbol.  I hadn't even noticed!