|
|
|||||||||||||||||||||||
Logical Expressions - erroramp2About the writer: Harvey Morehouse is a contractor/consultant with many years of experience using circuit analysis programs. His primary activities are in Reliability, Safety, Testability and Circuit Analysis. He may be reached at harvey.annie@verizon.net. Simple questions for which I know the answer are free. Complex questions, especially where I am ignorant of the answers, are costly!!! Summary: In previous articles of this series I showed how to create logical expressions. In this blurb I show how to prepare an error amplifier model useful with SMPS controller chips. There will be another error amplifier model (erramp) prepared for that set of articles, however in some ways this model is more suitable. Erramp2: Why would one wish to create such a circuit? Often when one uses a behavioral model for a device (particularly IC realizations), the linear range of the device is unlimited. But in the 'real' circuit the voltage excursions cannot exceed the power supply 'rails'. Now one could use a 'real' opamp model, but it will add to the complexity of the overall circuit and will simulate slowly. And the 'real' opamp chosen may also not represent the actual device implementation within a controller chip, and it might not work well with the internal voltages within the controller chip as well. Indeed, most of the parameters of the internal amplifier might be poorly specified on the controller chip data sheet. Yet, for current mode SMPS controller chip modeling, the error amplifier gain is a crucial parameter. And often the voltage excursions of the error amplifier are important as well. Alternately, even when the error amplifier (or compensation amplifier) is external to the controller one may wish to use a simplified model to ease simulations. Consequently, erramp2 was created to produce an error amplifier with a controllable gain, as well as voltage excursion limits. I might have also chosen to include an R-C voltage divider at the output to limit the gain bandwidth, but this would have added some complexity. As the model was chosen primarily to be used within SMPS controller chip realizations, which themselves be turned into a sub-circuit, it did not seem necessary to include this as they could easily be added externally to the error amplifier. Erramp2 model: There are several ways the device could have been modeled. I could have used a controlled gain error amplifier. The excursions could have been limited by clamping the output with a bilateral clamp circuit, or a feedback element could have been devised which would limit the output voltage levels. It seemed easier to implement it directly with logical expressions. What I chose to do is to determine the possible output states and devise equations to represent those states. The expressions themselves could have been written in several ways, however, as no real simplification seemed evident, and the model did work as intended, alternate implementations were not explored. Consider a simple opamp model with a non-inverting input Va, an inverting input Vb, and an output Vo. Excluding such effects as slew rate limiting, five states are evident. They are:
Vopl is the maximum positive output voltage limit, and Voml is the negative output limit. Inspection of the states reveals that states 2 and 4 are are the same, governed by the same result, namely Vo = G(Va - Vb). Moreover, state 1 is a subset of this state. The equations we wish to create, three in all, are as follows:
Now because
the else function is not specifically provided for as a logical function,
we must to a finagling to get it into the final product. Each of the three
expressions above separated by ELSE statements is separately implemented
and added. Clearly the first two expressions are logically self exclusive.
That is, they cannot both be true at the same instant. The third expression
has no logical conditions and thus its scope is 'universal'. The way to
get around this, so we can conveniently create the required expression
for a nonlinear controlled source is to let the third expression be subtracted
from the first two expression's output when they are true.
The equations thusly combined, become:
Thus, if
the first expression line is true then Vo = Vopl - G(Va -Vb) + G(Va -
Vb), as the second expression cannot be true when the first expression
is true. Likewise, if the second expression is true, then Vo = Voml -
G(Va - Vb) + G(Va - Vb). And if neither the first nor second expressions
are true, then Vo = G(Va - Vb).
To be honest, it took a little bit of time and effort to create these expressions in their final form, as shown in the results in Figure 1 following:
In this circuit the values which will eventually become passed parameters are shown in the equation for B3 generator as constants. A suggested symbol for this device is also shown. A test circuit for this model is shown in Figure 2 following:
There are actually two instances of erramp2 in this test circuit. What happened is that I debugged the erramp2 circuit, and them created a parameterized subcircuit model of the device which I then placed into the circuit. As there are some editing changes required to create the parameterized subcircuit model, it seemed appropriate to include this here, to compare the output results and insure that no mistakes were made in creating the parameterized subcircuit model. The parameterized subcircuit is shown as a subcircuit in the netlist while the model is shown under the main heading. A netlist for this circuit (remembering that there are two instances) is:
Note that in the parameterized subcircuit, the default values for G, Vopl and Voml are passed to the netlist.
They behave as expected, in that the linear region is centered about the zero crossings of the input sine wave. An astute observer will see that the N1 and N2 outputs have different amplitudes. This resulted from different values of Voml used in the test circuit than those set as default parameters in the parameterized subcircuit model. It is interesting to see what the effects are of using larger and larger values of input voltage. Eventually unexpected results will occur, due I suspect from numerical solution errors. However, the circuit is intended for use imbedded within a feedback loop, and not as a comparator. Consequently when the Va - Vb difference is small the results are as expected. Conclusions: An error amplifier model suitable for use within SMPS controller chip models has been created. It features a controlled gain, as well as settable output voltage excursion limits. By addition of external R-C and other devices, external to the model, or by their addition within another parameterized circuit model if desired, its utility
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||