S.Quoc.S
Newbie level 4
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:
Thanks and best regards
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