Scripted elements are custom elements that can be defined with analytic S-parameter representations via the Setup Script.
This makes it ideal for creating parameterized passive elements.
Like the compound element, you can set up custom properties, and the scripts are used to define the functionality of the scripted element.
Example components you could represent by using a scripted element include
a directional coupler parameterized by coupling length, a grating coupler parameterized by peak frequency and bandwidth,
or a waveguide parameterized by propagation loss.
Let's consider this last case of a waveguide parameterized by propagation loss.
Here's an example script which could be used to define the waveguide propagation parameters
and set the S-parameters of the scripted element.
This script uses the "setsparameter" command to set the S-parameters between input and output ports.
There are different options for how to define the S-parameters when using the "setsparameter" command.
Here, we specify the waveguide propagation parameters including absorption, effective index, group velocity, dispersion, and length.
But you could also define the S-parameters by providing the frequency-dependent amplitude and phase of the transmission,
or a constant optical gain, or by defining transfer function coefficients.
The syntax required for the script command will depend on how you want to define the S-parameters.
More details about the "setsparameter" script command, and additional examples of scripted element implementations are linked below.