# HP ADS 1.5 User-defined Models User Manual

Brand: HP, Pages: 216, PDF Size: 1.33 MB

### Page 156 from 216

6-6 The Frequency-Domain Defined Device

Custom Modeling with Frequency-Domain Defined Devices

The Frequency-Domain Defined Device

This section describes the equations and parameters of the FDD. A procedure for

adding an FDD to a schematic is in the section “Adding an FDD to a Schematic” on

page 6-23. For examples of FDDs developed into models, refer to the section“FDD

Examples” on page 6-28.

The frequency-domain defined device is represented on the circuit schematic as an

n-port, along with equations specifying the relationships between the spectral port

variables. An example of a 2-port FDD is shown here.

By usual convention, a positive port current flows into the terminal marked +.

Retrieving Values from Port Variables

The variables of interest at a given port are the port spectral voltages and port

spectral currents. Spectral voltages and currents can be obtained using the functions

_sv(), _si(), _sv_d(), and _si_d(), which are described in Table 6-2, and used in

conjunction with equations, which are described in the section “Defining Constitutive

Relationships with Equations” on page 6-8.The _sv() and _si() functions return

voltage or current values for a specific port and for a specific frequency. You choose

the port by port number, and you choose the frequency using a frequency index. The

index is either:

• The index to an FDD carrier frequency and its harmonics

• A set of indices that reference the frequencies of a harmonic balance analysis

For information on FDD carrier frequencies and indexing, refer to the section

“Specifying Carriers with the Freq Parameter” on page 6-10. For a description of

frequency indices from a harmonic balance analysis, refer to the section “Signal

Models and Sources” on page 6-2.

port 1port 2

equation

### Page 157 from 216

The Frequency-Domain Defined Device 6-7

As an example, to access the spectral voltage at port 1 for the second harmonic of the

first fundamental frequency, use the function _sv(1,2). Similarly, to access the port n

current at the frequency with indices [h1,h2,h3], use the function _si(n, h1, h2, h3).

Both of these functions return single complex values at each time point, unless the

specified envelope is baseband, in which case the value is real. The underscore in the

function names is used so as to not conflict with user-defined functions, and to signify

that these functions only have meaning within the context of evaluating the FDD

device. They cannot be used to directly generate output variables, for example.

The _sv() and _si() functions return the present value of the specified spectral

envelope. For transient, convolution, or Circuit Envelope simulations, it is also

desirable to access past values of the spectral port variables. This can be done using

the _sv_d() and _si_d() functions, which are described in Table 6-2. These functions

have a delay parameter. For example, to find the value of the port 2 voltage at the

[2,-1] intermod frequency 10 msec ago, use _sv_d(2, 10us, 2,- 1).

The delay values in the _sv_d() and _si_d() functions can be variables that change

during the simulation. However, these delay variables must have their maximum

value at time t=0. This is to allow proper initialization of the required history buffers.

This criteria can usually be met with an expression such as

fdd_delay = if (time = 0) then max_delay else variable_delay endif.

where max_delay is some reasonable value that the variable_delay is known to never

exceed.Table 6-2. Functions for Accessing Spectral Ports and Currents

Name Description

_sv(port, findex)

†

†

findex can refer either to the index of an FDD carrier frequency as defined with the freq parameter and its harmonics or a set of indices that reference the fundamental

frequencies of a harmonic balance analysis.Returns the spectral voltage for the specified port at

the specified frequency index.

_si(port, findex) Returns the spectral current for the specified port at

the specified frequency index.

_sv_d(port, delay, findex) Returns a past value of spectral voltage for the

specified port and time delay at the specified

frequency index.

_si_d(port, delay, findex) Returns a past value of spectral current for the

specified port and time delay at the specified

frequency index.

### Page 158 from 216

6-8 The Frequency-Domain Defined Device

Custom Modeling with Frequency-Domain Defined Devices

Also, FDDs require that all state variable dependencies that will ever exist must

exist at time = 0. For example, the following equation describes a discrete

accumulation operation, with a reset to 0 at time = 0:

v[2,0] = if (time = 0) then 0.0 else _sv_d(2,timestep) + _sv(1,0) endif

However, it must be modified to work with the FDD so that both state variable

dependencies as well as the maximum delay at time = 0. The following satisfies this

criteria by adding an insignificant portion to the time = 0 value.

next_state = _sv_d(2,timestep) + _sv(1,0)

v[2,0] = if (time = 0) then 0.0 + next_state*1.0e-100 else next_state endif

Defining Constitutive Relationships with Equations

An unlimited number of equations can be used to define constitutive relationships

between the port voltages and port currents. There are two basic types of equations

allowed, current equations and voltage equations. Their basic format is:

i[port, findex] = f(_sv(),_sv_d(),_si(),_si_d())

v[port, findex] = f(_sv(),_sv_d(),_si(),_si_d())

The equations can be listed in any order, and more than one equation can be used for

a single port, but each port must have at least one equation.

Note the use of indices on the left side of the equations. This is similar to the use of

indices in the _sv() and other functions that were previously described, they can be

can be either the index to an FDD carrier frequency and its harmonics or a set of

indices that reference the frequencies of a harmonic balance analysis. Indices are

discussed in the sections “Signal Models and Sources” on page 6-2 and “Specifying

Carriers with the Freq Parameter” on page 6-10.

In order for a port current to be used on the right side of an equation, at least one

voltage equation for that port must be defined. It does not matter which harmonic

indices are used for this. Normally, the simulator does not generate current-state

variables, only node voltage-state variables. This is sufficient as long as the devices

are modeled as voltage-controlled current sources. This is also the most efficient

method in terms of speed and memory. However, current-controlled sources can be

generated but the simulator requires an additional equation to define this current.

The presence of a voltage equation signifies this to the simulator. In general, the

voltage equations should only be used when the voltage-controlled current equations

are insufficient. Refer to “Modified Nodal Analysis” on page 5-45, for more detail.

### Page 159 from 216

The Frequency-Domain Defined Device 6-9

While the SDD has truly implicit equations of the form f(_v1,...,_vn,_i1,...,_in)=0

the FDD does not. However, the equivalent effect can be generated by adding the left

side to the right side of the voltage equations. For example,

v[2,1,0]=f(_sv(1,0),_si(2,1,0))+_sv(2,1,0)

has effectively generated the implicit equation f(...) = 0. The FDD is different in this

respect in order to solve the problem of how to define the voltage at all unspecified

spectral frequencies. The above voltage equation also generated a number of

additional implied equations that say

v[2,all other harmonic indices] = 0.0.

Note that all equations for the same spectral port variable are effectively added

together, so if you also define an equation for another spectral frequency at the same

port (i.e., v[2,0] = vcalc), this additional implied equation that sets the voltage to zero

is ignored.

For a procedure on how to add current and voltage equations to an FDD, refer to the

section “Defining Current and Voltage Equations” on page 6-24.

Continuity

As with any Newton-Raphson based circuit-solving algorithm, the constitutive

relationships should be differentiable with respect to each of the specified spectral

voltages and currents, and these derivatives should be continuous. Discontinuous

derivatives may cause the simulator to have trouble converging.

One possible technique to improve convergence, or to circumvent the above

limitations, is to add delay between the input and output using the _sv_d() or _si_d()

functions. If this delay is greater than the simulation timestep, then the derivative

information is no longer needed or used. If this delay is acceptable behavior for the

model, simulation speed can be improved.

Large step discontinuities in the time-domain functions can also create convergence

problems, either taking longer to solve or possibly causing convergence failure.

Although having continuous derivatives with respect to time is not as important as

having continuous derivatives with respect to the spectral port variables, care should

be taken when using abrupt time functions.

### Page 160 from 216

6-10 The Frequency-Domain Defined Device

Custom Modeling with Frequency-Domain Defined Devices

Specifying Carriers with the Freq Parameter

The FDD has a repeatable freq[n] parameter, which can be used to define one or more

carrier frequencies. The [n] is used to identify each carrier, for example, freq[1]=100

MHz, freq[2]= 350 MHz. If carrier frequencies are defined for the FDD, you can

reference them using _sv() and related functions in order to collect voltages and

currents at carrier frequencies and their harmonics. The syntax to reference them is

to set the first index parameter equal to the negative of the carrier frequency number

[n]. The optional second index parameter specifies the harmonic of that carrier

frequency. For example, if an FDD has defined freq[3]=800 MHz, then _sv(1,-3,3)

specifies the port 1 spectral voltage at the envelope closest to 2.4GHz. If there is no

analysis frequency close enough to 2.4 GHz (within 0.5/Timestep for Circuit

Envelope), then this function simply returns 0.0 and generates a warning. Note that

_sv(1,3,3) would be unaffected by the carrier frequency parameters but still refer to

the envelope at 3*_freq1 + 3*_freq2, where freq1 to _freq12 are predefined variables

that are set to the fundamental frequencies defined by the analysis.

The FDD freq parameter behaves differently than the source freq parameter (referred

to in the section “Defining Sources” on page 6-5) in that any acceptable offset

frequency between the carrier frequency and envelope center frequency is ignored.

For example, given an envelope analysis with a fundamental frequency of 0.5 GHz, a

timestep of 1msec, and FDD freq[1] = 500MHz and freq[2]=500.1MHz, then _sv(1,-1)

and _sv(1,-2) would return the same value, the port 1 spectral voltage at 500 MHz. (If

timestep is changed to 1msec, then _sv(1,-2) would return 0.0.)

Note that it is not possible to reference a mixing product of multiple carrier

frequencies. If this is desired, then an additional carrier frequency equal to the

desired mixing product frequency must be defined. For an example, refer to the mixer

example in the section “Mixer” on page 6-31.

For a procedure on how to add freq parameters to an FDD, refer to the section

“Defining Frequency Parameters” on page 6-25.