The Monte Carlo analysis tool allows users to run extensive Monte Carlo analysis, sweeping across multiple parameters. This can be useful for assessing statistical variations of circuit elements on overall circuit performance, as well as the effects of variations in componentlevel simulations. User can specify the parameters to vary and the variation includes "Global" variation, "Local" variation or both. The analyzed parameters can also be defined in a .lib file and if the same element appears several times in a circuit, they could be grouped up as the same "model" and have the same "Global" variation. The correlation between different parameters can also be defined. The available variational distribution types in the tool are: Uniform, Gaussian, Lognormal, Truncated Gaussian, Truncated lognormal, Discrete and Pearson IV. If a .lib file is used, spatial correlations can also be defined for the model parameters (see the “Spatial correlations” section for more information).
The tool runs a number of trials with parameters values generated according to a specified distribution and returns the analysis results include the dispersive statistics and probability density function, etc. The tool can also display histograms showing the distribution of parameter values used and the distribution of results from the trials.
This page describes how to run a Monte Carlo analysis task using an example finite impulse response filter circuit composed of cascaded MachZehnder interferometers. See Optical filters for more information about this circuit.
Monte Carlo properties
Multiphysics tools and System tools have different properties in the Monte Carlo analysis window. Following is the Monte Carlo analysis window in INTERCONNECT:
and following is the Monte Carlo analysis window in Multiphysics tools:
 NAME: Monte Carlo analysis name.
Configuration
 NUMBER OF TRIALS: The number of trials to run.
 INDIVIDUAL TRIAL: Check box to indicate to run the specified individual trial or not.
 SEED: Check box to indicate use specified seed or not.
 VARIATION: Drop down menu to choose the variations to run.
 BATCH SIZE: The number of trails run in each batch.
 UNBOUNDED: Check box to unbound the batch size; when checked, the total number of trials will be ran in one batch.
Parameters
 NAME: A user specified name for the parameter. Will appear in results dataset.
 PARAMETER: Property to do the Monte Carlo analysis.
 VALUE: Mean value of the property.
 DISTRIBUTION: Parameter statistical distribution settings. Refer to the distribution section for details.
 ADD: Add another parameter to the table.
 REMOVE: Remove a parameter from the table.
Libraries
 NAME: A user specified name for the library.
 LIBRARY: The .lib file that defines the model's variation properties.
 VARIANT: Drop down menu to choose the variant to analyze.
 ADD: Add another library to the table.
 REMOVE: Remove a library from the table.
Note: This feature is only available in INTERCONNECT. 
Models
 NAME: A user specified name for the model.
 MODEL: The model to do the analysis.
 VALUE: Mean value of the model property.
 GLOBAL: Global variation. This value is the same for all the model elements.
 LOCAL: Local variation.
 ADD: Add another model to the table.
 REMOVE: Remove a model from the table.
Note: This feature is only available in INTERCONNECT. The "model" property is in the element's "General" setting tab. All the elements have the same "model" are considered to have identical process hence have the same global variation. Select a "model" will select all the elements have this "model" name. 
Processes
 NAME: A user specified name.
 PROCESS FILE: Path to the process file.
 LAYER BUILDERS: The Layer Builders that contain the specified process file. This entry will be autofilled once the process file is specified.
 STATISTICAL: Drop down list to choose statistical variation defined in the process file.
 PARAMETERS: Drop down list to choose statistical process parameters defined in the process file. User can use the check box to select the parameters to run in the Monte Carlo analysis.
Note: This feature is only available in Multiphysics tools and it need to be used with the Layer Builder. 
Correlations
 ENABLE SPATIAL CORRELATIONS: Option to include spatial correlations during the Monte Carlo analysis.
 TYPE: Type of correlation, either "Custom" or "Spatial".
 NAME: A user specified name for the correlation.
 PARAMETERS: All parameters listed in the "Master table". The "Correlation Selector" allows user to select the parameters that are correlated.
 VALUE: Correlation value, in the range [1, 1]. If correlation type is "Spatial", then the correlation length is displayed.
 ADD: Add another correlation to the table.
 REMOVE: Remove a correlation from the table.
Master table
 NAME: The parameter's name.
 PARAMETER: The property to do the analysis.
 VALUE: Mean value of the property.
 DESCRIPTION: Global and Local variation description.
Note: All the parameters that defined in the previous tabs will be listed in the "Master table". The "Master table" is not editable. 
Results
 NAME: A user specified name for the result. Will appear in results dataset.
 RESULT: Result to collect.
 ESTIMATION: If "true" is selected in the Estimation field, the trial will be considered a pass if the result falls within the specified min/max range. If there is more than one result with a yield estimate, the final yield percentage will be the percent of trials where all of the results fall within the specified ranges.
 MIN/MAX: Min/max range when the Estimation property is set to True.
 ADD: Add another result to the table.
 REMOVE: Remove a result from the table.
Distribution options
There are eight distribution options available in the Monte Carlo Utility:
Uniform
Generates the parameter variation based on uniform distribution. Users can specify the "variation" (standard deviation) of the uniform distribution.
Gaussian
Generates the parameter variation based on Gaussian distribution. Users can specify the "variation" (standard deviation) of the Gaussian distribution.
Lognormal
Generates the parameter variation based on the lognormal distribution. Users can specify the "variation" (standard deviation) of the lognormal distribution.
Truncated Gaussian
Generates the parameter variation based on the truncated Gaussian distribution. Users can specify the "variation" (standard deviation) of the Gaussian distribution with the "max" and "min" values for the boundary of the distribution.
Truncated Lognormal
Generates the parameter variation based on the truncated lognormal distribution. Users can specify the "variation" (standard deviation) of the lognormal distribution with the "max" and "min" values for the boundary of the distribution.
Discrete
Generates the parameter variation based on the discrete distribution. Users can specify the "variation" (standard deviation) and the "step" of the discrete distribution.
Pearson IV
Generates the parameter variation based on the Pearson IV distribution. Users can specify the "variation" (standard deviation), "skew" and "kurtosis" of the discrete distribution.
Random
Generates the parameter variation randomly. Users can specify the "min" and "max" for the boundary of the random numbers generation, and the "option" to define the random number variable type. "option" = 1 for double precision number and "option" = 2 for integer.
Creating the Monte Carlo analysis project
This Monte Carlo analysis is defined based on the project file run_monte_carlo.icp. Please download this file and follow the following steps to create the Monte Carlo analysis.
Make sure that you can see the Optimizations and Sweeps window. This window can be opened by going into the top menu under View>Windows and selecting Optimizations and Sweeps, or by rightclicking on the upper menu bar for a list of windows and selecting Optimizations and Sweeps from the list.
Click the "Create New Monte Carlo Analysis" button in the Optimizations and Sweeps window to create a new Monte Carlo analysis task. Click the Edit button to open the Edit Monte Carlo analysis dialog window.
Once the Monte Carlo analysis object is open, set the Number of trials to 50. In the "Parameters" tab, add a parameter (button on the righthand side of the Properties section) and change the name of the property to "cpl_2". Doubleclick on the Parameter field and browse the pulldown menu. Select the “coupling coefficient 1” property of the WC2 coupler. Set its distribution type to be "Lognormal" and variation to be 0.02.
Add another parameter for "coupling coefficient 1" of WC3 and name it as "cpl_3". Set its distribution type to be "Uniform" and variation to be 0.04.
In the "Models" tab, add a new model and name it as "wgd_model". Double click on the "Model" field and select the "WGD" model "group index 1". Double click on the "Global" field and set the distribution type to be "Uniform" with 0.12 variation. Double click on the "Local" field and set the distribution type to be "Gaussian" with 0.1 variation.
In the "Correlations" tab, add a new correlation and name it as "wgd_corr". Double click on the "Parameters" field, from the "Master properties" table, select the "SW" entries and add them to the "Selections" table. Set the correlation "Value" to 0.95.
Click on the "OK" button and go back to the "Correlations" tab.
In the "Master table" tab, all the properties defined in the previous tabs will be listed. Please note that, the "Master table" is not editable; any change of the parameters should be made in the corresponding previous tabs.
Add a result to record using the button on the righthand side of the Results section of the window and change the name of the result to "fsr". Doubleclick on the Result field of the result to browse available results and select the “free spectral range” result from input 2 of the Optical Network Analyzer. Doubleclick on the estimation field of the result and set this to “true”. Next, select the minimum and maximum values of the yield range by setting the value in the Min field to 1e11, and the value in the Max field to 2e11. Next, add two more properties: the bandwidth and the gain from input 1 of the Optical Network analyzer, and set Estimation field to “false” for these two properties. The final yield analysis window should look like the following:
Click "OK" to accept all settings, and return to the main Optimizations and Sweeps window.
Monte Carlo seed
For each Monte Carlo analysis object a value for seed can be assigned. This value can be assigned from the LIB file or the dialog window. Monte Carlo uses this seed to generate statistical variations. Using the same seed, each Monte Carlo run gives the same answer. If no seed is defined, this value is randomly generated on the first run and saved internally for the Monte Carlo object. Running same object will give the same result.
Also for each statistical parameters defined either in the LIB file or in the dialog window, a number is automatically assigned based on the name and parameter provided. This value does not change by the order in which the statistical parameter is listed. This number is then added to the seed defined for the analysis object to be used to generate statistical variations. Running multiple MC runs with same seed and same parameter names, gives the same result.
Running the Monte Carlo analysis
To run the Monte Carlo analysis, select the Monte Carlo analysis task in the Optimizations and Sweeps window and click the run button.
The Monte Carlo analysis runs in UI nonupdating mode by default. User can change this setting in the INTERCONNECT Options/Preferences window by unchecking the "Disable UI updates when running sweeps" option in the Preferences tab.
Viewing the results
The Monte Carlo analysis runs the trials in batches of the value of "Batch size" or less and automatically updates the following window after each batch of trials. After the yield analysis has been run, the parameters and results are listed at the righthand side of the window. Selecting a result will generate a histogram with 10 bins showing the distribution of values of the result. If the estimation property of the result was set to true, then the minimum and maximum values specified by the user are also indicated in the histogram.
The log at the bottom of the window shows the calculated yield percentage which corresponds to the percentage of trials where all of the results fall within the specified yield estimate ranges.
Selecting a parameter generates a histogram for that parameter.
Selecting both a parameter and result generates a plot showing the value of the parameter versus and result for each trial and the yield estimate range.
Close the "Monte Carlo analysis status" window and click on the Monte Carlo task in the Optimization and Sweeps window, all the calculated results will also be listed in the "Result View" window.
The probability density function of the results are also calculated. The following figure is the the "fsr" result histogram and probability density function plot in one figure:
Monte Carlo analysis results can also be obtained in the script environment with the command getsweepdata, which is similar to the command getdata. The name of each data member is the Name column that you specified when adding the parameters and results, in this case the result is "fsr". For example, the following 2 lines of script will plot the histogram showing the distribution of free spectral range values.
yfsr=getsweepdata("yield ng","fsr");
histc(yfsr);
Note: Data Visualization In case no histogram is being populated, try changing the units in the visualizer. Ensuring that the magnitude of values in Axis min and Axis max are larger than 1e9 can fix the issue. 
Using the library file
This option of using the library file to define the model's variation properties is only available in INTERCONNECT. User can define several sets of variations for different models in the same .lib file and choose one of the variation methods in the Monte Carlo analysis tab. Using the library file can really facilitate the interoperability between INTERCONNECT and third party EDA tools, where the .lib file can be loaded directly as a model library during the simulation and it is subsequently included in the netlist for onward simulation into INTERCONNECT. Since INTERCONNECT version 2019a, we introduced protected properties and they can also be used in Monte Carlo .lib files. For more information on varying protected properties in Monte Carlo analysis, please see the page Custom Element with user defined properties.
The "model" property is in the element's "General" setting tab. Primitive elements have empty "model" properties so user has to preset their "model"s to be able to define their variations in the .lib file. Elements come from compact model libraries generally have predefined "model" properties that can be used directly. All the elements have the same "model" name will follow the same parameter settings and variation settings in the .lib file.
Following is an example wgd.lib file that defines two sets of variations for the "group index 1" property of the elements with the "WGD" model name.
.LIB sigma_1
.GLOBALGROUP group_a=(normal,0.1)
.MODEL WGD "group index 1"=8.05894 GLOBALGROUP=group_a library=""
.ENDL
.LIB sigma_2
.GLOBALGROUP group_a=(uniform,0.2)
.MODEL WGD "group index 1"=8.05894 GLOBALGROUP=group_a library=""
.ENDL
This file can then be loaded to the Monte Carlo analysis "Libraries" tab and the variation method can be chosen from the "Variant" drop down menu. In this example, the variation method "sigma_1" is chosen.
.lib file syntax
The .lib file syntax follows the standard Eldo simulator command syntax. A model is defined using the following syntax:
.MODEL MNAME TYPE [PAR=VAL]
.GLOBALGROUP group_name[/distrib_type]=val[%]
Using the process file
This option of using the process file to define the model's variation properties is only available in Multiphysics tools and it needs to be used with the Layer Builder. User can define process variations for different parameters in the process file and load this process file to the Layer Builder. Then in the Monte Carlo analysis window the process variation can be added to the Process tab.
For an example of the process file with process variation defined, please visit Layer builder  Simulation object page and check out the example file lumerical_foundry_process_file.lbr.
Once the process file is loaded into the Layer Builder user can add the parameters to the "Processes" tab to run Monte Carlo analysis or Corner analysis.
Note: All the parameters that defined in the previous tabs will be listed in the "Master table". The "Master table" is not editable. 
Statistical process parameters and other parameters are separate listed in the Monte Carlo analysis run status window.
Process file syntax
Following is the syntax to define process variation in the process file:
<process_variation>
<statistical name="string">
<pattern name="string" distribution="(string,float array)" delta="float" pattern_growth_delta="float array"/>
<stack name="string" distribution="(string,float array)" delta="float" thickness="float array" start_position="float array"/>
</statistical>
</process_variation>
In the process variation section, user can define the variation for statistical process parameters for Monte Carlo analysis. These parameters are "process" variations and need to be mapped into "layer" variations for the layer builder object to be able to simulate their effects in device performance. User can define two types of variations:
 "pattern": Maps into variations of "pattern growth delta" of layers in layer builder.
 "stack": Maps into variations of "thickness" and "start positions" of each layer.
Following are the definition for variation parameters:
distribution: 
The variation distribution = (distribution type, standard deviation). Example: distribution = "(normal,5e9)" 
delta: 
The variation distribution mean. 
thickness: 
The mapping array for "stack" variation. It maps the process variation to the layer thickness variation. The array is a float number array and has the same length of the number of layers in the layer builder. This array typically takes one of the 3 values for the entries:

start_position: 
The mapping array for "stack" variation. It maps the process variation to the layer start position variation. The array is a float number array and has the same length of the number of layers in the layer builder. This array typically takes one of the 3 values for the entries:

pattern_growth_delta: 
The mapping array for "pattern" variation. It maps the process variation to the layer pattern growth delta variation. The array is a float number array and has the same length of the number of layers in the layer builder. This array typically takes one of the 3 values for the entries:

Looking at the example process file in Layer builder  Simulation object page, the process variations are defined as:
<process_variation>
<statistical name="statistical_1">
<pattern name="hard_mask_bias" distribution="(normal,5e9)" delta="0" pattern_growth_delta="0 0 0 1"/>
<stack name="si_thickness" distribution="(normal,7e9)" delta="0" thickness="0 0 0 1" start_position="0 1 0 0"/>
</statistical>
</process_variation>
Here "hard_mask_bias" is a "pattern" statistical process parameter with a normal distribution, standard deviation of 5e9 and mean of 0. Based on the mapping array provided in "pattern_growth_delta", this statistical process parameter has a direct effect on the pattern growth delta of the fourth layer in the Layer Builder and does not affect other layers.
Also "si_thickness" is a "stack" statistical process parameter with a normal distribution, standard deviation of 7e9 and mean of 0. Based on the mapping array provided in "thickness" and "start_position", this statistical process parameter has a direct effect on the thickness of the fourth layer and also start position of the second layer in the Layer Builder.
Spatial correlations
Starting in release 2020 R2, if a .lib file is used, spatial correlations between the model parameters can be specified. For more information on how to set up a Monte Carlo analysis with spatially correlated model parameters, see Monte Carlo analysis with spatial correlations.