8. Your own quantities with equations
Goal: define your own result quantities in the Fields Calculator and show them in reports and
field plots: the return loss of a port from the S-parameters, the power that flows through each port from
the fields, and the power flow along the guide as a field of its own. We use the waveguide of
section 1; the equations, reports and the field plot of this section are in
examples/WaveguidePost.hzn as well.
An equation has a name and a formula, for example RL = -dB(S(1,1)). Hertzon works out its type from
the formula:
| Type | Example | Where it is shown |
|---|---|---|
| Value of the S-parameters (no fields needed) | RL = -dB(S(1,1)) |
Solution data reports, category Equations, at every frequency of the solution |
| Value from the fields (an integral, a maximum, a point value) | P_in = flux(Port1Sheet, re(S)) |
Fields reports, at every frequency with saved fields |
| Field (a value at every point) | Sy = y(re(S)) |
Plot Fields, like Mag E, on faces, objects or cut planes |
Equations are saved with the design and listed in the project tree under Equations.
8.1 Return loss from the S-parameters
- Open
examples/WaveguidePost.hzn(or your model from section 1) and solve it (Analyze All, F5). - Results > Calculator. The Equations tab opens next to the 3D Modeler, and the ribbon shows the Equation page with fields, symbols, fractions, integrals and functions.
- Type
RL = -dB(S(1,1))and press Save (optionally with a description above the formula). While you type, the formula is shown typeset; on the right, the type (Scalar value), the unit and where to use it. An error is underlined where it is. - Right-click
RLunder Equations in the project tree > Add to Report. The report shows the return loss over the whole interpolating sweep from 8 to 12 GHz: an equation of S-parameters needs no fields, so it is computed at every frequency of the sweep. In an existing report, choose the category Equations and the quantityRL.
The Equations tab: the formula typeset in the middle, the same as one line of text below it, the type and unit on the right. The ribbon shows the Equation page while the tab is open.
RL over the interpolating sweep (report Return Loss in the example): from 0.13 dB at 8 GHz over 0.41 dB at 10 GHz to 0.92 dB at 12 GHz. The post reflects most of the power, so the return loss is small.
Equations can combine the network data in any way: Y(1,1), Z(1,1) and VSWR(1) work as well, for
example mismatch = 1 - |S(1,1)|^2 for the share of the power that enters the guide.
8.2 Power through the ports from the fields
The ports are fed with 1 W. The active power that flows through the port sheet is the flux of the real part
of the Poynting vector S through it.
- In the Equations tab, type
P_in =and open Integral > Flux through a face on the ribbon. Hertzon switches to the 3D Modeler and a box asks for the face: click the sheet of port 1 at y = 0 (or choosePort1Sheetin the box) and press Use. Back in the Equations tab the name stands below the integral sign. Fill the box with Function > Re and the field S. As text this isP_in = flux(Port1Sheet, re(S)), which you can also type directly. Save. - The same for port 2:
P_out = flux(Port2Sheet, re(S)). The flux counts along the normal of the sheet, here +y for both sheets, so both values are positive.flip(Port2Sheet)would count the other way. - Results > Create Report > Create Fields Report > Data Table, then add
P_outnext toP_in(category Equations). A Fields report computes its values from the saved fields, so it has the frequencies with fields: here the adaptive solution at 10 GHz, because the interpolating sweep stores only S-parameters. With a discrete or fast sweep with Save fields, a Fields report shows the value over frequency.
P_in typeset: the face below the integral sign, Re{S}·n dA. Type: scalar value, unit W, computed in the direction of the normal of Port1Sheet.
Fields report Port Powers at 10 GHz: 91.8 mW enter at port 1 and 91.5 mW leave at port 2.
What you should get: with 1 W incident, the power that enters the guide is 1 W · (1 − |S11|²) = 89.8 mW, and the power that leaves at port 2 is 1 W · |S21|² = 89.8 mW. The flux integrals give 91.8 mW and 91.5 mW: the guide is lossless, so in and out agree to 0.4 %, and both agree with the S-parameters to 2 % on this coarse mesh of 1 376 tetrahedra. A tighter Maximum Delta S brings them closer.
8.3 A field of your own
- Type
Sy = y(re(S)), the y component of the active power density, and Save. Its type is Scalar field with the unit W/m². - Results > More > Equations > Sy (or right-click
Syin the project tree > Plot Field...): set Plot on toXYand Cut position tob/2, as for the Mag E plot of section 1. - View > Orientation > Top. The plot shows how the power flows from port 1 around the post to port 2. It is drawn on screen again whenever you change and save the equation.
Sy on the cut plane halfway up the guide at 10 GHz (field plot Sy_Cut in the example): the power passes the post on both sides, up to 880 W/m².
8.4 The library, functions and other designs
Right-click Equations in the project tree > Open Library... for ready-made equations and functions:
loss densities, energy densities, the RMS and instantaneous field, and functions such as power(A),
voltage(L), current(C), loss_diel(V), loss_wall(A, sig), energy_e(V) and q_diel(V) (quality
factor from the dielectric loss). Tick one or more, or a whole group, and Import; they are copied into
the design and can be changed there. With the function power, P_out = power(Port2Sheet) gives the same
as above.
Open Library: the ready-made equations (field densities) and functions (integrals over a geometry passed as argument).
A few more examples of what the language covers:
| Equation | Meaning |
|---|---|
W = energy_e(Waveguide) + energy_m(Waveguide) |
Stored energy in the guide (J), with functions of the library |
E_peak = max(Waveguide, \|E\|) |
Peak field strength in a volume (V/m) |
V = int_line(Radial, E) |
Voltage along a drawn line, e.g. between inner and outer conductor of a coax |
P_mid = flux(cut_xz(L/2), re(S)) |
Power through a cut plane at y = L/2, no sheet needed |
p_wall = 0.5*rs(5.8e7 S/m)*\|Js\|^2 |
Wall loss density of a copper surface (W/m²), with the surface resistance rs(σ) |
Numbers can carry units (5.8e7 S/m, 2mm), and design variables can be used. Right-click Equations >
Export Equations... writes all equations and functions of a design into a file; Import
Equations... reads them into another design or project. AI assistants can create equations, reports
and field plots of them as well (MCP tools set_equation, set_report, set_field_plot).