This video is taken from the INT 100 course on Ansys Innovation Courses.
Transcript
To add a scripted element, right-click on the whitespace in the view port and select "Create -> Scripted element".
Right-click on the element and select "Edit..." to open the edit window.
In the "Property Editor" tab, add a new parameter called loss, set "Kind" to "WaveguideLoss", and set the value to 3 dB/m for now.
Under the "Ports" tab, add two ports for the input and output ports of the waveguide.
Set the properties Type to "Bidirectional", Data to "Optical Signal", Position to "Left" for port 1 and "Right" for port 2, and location 0.5.
Next, under the "Simulation" tab, we can add a setup script.
You'll notice that there are 4 sub-tabs here where scripts can be added.
The "Setup" tab contains the script that is used to set the properties of the scripted element and this is the one that we will focus on.
The remaining tabs are for more advanced usage which we won't cover here, but you can find information about it on our Knowledge Base.
I have a setup script here that was discussed in the previous unit pre-written, and I will paste it into the Setup Script box.
In the script, we are setting the absorption using the "loss" property that we added in the "Property Editor" tab.
In the setup script, we can only access properties that are defined in the "Property Editor" tab of the element.
Since the ports have been set to bidirectional, we need to specify the S-parameter for both port 1 to port 2 as well as port 2 to port 1.
For demonstration purposes, the waveguide length is set to 1 meter.
Since we have set the value of the loss property to 3 dB/m, we should expect to see a gain of -3 dB for this element.
We can use the "Test" button to make sure there are no errors with the script.
Click "OK" to close the scripted element edit window, and add an ONA to test the element.
Connect the ONA to the element, and click the Run button.
Then, plot the gain result from the ONA.
We see that the gain is -3 dB, as expected.
Now that we are familiar with how to create custom models, we can use custom models to build compact model libraries.
This is the topic of the following section of this course.