Recently did a sampled oscillator ALC loop using an AVR chip (10 bit ADC+a bit of free dither and 'Course/fine' PWM as a DAC setpoint). Was tedious to figure out and redraw various interesting loop mechanisms in LTspice, so used Powerbasic. Much quicker in trialing a seemingly infinite number of valid control methods.
This is not a lot. The loop cutoff frequency can hardly be done higher then 1/(6 x total delay in the loop), so if you run at 25kHz, it is going to be 4kHz or so. You probably want at least 20dB of feedback, so
400 Hz it is; unless real fancy feedback arrangements. Pretty slow.
Vladimir Vassilevsky DSP and Mixed Signal Design Consultant
I could tolerate a 1 millisecond risetime, which is in fact in the ballpark of 400 Hz. If I run at 50K, things should be OK. I can maybe run at 100K, which gives me 1000 CPU cycles per whack. This is a
I am still considering doing the sim in PowerBasic, but LT spice has all those nice graphics and scope probes, and it's easy to fiddle values and save files and print and stuff. Just easier to drive.
PBCC would of course do the time-sample and quantization bits easily.
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.
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.
On a sunny day (Tue, 30 Mar 2010 07:02:15 -0700) it happened John Larkin wrote in :
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 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.
Sorry, no negative supply. So the depletion mode fet, with port pin driving the source, works with zero additional parts. The BCX70 would actually have a more repeatable sink current (the fet has a 3:1 Idss spec, whereas the BCX70J beta spread is under 2:1) but needs the base resistor.
We are very tight for space, so every part matters.
How do I make a schematic symbol, a B-source I guess, that's essentially a VCVS with my equation inside it? There's an int() function available for use in equations, so quantization looks pretty easy... scale up, int, scale back down. The HELP is just not specific on how to hook it all up.
Thanks, Helmut. LT Spice could use a few more examples, to make it easier for the occasional user.
I figured out a quantizer separately, and posted it yesterday. I'll stick s/h boxes and quantizers (simulating 12 bit ADCs, 10 bit DAC) into my control loop and see if it gets weird.
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.