From: John Larkin on 29 Mar 2010 12:11 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
From: Vladimir Vassilevsky on 29 Mar 2010 12:26 John Larkin 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? > > 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. You can simulate digital loops in the analog simulator quite accurately. The main problem is how to do delay by one sample. In the simple cases, this can be simulated as 1-st order phase shifter; you may need better approximation as you get closer to Nyquist. Another way to simulate digital circuit is by switched capacitor sircuit (beware of convergence problems). I've done it both ways; it is possible to get reasonably accurate results if you know and understand the properties and limitations of both analog and digital methods. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
From: Muzaffer Kal on 29 Mar 2010 12:32 On Mon, 29 Mar 2010 09:11:48 -0700, John Larkin <jjlarkin(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? > >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 You can use ptolemy or matlab. Either can do the job you're trying pretty well. -- Muzaffer Kal DSPIA INC. ASIC/FPGA Design Services http://www.dspia.com
From: Tim Wescott on 29 Mar 2010 12:43 John Larkin 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? > > 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. For analysis with a linearized plant see chapter 7 of my book: http://www.wescottdesign.com/actfes/actfes.html. If you're trying to simulate the loop with all of it's nonlinearities then Vladimir's suggestion of a one-cycle delay sounds smart. I don't know if there's a reasonable way to add quantization, though. You may want to consider a sample-and-hold circuit to simulate the action of the DAC and of any internal integrators instead of the delay; in theory it'd be more accurate. I wish that someone made an easy integration between some C-like scripting language and a circuit simulator (BTW: if it costs more than a new car it's not easy). Then you could implement your control algorithm in something resembling its native form, and still get a "real" circuit simulation. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
From: John Larkin on 29 Mar 2010 12:52
On Mon, 29 Mar 2010 11:26:39 -0500, Vladimir Vassilevsky <nospam(a)nowhere.com> wrote: > > >John Larkin 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? >> >> 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. > >You can simulate digital loops in the analog simulator quite accurately. > The main problem is how to do delay by one sample. In the simple >cases, this can be simulated as 1-st order phase shifter; you may need >better approximation as you get closer to Nyquist. Another way to >simulate digital circuit is by switched capacitor sircuit (beware of >convergence problems). >I've done it both ways; it is possible to get reasonably accurate >results if you know and understand the properties and limitations of >both analog and digital methods. I'd be happy with a 1 millisecond risetime, and can run the loop iteration ballpark 50 KHz, so my integration constants will be small. Given that, I can probably ignore sampling issues or, as you suggest, just throw in something like RC delays to approximate the effects of sampling. Simulating quantization would be interesting. I'll effectively (maybe even on purpose) be dithering the ADC and especially the DAC to more bits than they actually have. Hmmm... if I put an analog lowpass between the ADC and the mosfet (it's there already to deglitch, and I can play with the tau) the PID loop sort of dithers the DAC all by itself. And that dithers the ADC. All for free. John |