From: John Larkin on
On Tue, 30 Mar 2010 10:57:35 GMT, Jan Panteltje
<pNaonStpealmtje(a)yahoo.com> wrote:

>On a sunny day (Mon, 29 Mar 2010 16:16:55 -0700) it happened John Larkin
><jjlarkin(a)highNOTlandTHIStechnologyPART.com> wrote in
><7jc2r5doofsi8q2dl2rjmmvnn74q56tjkl(a)4ax.com>:
>
>>On Mon, 29 Mar 2010 15:31:02 -0700 (PDT), pnachtwey
>><pnachtwey(a)gmail.com> wrote:
>>
>>>On Mar 29, 11:53�am, John Larkin
>>><jjlar...(a)highNOTlandTHIStechnologyPART.com> wrote:
>>>> On Mon, 29 Mar 2010 14:20:31 -0400, Jerry Avins <j...(a)ieee.org> wrote:
>>>> >Tim Wescott wrote:
>>>> >> Fred Bartoli wrote:
>>>> >>> Tim Wescott a �crit :
>>>> >>>> Fred Bartoli wrote:
>>>> >>>>> John Larkin a �crit :
>>>> >>>>>> I'm designing a gadget that uses an ARM uP, with 12-bit mux'd ADC and
>>>> >>>>>> a 10-bit DAC, to essentially make a current and voltage regulated
>>>> >>>>>> power supply. The ADC will measure voltage and current and the DAC
>>>> >>>>>> will control a fairly soft source-follower series-pass mosfet. The
>>>> >>>>>> customer load could be most anything.
>>>>
>>>> >>>>>> I think it would be time-effective to simulate the control loop while
>>>> >>>>>> the PC board is being fabbed, so we don't have to play with dynamics
>>>> >>>>>> as much in the critical delivery path.
>>>> >>>>>> I can simulate it as an analog loop using LT Spice, as I'm familiar
>>>> >>>>>> with that and could get it done quickly. It would be handy if I could
>>>> >>>>>> also use the same model in digital mode, which would add sampling
>>>> >>>>>> delays and maybe even quantization.
>>>>
>>>> >>>>>> Any thoughts on how to do this?
>>>>
>>>> >>>>>> I note here that more and more formerly-analog control loops, things
>>>> >>>>>> like switching power supplies, motor drivers, power amps, will be
>>>> >>>>>> going digital in the future. Some of the ARM chips are selling for
>>>> >>>>>> under a dollar. Analog parts will, I think, increasingly be used for
>>>> >>>>>> things like amplification, and less for computation.
>>>>
>>>> >>>>>> John
>>>>
>>>> >>>>> It can easily done with spice.
>>>>
>>>> >>>>> The software delay can be modeled as a TLINE provided it is constant
>>>> >>>>> in your system.
>>>> >>>>> For switchers you model the switch as an averaged one (continuous
>>>> >>>>> model). The sampling action is modeled by a 2 poles TF (look at
>>>> >>>>> Ridley's paper "Accurate and practical small signal model for
>>>> >>>>> current mode control", or I can try to dig in one of my previous HDs).
>>>>
>>>> >>>>> With good modeling you can have average transient and AC (loop
>>>> >>>>> gain,...) simulations which are real close to the actual circuit.
>>>>
>>>> >>>>> That won't give you quantization though, and I guess this can't be
>>>> >>>>> modeled as with sigma delta since you have a first order loop and
>>>> >>>>> probably an almost constant signal.
>>>>
>>>> >>>>> Maybe, but I never tried this, you can discretize the loop (only for
>>>> >>>>> transient analysis) with use of B "arbitrary sources" within which
>>>> >>>>> you use some integer part function. I don't know whether LTspice
>>>> >>>>> support B sources, but you should find something equivalent...
>>>>
>>>> >>>> Quantization looks like infinite gain, though, so unless it is
>>>> >>>> wrapped inside of a sampled-time section it'll really slow down -- or
>>>> >>>> completely crash -- the simulation.
>>>>
>>>> >>>> You can analyze fairly well for quantization by treating it as noise
>>>> >>>> at the magnitude of the quantization, and the worst possible
>>>> >>>> frequency. Just inject a signal at the quantization point, do a
>>>> >>>> frequency sweep to figure out the sensitivity of the output to the
>>>> >>>> quantization, and take the worst spot.
>>>>
>>>> >>>> Quantization always seems to seek to do the most damage possible, so
>>>> >>>> treating it as worst case isn't paranoid. �In this case, it really is
>>>> >>>> out to get you!
>>>>
>>>> >>> It's been a while I've looked at this but IIRC it's only one bit
>>>> >>> quantizer that have infinite gain. Multibit quantizers, as I guess
>>>> >>> John will use since he has plentiful bits ADC/DAC, have unit gain.
>>>> >>> I once used an ARM with 12b ADC/DACs to build a low OSR SD converter
>>>> >>> with real high resolution at almost no cost (the ARM was mandated for
>>>> >>> other things). Of course it wasn't more linear than the DAC on large
>>>> >>> signals, but the app was OK with that...
>>>>
>>>> >> At the point of the quantization step the input moves an infinitesimal
>>>> >> amount, and the output moves a finite amount. �That's an infinite gain.
>>>> >> �With a 12-bit device, it happens 4095 times, instead of once.
>>>>
>>>> >It really plays havoc when computing a simple "derivative".
>>>>
>>>> >Jerry
>>>>
>>>> Derivatives usually cause more trouble than they do good. My "PID"
>>>> controller will almost certainly have D=0.
>>>>
>>>> John
>>>Many systems don't require a derivative gain. It depends on the
>>>number of poles in your plant and we have no idea what you are trying
>>>to do.
>>>
>>>I am a big believer in derivative gains since I must tune under damped
>>>systems. The trick is a have very fine resolution feed back that is
>>>almost noise free or a good model. I would use 16 bit analog feedback
>>>devices to get the finer resolution. I was just at a site where I
>>>used the second derivative gain and it was necessary.
>>>
>>>Sometime a low pass filter on the output helps too. If you are clever
>>>you can calculate the gains and take the low pass filter into
>>>consideration. This is better than trying to tweak each gain one a
>>>time along with the output filter.
>>>
>>>Do you have excess CPU time?
>>>
>>>Peter Nachtwey
>>
>>This is my VME module, with 12 channels of 4-20 mA isolated outputs.
>>Each channel has its own ARM with a 12-bit ADC and a 10-bit DAC. The
>>ADC will measure the voltage drop across a shunt resistor, to get loop
>>current, and also our terminal voltage. The DAC drives a series linear
>>mosfet to regulate output. It will behave like a constant-voltage,
>>current-limited power supply, in that the user can program current and
>>voltage and it will operate in the appropriate mode, depending on the
>>load.
>
>Why not 2 DACs, and do the current limit voltage thing analog?
>Or is it just an excercise in digital?
>

The uP only has one dac. And it would take more parts to do it
analog... I only have one pass transistor. The processor knows
everything can do the voltage:current mode switch, and optimize the
loop response in both modes, and do all the protections. Code is free
on a production basis and doesn't take up board area.

I woke up in the middle of the night and decided to count parts. I've
been working on this circuit so much in the last three days that I can
literally see it in my head and stroll around and count the parts. I
got 68 parts in each channel. Times 12 channels, plus VME interface,
13th control processor, power supplies, LEDs, and BIST, that will be
about 1000 parts. That's a lot; I should pare it down some if I can.

I need a current-dumper for when I'm operating in voltage-regulator
mode, to give some minimum load to the source follower. I can use an
LND150 depletion fet: ground the gate, connect the source to a uP port
pin, then the drain becomes the dump. Saves me two parts.

John


From: pnachtwey on
On Mar 29, 9:11 am, John Larkin
<jjlar...(a)highNOTlandTHIStechnologyPART.com> wrote:
> I'm designing a gadget that uses an ARM uP, with 12-bit mux'd ADC and
> a 10-bit DAC, to essentially make a current and voltage regulated
> power supply. The ADC will measure voltage and current and the DAC
> will control a fairly soft source-follower series-pass mosfet. The
> customer load could be most anything.
>
> I think it would be time-effective to simulate the control loop while
> the PC board is being fabbed, so we don't have to play with dynamics
> as much in the critical delivery path.
>
> I can simulate it as an analog loop using LT Spice, as I'm familiar
> with that and could get it done quickly. It would be handy if I could
> also use the same model in digital mode, which would add sampling
> delays and maybe even quantization.
>
> Any thoughts on how to do this?
Why not use Matlab, Scilab, Mathcad etc?
I do simulations for motion control all the time. I use a Trunc()
function in Mathcad to simulate quantizing. I also have functions for
generating noise.

Peter Nachtwey
From: Tim Wescott on
pnachtwey wrote:
> On Mar 29, 9:11 am, John Larkin
> <jjlar...(a)highNOTlandTHIStechnologyPART.com> wrote:
>> I'm designing a gadget that uses an ARM uP, with 12-bit mux'd ADC and
>> a 10-bit DAC, to essentially make a current and voltage regulated
>> power supply. The ADC will measure voltage and current and the DAC
>> will control a fairly soft source-follower series-pass mosfet. The
>> customer load could be most anything.
>>
>> I think it would be time-effective to simulate the control loop while
>> the PC board is being fabbed, so we don't have to play with dynamics
>> as much in the critical delivery path.
>>
>> I can simulate it as an analog loop using LT Spice, as I'm familiar
>> with that and could get it done quickly. It would be handy if I could
>> also use the same model in digital mode, which would add sampling
>> delays and maybe even quantization.
>>
>> Any thoughts on how to do this?
> Why not use Matlab, Scilab, Mathcad etc?
> I do simulations for motion control all the time. I use a Trunc()
> function in Mathcad to simulate quantizing. I also have functions for
> generating noise.

In my experience the general-purpose math package route works very well
with motion control -- things are generally far more linear and (with
the exception of friction) if they're nonlinear they generally have just
a few salient nonlinearities so you know what you have to model.

Circuits -- and switching amplifiers specifically -- tend to have lots
of nonlinearities that may or may not matter, many more parts whose
dynamics may or may not matter (or matter under different operating
conditions, because of those nonlinearities), and they're just plain
more opaque in operation. Add to that the fact that the world is
flooded with excellent circuit simulation packages, and the attraction
of simulating one's digital controller inside the circuit simulator
becomes very strong.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
From: Jan Panteltje on
On a sunny day (Tue, 30 Mar 2010 07:02:15 -0700) it happened John Larkin
<jjlarkin(a)highNOTlandTHIStechnologyPART.com> wrote in
<pd04r5dj17cfb89gf4m25png9elos4vf12(a)4ax.com>:

>I woke up in the middle of the night and decided to count parts.


I once dream t I was an electron, moving through the ciruits.
Poor electrons, the things we do to them.

I woke up at 3:30 last night because computers started beeping... alarms...
power glitch, rare here, but the server stuff did not re-start.
Have to add a big relay and a watchdog some day.
Finised the millivolt measurement part of my scope-PIC.
You can move a cursor over the waveform and it displays the voltage at that point.


> I've
>been working on this circuit so much in the last three days that I can
>literally see it in my head and stroll around and count the parts. I
>got 68 parts in each channel. Times 12 channels, plus VME interface,
>13th control processor, power supplies, LEDs, and BIST, that will be
>about 1000 parts. That's a lot; I should pare it down some if I can.

>I need a current-dumper for when I'm operating in voltage-regulator
>mode, to give some minimum load to the source follower. I can use an
>LND150 depletion fet: ground the gate, connect the source to a uP port
>pin, then the drain becomes the dump. Saves me two parts.

BJTs are cool.



>John
>
>
>
From: John Larkin on
On Tue, 30 Mar 2010 15:20:12 GMT, Jan Panteltje
<pNaonStpealmtje(a)yahoo.com> wrote:

>On a sunny day (Tue, 30 Mar 2010 07:02:15 -0700) it happened John Larkin
><jjlarkin(a)highNOTlandTHIStechnologyPART.com> wrote in
><pd04r5dj17cfb89gf4m25png9elos4vf12(a)4ax.com>:
>
>>I woke up in the middle of the night and decided to count parts.
>
>
>I once dream t I was an electron, moving through the ciruits.
>Poor electrons, the things we do to them.
>
>I woke up at 3:30 last night because computers started beeping... alarms...
>power glitch, rare here, but the server stuff did not re-start.
>Have to add a big relay and a watchdog some day.
>Finised the millivolt measurement part of my scope-PIC.
>You can move a cursor over the waveform and it displays the voltage at that point.
>
>
>> I've
>>been working on this circuit so much in the last three days that I can
>>literally see it in my head and stroll around and count the parts. I
>>got 68 parts in each channel. Times 12 channels, plus VME interface,
>>13th control processor, power supplies, LEDs, and BIST, that will be
>>about 1000 parts. That's a lot; I should pare it down some if I can.
>
>>I need a current-dumper for when I'm operating in voltage-regulator
>>mode, to give some minimum load to the source follower. I can use an
>>LND150 depletion fet: ground the gate, connect the source to a uP port
>>pin, then the drain becomes the dump. Saves me two parts.
>
>BJTs are cool.
>
>

I could also do it with a BCX70J NPN transistor, with a 1M resistor
from a port pin to the base, ground the emitter, and beta limit. That
would be a more predictable sink than the dmos fet. Certain geezers
wouldn't approve.

John