In this example, we will use Speos and optiSLang to analyze the robustness of a prismatic light guide and quantify the failure rate due to production tolerances in an automated way.
We will understand which tolerances lead to regulation fails for the automotive Day-Time-Running Lights and which tolerances must be improved to increase the optical performance. Additionally, we will evaluate the scattering of the homogeneity (RMS-contrast) and the lit appearance (average luminance) to see what the worst design looks like due to tolerances.
Notes: Software Prerequisites:
To be able to use this example, the following tools and assets need to be installed on your computer:
- Ansys Speos 2023 R2 or later
- Ansys optiSLang 2023 R2 or later
Overview
In the automotive lighting application, daytime running lights are used to create a unique lighting signature. These lightguides are nearly on all the time and need to comply with high homogeneity standards and the regulation posed by the government. To perform this robustness analysis, we use a design created with Ansys Speos Optical Part Design. Ansys optiSLang will be used to drive the scattering parameter change and subsequently check the robustness of the design against the production tolerances. Tolerances on the position of the LED, energy of the light source, as well as the deviation of the trimming ratios and milling are considered.
Step 1: Ansys Speos Model
Demonstrate Speos lightguide simulation containing a colorimetric radiance map and an Intensity map with a regulation check.
Step 2: optiSLang Robustness Analysis
Demonstrate the robustness evaluation capabilities by analyzing the initial (best) design regarding production tolerances and quantifying the failure rate (probability of failure) as a criterion for robustness.
Run and Results
Step 1: Run Speos best design model
- Open the Ansys Speos model Headlamp_LG_Robustness.scdocx (located “.\optiSLang_project_with_reference\01_reference\Headlamp_LG_Robustness.scdocx”)
- Perform a local compute of the direct simulation “Lightguide”.
The two results, intensity map and radiance map, are used to measure the optical performance in terms of regulation and homogeneity.
The grid view of the intensity map highlights the regulation compliance
Each of the boxes represents a measurement point of intensity specified by the regulation. The center value represents the simulation result, the bottom left represents the minimum limit to pass, the top left value is the maximum limit to pass the regulation, and the right side will represent personally set safety margins. If a regulation fails, it will be highlighted in red. If the safety margin is not met, it will be highlighted in yellow. If the regulation is passed, it is highlighted in green.
In the radiance map, the measurements for the homogeneity performance are defined. The measurements are based on an 18-point polyline. The radiance is evaluated along the line. This will be used to measure the average radiance and RMS contrast.
These are the outputs that will be used for the robustness analysis. The goal is to evaluate the scattering of the RMS contrast and the average of the polyline and the related compliance with the ECE regulation.
The best design (initial design) shows an RMS contrast of 0.156 and an average luminance of 161 kcd/m²:
Step 2: optiSLang Robustness Analysis
- Open LG_Robustness.opf (located in “.\optiSLang_project_with_reference\”) and click “relocate files automatically” when optiSLang asks.
- Double-click on the “Robustness”-system to see the defined scattering parameter, sampling method, and criteria.
- To review the results of the robustness analysis, right-click on the “MOP” node, which is connected to the system, and select 'show Postprocessing'. The file already contains the results of the robustness analysis.
- Optional: to regenerate the picture you can rerun the study. To do this, right-click on “Robustness”-system and select “Start from here”.
HINT: The step-by-step tutorial shows how to create the automated workflow (solver chain) and how to set up the sensitivity analysis. (The tutorial can be found in the download folder: “.\optiSLang_Prismatic_Light_Guide_2023R2_Robustness.pdf”).
The “Robustness”-system shows the necessary solver chain to perform the lightguide analysis and is used to run the robustness analysis in order to identify important tolerances and to evaluate the results statistically.
The robustness analysis is based on a previous lightguide optimization.
The system is defined to include pictures and to keep the result files of each simulation. Due to the size, these pictures and result files are not delivered with this example.
Postprocessing 1: Identify and understand important tolerance
The COP-Matrix in the optiSLang postprocessing shows us which of the considered tolerances have an impact on the optical performance and the single regulations. With this, we can answer the question “Which tolerance must be improved to increase the robustness of the design?”
The shift of the LED in y-direction (“LED_delta_y”) and the energy of the LED (“Flux”) have the strongest influence on the average as well as on the regulations. The RMS contrast depends on the production-based deviation of the trimming ratios and the milling value.
The Metamodel of Optimal Prognosis (MOP) approximates the response as a function of all important input parameters. By clicking on one of the “Total” updates, the 3d Response surface is plotted. This plot is the representation of the metamodel based on the two main contributors and the remaining ones are set to a fixed value. By using the sliders (see picture below) you can see the influence of the other dimensions.
Based on the metamodels we can understand where (in which range of the tolerances) the regulations are not fulfilled, or where the optical performance is the worst.
Green : Design is feasible
Magenta : Design is not feasible:
|
Hint: The colored points were not saved in the provided data. How Tto color the different designs is shown in the step-by-step tutorial, (The tutorial can be found in the download folder: “.\optiSLang_Prismatic_Light_Guide_2023R2_Robustness.pdf”)
Postprocessing 2: Get the probability of failure
Furthermore, the robustness analysis shows the statistical distribution of the device response due to the manufacturing tolerances (scattering of the output parameters). With this, we answer questions like “How robust is the light guide?” What percentage of fabricated devices will not meet the required design goal or will not fulfill the regulations?”
- In the optiSLang postprocessing, click on “Limits” under “Edit” in the menu bar.
- Add “Safety limit” for specifications
- Add “Failure limits” for national regulations and optical performance (e.g. average luminance)
- Add “Histogram”-Plot to the postprocessing scenery and choose one of the outputs (e.g. “Average”)
How to do this is shown in the step-by-step tutorial. (The tutorial can be found in the download folder: “.\optiSLang_Prismatic_Light_Guide_2023R2_Robustness.pdf”). - Check distribution and statistical data in the histogram plot for the average:
- The probability that the average is smaller than 160kcd/m² is 3.0%. This represents a sigma level of 2.18.
- In combination with the Metamodel for the average, we can see that we can improve the robustness of the lightguide by tuning the tolerances of the LED energy and the LED y-position.
E.g. if it can be ensured that the maximal y-position of the LED is smaller than 0.5 mm, then we get a robust design regarding the average luminance
- Check statistical data for all other output parameters
Summary robustness analysis
Based on the robustness analysis we understand how robust the design is and which possibilities we have to improve the robustness of the design:
probability of failure |
Possibility to get a more robust design |
|
national regulation |
0 % (robust) |
To determine a very smal Failure rate (<1:1000; sigma levels larger than 2), we recommend a reliability analysis |
specifications |
5,0 % |
Tune mainly the flux tolerances |
Average luminance |
3,0 % |
Tune flux and LED y-position tolerances |
RMS contrast |
24,0 % |
Tune Trimming ratio and milling value tolerances |
Furthermore, we can see how the worst design looks like under consideration of the tolerances:
worst design regarding RMS contrast due to tolerances |
worst design regarding average luminance |
Nominal Design |
|
RMS contrast |
0.44 |
0.15 |
0.15 |
Average luminance [kcd/m²] |
154 > 165 (not fulfilled) |
129 > 165 (not fulfilled) |
162 > 165 (fulfilled) |
Number of not fulfilled regulations |
0/42 (fulfilled) |
||
Result Picture | |||
Section View |
Important model settings
Speos model settings
Lightguide meshing
A precise meshing of the lightguide is extremely important. The prisms can get extremely small. If this is not accounted for in the meshing, no light will be extracted from the lightguide. Use Local Meshing on important optical geometries.
Maximum number of surface interaction
A lightguide relies on Total Internal Reflection to guide the light, resulting in a lot of surface interactions. The default value of 100 is often too low.
XML Template
The XML template in the sensor definition is used to export the measurements to make them usable in optiSLang
optiSLang
Speos settings
Double click on “Ansys Speos” node to change the settings:
- Parametrization Tab:
- Define parameter that should be considered in the variation analysis
- Execution settings Tab:
- define the Speos version to use (minimum version is 2023R2)
- choose batch mode / GUI mode (Gui mode might be useful for bug fixing)
- add a Python script that executes before or after the design is updated
(e.g. needed for coupling Speos with CAD-Tools like Catia / Inventor / NX / Creo)
- Speos Simulation Tab:
- select the simulations to be exported in the design directory and resolved by the Speos Core node
- Export Tab:
- selected formats are written as result files in the design directory (e.g., export image file of the design and include it in the optiSLang post processing to increase design understanding)
Solver settings
Double click on the “SpeosCore” node to change the settings:
- number of used cores
- activate solve on GPU
Robustness settings
Double-click on the “Robustness” – system:
- to change the scattering parameter properties in the “Parameter” tab
- to change values for the reference design in the “Parameter” tab
- to change the number of samples in the “Dynamic sampling” tab
- to view the results in the “result designs” tab.
Updating the model with your parameter
Add more Parameters:
To add new parameters you need to use the Publish parameter feature in the Workbench tab and you can select any Speos feature to publish any available Property of this Object. ( Defining the Speos Parameters to Use in optiSLang (ansys.com) )
You can also create SpaceClaim Driving dimension or SpaceClaim script parameters. All SpaceClaim parameters will be automatically displayed and read by the Speos integration in optiSLang.
Create a new optiSLang Robustness study
To define an optiSLang robustness study from scratch you can use the Step-by-Step Tutorial added to this data. It will allow you to understand the creation Process of an optiSLang Robustness evaluation with Speos.
Add new outputs to the simulation report
To add new outputs, it is needed to add new measurements to the XML-Templates selected in the simulation setup. The easiest way to do this is by replacing the existing XML-Templates from the input files or reselecting it in the sensor definition. XML-Templates are created by creating a measurement on the XMP map and then exporting this measurement to an XML-Template.
By editing the Speos reader node the outputs will be added to the optiSLang project. You can find a detailed step-by-step guide in the Ansys Learning Hub or in the reference folder for this article's data.
Taking the model further
optiSLang postprocessing
To increase the understanding on “how robust is the light guide design,” the activation of the result images in the optiSLang postprocessing, as well as the “Parallel Coordinates Plot” (PCP), can be used. With the PCP, it is possible to visualize the dependencies between the input and output parameters, as well as to identify the ranges of the scattering parameters in which the light guide is robust. Furthermore, a coloring of a design set helps to identify the regions where the robustness criteria (limits) are fulfilled.
How to do this is shown in the step-by-step tutorial of light guide optimization (Exterior Lightguide Optimization – Ansys Optics) .
Automate workflow using PyAnsys
PyAnsys is a collection of Python packages that enables users to interact with Ansys products in a highly efficient and programmable manner. It allows the automation of simulations and workflows, which can significantly enhance the accuracy and efficiency of engineering tasks. Additionally, it allows a seamless integration of Ansys simulations into a broader ecosystem, resulting in significant time and cost savings.
Starting from the Ansys 2025R1 release, PySpeos and PyOptiSLang are available. You can find detailed installation instructions and user guides at the following links:
In this example, we will setup the lightguide robustness workflow using PySpeos and PyOptiSLang to understand the influence of source power, source position on the lightguide performance, i.e. RMS contrast, average luminance as well as the number of failed regulations. The example project (an exported *.speos file from the robustness study speos project) and python scripts can be found inside the example folder (pyAnsys_LG_robustness_study) provided in this article.
Prerequisites
- Python 3.10 or higher: Make sure you have Python installed on your system.
- PyOptiSLang: Install latest release from PyPi to your python environment with the following command:
pip install ansys-optislang-core
- PySpeos: Install latest release from PyPi to your python environment with the following command:
pip install ansys-speos-core
- PySpeos gRPC server: launch gRPC server by docker container or local service
- Ansys optiSLang 2025R1 or higher
- Ansys Speos 2025R1 or higher
Note: Ansys Speos installation is required because there is no speos result lab service available in 2025R1 PySpeos release. A local Ansys Speos installation is needed to use the speos result lab application in this workflow.
Script Overview
Open the main_LG_robustness_study.py file located in the example folder. This script performs a robustness analysis for the exterior lightguide with Ansys optiSLang and Ansys Speos through the following steps:
- Definition of the variation analysis boundaries Within ‘get_variation_analysis_boundaries()’ you can define or adjust
- tolerance parameter and distributions
- responses (quality measurements / performance indicator)
- constraints (quality limits for each performance indicator)
- the number of designs to be calculated for the robustness analysis
- optiSLang Project creation and workflow setup In the next step we create a new optiSLang instance and create the workflow within ‘create_workflow()’. This include:
- creation of the robustness system with a proxy solver node
- creation of the MOP node to identify important tolerance parameter (can be reviewed in the optiSLang postprocessing)
- registration of the parameter and definition of the parameter settings (e.g., distribution function, mean value, …)
- Within ‘criteria_definition()’ we set the constraints in optiSLang. Optional, you can save the optiSLang project to keep the results and the databases.
- optiSLang project execution
- In this step we start the optiSLang project execution in batch mode. As the project runs, optiSLang samples all designs and send them to the proxy node. From there we receive all design information (e.g., design ID, parameter values), call a Speos instance and pass the design information to the second script, ‘speos_solve.py’, to calculate the optical performance for each design within ‘speos_simulation()’.
- Connect to PySpeos server
- Inside the calculate(), a speos client is created via connecting to a PySpeos server. In this example, a local host with port number 50098 is used, user should modify this part with server information explained in the link. Each design parameters are then passed to the created speos client to be processed and simulated.
- PySpeos execution
- Inside the speos_simulation() defined in the speos_solve.py, the exported lightguide robustness project speos file is loaded in PySpeos. New LED source power and LED locations are then applied to the project inside the PySpeos. Next, the simulation with new LED configuration is computed in CPU. User can choose to run simulation in GPU via changing the line 251 from compute_CPU() into compute_GPU().
- Optionally, User can uncomment the line 246 project.preview() to preview the project CAD setup. Please make sure to comment this line when running the robustness study, otherwise preview window will open for each design iteration
- Result evaluation
- Speos result extraction is executed calling the open_result() method. A Speos Virtual Photometric Lab is used to open the generated speos result and extract the measurement results. Those responses are the return to optiSLang to evaluate all designs and calculate the probability of failure. After all designs completes, a robustness summary table is printed out to the console.
Script Execution
- Make sure the provided Python scripts and the 'Lightguide.speos' folder are in the same directory. If not, you will need to modify the path to the 'Lightguide.speos' file in 'speos_solve.py'.
- Launch the SpeosRPC Server as described in prerequisites section and choose the correct server and port number.
- Launch ‘main_LG_robustness_study.py' in your Python environment and run the script. The terminal will display the progress of the robustness evaluation (calculated design) along with the results. The analysis ends after the defined number of designs were completed (per default 200 designs).
Check Result Output
After the defined number of designs were completed, a robustness summary will be prompted illustrating the robustness of the lightguide performance, i.e. the influence of the scattering LED power and position due to production tolerances.
Inside the summary, the probability of failure for each lightguide performance indicator has been presented to understand how robust the design is. Based on the shown summary, we can see that the design is robust regarding the RMS contrast. That means that the production-based scattering of both LED power and position leads to a scattering of the RMS contrast which does not exceed the specified limit (here 0.2, as defined in the criteria). For the other performance indicators we see that some of the designs exceed the limits. E.g., 3.5% of the produced lightguide designs are not fulfilling the specification rules. In total, 188 out of 200 lightguides are fulfilling all quality measurements. To better understand which variation (i.e. LED power and LED position) has a bigger impact on the lightguide performance and which possibilities we have to improve the robustness of the design, please review the main article to that topic: Evaluating Robustness of Exterior Lightguide – Ansys Optics.
Additional resources
Related KB pages:
Related Ansys Innovation Courses