pankaj jha
Full Member level 3
- Joined
- Apr 16, 2010
- Messages
- 170
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,298
- Location
- jaipur
- Activity points
- 2,457
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
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