I'm running AC analysis on a simple opamp circuit, and the gain at the output is much lower than the gain I calculate by hand. What could be happening?
In AC analysis, a DC operating point is calculated at the beginning of the analysis. The circuit is then linearized around this calculated point. In simulating a circuit with an operational amplifier that uses a Micro-Cap .model statement, you have to be conscious of the effect that the three offset parameters may have on that DC operating point calculation. In high gain configurations, the offset parameters may wind up saturating the opamp at the operating point. The saturation would skew any expected results.
The three offset parameters are VOFF, IOFF, and IBIAS. VOFF is the input offset voltage. IOFF is the input offset current. IBIAS is the input bias current. In many data books, the offset parameters are only specified with their maximum values, so those would be the values specified in the library. Decrease the values of these parameters if necessary.
The opamp may also be saturating at a lower voltage than expected. The saturation point is determined by four parameters. A typical opamp in circuit design today must be able to function at a variety of power supplies. Some must be able to operate on either a dual or a single rail. The opamp device model in Micro-Cap is capable of handling a wide range of power supplies. However, the opamp model can only have its output range set at one voltage. This means that if you would like to use anything but the standard power supply, usually +/-15 volts, the model may need to be edited.
The four opamp parameters that control the point at which the opamp saturates: VCC, VEE, VPS, and VNS. VCC is the positive power supply. VEE is the negative power supply. VPS is the maximum positive voltage swing. VNS is the maximum negative voltage swing. The actual power supplies that the opamp uses are those that are connected to its power pins in the schematic. VCC and VEE only define the power supplies that the maximum voltage swings have been set at. Therefore, it is possible to have +5 volt power supplies on the schematic but have VCC and VEE set to +15 volts. To make the opamp run correctly with +5 volt power supplies, VCC, VEE, VPS, and VNS would all need to be changed. What these parameters actually do is determine an offset from the power supply that the opamp will saturate at. It calculates the offset through the following equations:
Positive saturation = VCC - VPS - diode drop
Negative saturation = -VEE + VNS - diode drop