error in execution of code

Parth
2012-12-16
2013-06-12
  • Parth
    Parth
    2012-12-16

    Hello,
    I have this code in which a current source is there and subckt is used which decides the resistance. But this does not work and works if I use voltage source instead.
    *dsada
    .TRAN 10us 1000ms 0ms UIC
    .OPTIONS NOECHO NOMOD NOPAGE NOBIAS NOOUTMSG NOPRBMSG
    Ip 0 1 SIN(0 10 1 0 0)
    V2 1 2 0
    Xa 2 0 ckt1
    .subckt ckt1 plus minus
    Ba 0 x I=f1(V(plus)-V(minus))<condition?{do this}:{or this}
    Ch x 0 1 IC={5}
    Rm plus minus r={V(x)}
    .func f1(y)=(y-4)
    .ends
    .save TRAN V(1)
    .save TRAN I(V2)
    .END

    Can someone help me on how to make this work.?
    Thanks