Quote:This code works fine, except there is no delay. When I replace the last line with:
I(b,o) <+ transition(Iout,td);
OR
I(b,o) <+ absdelay(Iout,td);
it doesn't work. Is there anything obviously wrong?? How do I add a delay of say 10p?
Just saying it doesn't work is not very helpful. You should tell us what it does, and why that is not what you want.
I think what you want is to delay the switching action, not the signal being switched. So you probably want something like ...
Code:if(V(b,c) > Vth) Gsw = Gon; else Gsw = Goff;
@(cross(V(b,c) - Vth));
I(b,o) <+ transition(Gsw,td,tt)*V(b,o);
Notice that the transition function, and hence the delay, is applied to the switch conductance, so you would be delaying the switching action itself, and not delaying the current of the input signal relative to its voltage, which would actually model some very strange distributed component.
I have seen some people write this model as
Code:if(V(b,c) > Vth) logGsw = log(Gon); else logGsw = log(Goff);
@(cross(V(b,c) - Vth));
I(b,o) <+ pow(10, transition(Gsw,td,tt))*V(b,o);
so that the resistance transitions in a logarithmic fashion, but I don't know that the extra complexity buys you much.
You also made two classic mistakes when writing your model. First, you tried to apply the transition function to a continuous signal (transition(Iout,td)). Never do that. The transition function is only to be applied to piecewise constant signals. Second, you forgot the cross function, which is needed to accurately observe the time of the threshold crossing.
-Ken