Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

VerilogA current limit for a voltage source

Status
Not open for further replies.

S.Quoc.S

Newbie level 4
Joined
Nov 15, 2015
Messages
6
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,391
Hi all,

I made a model for a voltage-controlled voltage source (vcvs) that has both the output resistance and maximum current parameter as well.
However, I don't know why the current limit description seems not to work and causes the voltage source not to be functional as expected (i.e., the output of the voltage source is just 0V regardless of the input level). When I commented out the current limit block then I have a functional vcvs. The last time I added a current limit function to a block, it has the same description for the current limit, I wonder if there is something worth noticing if it is a vcvs that I am missing here. The code can be seen as below:

module cl_vcvs (vout_p, vout_n, vin_p, vin_n);

input vin_p, vin_n;
output vout_p, vout_n;
electrical vout_p, vout_n, vin_p, vin_n;

parameter real gain = 1;
parameter real Rout = 1m;
parameter real Ilim = 100m;

real iout;

analog begin
V(vout_p, vout_n) <+ gain*V(vin_p, vin_n);
iout = V(vout_p, vout_n)/Rout;

if (iout > Ilim) begin
iout = Ilim;
end
else if (iout < -Ilim) begin
iout = -Ilim;
end
I(vout_p, vout_n) <+ iout;

end
endmodule

Thanks and best regards
 

My veriloga chops are not grande enough, to say whether
the case mismatches I see in the code have anything to do
with the problem. But cleaning that is where I'd start, just
to cross one "could be" off the list.

Iout == iout, or not?
Ilim == ilim, or not?
according to veriloga parsing

Then, I'm not sure about how the "if" statements for current
limit behave or are triggered.

If you don't need (and maybe you don't want) "sharp corners"
in your transfer function (which tend to make numerical
challenges for the simulator) you could consider a tanh()
type implementation - that will get you continuous derivatives
all the way out, you can get a resistance-ish region and two
current limit asymptotes but the transition "blends" in a smooth
curve.

But maybe you want a "brick wall" transfer characteristic
for some specific reason.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top