Re: [ng-spice] Switch problems / solutions . . .


To ng-spice@ieee.ing.uniroma1.it
From Alan Gillespie <alan.gillespie@analog.com>
Date Fri, 27 Oct 2000 14:52:44 +0100
Delivered-To mailing list ng-spice@ieee.ing.uniroma1.it
Mailing-List contact ng-spice-help@ieee.ing.uniroma1.it; run by ezmlm
References <Pine.LNX.3.96.1001026101808.349A-100000@ieee.ing.uniroma1.it > <39F945B9.CB8405F2@uci.agh.edu.pl >
Reply-To ng-spice@ieee.ing.uniroma1.it
Sender agilles@epc.co.uk

The code for the switch could be changed, probably by adding
"levels" to the model.

There is a bug in the time-step control of the switch in
standard Spice which we have made a crude attempt at fixing,
i.e. standard Spice does not attempt to "catch" the trip
point of the switch. If the control voltage/current is moving,
Spice does not attempt to limit the next time step so that
the trip point is accurately simulated. The latest ng-spice
looks at the rate of change of the control voltage/current
and makes a crude attempt at guessing how big the next
time-step can be allowed to be, in order not to overshoot
the trip point (by too much). Unfortunately, there's no easy
way to know how much the control voltage/current is going to
move in the next timestep, so we just guess based on the last
time-step.

Anyway, if you're looking for a switch that varies continously
with control voltage/current, the you can make one up with the
arbitrary source (B) device.

Bres a b i=v(a,b)/ on_resistance+
                   (off_resistance-on_resistance)*
                     (uramp(v(p,n)-lower_threshold)-
                      uramp(v(p,n)-upper_threshold))

I think I've got some signs wrong and the lower and upper
thresholds swapped, but you can see what I mean ? If you're
looking for a variation with time, you can build an RC filter
into the control voltage (p,n).

Note that if there are any timestep controls on the B device,
they may not work very well in these conditions. It's a
difficult area, which could be improved.

Cheers,

Alan


widlok wrote:
> 
> Hi All,
> 
>     During last week I had to made some rather complicated simulations of 3
> phase AC/DC converter. I wanted to use simple SCR model made of switch and B
> control source. As build-in spice switches change their states instantaneous
> they are not very useful for transient.
> 
> I looked and switch code and it seems that it will be easy (:-)) to improve
> it. My idea is to make the switch that will change its state exponentially 
>in
> transient and DC analysis, and behave like normal ON-OFF device for the 
>rest.
> 
> Is it correct? Please send my comments about what do You think about such
> change in the code.
> 
> Michael

Partial thread listing: