Macro Command List

The following is a list of commands that may be used in a Sonnet macro command (*.smc) file.

Expressions in square brackets [] are optional, and Expressions in angle brackets <> are placeholders that should be replaced with actual values.

Many commands include an optional assignment-list. An assignment-list contains one or more assignments, where an assignment is in the form of key=value. To see a list of assignments, follow these steps:

Open a project that contains the element in which you are interested.

Select Launch > Auto Documentation.

Click the Macro Assignments tab.

A list of all items, their Macro IDs, and their assignments are listed.

Add Commands

add project

Usage:

add project id=<macro_id> [template="<sonx_file>"] [assignment-list]

Description:

Opens a new or existing Sonnet project in the macro environment. If a template file is not specified, then the new project will not contain any dielectric layers, Tech Layers, or sweeps.

The assignment list may include units. Although the units are not required, it is highly recommended that you specify them if not using a template file because your default units may be changed by using the Sonnet GUI. If this occurred, your macro would produce different results. Valid keys and values are given in the following table.

Key Allowed Values
Angle_unit* DEG, RAD
Capacitance_unit F, MF, UF, NF, PF, FF
Conductance_unit* /MOH, US, /KOH, MS, /OH, S, KS
Conductivity_unit SM, SCM, MSCM, USCM
Frequency_unit HZ, KHZ, MHZ, GHZ, THZ, PHZ
Inductance_unit H, MH, UH, NH, PH, FH
Length_unit NM, UM, MM, CM, M, MIL, IN, FT
Roughness_unit NM, UM, MM, CM, M, MIL, IN, FT
Resistance_unit WOH, OH, KOH, MOH, GOH, TOH
Resistivity_unit OHCM, OHMM, OHUM
SheetRes_unit OHSQ, MOSQ
*Angle and Conductance units are not presently used in Sonnet but are included for potential future compatibility. The defaults for these units are DEG and /OH.

Examples:

add project id=project1 Angle_unit=DEG Capacitance_unit=PF Conductance_unit=/OH Conductivity_unit=SM Frequency_unit=GHZ Inductance_unit=NH Length_unit=UM Roughness_unit=UM Resistance_unit=OH Resistivity_unit=OHCM SheetRes_unit=OHSQ

 

add project id=project1 template="mytemplates/basic1.sonx"

 

add tech_file

Usage:

add tech_file path=<file_path>

Description:

Links a Technology File to the project.

 

add dielectric

Usage:

add dielectric id=<macro_id> [assignment-list]

Description:

Adds a dielectric material to the project.

Examples:

add dielectric id=dielectricA Name="GaAs" Eps:Value=12.9 Tan:Value=1.0e-3

The example above adds an isotropic dielectric material. By default, dielectrics are isotropic and the isotropic value must be specified using the ":Value" tag as shown. See the next example for an anisotropic example.

add dielectric id=Crystal1 Name="Crystal1" Anisotropic=true Eps:X=15.6 Eps:Y=15.6 Eps:Z=Kz Tan:Value=2.0e-3

The example above adds an anisotropic dielectric material. "Anisotropic=true" must appear before all the other specifications.

add conductor

Usage:

add conductor id=<macro_id> [assignment-list]

Description:

Adds a conductor material to the project.

 

add diel_layer

Usage:

add diel_layer id=<macro_id> num=<level_number> [assignment-list]

Description:

Adds a dielectric layer at level number <level_number>.

 

add tech_layer_planar

Usage:

add tech_layer_planar id=<macro_id> diel_layer=<diel_layer_id> [assignment-list]

Description:

Adds a Planar Tech Layer to the dielectric layer that has the Macro ID <diel_layer_id>.

 

add tech_layer_via

Usage:

add tech_layer_via id=<macro_id> from=<from_id> to=<to_id> [assignment-list]

Description:

Adds a Via Tech Layer from <from_id> to <to_id>. The values <from_id> and <to_id> can be Planar Tech Layer Macro IDs or dielectric layer Macro IDs. Use TOP and BOT for the top cover and bottom cover, respectively.

Example:

add tech_layer_via id=viaTLG from=diel_layerA to=BOT Name="Cu1" Color="#303060" Pattern="dotdash" MaterialName="Copper"

 

add tech_layer_brick

Usage:

add tech_layer_brick id=<macro_id> diel_layer=<diel_layer_id> [assignment-list]

Description:

Adds a Brick Tech Layer to the dielectric layer that has the Macro ID <diel_layer_id>.

 

add polygon

Usage:

add polygon id=<macro_id> tech_layer=<techlayer_id> points=<point_set> [assignment-list]

Description:

Adds a polygon with the point set of <point_set> to the Tech Layer that has the Macro ID <techlayer_id>.

Example:

add polygon id=polygonW tech_layer=planarTLB points=60,90;90,90;90,0;130,0;130,90;160,90;160,140;60,140

The example above adds a polygon to the Tech Layer with the macro ID of "planarTL1". The points are with respect to the Local Origin (0,0 by default).

add port

Usage:

add port id=<macro_id> port_number=<port_number> poly=<polygon_id> edge=<edge_number>

Description:

Adds a port with the port number of <port_number> to the <edge_number> edge of the polygon that has the Macro ID <polygon_id>.

Example:

add port id=portB port_number=2 poly=polygonC edge=3 # Add output port.

 

add variable

Usage:

add variable id=<macro_id> var_name=<variable name> value=<variable value>

Description:

Adds a variable with the name <variable name> and value <variable value>.

Example:

add variable id=variableC var_name=myvar value=20

The example command above adds a variable called "myvar" with a value of 20.0.

add sweepset

Usage:

add sweepset id=<macro_id>

Description:

Adds an empty sweep set to the project.

Example:

add sweepset id=sweepsetB

 

add freq_sweep

Usage:

add freq_sweep id=<macro_id> set=<sweepset_id> <freq_sweep_type> <freq_sweep_params>

Description:

Adds a frequency sweep with the given type and parameters to the sweep set <sweepset_id>. The <freq_sweep_type> values and corresponding parameters are as follows:

  • adaptive start=<start_freq> stop=<stop_freq>
  • linear start=<start_freq> stop=<stop_freq> step=<step_value>
  • exponential start=<start_freq> stop=<stop_freq> num_points=<number of points>
  • list freqs=<comma separated values>
  • single_freq freq=<freq_value>
  • dc_freq [freq=<freq_value>]

 

Example:

add freq_sweep id=freq_sweepB set=sweepsetB adaptive start=0.0 stop=10.0

add freq_sweep id=freq_sweepC set=sweepsetA list freqs=10, 15, 20

 

add param_sweep

Usage:

add param_sweep id=<macro_id> set=<sweepset_id> var=<var_id> <var_sweep_type> <var_sweep_params>

Description:

Adds a parameter sweep for the variable with macro ID <var_id> to the sweep set <sweepset_id>. The <var_sweep_type> values and corresponding <var_sweep_params> are as follows:

  • linear start=<start_value> stop=<stop_value> step=<step_value>
  • exponential start=<start_value> stop=<stop_value> num_points=<number of points>
  • list values=<comma separated values>
  • single_value value=<value>
  • corner min=<min_value> max=<max_value>
  • sensitivity min=<min_value> max=<max_value>

 

Example:

add param_sweep id=param_sweepA set=sweepsetA var=Lstub linear start=200 stop=300 step=5

 

add output_file

Usage:

add output_file id=<macro_id> path=<file_path> [output_specs]

Description:

Adds an output file specification to the project. After saving, analyzing the project will generate that output file. If <file_path> includes the string $BASENAME, then the output file's base name will be the project file's base name. Output specs are as follows:

  • param=<param_value>, where the possible values are S, Y and Z
  • file_format=<file format>, where the possible values are TOUCH, DATA_BANK, CADENCE, CSV, TOUCH2 and MDIF.
  • format=<data format>, where the possible values are RI, MA and DB (Real/Imaginary, Magnitude/Angle, and dB/Angle, respectively).

 

Example:

add output_file id=output_fileA path="$BASENAME.s2p" param=S file_format=TOUCH format=RI

In the example above, the special string "$BASENAME" is used. When the EM solver runs, it will generate an output file that has the same base name as the input project file name. For example, if the project name is "filter.sonx", the output file will be "filter.s2p".

Modify Commands

modify

Usage:

modify <macro_id> <assignment> [assignment-list]

Description:

Changes the properties of an element. See the corresponding "add" command for more examples. Please note the following restrictions:

  • Frequency sweeps, parameter sweeps, and sweep sets may not be modified at this time. Instead, use delete and add commands.
  • You may modify the path/name of an output file, but you may not modify any of the other parameters of an output file. Instead, use delete and add commands.

 

Examples:

modify dielectricB Eps:Value=3.75 Tan:Value=0.005

 

modify port1 Inductance=1.5

 

modify project1 box_size_x=200.0 box_size_y=100.0 num_cells_x=800 num_cells_y=400 # Set Analysis Box size and number of cells. Cell size = (box size)/(number of cells).

 

modify project1 local_origin=40,100 # move local origin to global coordinates (40,100).

 

modify top_cover MaterialType="Free Space"

 

modify bot_cover MaterialType="Material" MaterialName="Silver" Thickness="1.0" Roughness="1.2"

 

modify variable1 Value=0.50

 

Move Commands

move_polygon

Usage:

move_polygon <macro_id> by <x,y>

Description:

Moves the polygon with the given Macro ID by x,y distance.

Example:

move_polygon polygon3 by 10,0

 

move_vertex

Usage:

move_vertex <macro_id> vertex=<vertex_number> to|by <x,y>

Description:

Moves the <vertex_number> vertex of the polygon with the given Macro ID. Using "to" moves the vertex to the given absolute <x,y> location with respect to the Local Origin (0,0 by default). Using "by" moves the vertex by the <x,y> distance relative to the original location of the vertex.

Examples:

move_vertex polygonB vertex=2 by 10.0,-20.0   # Move vertex 10 units right and 20 units down.

move_vertex polygonJ vertex=0 to 10.0,200.0   # Move vertex to coordinate (10.0, 200.0).

 

move_component

Usage:

move_component <macro_id> by <x,y>

Description:

Moves the Component with the given Macro ID by the <x,y> distance relative to the original location of the Component.

Example:

move_component componentA by 1.0,-3.2

The example above moves the Component 1.0 units in the x-direction and -3.2 units in the y-direction. The Component's ports and label also move with the Component.

move_component_port

Usage:

move_component_port <macro_id> terminal=<terminal_number> to|by <point>

Description:

Moves the <terminal_number> port of the component with the given macro ID. Using "to" moves the port to the given point with respect to the Local Origin (0,0 by default). Using "by" moves the port by the x, y coordinates of point.

Example:

move_component_port componentA terminal=1 by -60,80.0     # Use relative coordinates

move_component_port componentA terminal=2 to 840.0,960.0  # Use absolute coordinates (relative to local origin)

 

Delete Commands

delete polygon

Usage:

delete polygon <macro_id>

Description:

Deletes the polygon with the given macro ID.

Example:

delete polygon polyAD

 

delete port

Usage:

delete port <macro_id>

Description:

Deletes the port with the given macro ID.

Example:

delete port portB

 

delete sweepset

Usage:

delete sweepset <macro_id>

Description:

Deletes the sweep set with the given macro ID.

Example:

delete sweepset sweepsetA

 

delete freq_sweep

Usage:

delete freq_sweep <macro_id>

Description:

Disables the frequency sweep with the given macro ID. The frequency sweep is still in the file, but disabled.

Example:

delete freq_sweep freq_sweepA

 

delete param_sweep

Usage:

delete param_sweep <macro_id>

Description:

Deletes the parameter sweep with the given macro ID.

Example:

delete param_sweep param_sweepA

 

delete output_file

Usage:

delete output_file <macro_id>

Description:

Deletes the output file with the given macro ID.

Example:

delete output_file output_fileA

 

Save Commands

save

Usage:

save path="<file_path>"

Description:

Saves an open project as the given file path.

Example:

save path="output/2dmodel.sonx"

 

Analysis Commands

verify_project

Usage:

verify_project

Description:

Checks the active project for analyzability. If the project cannot be analyzed, an error message will be printed to stderr.

 

analyze

Usage:

analyze [monitor] [server=<hostname>:<port>]

Description:

Analyzes the project file associated with the active project. You should always save the project before analyzing. The active project is the last referenced project. See the "using" command if you wish to change the active project. If a server is specified, the analysis will be performed on the remote server. Otherwise, the analysis will be performed on the local computer. If the monitor option is specified, it will launch a status monitor window, similar to a Job Queue tab, so you can monitor the progress of your analysis. Otherwise, the analysis is performed in the background without any visual feedback.

 

clean_data

Usage:

clean_data

Description:

Deletes all of the analysis and log data stored in the active project. The active project is the last referenced project. See the "using" command if you wish to change the active project.

 

Get Commands

get num_ports

Usage:

get num_ports

Description:

Prints the number of ports to stdout in JSON format.

 

get variables

Usage:

get variables

Description:

Prints the information on variables to stdout in JSON format.

 

get optimization

Usage:

get optimization

Description:

Prints the information on optimization settings to stdout in JSON format.

 

Miscellaneous Commands

using

Usage:

using <macro_id>

Description:

Sets the active project. This is useful when there are multiple projects in the same macro and you wish to specify which project is used by commands such as "save" or "clean_data".

 

launch

Usage:

launch <nowait | wait> <program name> <[command line options]>

Description:

Launches the specified Sonnet program.

nowait: If nowait is specified, the next macro command is executed immediately without waiting for the Sonnet program to finish.

wait: If wait is specified, the next macro command is not executed until the Sonnet program finishes. The keyword is best used for non-graphical programs such as em. For graphical programs (e.g., sonnet), the program must not be running when the macro line is executed and the next line in the macro will not be executed until the window is closed.

The command line options for the Sonnet program are specified within square brackets. Please note that the square brackets are required even if there are no command line options. See Command Line Programs for a list of programs available.

Examples:

launch nowait sonnet [-graph raystub.sonx]

 

launch wait em [cap3.sonx]