jovial
Junior Member
![* *](https://designers-guide.org/forum/Templates/Forum/default/starblue.gif)
Offline
Posts: 19
|
Hello everyone!! I am modeling a simple voltage controlled switch which shld be a short ckt when control voltage is high, and open otherwise. But the switch doesn't seem to work.. Can someone tell the mistake in my code given below...
-------------------------------------------------------------------------------- --- `include "disciplines.vams"
module dig_ctrl_switch_va (p, n, ps, ns); parameter real thresh=0.9; // threshold (V) parameter real ron=10 from (1:inf); // on resistance (Ohms) parameter real roff=100M from [1:inf); // off resistance (Ohms) input ps, ns; electrical p, n, ps, ns;
analog begin @(cross( V(ps,ns) - thresh, 0 )) $discontinuity(0); if (V(ps,ns) > thresh) I(p,n) <+ V(p,n)/ron; else I(p,n) <+ V(p,n)/roff; end endmodule
|