# Harmonic Balance for Oscillator Simulation

The *HarmonicBalance* simulation component includes features specifically designed for simulating oscillators. You can obtain results such as:

- Oscillator frequency and spectrum
- Small-signal loop gain
- Large-signal loop gain
- Phase noise
- VCO tuning

If you are not familiar with the harmonic balance simulator, refer to Harmonic Balance Basics before continuing with this topic.

For basic information about using harmonic balance for oscillator and oscillator noise simulation, see the following topics:

- Performing an Oscillator Simulation has the minimum setup requirements for simulating an oscillator.
- Performing an Oscillator Noise Simulation focuses on noise simulations for oscillators.

For examples on performing harmonic balance simulations for oscillators and oscillator noise, see the following section:

- Examples of Oscillator Simulations describes in detail how to set up simulations for many items of interest in an oscillator, such as finding the oscillation frequency, steady-state conditions, loop gain, and oscillator noise.

For detailed information on harmonic balance for oscillator and oscillator noise simulation, see the following topics:

- Oscillator Simulation Description is a brief description of the oscillator simulation process.
- Phase Noise Simulation Description describes the elements of phase noise and the calculations made during a phase noise analysis.
- Troubleshooting a Simulation offers suggestions on how to improve a simulation.
- Simulation Techniques for Recalcitrant Oscillators offers two techniques to solve the occasional problem with an oscillator that converges in a time-domain simulation, yet the harmonic balance oscillator algorithm is unable to find the solution.

## Performing an Oscillator Simulation

The main goal of simulating an oscillator using harmonic balance is to find both the oscillation frequency and the output spectrum of the oscillator. There are two methods that can be used to simulate an oscillator using harmonic balance. The first method requires the insertion of an OscPort or OscPort2 into the feedback loop of the oscillator. The second, and preferred, method, commonly referred to as OscProbe, involves the identification of nodes in the oscillator's feedback loop.

### Using OscPort

The first oscillator simulation method requires that an OscPort or OscPort2 be inserted into the oscillator.

*OscPort*is a component that is inserted into the feedback loop of a single-ended oscillator.*OscPort2*is a component that is inserted into the feedback loop of a differential (balanced) oscillator.

These components are inserted either in the feedback loop of the oscillator, or between the parts of the circuits that have negative resistance and the resonator. During harmonic balance oscillator analysis, the OscPort or OscPort2 is used by the simulator to monitor the loop gain of the oscillator and adjust the amplitude and frequency of oscillation.

### Specifying Oscillator Nodes

The second oscillator simulation method involves the identification of nodes in the oscillator's feedback loop. This method is often referred to as OscProbe, or Oscillator Probe. Unlike OscPort or OscPort2, OscProbe is not a component, but a preferred method for preparing an oscillator simulation.

For single-ended oscillators, one node in the feedback loop is identified; for differential oscillators, two nodes in the feedback loop are identified. These nodes should be either at the input or output of the active device of the oscillator, or in the oscillator's resonant tank. Nodes in the bias circuitry or an output buffer amplifier should not be used. The simulator uses these nodes to inject a voltage into the oscillator and adjusts the voltage and frequency so that no current flows from the injected source to these nodes.

### Setting Up an Oscillator Analysis

Set up a harmonic balance simulation then enable the Oscillator analysis mode. Select a *Method* to use either an Oscport or to specify oscillator nodes (OscProbe). If you use an Oscport, there is no further information to be specified for this option. If you specify oscillator nodes, then more information must be specified:

- Enter a node name for
*Node Plus*for all oscillators. - Enter a node name for
*Node Minus*only for differential oscillators; leave this blank for single-ended oscillators.

Set the fundamental frequency on the Freq tab. Set the Fundamental Frequencies by entering the oscillation *Frequency*. Enter the number of harmonics of interest in the *Order* field.

For details about each field, click *Help* in the dialog box.

The use of an OscPort in ADS is illustrated in the example Calculating Large-Signal, Steady-State Oscillation Conditions. The use of an OscPort2 is illustrated in the example Using OscPort2 for Oscillator Analysis.

### Other Oscillator Analyses

For a successful analysis, make sure your active device has sufficient feedback gain to permit oscillation and your resonator exhibits resonance. To check this, run an S-parameter simulation on the circuit before attempting the harmonic balance simulation. A brief overview of how to set this up is in the example Finding the Frequency of Oscillation. For more details on how to set up the S-parameter simulations, refer to S-Parameter Simulation.

There are two ways that the small-signal oscillator loop gain can be simulated:

*OscTest*calculates loop gain for single-ended oscillators. Use it in circuits where you would use the OscPort. This component has a simulation controller already included in it, so you should not set up a harmonic balance simulation. This component is on the Probe Components palette in ADS. This is illustrated in an ADS schematic in the example Calculating Oscillator Loop Gain.*OscPort2*can also be used to calculate the loop gain for differential (balanced) oscillators. The OscPort2 has a mode parameter that should be changed from its default setting of*Automatic*(for harmonic balance oscillator analysis) to*Small Signal Loop Gain*mode. This is illustrated in an ADS schematic in the example Calculating Small-Signal Loop Gain.

The placement and setup of the OscTest, OscPort, and OscPort2 components vary. For instructions on how to do this, place one component in your schematic, double-click the component, click the *Help* button in the dialog box, and follow the instructions that appear.

Note

Do not use more than one OscTest, OscPort, or OscPort2 in a circuit.

You can obtain certain oscillator characteristics using simulators other than the harmonic balance simulator:

- A DC simulation can be run separately to find the circuit's DC operating point.
- An S-parameter simulation can be used to find S
_{21}(small-signal oscillator gain), and f_{o}(approximate frequency of oscillation). - Transient analysis or circuit envelope simulation can be used to simulate the oscillation startup.

## Performing an Oscillator Noise Simulation

This section focuses on setting up noise simulations for oscillators. It describes how to calculate:

- Phase noise around fundamentals and harmonics
- Absolute noise voltage spectrum around a harmonic
- Relative noise voltage spectrum around a fundamental

There are two methods of noise simulation: using the parameters on the Noise tabs in the Harmonic Balance dialog box, or using NoiseCon components. Using NoiseCons, you can set up several noise simulations, thereby eliminating the need to change the values on the Noise tabs in the Harmonic Balance dialog box. With NoiseCons, you can also set parameters to calculate phase noise.

If you are not familiar with the general procedures for simulating oscillators, see Performing an Oscillator Simulation before continuing with this section.

See the following topics for details on oscillator noise simulation:

- Simulating Phase Noise Using OscPort describes how to set up a phase noise simulation.
- Simulating Phase Noise with NoiseCons describes how to use NoiseCon components to calculate phase noise, relative noise voltage spectrum, phase noise voltage around a harmonic, and absolute noise voltage spectrum.
- Phase Noise Simulation Description describes the elements of phase noise, and the calculations made during a phase noise analysis.

## Examples of Oscillator Simulations

This section describes examples showing how to set up and run simulations for oscillators and oscillator noise.

- Finding the Frequency of Oscillation
- Calculating Large-Signal, Steady-State Oscillation Conditions
- Calculating Oscillator Loop Gain
- Using OscPort2 for Oscillator Analysis
- Simulating Phase Noise Using OscPort
- Simulating Phase Noise with NoiseCons

Note

The Harmonic Balance simulation uses the Harmonic Balance Simulator license (sim_harmonic) which is included with all Circuit Design suites except RF Designer. You must have this license to run Harmonic Balance simulations. You can work with examples described here and installed with the software without the license, but you will not be able to simulate them.

### Finding the Frequency of Oscillation

Fundamental to any oscillator analysis is establishing the frequency of oscillation. The simplest way to do this is to use the S-parameter simulator. The following figure illustrates how to use the S-parameter simulator and Term components to find the resonant frequency. This simulation just gives a rough estimate of the frequency of oscillation.

If you are not familiar with S-parameter simulations, refer first to S-Parameter Simulation.

Note

This design, *OscFeedbackTest.dsn*, is in the *Examples* directory under *Tutorial/SimModels_prj*. The results are in *OscFeedbackTest.dds*.

###### Example setup for finding an oscillator's resonant frequency

To find the frequency of oscillation:

- Place Term components at the input and output of the resonant circuit, and run the S-parameter simulation.
- Open a Data Display window and plot S(2,1). Place a marker where the curve shows the peak response:

- Note the frequency of oscillation, in this example, approximately 102 MHz. This frequency will be used in the next simulation example.

### Calculating Large-Signal, Steady-State Oscillation Conditions

The following figure illustrates a setup that uses the harmonic balance simulator and OscPort component.

For oscillators with a differential (or balanced) topology, the OscPort2 component in automatic mode should be used instead of OscPort. For an example using OscPort2, refer to Using OscPort2 for Oscillator Analysis.

Note

This design, *OSC2.dsn*, is in the *Examples* directory under *Tutorial/SimModels_prj*. The results are in *OSC2.dds*.

This oscillator circuit consists of two subnetworks: an active gain stage and a frequency-determining feedback stage.

###### Example setup for a basic oscillator test using the harmonic balance simulator and the OscPort component

The next figure depicts the active gain stage.

###### Active gain subnetwork

The next figure depicts the resonant feedback stage.

###### Resonator subnetwork

To determine large-signal, steady-state oscillation conditions:

- From the
**Simulation-HB**palette, select an**OscPort**grounded oscillator port (which is essentially a probe) and place it in the circuit so that it breaks the feedback loop.- In a feedback oscillator, use this port to break the feedback path. The arrow (and pin 2) should point in the direction of injection (the direction of the gain). Refer to the figure above, Example setup for a basic oscillator test using the harmonic balance simulator and the OscPort component.
- In a reflection oscillator, place the port so that it separates the negative-resistance portion of the oscillator from the resonator portion. The arrow (and pin 2) should point in the direction of the negative resistance.
Note

A circuit should contain only one oscillator port.

- From the
**Simulation-HB**palette, select the**HarmonicBalance**simulation component and place it on the schematic. Edit the component, scroll to the**Osc**tab and select it.- At the bottom of the dialog box, select
**Oscillator**. - Enter the name of the
*OscPort*item (in this example,**oscport1**, in the*Oscport*name field. This will report the values the simulator finds at this component. The circuit simulator is capable of automatically finding the only OscPort or OscPort2 in the circuit if the name is entered as "yes". This is required if the OscPort2 component is used.

- At the bottom of the dialog box, select
- Scroll to the
**Freq**tab and enter a frequency for the fundamental (Freq[1]), if you know it (in this example,**102 MHz**). The oscillator will use this value and the values for the OscPort parameters*NumOctaves*and*Steps*to search a range of frequencies until the small-signal oscillation conditions are satisfied. - Set
*Order[1]*, the order of the fundamental, to**8**. - Label nodes at which you want data to be reported. In this example,
**Output**indicates the output of the gain stage. **Simulate**. When the simulation is complete, open a Data Display window and do the following:

Plot the power relationship of the tones:- Select the Rectangular plot option and select
**Output**as the parameter to plot. Accept**dB**as the default plot type. - After adding Output to the
*Traces*field, select it and click**Trace Options**. - Click
**Trace Expression**, and enter the following equation:

**dBm(OSC2..Output,1000)**

This provides a value in dBm as referenced to the 1-kohm resistor in the gain stage (the default would otherwise be 50 ohms).

Click**OK**. The following appears, showing the power relationship of the eight tones (Order = 8), plotted as the harmonic index (harmindex):

Plot voltage output of the gain stage over time: - Still in the Data Display window, select an Equation plot and enter the following equation:

**time_wave=ts(Output)**

Plot the equation*time_wave*to yield the following:

- Select the Rectangular plot option and select

### Calculating Oscillator Loop Gain

To calculate oscillator loop gain, use the *OscTest* component as described here. Because the *OscTest* component incorporates a simulation component into itself, no HarmonicBalance simulation component is required.

For oscillators with a differential topology, use the OscPort2 component for calculating loop gain. For an example, refer to Using OscPort2 for Oscillator Analysis.

The following figure illustrates a setup using the OscTest component.

Note

This design, *OSC1.dsn*, is in the *Examples* directory under *Tutorial/SimModels_prj*. The results are in *OSC1.dds*.

###### Example setup for using the OscTest component

To determine oscillator loop gain:

- From the
**Probe Components**palette, select the**OscTest**grounded oscillator port and place it in the circuit so that it breaks the feedback loop:- In a feedback oscillator, use the OscTest component to break the feedback path. The arrow (and pin 2) should point in the direction of injection (the direction of the gain). Refer to the figure above.
- In a reflection oscillator, place the component so that it separates the negative resistance portion of the oscillator from the resonator portion. The arrow (and pin 2) should point in the direction of the negative resistance.

- Double-click the OscTest component to edit it. Edit values for Start and Stop frequencies, as well as Points (the number of frequency points to be considered). In this example:
- Start =
**90 MHz** - Stop =
**110 MHz** - Points =
**101**

- Start =
**Simulate**. When the simulation is complete, open a Data Display window and:- Select a Polar plot, plot S(1,1), and place a marker on the result, as follows.

- Plot both the magnitude and phase of S(1,1), and place a marker directly over the zero crossing of the phase plot (shown next).

- Select a Polar plot, plot S(1,1), and place a marker on the result, as follows.

As required, the gain is greater than unity at the resonant frequency.

Hint

Sometimes the simulated loop gain obtained by this procedure is sensitive to the OscTest impedance, Z. If the small-signal loop-gain conditions cannot be satisfied, try running the simulation with Z as a swept parameter.

### Using OscPort2 for Oscillator Analysis

The *OscPort2* component combines the features of the OscPort and OscTest components and adds the abilities to examine large signal loop gain and to analyze oscillators with a differential topology. The OscPort2 can be used in the harmonic balance simulation of an oscillator to compute its large signal solution and frequency, like OscPort. It can be used to examine the small signal loop gain of an oscillator over a range of frequencies, like OscTest. It adds the ability to examine the large signal loop gain over a range of frequencies and injected signal levels.

The OscPort2 component provides the ability to easily handle oscillators with a differential, or balanced, circuit topology, which are commonly found in integrated circuits. OscPort2 can also be used to analyze a single-ended oscillator by grounding the negative input and output of the OscPort2.

#### Connecting OscPort2 in a Differential Oscillator

The following figure shows the schematic of a differential ring oscillator. It is made of four differential amplifiers with differential inputs and outputs. Unlike a single-ended ring oscillator, a differential ring oscillator will oscillate with an even number of stages, provided that one of the connections between stages crosses over, connecting a positive output to a negative input and vice-versa.

Note

This design, *hbosc.dsn*, is in the *Examples* directory under *Tutorial/OscPort2_prj*. The results are in *hbosc.dds*.

###### Differential ring oscillator

OscPort2 is available in both the Simulation-HB and Probe Components palettes. It should be inserted in a differential oscillator so that it intercepts both the positive and negative signals in the feedback loop. The arrow should point in the direction of loop gain or signal flow.

#### Calculating Oscillator Frequency and Harmonics

An OscPort2 in Automatic oscillator mode is used in a harmonic balance to simulate an oscillator and determine both its large signal oscillation spectrum as well as its actual frequency of oscillation. The *Mode* of the OscPort2 should be set to *Automatic*. The FreqPlan and VinjPlan are not used.

The simulation results for the oscillator are shown below. The frequency of oscillation was found to be 133.7 MHz. Both the differential output, from node *vplus* to *vminus*, and a single-ended output, from node *vplus*, are shown. As expected, the differential signal contains only odd-order harmonics.

#### Calculating Large-Signal Loop Gain

OscPort2 can be used to simulate the large-signal loop gain of an oscillator using harmonic balance. The equivalent circuit of the OscPort2 in Large signal loop gain mode is shown below. The OscPort2 is used to break the oscillator feedback loop at the fundamental frequency only. The loop remains connected at DC and the other harmonics. A signal, *LoopIn*, is injected into the oscillator and the resulting signal that comes back around the loop, *LoopOut*, is obtained. The complex loop gain is computed using LoopOut/LoopIn and is placed in the dataset with the name *LoopGain*. The user can sweep both the injected signal frequency as well as its voltage. The circuit will oscillate at the injected frequency and voltage where the loop gain is exactly 1+j0.

Note

This design, *loopgain_large.dsn*, is in the *Examples* directory under *Tutorial/OscPort2_prj*. The results are in *loopgain_large.dds*

###### Equivalent circuit of OscPort2 in large-signal loop gain mode

###### Simulation setup to simulate large-signal loop gain of an oscillator

Set the Mode parameter (of OscPort2) *Large signal loop gain*. Because the control items are built into OscPort2, no analysis controller is necessary, when using OscPort2 in this mode. The names of the appropriate SweepPlans should be set for FreqPlan and VinjPlan. For this oscillator, the injected frequency is swept from 130 MHz to 138 MHz using the SweepPlan named *SweepFreq*. The injected voltage level is swept from 0.01 V to 1.0 V using the SweepPlan *SweepVinj*.

The simulation results are shown above. In the dataset, the result named *LoopGain* is the complex loop gain for the oscillator. One typical way to present this information is to plot the loop gain phase against the loop gain magnitude in dB. The point of oscillation will then be at the 0,0 point on the graph. The lines on the plot are lines of constant frequency, plotted with increasing injected voltage. On these plots, the injected voltage increases from right to left, showing the gain compression of the oscillator as the injected signal increases.

#### Calculating Small-Signal Loop Gain

OscPort2 can be used to simulate the small-signal loop gain of an oscillator using small-signal AC analysis (like the OscTest component allows). The equivalent circuit of OscPort2 in Small-signal loop gain mode is shown below. The OscPort2 is used to break the oscillator feedback loop at the small signal frequency only. The loop remains connected at DC. A signal, *LoopIn*, is injected into the oscillator and the resulting signal that comes back around the loop, *LoopOut*, is obtained. The complex loop gain is computed using LoopOut/LoopIn and is placed in the dataset with the name *LoopGain*. The user can sweep the injected signal frequency. The circuit oscillates near the injected frequency where loop gain is approximately 1+j0. The loop gain calculation finds the point where the real part is maximum and the imaginary part is zero. In this example, the real part is slightly greater than one.

Note

This design, *loopgain_small.dsn*, is in the *Examples* directory under *Tutorial/OscPort2_prj*. The results are in *loopgain_small.dds*

###### Equivalent circuit of OscPort2 in small-signal loop gain mode

###### Simulation setup to simulate the small-signal loop gain of an oscillator

Set the Mode parameter (of OscPort2) to *Small-signal loop gain*. Because the control items are built into OscPort2, no analysis controller is necessary (when using OscPort2 in this mode). The name of the frequency SweepPlan should be set for *FreqPlan*. For this oscillator, the injected frequency is swept from 15 MHz to 25 MHz using the SweepPlan named *Plan1*.

The simulation results are shown here. In the dataset, the result named *LoopGain* is the complex loop gain for the oscillator. The magnitude and phase of the loop gain are plotted and shown above. This oscillator will oscillate near 20.55 MHz.

### Simulating Phase Noise Using OscPort

The following figure illustrates an example setup for determining oscillator phase noise.

Note

This design, *OSC3.dsn*, is in the *examples* directory under *Tutorial/SimModels_prj*. The results are in *OSC3.dds*.

This example is similar to Calculating Large-Signal, Steady-State Oscillation Conditions with the addition of the settings described below.

###### Setup for determining oscillator phase noise

To determine oscillator phase noise:

- Label all nodes where you want to collect noise data.
- Open the Harmonic Balance dialog box and enable
**Nonlinear noise**and**Oscillator**at the bottom of the dialog. - Select the
**Noise (1)**tab and set these parameters under Noise frequency:- Sweep Type =
**Log** - Start =
**1 kHz** - Stop =
**10 MHz** - Pts./decade =
**2**

- Sweep Type =
- Select
**Noise (2)**. In the section*Nodes for noise parameter calculation*, display the*Edit*drop-down list and select each node at which to report noise data and click**Add.**That node is listed in the*Select*list box. -
**Simulate**. Plot*Gain_out.pnmx*, for phase noise due to noise mixing. The plot appears as follows:

Notice that the noise is at least 100 dB below the fundamental (resonant) frequency.

### Simulating Phase Noise with NoiseCons

When you use a NoiseCon nonlinear noise controller with an oscillator, you have more flexibility in controlling over how noise simulation is performed than you do with Noise(1) and Noise(2). You can compute both single-sideband phase noise as well as a double-sideband noise voltage spectrum. In addition, you can compute phase noise around the oscillator fundamental, an oscillator harmonic or a mixing product.

The following figure shows an oscillator with a frequency multiplier that will be used to demonstrate the use of NoiseCons with an oscillator.

Note

Refer to the ADS project *examples/Tutorial/Noisecon_prj* for an illustration of how to use NoiseCons for oscillator phase noise simulation. See *oscmul.dsn* for the design and *oscmul.dds* for the results.

###### Setup for demonstrating NoiseCons with an oscillator

Four Noisecon components will be used to demonstrate:

- Phase noise around the fundamental
- Relative noise voltage spectrum around the fundamental
- Absolute noise voltage spectrum around a harmonic
- Phase noise around a harmonic

#### Single Sideband Phase Noise

The first NoiseCon illustrates phase noise around the fundamental frequency of the oscillator.

- Place a
**NoiseCon**from the Simulation-HB palette. Name it**NC1**. - Select the
**Freq**tab to specify the phase noise offset frequencies. Select a**Log**sweep and set the Start frequency to**1 kHz**, the Stop frequency to**1 MHz**and Pts./decade to**3**. - Select the
**Nodes**tab and enter the name of the oscillator output node,**vosc**, in the*Pos Node*and**Add**it to the list. - Select the
**PhaseNoise**tab and select**Phase noise spectrum**as the Phase Noise Type. Specify the Phase noise carrier (using Frequency) as**100 MHz**. The simulator will find the closest actual frequency to this, which is the oscillation frequency of 103.6 MHz. - Edit the Harmonic Balance controller and select the
**NoiseCons**tab. Select**NC1**and**Add**it to the list of NoiseCons to be simulated.

The simulated single-sideband phase noise results are shown next. The result in the dataset has the name *HB1.NC1.vosc.pnmx* and is phase noise in dBc. Refer to How ADS Simulates Phase Noise for more information on phase noise analyses.

#### Relative Noise Voltage Spectrum

The second NoiseCon illustrates the relative noise voltage spectrum. Rather than compute the single sideband phase noise, the noise voltage is computed both at the carrier frequency minus the offset frequency and at the carrier frequency plus the offset frequency. The results are presented as a relative noise voltage spectrum around zero, with the results extending from minus the largest offset frequency to plus the largest offset frequency.

- From the Simulation-HB palette, select and place a
**NoiseCon**. Name it**NC2**. - Select the
**Freq**tab to specify the phase noise offset frequencies. Select a**Log**sweep and set the Start frequency to**1 Hz**, the Stop frequency to**100 kHz**and the Pts./decade to**3**. - Select the
**Nodes**tab. Select the name of the oscillator output node,**vosc**, from the*Pos Node*drop-down list and**Add**it to the list box for noise parameter calculation. - Select the
**PhaseNoise**tab and select**Relative vnoise spectrum**as the Phase Noise Type. Specify the phase noise carrier (using Carrier mixing indices) as**1**, which corresponds to the fundamental oscillation frequency. - Edit the Harmonic Balance controller and select the
**NoiseCons**tab. Select**NC2**and**Add**it to the list of NoiseCons to be simulated.

The simulated single-sideband phase noise results are shown next. The result in the dataset has the name *HB1.NC2.vosc.noise* and is a noise voltage. The spectrum extends from -100 kHz to +100 kHz, and is assumed to be centered relative to the carrier frequency.

#### Phase Noise Voltage Around a Harmonic

The third NoiseCon illustrates the phase noise spectrum around the seventh harmonic of the oscillator after it passes through a diode frequency multiplier.

- From the Simulation-HB palette, select and place a
**NoiseCon**. Name it**NC3**. - Select the
**Freq**tab to specify the phase noise offset frequencies. Select a**Log**sweep and set the Start frequency to**1 kHz**, the Stop frequency to**1 MHz**and the Pts./decade to**3**. - Select the
**Nodes**tab and select the frequency multiplier output node,**vmul**, from the*Pos Node*drop-down list and**Add**it to the list box for noise parameter calculation. - Select the
**PhaseNoise**tab and select**Phase noise spectrum**as the Phase Noise Type. Specify the phase noise carrier (using Carrier mixing indices) as**7**, corresponding to the frequency multiplier output harmonic with the largest power. - Edit the Harmonic Balance controller and select the
**NoiseCons**tab. Select**NC3**and**Add**it to the list of NoiseCons to be simulated.

The simulated single-sideband phase noise results are shown next. The result in the dataset has the name *HB1.NC3.vosc.pnmx* and is phase noise in dBc. Refer to How ADS Simulates Phase Noise for more information on the phase noise analyses. If the phase noise results from this simulation at the seventh harmonic and the phase noise results around the fundamental are compared, the phase noise is seen to be increased 20 log(7), or 16.9 dB, as expected.

#### Absolute Noise Voltage Spectrum

The fourth NoiseCon illustrates the absolute noise voltage spectrum. Rather than compute the single sideband phase noise, the noise voltage is computed both at the carrier frequency minus the offset frequency and at the carrier frequency plus the offset frequency. The results are presented as an absolute noise voltage spectrum around the carrier frequency, with the results extending from the carrier frequency minus the largest offset frequency to the carrier frequency plus the largest offset frequency.

- From the Simulation-HB palette, select and place a
**NoiseCon**. Name it**NC4**. - Select the
**Freq**tab to specify the phase noise offset frequencies. Select a**Log**sweep and set the Start frequency to**1 Hz**, the Stop frequency to**100 kHz**and the Pts./decade to**3**. - Select the
**Nodes**tab and select the frequency multiplier output node,**vmul**, from the*Pos Node*drop-down list and**Add**it to the list box for noise parameter calculation. - Select the
**PhaseNoise**tab and select**Absolute vnoise spectrum**as the Phase Noise Type. Specify the phase noise carrier (using Carrier mixing indices) as**7**, corresponding to the frequency multiplier output harmonic with the largest power. - Edit the Harmonic Balance controller and select the
**NoiseCons**tab. Select**NC4**and**Add**it to the list of NoiseCons to be simulated.

The simulated single-sideband phase noise results are shown next. The result in the dataset has the name *HB1.NC4.vosc.noise* and is a noise voltage. The spectrum extends from 725.62 MHz to 725.82 MHz, centered around the seventh harmonic of the oscillator.

## Oscillator Simulation Description

Oscillators are nonlinear by nature, using positive feedback to achieve oscillation. The loop gain must be greater than one with a phase shift of zero. Once it has been placed in the appropriate point in the circuit, the OscPort (oscillator port) component checks for this condition. When the loop-gain calculations are being performed, the oscillator port becomes a short circuit to all harmonic frequencies and a unidirectional isolator to the fundamental. During these calculations, the port effectively turns the closed-loop oscillator into an open-loop amplifier.

When the Specify Oscillator Nodes method is used instead of placing an OscPort component, the concept of loop gain is lost. In this mode the simulator connects a special voltage source to the specified node(s). This special source is connected to the circuit at only the fundamental frequency; nothing is connected at DC or the harmonics. This special source injects a voltage at the fundamental frequency to excite the oscillator. The oscillation will be self sustained when the voltage and frequency are such that the voltage is nonzero and no current flows from the special source.

Although a loop gain greater than one is required for oscillation to begin, at some level the amplitude of oscillation is limited. This limit may come about through the saturation of some active device, or may be the result of an active gain control (AGC) network. Either way, the limiting action requires that the gain of the loop be a function of the amplitude of the signal. This requires a nonlinear analysis. The simulator uses an iterative process to try to find a set of nonzero steady-state solutions.

When the oscillator simulation is launched, a harmonic-balance search algorithm varies the operating frequency to find the oscillation frequency, as well as the final operating frequency and power levels, of the oscillator circuit.

Note

Power levels are computed by means of a reference impedance value. However, because this value typically does not represent your circuit's impedance, the power levels may not be physically meaningful. For example, in a high-impedance oscillator, the simulation power levels may be much greater than the power the oscillator can actually deliver to its load.

The simulator performs a fully automated search for the oscillator's operating characteristics. The automated search involves:

- Searching for a frequency where the circuit satisfies the linear oscillation condition.
- Searching for a frequency and power such that the oscillator's open-loop gain is at unity magnitude and zero phase angle (within a given tolerance).
- A full
*closed-loop*harmonic balance analysis in which frequency and oscillator power are further refined to a more exact solution.

### Performing VCO Tuning

VCO tuning is accomplished by performing an oscillator simulation in conjunction with a swept variable analysis (refer to Parameter Sweeps and Sweep Plans). The simulator performs a separate oscillator analysis for each swept variable value, then attempts to find the actual oscillation condition for each value. After the analysis is complete, you can display the frequency of oscillation and the output power of that frequency as a function of, for example, the swept variable.

You should not sweep a variable in large steps, because that may *snap* the algorithm out of the vicinity of the prior oscillation condition, resulting in a convergence failure.

### Measuring Oscillator Loop Gain

A quick and efficient way to ensure that the network meets the necessary conditions for oscillation is to use the OscTest component to verify whether the linear oscillation conditions are satisfied. OscTest performs a small-signal loop gain analysis on the oscillator. It does the initial analysis that is performed by the OscPort component, and it acts like a signal source, load, and ideal circulator. The impedance of the source and load are the same, and are set via the Z-parameter on the OscTest component. For some oscillators, the loop gain and phase shift vary with this Z-parameter, so it is sometimes a good idea to check the loop gain and phase shift versus frequency for different values of the Z-parameter. The results of a simulation with an OscTest component are the small-signal open loop gain and phase shift, as a function of frequency. Generally, the circuit will oscillate if the open loop gain satisfies

|G

_{l}| > 1, I_{m}(G_{l}) = 0

or equivalently, where the output impedance (Z_{out}) satisfies

R

_{e}(Z_{out}) < 0,I_{m}(Z_{out}) = 0

For a more rigorous description of the oscillation conditions that must be satisfied, refer to the oscillator component descriptions in Introduction to Circuit Components.

Note

Because the control items are built into OscTest, no analysis controller is necessary.

In addition, an example of this type of analysis can be found in the example file */examples/Tutorial/LearnOsc_pr/OscTest_VCO*. The application note, PN 85150-4 Simulating Noise in Nonlinear Circuits Using MDS/RFDS, provides further information about determining the expected frequency of oscillation for an oscillator, including a description of a method that does not use the OscTest component. This application note is accessible from the Agilent EEsof website.

After performing the simulations with OscTest and finding the potential frequency of oscillation, OscTest can be replaced with an OscPort and oscillator harmonic balance simulations can then be run.

It is important to note that an OscTest analysis is not an accurate way to determine the oscillation frequency, nor does it help determine the operating power levels of the oscillator. During oscillation, reactances within the device change considerably, causing frequency shifts not predicted by the linear simulation.

A large-signal nonlinear analysis accounts for the variations in device reactances and provides a way to determine the oscillation frequency with far greater accuracy. It also provides information on the output power level of the oscillator, output power spectrum, and voltage and current waveforms.

Consider the operation of a negative-resistance oscillator from a point in the network between the resonating circuit and the nonlinear device:

- Ambient noise usually provides the initial stimulus. When a small voltage disturbance at the appropriate frequency is presented at this node, it encounters negative resistance at the device and reflects back to the resonator with a greater magnitude.
- The resonator reflects the signal, which experiences some loss as it propagates through the circuit. As long as the negative resistance of the device is sufficient to exceed the losses in the circuit, the stimulus signal continues to grow.
- At some point, the magnitude of the signal becomes sufficient to reduce the negative resistance of the device.
- Steady state is reached when the magnitude of the signal causes the negative resistance and the loss effects to be balanced. Nonlinearities in the device will generate harmonics, which also reach steady-state values.

There are two unknowns in the process of simulating an oscillator:

- Amplitude of the injection/feedback signal
- Frequency of oscillation

The injection amplitude must be adjusted and applied over a range of frequencies until the oscillation conditions are met at one of the frequencies. Only then is the oscillator's steady-state operating point obtained.

## Phase Noise Simulation Description

An *oscillator phase noise* analysis computes the noise sidebands of the oscillator carrier frequency as well as:

- Normal frequency conversion
- Amplitude-noise-to-frequency-noise conversion
- Frequency translation of noise, caused by component nonlinearities in the presence of large-signal oscillator signals. Upconverted flicker noise is a commonly observed effect.
- Bias changes due to the oscillator signals. Any shift in DC bias that occurs in the presence of the oscillation waveforms is taken into account. This bias-shift calculation is needed for accurate calculations of nonlinear device noise.

The results from the phase noise analysis have .*pnmx* (phase noise, in dBc/Hz) and .*anmx* (AM noise, in dBc/Hz) appended to the selected node name(s).

Note

Most of the nonlinear devices in the semiconductor libraries do not have stable 1/f noise parameters. Instead, noise sources must be added to model the 1/f noise.

### How ADS Simulates Phase Noise

Phase noise in an oscillator can be analyzed from small-signal mixing of noise. The small-signal mixing of noise comes from the nonlinear behavior of the oscillator, where noise mixes with the oscillator signal and harmonics to mix to sideband frequencies on either side of the oscillator signal.

The phase noise computed is available to the user directly in dBc. Assuming there is a node labeled *vout* for which phase noise is to be computed, the following variables are available for use in a data display following a phase noise analysis.

hb_noise.vout.pnmx (phase noise (in dBc) from mixing analysis)

hb_noise.vout.anmx (AM noise in (dBc) from mixing analysis)

To model oscillator phase noise with a noise mixing analysis, the noise at the sidebands on either side of the carrier are obtained from a small-signal mixer analysis where noise sources mix with the oscillator large signals to produce noise sidebands. The noise at these two sideband frequencies and their correlation is then used to compute the phase noise. The mixing analysis additionally computes the AM noise as well as phase noise.

### Possible Problems with Phase Noise Analysis

When simulating phase noise, it is recommended to set the *Oversample* parameter to 4 or higher.

For the mixing analysis, it is important that the analysis uses all of the small signal frequencies. By default, the simulator will use all of the small signal frequencies. The only way to make it not use all of them, and degrade the accuracy of the noise results, is to perform a small-signal analysis along with the noise analysis, and set *Use all small-signal frequencies* to *no* there. This parameter controls the number of small-signal frequencies used in the mixing analysis; if TRUE, then the sidebands around all of the large-signal frequencies are used (2 · order + 1 small-signal tones); otherwise sidebands are used only around the lowest half of the large-signal frequencies (order + 1 small-signal tones). (Note that order is the number of harmonics (including the fundamental) of the oscillator simulated.) Disabling this option can severely underpredict the phase noise from a mixing analysis, especially at small offsets; this is not because the extra sidebands contribute more noise, but is due to a matrix stability issue.

The following figure illustrates the different components of phase noise for a simple oscillator. Phase noise from the mixing analysis, *pnmx*, is shown both when all small-signal frequencies are used ( *all=yes* ) and when they are not used ( *all=no*.)

### Basic Phase Noise Theory

Phase noise occurs naturally in electronic circuits. It can be observed in the time domain as phase jitter of the signal on an oscilloscope display or as time fluctuations of the zero crossings (see the following figure).

#### Relationship of Phase Deviation and Sideband Level

Phase noise and frequency fluctuations are the same physical phenomenon. Noise in angular frequency can be obtained from the derivative of phase with respect to time. The modulation of the signal phase manifests itself in the sidebands of the oscillator carrier as offsets from the carrier frequency; these offsets are related to the multiples of angle-modulation frequency. For small angle modulation, only the first term is important and the relationship between the phase deviation and the sideband level is approximated as follows:

#### Single-Sideband Noise Power in a 1-Hz Bandwidth

A common but indirect representation of phase noise is denoted L *(f)* (see the following figure). This is the ratio of the single-sideband noise power (in a 1-Hz bandwidth at an offset frequency from the carrier) to the total carrier power. This common representation is applicable only to small phase deviations.

#### Oscillator Phase-Noise Analysis

The simulator computes the noise at an offset from the unknown oscillation frequency. After the normal harmonic-balance noise analysis has determined the steady-state oscillation frequency and amplitude, the phase-noise analysis computes the noise amplitude as an offset from the carrier. With this noise spectral density *Sv(f)*, the phase noise can be computed as

where

Acis the amplitude of the fundamental oscillator output.

There are four distinct regions of phase noise, as shown next. Note that not all oscillators will show all four regions.

- The lowest frequency is dominated by
*flicker FM noise*, which is device flicker noise that causes a random frequency modulation. This has a slope of 1/f^{3}. *White FM noise*, is white noise that causes a random frequency modulation. This has a slope of 1/f^{2}.*Flicker PM noise*is modeled by flicker noise that mixes up to the oscillation frequency. This has a slope of 1/f.*White PM noise*is simply white noise that mixes up to the oscillation frequency. This has the typical flat white-noise floor.

Note

To model added white noise, select a *V_Noise* (Noise Voltage Source) component if you know the rms noise voltage, and an *I_Noise* (Noise Current Source) component if you know the rms noise current (these are found in the Noise and Controlled Sources palette). To model flicker PM or flicker FM noise, a device (such as a BJT) with flicker noise parameters must be in the circuit.

## Troubleshooting a Simulation

This section presents suggestions for improving the accuracy of results.

### Solving Convergence and Speed Problems

You may find that simulation of your oscillator circuit does not converge properly. It may converge to a frequency, but with negligible AC power (a DC solution), or it may completely fail to converge. You may find instead that the oscillator analysis moves too slowly and you may want to speed it up. There are several methods you can apply to correct these problems.

- Ensure that the OscPort component is placed properly (refer to Calculating Large-Signal, Steady-State Oscillation Conditions).
- Ensure that the OscPort component is connected to a node in the circuit where a nonzero voltage at the fundamental oscillation frequency is expected. It should not be connected to a node that contains only a DC bias voltage. Good locations to pick are at the input or output of the active device, within the feedback loop, or between the negative resistance and the resonator.
- If oscillator nodes are specified instead of using an OscPort, good nodes to pick are the input or output nodes of the active devices or nodes in the resonator tank. Do not pick nodes in the bias circuitry or nodes in an output buffer amplifier.
- When there are convergence problems, or when there is reason to question the accuracy of the result, try setting
*Oversample*(under the*Params*(1) tab) to a value between 1 and 3 (2 is recommended). If sampling within this range does not help, leave*Oversample*at 2 and try some of the other techniques listed next. - Modify the value of
*Order*(under the*Freq*tab). A larger value is helpful when there are convergence problems, or when there is reason to question the accuracy of the result. This value cannot be increased arbitrarily, however, without a severe time penalty. Reducing the value of*Order*is an effective way to increase the analysis speed. You can often do so without dramatically affecting the results. - If tolerances are set for
*Frequency relative tolerance*and*Frequency absolute tolerance*(in the*Options*component, under the*Convergence*tab), decrease them to improve convergence and increase them to improve speed. This can help especially in the case of high-Q oscillators. Reductions in frequency tolerance can improve the accuracy of results, but the values should be reduced carefully to avoid very lengthy analyses. - Oscillator analysis works best with default convergence tolerances. Avoid loosening tolerances, especially
*I_AbsTol*, unless absolutely necessary.

### Correcting for Search Failures

Status messages inform you of the simulation process and results for each step in the three-step process. A failure in one step may lead to a failure in a successive step. Be sure to check the status messages to verify that a successful analysis was accomplished. A negligible power level resulting from the analysis is also the sign of a search failure.

If any step fails, consider the following to achieve proper results:

- If the linear oscillation search fails, first verify that circuit is properly biased and that either the OscPort component is located properly or the correct oscillator nodes were identified. If this is so, modify the OscPort parameters
*Octaves to Search*,*Steps per Octave*, and*MaxLoopGainStep*– notice high-Q effects. - If the approximate frequency search fails, switch to the fixed frequency search. Set the
*Octaves to Search*parameter to zero, make sure that the*Frequency*specified for the Fundamental Frequencies on the Freq tab is close to the expected frequency of oscillation, and resimulate. This analysis mode is useful for oscillators that don't display the usual concept of small-signal loop gain greater than one, such as ring oscillators. - If the approximate frequency and power search fails (or is extremely slow), you may need to specify an initial guess at the fundamental voltage. Give a value to the parameter
*V*in the OscPort component.

### Additional Potential Oscillation Frequencies

Some circuits may have more than one oscillation frequency. During the linear frequency search, which is done at the beginning of the analysis, the simulator will determine if the circuit contains additional potential oscillation frequencies. In the case that more than one frequency is found during the linear frequency search, the simulator uses the smallest oscillation frequency. A warning message will be given in the status window if additional oscillation frequencies are found, and the frequency values of the additional ones. The message will also state the frequency at which the simulation will continue for the remainder of the analysis. If additional potential frequencies are found, it is recommended that you re-examine your circuit design.

When performing an oscillator simulation (of a ring oscillator, for example) using *NumOctaves=0* on the OscPort component, or when *Octaves to Search=0* when specifying oscillator nodes, the simulator uses an alternate method to find the oscillation frequency. With this approach, the simulator does not perform the linear frequency search. Thus, it will not detect any additional potential oscillation frequencies in this mode.

### When You Question the Accuracy of Frequency Results

The accuracy of the completed oscillation frequency is a function of many variables. If you are concerned that results might be inaccurate, consider the following steps:

- It is possible that you have an insufficient number of harmonics to model your circuit. Increase the number of harmonics or add loss effects to your circuit, so that the higher-order harmonics become negligible.
- Decrease the values of
*Frequency relative tolerance*and*Frequency absolute tolerance*(in the*Options*component, under the*Convergence*tab). This forces the simulator to take additional iterations when refining the frequency-of-oscillation solution. The oscillator frequency is considered converged if

where is*Frequency relative tolerance*and is*Frequency absolute tolerance*. - Decrease the values of
*Voltage relative tolerance*,*Voltage absolute tolerance*,*Current relative tolerance*, and*Current absolute tolerance*(in the*Options*component, under the*Convergence*tab). This will increase the accuracy of the voltage and current computations and indirectly improve the accuracy of the oscillation frequency.

## Simulation Techniques for Recalcitrant Oscillators

Note

If you have purchased and installed the Oscillator DesignGuide, you can access the examples shown in this topic by selecting *DesignGuide* > *Oscillator* > *Solving HB Convergence Problems* from the Schematic window.

Harmonic balance simulation in ADS is an excellent way to analyze many oscillators in the frequency domain. Occasionally, you might have an oscillator that converges in a time-domain simulation, but the harmonic balance oscillator algorithm is unable to find the solution. There are two techniques for solving those oscillators:

- Analyze the large-signal loop gain in harmonic balance to find the point of oscillation and using that as an initial guess for the full harmonic balance oscillator analysis.
- Use a Transient Assisted Harmonic Balance.

The oscillator shown in the following figure is the starting point for our test case. This is a five-stage CMOS ring oscillator that oscillates at 86 MHz. The following two techniques that are demonstrated use a ring oscillator, but they can be used with any type of oscillator that won't converge in a standard harmonic balance oscillator simulation.

###### Five-stage CMOS ring oscillator

Transient analysis shows that it works, but if we run a harmonic balance simulation, the analysis fails with the following error message:

Error detected by HPEESOFSIM in frequency search during HB analysis `HB5'. Cannot find a frequency where loop gain phase equals 0.0 degrees. The magnitude of the loop gain is greater than one but additional phase shift around the loop is needed. Warning detected by HPEESOFSIM during HB analysis `HB5'. Oscillator analysis did not converge. Setting solution to zero. Warning detected by HPEESOFSIM during HB analysis `HB5'. More than one mixing term has landed on frequency 0 Hz.

### Using Transient Assisted Harmonic Balance

The simplest method is to use transient assisted harmonic balance. Simply set TAHB to *On* under the Initial Guess tab in the HB controller and leave all other fields blank to use default settings. The HB controller in the schematic is shown in the following figure.

###### Setup for harmonic balance analysis with TAHB set to On

The simulation goes quickly and the results are shown in the following figure.

###### Results using transient assisted harmonic balance

### Large-Signal Loop Gain Analysis

We will take the view that an oscillator is an amplifier with a feedback loop. An initial small signal due to thermal noise or a startup impulse from a power supply goes around the loop and gets amplified and phase shifted by some small-signal gain. This larger signal continues to go around the loop, getting larger. At some point, the nonlinear nature of the amplifier kicks in, and the gain starts to decrease due to gain compression as the signal gets larger. At this point, we have to start thinking of it as a large-signal gain that is dependent on the amplitude of the signal. Ultimately, the signal gets so large that the gain is reduced to unity, and if the signal gets any larger, the gain is less than unity. This is the limiting nature of an oscillator.

At the frequency at which the large-signal gain is unity, the circuit is capable of sustaining the same signal it oscillates. Another requirement for oscillation is that the phase shift around the loop is zero (really a multiple of 360 degrees). So we can say that an oscillator will oscillate at some fundamental frequency with some voltage at that frequency when that signal would set unity gain and zero phase shift around the loop.

The circuit shown in the following figure shows how we can simulate large-signal loop gain in ADS.

###### Simulating large signal loop gain

The S4P is defined to have some special properties.:

- S[2,1], the forward signal flow from port 1 to port 2, is one at all frequencies except the fundamental is zero.
- S[1,2], the reverse signal flow from port 1 to port 2, is one everywhere.
- S[2,3] defines the injection from the source at port 3 into the loop at port 2; it is set up to pass only the fundamental frequency.
- S[4,1] passes the full signal coming out of the loop to the termination at port 4. This terminates the fundamental but duplicates the rest of the signal (DC and harmonics). In this way, we have opened the feedback loop only at the fundamental frequency, allowing DC and the harmonics to continue to flow around the loop.

We can now inject a large signal tone at the fundamental frequency into the feedback loop and observe the fundamental after it travels around the feedback loop. We can then define the loop gain as the ratio of the voltage at the output to the voltage injected into the loop, both at the fundamental frequency. This analysis capability is built into the OscPort2 component in its large-signal loop gain mode.

#### Swept Large-Signal Loop Gain

We can now start our oscillator analysis. We will use a discrete version of the loop gain measurement rather than use the OscPort2, as it will be needed in the next step. The simulation setup is shown in the following figure. The OscPort2 is disabled, as it is replaced by the S4P circuit for this analysis. A harmonic balance analysis will be done where both the injected voltage *Vinj* and the fundamental frequency *Fosc* are swept. This is not an oscillator analysis, because we are specifying the analysis frequencies and driving the circuit with a source.

###### Setup for swept large signal loop gain

We will start with a fairly coarse sweep. Frequency will be swept from 80 to 90 MHz in 2 MHz, and the injected voltage will be swept from 0.1 to 1.1 V in 0.2 V steps. We are looking for the frequency and voltage that will sustain oscillation: that point at which the loop gain is unity with zero phase shift. In terms of the expressions used in the data display, this is *dB(LoopGain)=0* and *phase(LoopGain)=0*. A good way of viewing this is shown in the following figure. We plot *phase(LoopGain)* versus *dB(LoopGain)*, and the point of oscillation will be the (0,0) point on the graph.

###### Phase loop gain vs dB loop gain

The blue lines are lines of constant frequency and the red lines are lines of constant injected voltage. By using a marker, we can identify which line is which. We can see how the magnitude of the loop gain decreases as the injected voltage increases: the red lines move to the left as the voltage increases.

From this coarse plot, we can narrow down the range of our search for the next step. The frequency range will be swept from 84 to 87 MHz in 1 MHz step, and the injected voltage from 0.85 to 0.95 V in 0.02 V steps. The new results are shown in the following figure. The (0,0) point is circled for clarity.

###### Results with lower search range

We will make one additional refinement on this analysis. The frequency range will be swept from 84.0 to 84.5 MHz in 0.1 MHz steps, and the injected voltage from 0.890 to 0.895 V in 0.001 V steps. These results are shown in the following figure.

###### Results with modified frequency and injected voltage

Depending on the nature of the oscillator, more or less sweep refinements might be necessary. If the oscillator appears to be well behaved (plots have a nice grid-like structure), then less refinements may be needed. If the plots are more curvy, or show the possibility of multiple solutions, further refinement might be needed.

#### Optimization of Large-Signal Loop Gain

From this last analysis, we have a good estimate of the point at which oscillation will occur. Rather than continuing to manually sweep, we will switch to optimization and let ADS find this point by itself. From the last analysis, we can estimate a bounding box for the oscillation point and restrict the optimization to this range:

Fosc = 86.1 MHz opt {86.0 MHz to 86.5 MHz}

Vinj = 0.89 opt {0.88 to 0.90 }

The optimization goals are simple:

dB(LoopGain) = 0

phase(LoopGain) = 0

The circuit used is shown in the following figure. Only the simulation setup is shown; the rest of the circuit is the same as the previous one. A gradient optimization is done using the two goals. The object is to find the frequency and injected voltage at which the oscillation condition is satisfied.

###### Optimization setup

The plot in the next figure shows the optimization results.

###### Optimization results

The initial error values are shown, and they were fairly good to start with. But seven iterations get the error down below 10^{-8}. The final values are Fosc=86.1304 MHz and Vinj=0.890945 V.

#### Creation of Initial Guess

We run one final simulation with this circuit, setting specifications for VAR, MeasEqn, and Harmonic Balance. The large signal loop gain will be simulated at one point, which includes the values found from optimization. The harmonic balance simulation will save all of its results (the voltage spectra at every node in the circuit) in an output file, using the OutFile parameter. This will be used as initial guess for a full oscillator simulation.

The VAR, MeasEqn, and harmonic balance items are set up as follows:

**VAR2**

Zosc = 1.1

Vinj = 0/890945

Fosc = 86.1304 MHz

linj = Z.0*Vinj/Zosc**MeasEqn**

LoopGain = LoopOut[1]/LoopIn[1]**HB2**

Fre1[1] = Fosc

Order[1] = 15

OutFile = fig22_out

UseOutFile = yes

#### Final Oscillator Simulation

Now that we have a good initial guess for the oscillator, we can return the automatic oscillator algorithm in harmonic balance. To use this, we must enable the OscPort2 component and disable the S4P and related components that were added to compute the loop gain.

The simulation setup is shown in the following figure. Harmonic balance simulation is done, the oscillator mode is selected and the OscPort name is entered ("yes" means automatically find it). The initial guess is read in using the InFile parameter. It should be set to read the file that was written out in the last step.

###### Setup for final oscillator

The simulation goes quickly, as the simulator has a good initial guess. The initial guess code will complain that some components in the input file don't exist in the current circuit and vice versa, but that doesn't affect its ability to converge. The important nodes (those associated with the nonlinear devices) get the correct initial guess values. The harmonic balance oscillator algorithm refines the frequency and voltages a little, and this time converges. The results are shown in the next figure.

###### Results of final oscillation

If we look at the oscillation frequency to many decimal places, we'll see that the loop gain optimization came up with a slightly different value than the oscillator search algorithm found. They are close but vary a little because we did change the circuit a bit.

Fosc from optimization: 86.130 415 03 MHz Fosc input to osc analysis: 86.130 4 MHz Fosc final answer: 86.130 487 02 MHz

#### Summary of Simulation Techniques

The preceding shows two methods for solving difficult oscillators in harmonic balance using initial guesses. Initial guess can either be generated from harmonic balance by looking at the large signal loop gain, or from a transient analysis.

If we look at the oscillation frequency to many decimal places, we'll see that the loop gain optimization came up with a slightly different value than the oscillator search algorithm found. They are close but vary a little because we did make small changes to the circuit.

Transient method: Fosc from transient: 86.094 601 MHz Fosc input to osc analysis: 86.1 MHz Fosc final answer: 86.131 078 MHz Loop gain method: Fosc from optimization: 86.130 415 MHz Fosc input to osc analysis: 86.130 4 MHz Fosc final answer: 86.130 487 MHz

The harmonic balance oscillator results from the two methods are very similar. The frequencies differ by only 591 Hz, which is a relative difference of 6.9x10^{-6}.