# Apply Matching Circuit | XFdtd

Update results based on an *.s2p matching circuit file.

The Apply Matching Circuit macro inserts a matching circuit into an unmatched feed as a post-processing step and computes, reports, and plots results for the matched antenna.

## Background

Engineers designing an antenna's matching circuit begin by simulating an unmatched antenna in a full-wave electromagnetic solver, such as XFdtd. They then send both the S-parameters and efficiency results to a circuit solver, where a matching circuit is synthesized. Because circuit solvers consider a limited set of results, they must import the synthesized matching circuit into XF as a post-processing step so that the full-wave results—such as envelope cross correlation (ECC), specific absorption rate (SAR), and hearing aid compatibility (HAC)—reflect the performance of the matched antenna.

For example, when simulating a GPS-Bluetooth antenna in XF, the unmatched antenna is excited by connecting a voltage source between the ground and the input to the antenna. This is equivalent to connecting a source to a load. After performing a simulation, users pass both the S-parameters and efficiency results to Optenni Lab, where a matching circuit is synthesized. In order to see the matched antenna's SAR and other full-wave results, Optenni Lab's matching circuit must be exported to an *.s2p file and then imported into XF using the apply matching circuit script. This script places the matching circuit between the voltage source and the antenna, and recomputes the results as if the antenna were matched.

## Prerequisites

This macro applies a matching circuit that is supplied by an .s2p file. Before running the script, users must generate this file by completing the following steps:

1. Set up an XF project to include unmatched antennas and a 3-D far zone sensor. If desired, specify other sensors including SAR and HAC.
2. Compute S-parameters, select the port(s) of interest, and specify steady-state frequencies when creating the simulation.
3. Export the S-parameter and 3-D far zone data to a circuit simulator, such as Optenni Lab or ADS.
4. Synthesize a matching circuit topology and component values.
5. Export the matching circuit to an .s2p file.

## Workflow

After complying with the prerequisites, run the macro by following these steps:

2. Right-click on Scripts in the Project Tree and select Import Scripts.

Once the script is available, select a result.

1. Open the Results browser.
2. Left-click on a far zone sensor result in the lower portion of the Results browser.
3. Double-click on Apply Matching Circuit in the Scripts branch of the Project Tree to open the Scripting window.
4. Click Execute at the top of the window, then select Execute Macro to open the Apply Matching Circuit window.

In the Port Specification section of the window, users must select a minimum of one port to which the matching circuit will be applied.

1. In the Port Specification section of the window, check each port of interest.
2. Enter the Feed Resistance by typing into the field.
3. Enter the Available Power by typing into the field.

The .s2p file specified in the macro window represents the matching circuit, where Port 1 of the file is connected to the feed and Port 2 of the file is connected to the antenna.

1. Click the browse button underneath the Matching .s2p file setting and choose the desired file.
2. Click Open.

The SAR and HAC Sensors section allows users to select which sensors to include in the post-processed results. These options increase computation time, and are greyed-out when the sensors are unavailable.

1. In the SAR and HAC Sensors section, check the desired sensors.

Selections made in the Plots vs. Frequency section determine the resulting graphs. Choosing S-parameters Diagonal Only plots only the $S_{ii}$ for S-parameter graphs rather than all $S_{ij}$. The frequency axis is discrete, and determined by the steady-state frequencies provided during simulation setup.

1. In the Plots vs. Frequency section, check each desired output.
2. Click OK.

All data appears in the Scripting window's output. The script adds a graph to the Project Tree for each selected plot type.