Menu

#101 limits in vcvs, vccs, cccs, ccvs desired

open
nobody
None
5
2025-07-14
2025-07-11
No

It would be very advantageous to be able to set the lower and upper voltage limits in vcvs and ccvs and the lower and upper current limits in vccs and cccs. Could this be implemented in ngspice?

Discussion

  • marcel hendrix

    marcel hendrix - 2025-07-11

    The vcvs and ccvs are very efficient (i.e. fast) basic devices that can be solved in a single timestep. Adding limits to them removes their best features.

    Why not add limits to a behavioral source, or use a table source?

     
  • Patrick Fath

    Patrick Fath - 2025-07-11

    Yes, i used behavioural sources with a limit function but it would be much more user-friendly if it already can be set in the vcvs etc. If there would be too much performance degradation, could you please introduce a vcvs_limit function e.g. which uses the vcvs and limits the outputs? Then both would work and if performance is not such important the vcvs with limit function can be used :)
    In addition with a dedicated xschem symbol this would be quite user-friendly, I almost always needed the limit function (saturation behaviour) during circuit design when using a vcvs.

     
  • Holger Vogt

    Holger Vogt - 2025-07-11

    What about using an analog code model as described in chapter 8.2.5 Limiter of the ngspice manual?

     

    Last edit: Holger Vogt 2025-07-11
  • Holger Vogt

    Holger Vogt - 2025-07-12

    A vcvs with limits is described as

    alimit %vd(in+ in-) %vd(out+ out-) limit5
    .model limit5 limit(gain=2.5 out_lower_limit=-5.0 out_upper_limit=5.0)
    

    The whole thing may be put into a subcircuit with parameters, see below. This is the typical model to be attached to a symbol in the KiCad world. Maybe XSCHEM is similar. If called as an X line, parameters may be set by the user. Another advantage is that this model smoothes the output when reaching the limit. The derivative is continuous, supporting convergence. Current control or current output may be achieved by replacing %vd by %id at the input or output respectively.

    .subckt vcvslim out+ out- in+ in- params: gain=3 oll=-1 oul=1
    alimit %vd(in+ in-) %vd(out+ out-) limit5
    .model limit5 limit(gain='gain' out_lower_limit='oll' out_upper_limit='oul'
    + limit_trange=0.05 fraction=FALSE)
    .ends
    
     
  • Patrick Fath

    Patrick Fath - 2025-07-14

    Yes, that would also be an option. Thank you very much! I will try to create an xschem symbol for this.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.