# S parameter extraction from Device

Hi I am trying to extract the s parameter data from Lumerical Mode and FDTD and import them into the Interconnect Module. Could someone please explain how to do so? I am not too sure whether it can be done through writing a script or there is a simpler way to do so. If it needs to be done through writing a script, can someone help how to do so?

1 Like

Please have a look at this post where a related application example link is provided. Indeed in general some short scripts are used to generate the s-parameter files. Let me know if you have any further problems

Hi again,

Thanks for your response, but I always have problems grasping that example as it opens a script file in Mode and not FDTD- when I run it never works either. Can you help me regarding how to use the code for FDTD?

Also I asked earlier that I am trying to extract information from the Device module. Is that possible? If not, am I supposed to send everything to the Mode Module in order to be able to extract information?

Thanks, Hani

The method to extract s-parameter from FDTD Solutions is more or less the same as from MODE Solutions. There is a sample script in the example I linked in the previous reply, which extracts s-parameters to a text file from a FDTD simulation. In the example file grating_coupler_2D.fsp (500.7 KB), the result ‘S’ matrix is defined in the ‘model’ analysis tab, using the following script commands:

T = getresult("waveguide","expansion for T");
?T;
Tfund = -T.getattribute("T_backward");
lambda = T.lambda;
?T_avg = integrate(Tfund,1,lambda)/integrate(matrix(length(lambda))+1,1,lambda);

if(!%fiber analysis%) {
break;
}

if(havedata("fiber::top")) { # fiber turned on
fiber = getresult("fiber::fiber modes","expansion for top");
}

S = matrixdataset;

if(output) {
S22 = T.b/T.a;
S12 = fiber.a*sqrt(fiber.N)/(T.a*sqrt(T.N));
} else {
S11 = fiber.a/fiber.b;
S21 = (T.b*sqrt(T.N))/(fiber.b*sqrt(fiber.N));
}


Then after run the simulation, the result ‘S’ can be read out by using the following commands:

S = getresult("::model","S");
S22 = S.S22;
S12 = S.S12;


You can also extract the admittance and impedance s-parameter/matrix from DEVICE, but this has to be done by using script. After the simulation runs, you can get the current and voltage from the simulation result and then calculate for the admittance and impedance. For a small signal analysis, you then can get the transfer function of the admittance and impedance. The following script can be used to convert the admittance transfer function to s-matrix:

S11 = ((1-Z0*Y11)*(1+Z0*Y22) + Z0^2*Y12*Y21) / D;
S12 = -2*Z0*Y12 / D;
S21 = -2*Z0*Y21 / D;
S22 = ((1+Z0*Y11)*(1+Z0*Y22) - Z0^2*Y12*Y21) / D;


where Y is the transfer function and S is the s-matrix.

I hope this could help, let me know if you have any difficulties reading these

1 Like

an you please explain the code in general to me?
2) Why do you have two sections: 1) fiber analysis 2) output (I assume this is solely for the purpose of extracting the s parameters?
3) I cannot seem to be able interpret the s parameter graphs that I get? Their values seem to be way larger than 1 which it doesn’t make sense to me.

• Note that I get two different s parameter graphs depending on what I set as the value for the fiber and output variables:
When output and fiber analysis are both 1 I get the following graph:

“Sparameters_GRATINGCOUPLER.jpg”

And when fiber analysis = 1 and output = 0 I get:

“SparameterSecondGraph.jpg”

1. Could you please explain the above graphs to me?

2. You also use some variables that are nowhere defined in your design, i.e. T_backward or T.f? Could you explain these for me please?

T = getresult(“waveguide”,“expansion for T”);
?T;
Tfund = -T.getattribute(“T_backward”);
lambda = T.lambda;
?T_avg = integrate(Tfund,1,lambda)/integrate(matrix(length(lambda))+1,1,lambda);

if(!%fiber analysis%) {
break;
}

if(havedata(“fiber::top”)) { # fiber turned on
fiber = getresult(“fiber::fiber modes”,“expansion for top”);
}

S = matrixdataset;

if(output) {
S22 = T.b/T.a;
S12 = fiber.asqrt(fiber.N)/(T.asqrt(T.N));
} else {
S11 = fiber.a/fiber.b;
S21 = (T.bsqrt(T.N))/(fiber.bsqrt(fiber.N));
}

1. Where am I supposed to be using the following? After I ran the code above I did put this in the script section and no results:
S = getresult("::model",“S”);
S22 = S.S22;
S12 = S.S12;

The code I attached is not universally usable, it is only for the corresponding attached example file. You have to tweak the script a bit to suit your own design. For the ‘T.f’ part, ‘T’ is a dataset and ‘f’ is a parameter inside the dataset, you can access the parameters and attributes inside the dataset by using the dot ‘.’ option.

Attached please find for example one design that I’m trying to find its s parameters. Can you help me get started?

Also you didn’t answer me about the graphs I attached in my above inquiry. Why are the values not less than 1 and somewhere around 500 or so?