Scripting command to import S-parameter file for scripted element



I am trying to create a scripted element, and inside the Setup Script under the Simulation tab, I would like to know if there is a command I can use to import an S-parameter .dat file that I have generated in FDTD using the s-parameter sweep function.

I know I can use the “readnportsparameterat” command to import the S-parameter data, but I think that only works when I have actual parameters that I swept during the FDTD simulation. However, in my case, I did not actually sweep any parameters, but just generated an s-parameter file on a static structure. Is there another command I can use or how do I use the “readnportsparameterat” for the case when I actually did not sweep any parameters.

I have attached my S-parameter file to this post.

file.dat (116.2 KB)


Hi @herman.wong ,

The file is already well formatted for the “Optical N Port S Parameter” element. Could using the “Optical N Port S Parameter” be an option? You can use this element inside a compound element as well if you want to pass parameters to it.


Thanks for the reply.

However, I would like to create an element in which there are also electrical ports; in that case, I think I have to create a scripted element, correct?

I would actually like to create a ring modulator compact model in which the input voltage can be used to set the S-parameter, and the voltage can be inputted via electrical ports. Can you suggest whether compound or scripted element is better suited for this?


Hi @herman.wong,

You can try the Optical Time Varient S-Parameter element. This element requires a tweaked version of s-parameters where you define the s-parameters regarding to the modulation signals. For the file format, please check this page in the Optical Time Variant S-Parameter section.

Let me know whether this could work for you.


Hi @gwang,

Thanks! I think this method will work for me. Will update you if I have any questions.


Hi @gwang,

I am able to use the Optical Time Variant S-Parameter for implementing a ring modulator device as a function of voltage; I have S-parameters for the voltages of 0, 1, 2, 3, 4 V. However, when I test this element using an ONA and an electrical DC source, and set the voltage to say 1.5 V, the simulated transmission of the ring modulator does not seem to be simply a shifted resonance of when V = 1 V, but the transmission contains 2 resonances. Please see below a plot of the through port transmission.

I thought the S-parameter element is supposed to automatically interpolate to yield S-parameters for “in-between” values of element properties based on user input of S-parameter file. However, it this case, the interpolation seems incorrect. Is there a way to fix this?




Hi @herman.wong,

The element does the interpolation. Could you please upload your files here and I will take a look.