Fun And Games With Spice

Subjects that don't have their own home
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#46

Post by Mike H »

Ack-shirley, a better version where the current can be specified as well:

.param mains=230
.param Trms=450
.param TImax=0.25
.param Tover=Trms+(Trms*0.1)
.param Tratio=Tover/240
.param Tsec=(mains*Tratio)*1.414

V1 SINE(0 {Tsec} 50)
Rser={(Trms*0.1)/TImax}
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#47

Post by Mike H »

I'm going to have to put some of these in the databank forum I think, this thread is getting quite untidy.

Following on from the varistor success, today I found a thermistor model. Ack-shirley changes resistance by self-heating by Volts vs current etc. Majik. Image

Just need to table specs of actual types. Sounds simple if you say it quick.

Also I found a lamp model, which with a bit of jiggery pokery I'm sure can be configured to represent a valve heater filament. That also changes resistance with increasing temperature. The basic lamp is quick, as you might imagine.

#
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#48

Post by Mike H »

Fun and games indeed!! In an idle moment (LOL) I decided to try out the LM317 model. Wot a scream...

Firstly, mucho respect Image to whoever it was who painstakingly recreated a copy in spice of the chip's entire schematic to the last detail. Pity it doesn't work too well.

As an educational demo type thing it's fine, as an actual regulator component you might want to use in spice to do 'real work' it's a non-starter.

First prob, crap output current; it 'sags' at 800mA. Mainly because, (it turns out) the transistors' current gain is wwaay nowhere big enough. Mostly, the output stage...

Secondly, the adjust control pin offest Voltage (1.25) only works properly with one particular resistor set-up.

And forget about trying to use it as a constant current source, it just sits there and plays dead.

Did you know, spice trransistors have four terminals? The fourth is 'substrate' I believe. The default is '0', the universal spice ground.

Seems you can assign different nodes to the substrate terminal, not sure about that but seems that's what was going on here. Not yet seen these being used. Anyway in this model all kinds of weird substrate reassigning shenanigans had to go on just to make it work at all.

After a bit of further exploration and a think I decided to have a go at making my own model, LM317 datasheet to hand. I.e. let's try to make something that will actually do what it sez on the tin...

It dawns on me eventually that it's not absolutely necessary (or even desirable?) to exactly duplicate the devices on the chip, 'specially as some of them don't work proper to start with, so...

1. Throw away the current generator block which biases the CCS's, seems to work alright but really we've got a 'I' element for such things. No wait, actually, replace all the CCS's with load type I elements and be done with it...

2. Junk the thermal shut-down block, as it's never going to function. Unless you can figure a way of adding a temperature model into it, which sure won't look like a bunch of transistors anyway. (From what little I've seen on the subject so far.)

3. Get the hFE up. (bf) UP!! 40 for the pnp's and 80 for the npn's? Image Are you 'aving a larf ... IC's of 30+ years ago maybe ~ no wonder it's struggling to make any decent output current.

4. One drastically modified output stage later, (hFE = 200) let's try to sort out the control amp part. The original config is clever but overly so, worse, the gain is very poor. (Might work on the actual real chip but not here.) I had to resort to a darlington pair with a CCS load direct from the supply line. Fortunately two be junctions in series coincides with the required 1.2 something Volts drop, as adj. Voltage is below the output rail (which is the neg. rail for rest of the circuit). Just needed to adjust the CCS so the adj. pin current drain is 50uA as per datasheet.

5. The overload current limiter. This had me going round in circles for ages. The original is so ingeniously elegant as to be almost a work of art, but don't work. No that's not true, I made it work in one basic form, but it was far too fussy about exact resistor values. Did not auger well for the future, shall we say...

I resorted to what I know about such things and opted for a simple transistor and sensing resistor combination. (When V-drop across the resistor reaches transistor's Vbe it turns on.) Cleverly the sensing current comes from the o/p driver transistor collector current by a current mirror, this I kept as it works well.

6. Current limiting changes depending on the Voltage across the In and Out terminals. According to datasheet, you can only get the 'typical' max. of 2.2 Amps provided the V-In/Out <= 15V. Over 15V it switches to 400mA. What I did was make it clamp at 2.5A in the first case and 500mA in the second case. This was done with a 'B' element as the sense resistor, simply passes the equivalent current of one of two resistor values, chosen depending on the Voltage across nodes 1 and 3. If >15V, the low current version is emulated.

Working schematic attached if you want a play with it. :)

.
Attachments
My regulator subckt master-4.zip
(2.4 KiB) Downloaded 307 times
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#49

Post by Mike H »

Oo interesting, this represents a virtual short-circuit into 0.1 Ohms and a 21V supply. Clamping steps down to the 500mV level because the Volts across In & Out have exceeded 15V. Note however spurious high frequency oscillation.

This is because C3 is too small, upped to 50pF, it doesn't oscillate. :D
Attachments
reg-short-circuit.gif
reg-short-circuit.gif (7.64 KiB) Viewed 5339 times
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
Andrew
Eternally single
Posts: 4206
Joined: Thu May 24, 2007 2:18 pm

#50

Post by Andrew »

Err, did anyone tell Mike about the LT1085? Ducks for cover....
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#51

Post by Mike H »

They have now :D


Is not exactly like a LM317 I don't think. :?:



.
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#52

Post by Mike H »

Youse all can scoff :D but I finished my LM317 model. So Image

Andrew wrote:Err, did anyone tell Mike about the LT1085? Ducks for cover....
But it's not a LM317

LM317 has quite specific behaviour

Plus LT1085 must have an elec cap across it's output else it's unstable. That's no good if you want a constant current reg for a DHT filament with NO caps across it.

Anyway my 300B heater sim works now... that's what I wanted the LM317 model for

Green: filament Volts, pink: filament current.
Attachments
dc-ccs-heater-300b-plot.gif
dc-ccs-heater-300b-plot.gif (7.76 KiB) Viewed 5298 times
dc-ccs-heater-300b.gif
dc-ccs-heater-300b.gif (10.39 KiB) Viewed 5298 times
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
simon
Thermionic Monk Status
Posts: 5600
Joined: Thu May 24, 2007 11:22 am
Location: People's Republic of South Yorkshire

#53

Post by simon »

Is the cap such a problem? Dunno. I wonder if it might be a way of tuning? Anyway, I see you've got a choke in there - it that to filter the crud coming from the 317 perhaps? Might there be merit in using CMC after the reg?
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#54

Post by Mike H »

Quote from LT1085 datasheet:

"The circuit design used in the LT1083 family requires the
use of an output capacitor as part of the device frequency
compensation. For all operating conditions, the addition of
150uF aluminium electrolytic or a 22uF solid tantalum on
the output will ensure stability."

Ergo, cannot be used for a completely capacitor-less CC type output.

Sorry my mind's gone blank, define "CMC"

Yes the choke is to omit any IC noise and such, 'twas a Nick recommendation. Sort of. Worth a try anyway.

May end up having a cap across the filament anyway if I decide it sounds better that way. :D
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#55

Post by Mike H »

PS
The point re having a cap across (or not) is that soon as you put a cap across, it ceases to be a constant-current souirce, and becomes a constant Voltage source instead.

Nick said, so must be true :D

.
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
User avatar
Nick
Site Admin
Posts: 15706
Joined: Sun May 06, 2007 10:20 am
Location: West Yorkshire

#56

Post by Nick »

I may just stop saying things :-)

I think my point wasn't that its a constant voltage or current source, but it becomes Thévenin equivalent instead of Norton equivalent, and yes I know you can go from one to the other but you can see my point.
Whenever an honest man discovers that he's mistaken, he will either cease to be mistaken or he will cease to be honest.
simon
Thermionic Monk Status
Posts: 5600
Joined: Thu May 24, 2007 11:22 am
Location: People's Republic of South Yorkshire

#57

Post by simon »

Mike H wrote:Sorry my mind's gone blank, define "CMC"
Common mode choke. So one as you've shown it plus the other half in the negative rail. Has the benefit of crud rejection from the reg plus filtering some of the common mode noise? Maybe a couple of small caps between the filament pins with the centre to earth for belt and braces?
Andrew
Eternally single
Posts: 4206
Joined: Thu May 24, 2007 2:18 pm

#58

Post by Andrew »

Mike H wrote:PS
The point re having a cap across (or not) is that soon as you put a cap across, it ceases to be a constant-current souirce, and becomes a constant Voltage source instead.

Nick said, so must be true :D

.
He got me on this one too, the way I thought about it is the job of a cap is to try and keep the voltage constant, which in this case isn't the required behaviour.
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#59

Post by Mike H »

Well this was my thinking also anyway


Real life may dictate something entirely different of course. :D

Nick wrote:it becomes Thévenin equivalent instead of Norton equivalent
Eerrm... Image


Re CMC, yes thanks. Image


Yes this has turned into quite a marathon. Unexpectedly...

The only reason why I've got the chokes in is because I just happen to have them is all, so just a case of try them and see. So should also try without as well for comparison.
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#60

Post by Mike H »

As if I haven't got enough to do. Dunno why I think of these things


Pentode with working suppressor grid.

Long boring diatribe, please be patient :D

Those not interested, please take this opportunity to have a break and go make a cup of tea


Note ~ purely theoretical working only ~ the so-called 'calculations' are extremely rough!!

Simple ratios are worked out by which to modify the Ia and Ig2. I did have a bit of bother working out what should happen if Vg3 to k = zero (g3 tied to k), the ratios cannot be zero! The answer was for the numbers to be just fractions always with '1' added, so if Vg3 to k = 0 the ratio is at least '1:1'. (I.e. no change, as original tetrode model.)

After much Googling I managed to establish the basic principle of what varying Vg3 can do (mostly from radio texts re modulation).

The basic premise is that:
1. The suppressor grid is still a grid, ergo a Voltage on it relative to cathode (Vg3) can be used to affect Ia.
2. Because it is the furthest grid from the cathode, it has the smallest effect of the three. Nevertheless it has an effect.
3. Changing Vg3 changes Ia. As you might expect. It's a grid. However...
4. Screen grid current is also changed, but in the opposite direction. This is important. I.e. +Vg3 = +Ia, -Ig2; -Vg3 = -Ia, +Ig2.
5. G3 can be used as an input. The result is like a low gain triode.


Rough demos:

Grounded G3 as an input. I.e. it has a negative DC bias on it same as G1 (terminated to 0V via a resistor).

See: g3-demo-as-input-1.gif

Plots:
See: g3-demo-as-input-1-plot.gif

Blue: input signal at g3 (1 Volt).

Green: anode output (inverted of course).

Pink: anode current.

Red: screen current. Note it's increasing and decreasing opposite to Ia.
Attachments
g3-demo-as-input-1-plot.gif
g3-demo-as-input-1.gif
g3-demo-as-input-1.gif (6.9 KiB) Viewed 5191 times
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
Post Reply