User Defined Functions Enhance the Power and Flexibility of Design and Simulation Software
By Dale D. Henkes, ACS
Computer aided engineering (CAE) and electronic design automation (EDA) software have become indispensable for engineers designing circuits for products operating in the RF, microwave and millimeter wave bands and beyond. While the increased dependence on these software packages has been and continues to be immensely beneficial to the user, some degree of creativity is yielded to the types of solutions provided by the EDA program and the way the program itself is structured. A certain way of approaching a problem is sometimes forced on the user by the program’s work flow model, menu structure, features and available tools.
A great degree of flexibility and creative power is given to the user when some kind of user programmability or user defined functions are provided by the software. The LINC2 Pro circuit simulator from Applied Computational Sciences (ACS), provides user variables and user defined functions for enhancing the flexibility and power of the software.
There are two kinds of functions available to the user for customizing the LINC2 simulator such that it produces the simulations and analyses that are most satisfying to the user. These can be broadly categorized as either input functions or output functions. In the LINC2 simulator, output functions are generally built-in functions that provide new ways of processing and viewing simulation results. For example, an intrinsic function can be employed to find the loaded Q of a circuit or, more specifically, the exact frequency at which the maximum loaded Q is obtained — a useful feature in designing oscillator circuits for low phase noise. In a July 2008 MPD article on VCO design, this author demonstrated the use of LINC2 intrinsic functions for plotting the frequency of oscillation of a VCO as a function of the VCO’s varactor tuning voltage .
On the other hand, input functions can be created that utilize user defined equations for formulating new relationships between named variables and circuit component values. This gives the user the ability to create new component models or to modify existing ones. For example, in the aforementioned article , a regular capacitor was converted to a varactor diode type tuning capacitor by writing an equation that captured the specific varactor diode’s voltage to capacitance transfer function. This allowed the simulation of the voltage-controlled oscillator (VCO) to track and display the frequency of oscillation as a function of tuning voltage rather than tuning capacitance, thus rendering a natural response more meaningful to the user.
LINC2 user defined equations are made up of any combination of numerical constants, mathematical functions (from a library of built-in functions), arithmetical operations (+/-*), and user defined variables. This article will demonstrate how user defined equations can be used to construct a circuit design template that can create a circuit function uniquely adapted to a set of user specifications for a given application. Variables and equations can be placed on the schematic page along with the circuit schematic. When these equations are formulated to calculate component values from variables whose values are input by the user, such that they capture the design specifications or operational aspects of the circuit (frequency of operation, port impedances, circuit Q or coupling factor, etc.), the result is a complete design template that can be used repeatedly to customize the circuit’s function to new requirements. Simply changing the values of the input variables instantly creates a circuit that is uniquely adapted to the new application.
At this point it should be beneficial to explain what a variable is in context of the circuit simulator and its related functions.
Types of Variables - Scope
There are at least two different kinds of variables through which the user (or optimizer) can modify circuit component parameters in real time. The difference is primarily in the scope of the variable. The scope can be local or global.
A component parameter value enabled for tuning, as shown in Figure 1, has local scope since it has influence only over that particular parameter of that one parent component (C2 in this case). Changing its value manually during a simulation tuning session, or automatically during optimization, only affects the parameter value of that one component. On the other hand, a global variable is a user defined and named variable that can be assigned to any number of parameters in any number of components across the entire circuit schematic (e.g. CVar in Figure 3). When the value of a global variable is changed by tuning or optimization, then every parameter that has been assigned the name of the global variable is updated simultaneously with the new value (Figures 3 and 4).
Consider the schematic of the tunable filter in Figure 1. The filter is tuned across a range of frequencies by simultaneously changing the values of C1 and C2 while at the same time keeping C1 = C2. Checking the Tune box next to a component’s parameter value (as shown in the lower right of Figure 1) enables that parameter (capacitance of C2 in this case) for tuning and creates a local variable with the same name in the simulation graph’s Tune menu as shown in Figure 2.
However, as we tune the filter (i.e. change the center frequency) we cannot meet the requirement of C1 = C2 with one (tuning) operation using local variables. As we increase the value of C1 and then subsequently C2, the filter response moves to the left through a severely distorted transitional filter response shape (blue curve in Figure 2) until we change C2 also to equal the new value of C1.
A smoother way to view the tuning response of the filter would be to set up a single global variable (such as CVar in Figure 3) and assign its value to both C1 and C2 so that tuning one variable equally and simultaneously tunes both tuning capacitors as required to maintain the proper filter response (Figure 4). The process whereby a variable is set up to control two or more circuit component parameters simultaneously is referred to as gang tuning. Gang tuning is especially useful in circuits where many similar or identical sections need to be tuned together, such as in the four section tunable filter . This saves a lot of time and effort over manually tuning each component, one by one, until their new values are all equal.
However, there are times when it is advantageous to use individual local variables even when the normal operation of the circuit is for the respective circuit component values to track each other. In this way, the user can investigate the adverse consequences of a non-alignment of the components as demonstrated by the blue curve in Figure 2 (where C1=1.5pF and C2 is mistuned at 0.9pF).
The LINC2 circuit simulator offers yet another type of global variable called the Swept Variable. In high frequency circuit simulation, the most common type of output is some rendering of the frequency response of a circuit quantity such as gain or return loss (i.e. a circuit response as a function of frequency). However, a Swept Variable allows for a rendering of the circuit response not as a function of frequency, but as a function of the swept variable itself (at a specific fixed frequency). Executing a variable parameter sweep answers the question “what influence does this particular component or circuit parameter exert on circuit performance at any given frequency?”
The swept variable can be assigned directly to a circuit component parameter (similar to the regular variable assignments made in Figure 3) or indirectly, through a user defined equation as shown in the schematic of Figure 5. The tunable filter of Figure 5 is the same circuit previously discussed from Figures 1 and 3, with the exception that the variable capacitors C1 and C2 have been replaced by varactor tuning diodes C1 and C2. Here, each varactor’s capacitance is assigned the value of the function CVarFunc. CVarFunc = 21.54/(1 + Varactor_V/13)^10.5 captures the varactor diode’s voltage to capacitance transfer function.
Using the swept variable Varactor_V to represent the tuning voltage applied to the varactors, the filter’s tuned frequency response (the frequency to which it is tuned, i.e. the center frequency of the filter) can be plotted as a function of the varactor tuning voltage (Figure 6). The graph displayed in Figure 6 uses the intrinsic function Maximum(|S21|) to plot the frequency of the peak magnitude of S21 (which is approximately equal to the filter’s pass band center frequency) as a function of the varactor tuning voltage, Varactor_V. The green plot relative to the left vertical axis of Figure 6 indicates that the filter can be tuned between approximately 1500 MHz and 2700 MHz for a tuning voltage ranging between 3 and 5 volts. The blue curve (relative to the right vertical axis) plots the varactor’s capacitance as a function also of the tuning voltage (Varactor_V). This plot indicates that the filter’s tuning varactors will present a capacitance to the circuit ranging between 0.7 pF and 2.43 pF for a tuning voltage ranging from 3 to 5 volts.
Further details on the application of swept variables for the design and analysis of tunable RF circuits can be found in references  and .
Using LINC2 Equations to Design Circuits and Components
Design Template for the Lumped Element Directional Coupler
We can now apply the concepts of equations and variables to the construction of circuit design templates that can be reused over and over again to tailor the circuit’s function to a new set of design requirements.
Figure 7 shows a design template for designing lumped element directional couplers. Variable Zc specifies the port impedances, Fre specifies the operating frequency (in MHz) and C_F sets the coupling coefficient in dB.
Equations LVal, CVal and Cc_Val implement the design formulas for automatically calculating all the component values . In the simulation, the result of equation LVal is assigned to inductors L1 through L4, while the equation value for CVal is assigned to capacitors C1 and C2. Equation Cc_Val calculates the value in pF for the remaining components, C3 and C4.
The Analyze button starts the simulation and View > Plot produces the simulation results shown in Figure 8. The simulation indicates that the coupled port produces coupling very close to the desired 20 dB value (at 19.96 dB). With the level down 40 dB on the isolated port, 20 dB of directivity is achieved. Although the simulation was run from a schematic employing ideal components, the LINC2 capacitor and inductor models used here are capable of simulating the non-ideal aspects of the actual parts that they represent. When the component Q values for all the inductors and capacitors are reduced to practical values (around 100), the results are still very close to those displayed in Figure 8. With component Qs of 100, the insertion loss degrades by less than 0.25 dB and there is only 1 dB loss in directivity.
The design and simulation capabilities of the circuit simulator can be significantly extended through the provision of user defined equations and variables. Variables and equations can be placed on the schematic page as an integral part of the actual circuit schematic. These equations can then be formulated to become the design equations for a particular component (such as a filter, directional coupler, attenuator, BALUN, etc.) or an entire circuit function such as an impedance matching network. When certain variables used in the design equations represent design specifications or operational aspects of the circuit (such as frequency of operation, port impedances, coupling factor, etc.) then simply changing these input variables instantly creates a circuit uniquely adapted to the new application! For example, changing input variables Fre and C_F to 400 MHz and -30 dB (coupling), respectively produces the simulation results for the 400 MHz 30 dB coupler shown in Figure 9. When equations and variables are used with schematics in this way they create efficient design templates that can be reused many times to adapt the circuit to the various requirements of a new application. Incorporating equations into the schematic also helps to document the design, providing a record of how the circuit’s component values are calculated. This kind of self documenting schematic will be better understood at a later date when the schematic file is again reloaded.
The LINC2 Pro software used in these examples is a high performance, low cost, RF and microwave design and simulation program from ACS (Applied Computational Sciences, Escondido, CA). The LINC2 software suite provides circuit simulation, optimization and statistical yield analysis as well as many value-added features for automating design tasks, including circuit synthesis and equation based modeling and optimization. More information about LINC2 can be found on the ACS web site at www.appliedmicrowave.com.
 Henkes, Dale D., “LINC2 Software Enhances the Design and Analysis of VCOs and Other Tunable RF and Microwave Circuits”, Microwave Product Digest, July 2008.
 Henkes, Dale D., “Software Enhances the Design and Analysis of Tunable Circuits”, High Frequency Electronics, July 2008.
 Vizmuller, Peter “RF Design Guide: Systems, Circuits and Equations”, Artech House Publishers, 1995, ISBN: 0-89006-754-6.
this article to a friend!