One way to create a compound element is to right-click on the whitespace in the view port and select "Create -> Compound element".
This will add an empty compound element to add elements into.
However, in the ring modulator file, the circuit for the ring modulator is already set up,
and we can group the existing elements into a single compound element.
First, delete the connections from the ONA and the DC source.
To ensure that the ONA result data is not carried into the compound, we'll remove the circle around the port that was previously connected to the ONA input.
To do so, go to the Mouse Mode toolbar and click on the "monitor ports" button, then click on the circle.
Now let's go back to using the "select" cursor.
Now, click and drag in the view port to select the elements to group together.
Right-click and choose "Create -> Compound element".
The selected elements are now inside this compound element.
Select the compound element, right-click and select the "Edit..." Option.
The "Property Editor" tab lists all the properties of the compound, and the default properties are inherited from the Root Element.
In the "Ports" tab, I can add five ports by clicking the "Add" button 5 times.
The data type for four of the ports should be "Optical Signal", and the fifth should be "Electrical Signal" for the modulation signal.
All port types are set to be "Bidirectional".
I can set the location of where the ports will appear on the element icon.
Click on the "Arrange" button which sets the location of each port in order to have even spacing between the ports.
The Results and Scripts tabs allow us to define custom result variables and to use scripts to set up the internal elements.
Click "OK" to accept the settings.
I can now connect the ports to the ONA and DC source.
Next, select the compound element and right-click to select the "Expand" option to open a new view port tab
that shows the elements in the compound and the relays that correspond to the ports of the compound element.
Connect the relays to the circuit.
At this point, we can run the simulation and see the same gain result as before we created the compound element.
If we were customizing the model to represent a foundry component, we could load modulation data from the foundry.
In the optical modulator "Standard" properties, I can set "load from file" to "true"
and select a data file containing the measured data which could contain the real and imaginary part of the effective index
or absorption and phase, as a function of the modulation voltage.
To show the parameterization capability of the compound element, I'll edit the compound again,
and add a property called "radius" which will be used to set the lengths of the straight waveguide elements that make up the ring.
Set the "Kind" to "Distance", which will allow me to set the length units for this property.
Set the value to 40 for a length of 40 microns.
I can select the "Annotate" option so the value of the property will show up in the schematic.
Under the "Scripts" tab, I can add a setup script to set the length of the straight waveguides as a function of radius.
An alternative way of doing this would be to use the "expression" option to set the length as a function of radius.
We will set the length of the modulator using the expression 0.8*2*pi *radius,
where radius is between two % signs to show that it's being inherited from a parent. Which is in this case, the compound element.
It can access the value for the "radius" parameter that we've just added.
Click on the "Test" button to check to see if there are any errors within the setup script.
The Script Output shows that the script completes with no errors.
I can now change the radius of the compound element in the Property View window
and the lengths of the waveguides inside the compound will automatically be updated.
Lumerical University's Scripting 100 course, and the introductory scripting tutorials in the link below this video are good resources for learning more about scripting.