Feature: Analogue design
Step 6: Produce the Bode plot Open the ‘SPICE Error Log’ by right- clicking the schematic window and choosing ‘Plot .step’ed .meas data’. Choose ‘Visible Traces’ from the ‘Plot Settings Menu’ and select ‘Gain’ to plot the data. Optionally, measurement data can be exported by clicking ‘File’ and selecting ‘Export Data as Text’ to produce a CSV file of the Bode data.
Figure 5: LED driver control loop Bode plot measurement setup using a network analyzer
compute the complex open-loop gain and phase of the LED driver: • .measure Aavg avg V(a)-V(c) • .measure Bavg avg V(b)-V(c) • .measure Are avg (V(a)-V(c)- Aavg)*cos(360*time*Freq)
• .measure Aim avg -(V(a)-V(c)- Aavg)*sin(360*time*Freq)
• .measure Bre avg (V(b)-V(c)- Bavg)*cos(360*time*Freq)
• .measure Bim avg -(V(b)-V(c)- Bavg)*sin(360*time*Freq)
• .measure GainMag param 20*log10(hypot(Are, Aim) / hypot(Bre,Bim))
• .measure GainPhi param mod(atan2(Aim, Are) – atan2(Bim, Bre)+180,360)-180
Step 3: Set the measurement parameters A few more small directives are needed. First, the circuit must be in steady state (past startup) in order to make proper measurements. Adjust t0, the start time for the measurement, and stop time. Te start time can be estimated, or determined by starting up the simulation and observing the start-up time. Te stop time is chosen to be 10/freq, or 10 periods, aſter steady state is reached, reducing errors by averaging over 10 cycles for each frequency. Here are the directives:
• .param t0=0.2m • .tran 0 {t0+10/freq} {t0} startup • .step oct param freq 1K 1M 3
Step 4: Set the frequency sample step and range The .step command sets the frequency resolution and range for the analysis. In this example, the simulation runs from 1kHz to 1MHz, using a resolution of three points per octave. Bode plot measurements are accurate up to fSW
/2, so the upper
frequency limit should be set to half the switching frequency of the system. Obviously, more points improve resolution, but the simulation takes longer. Three points per octave is the low end of resolution, but running the simulation at minimum resolution can save some time. Nevertheless, at the overall design cycle picture, even a five-minute simulation is orders of magnitude faster than designing, assembling and testing PCBs. With this in mind, you may want to run at a higher resolution, such as five or more points per octave, to produce more complete and easier-to-view results.
Step 5: Run the simulation It seems straightforward, but LTspice requires multiple steps to actually produce the Bode plot. The first step is ‘Run the Simulation’, which does not (yet) yield the plot, but instead shows normal scope voltage and current measurements. Follow the next steps to produce the Bode plots.
Beyond simulation At some stage of the design process, the control loop should be verified in the lab using a network analyzer tool, since simulation of control loops is not as reliable as the real thing and should not be taken as a complete guarantee of loop stability and margins. The Bode plots generated in LTspice
can be compared to network analyzer Bode plots. Just like the simulation, the actual loop measurements are captured by injecting noise into the feedback loop and measuring and processing the A-B and A-C gain and phase data. The measurement setup schematic and photo are shown in Figures 5-7. LTspice simulation results show a
strong correlation to network analyzer data, proving that LTspice is a useful tool in LED driver design, producing a rough baseline to aid the engineer in narrowing the range of component choices. The gain and phase at lower frequencies closely follow the hardware, with a greater difference between simulation and hardware data at higher frequencies. This might represent the challenge of modelling high-frequency poles, zeroes, parasitic inductances, capacitances and equivalent series resistances. LTspice modelling can be used to
measure control loop gain and phase, thus producing Bode plots for LED drivers. The accuracy of the LTspice simulation data is dependent on the accuracy of the SPICE models used, although carefully modelling each component to account for real-world behaviour comes at the cost of increased simulation times. For the purpose of LED driver design,
www.electronicsworld.co.uk May 2022 29
Page 1 |
Page 2 |
Page 3 |
Page 4 |
Page 5 |
Page 6 |
Page 7 |
Page 8 |
Page 9 |
Page 10 |
Page 11 |
Page 12 |
Page 13 |
Page 14 |
Page 15 |
Page 16 |
Page 17 |
Page 18 |
Page 19 |
Page 20 |
Page 21 |
Page 22 |
Page 23 |
Page 24 |
Page 25 |
Page 26 |
Page 27 |
Page 28 |
Page 29 |
Page 30 |
Page 31 |
Page 32 |
Page 33 |
Page 34 |
Page 35 |
Page 36 |
Page 37 |
Page 38 |
Page 39 |
Page 40 |
Page 41 |
Page 42 |
Page 43 |
Page 44 |
Page 45 |
Page 46 |
Page 47 |
Page 48 |
Page 49 |
Page 50 |
Page 51 |
Page 52