In this example, an windshield optical distortion analysis workflow based on Standard TL 957 and No. 43 Regulation (ECE R43) are introduced together with the analysis automation tool provided in the GitHub Ansys optical-automation.
If you have never worked with any GitHub repository, follow the article Optical Automation library introduction, which provides you with prerequisite knowledge before running the workflow below.
The workflow will utilize the light expert function and the light path find API feature which was initially released in 2023R1. Please beware that a certain Python version is requested when using the API. For example, in Speos version 2023R1, python version 3.9 or later version is required to interact with the 23R1 result; in Speos version 2024R2, python version 3.10.12 or later version is required. Please check this user guide of your Speos version to confirm which Python version will be needed in your workflow.
Overview
Understand the simulation workflow and key results
There are several optical distortion standard/regulations used in the automotive industry. Standard TL 957 and No. 43 Regulation (ECE R43) are two of the most popular ones. The methodologies for measuring the optical distortion between those 2 standards are similar with differences in 2 parameters (i.e. measurement radius and surrounding ray number, which will be explained in more details below). In this example, standard TL 957 is used to demonstrate the workflow. The ECE R43 is covered in the section of “Taking the Model Further” for users who are interested to follow the definition of ECE R43.
This article illustrates how Speos can be utilized to analyse the optical distortion of a windshield glass. The example shared in this article will cover a Speos windshield example project using TL 957. An optical distortion map and a diopter map that are calculated based on the given windshield geometry will be generated.
Standard TL 957 specifies requirements and tests for vehicle glass panes made of silicate glass. Inside the TL 957 section 9.2, the optical distortion test is explained. It should be noted that, although the test is named “optical distortion”, it really generates a result of refractive power. The refractive power calculation is defined by the images below:
The image above shows a cross-section view of a windshield. There are 2 rays travelling through the windshield from left to right. The ray on the top interacts with the windshield at position \({M}\) while, the ray at the bottom interacts at \({M^\prime}\). The two deflection angles \({\alpha_1}\) and \({\alpha_2}\) present the angle between the exist direction/transmission ray out of the windshield and incoming ray.
The refractive power value \({D_M}\) at a position \({M}\) can be calculated as optical distortion value \({∆α_M}\) at \({M}\) divided by \({∆X}\). The optical distortion value is defined as the difference in deflection angle over the distance . Based on the image above, the optical distortion value is calculated as the angle between the 2 transmission rays existing windshield at position \({M}\) and \({M^\prime}\). In the standard TL 957, the maximum optical distortion values measured at 4 \({M^\prime}\) points are used to calculate the refractive power, as illustrated in the image below.
This article illustrates how Speos can be utilized to analyse the optical distortion of a windshield glass. This example will cover a speos windshield example project. An optical distortion map and diopter map calculated based on a given windshield geometry will be generated.
The green dot represents the ray at position \({M}\). Four other rays at the top, bottom, left, and right of the central ray representing ray at \({M^\prime}\) are used to get the maximum optical distortion value. In the standard TL 957, the distance value \({∆X}\) is set to be 12mm.
There are other standards defining the optical distortion analysis in a similar but slightly different manner. For example: Regulation No 43 of the Economic Commission for Europe of the United Nations (ECE R43). In regulation No. 43, the distance value \({∆X}\) is set to be 4mm and it requires 16 rays to get the maximum optical distortion value.
In this example, a simple single-layer windshield with material of PMMA is used for the demonstration purpose. The optical distortion is calculated based on definition of standard TL 957. The following tools and assets need to be installed on your computer:
- Ansys Speos 2023R2 or later version.
- Python with version defined in the link .
- PyCharm or another Python IDE
Step 1: Create rayfile files.
In this step, 5 different ray files are generated using the script available from the attached project.
In the demonstration project, the z-axis is the vehicle's upward direction, negative x-axis is the front direction. If your project has a different orientation setup, please adjust your project.
Each ray file contains a number of rays whose propagation information will later be used for calculating the windshield distortion. 5 pre-generated ray files are also provided in the example project: The very first ray file contains centre rays and the other 4 ray files contain rays around the centre ray correspondingly with radius 12mm. The property of those ray files can be customized for different purposes. In this windshield analysis example, the rays are created with the following properties:
-
Start position:
- x position equals to 3500mm
- y positions are calculated based on the user-selected windshield surfaces' shape with a distance of 30mm between 2 neighbour rays.
- z positions are calculated based on the user-selected windshield surfaces' shape with distance 30mm between 2 neighbour rays.
- Direction: -x direction
- Wavelength: 555nm
- Energy: 1
Step 2: Speos Simulations
In this step, 5 rayfile files are imported to a speos project that sending ray toward a windshield as below:
Ray file sources setup: the orange (highlighted) lines are centre rays, around which there are 4 rays (black colour).
To generated required *.lpf files, both 2d and 3d sensor can be used for simulation. In this example, a 3D sensor is used which will record any refracted rays exit the windshield.
One simulation with light expert function activated will be executed for each rayfile file to generate *lpf files. The lpf files record the ray propagation information through the windshield: each ray from a rayfile file travels forward, interact with the windshield, refracted twice, and exist the windshield. Information like start positions, interaction positions, exit directions are recorded inside the LPF file.
An illustration using 2D sensor showing the exiting rays captured by 2D sensor.
Step 3: Distortion Analysis via Processing LPF file
The python script from GitHub optical automation is utilized here. The script will require user to select the *.lpf/*.lp3 simulation files from centre, top, bottom, left, and right simulations one by one. Then, it calculates the distortion and refractive power map and plot image.
Run and Results
Instructions for running the model and discussion of key results
Step 1: Create rayfile files
- Download the download example zip from this application gallery. A "distortion step 1 enhanced.py" python script can be found in the zip folder.
- drag and drop the script python file "distortion step 1 enhanced.py" into Ansys Speos.
- at line 100, the user needs to define windshield_surfaces whose position will be used by the script to generate rays.
- select the script content as shown in the screenshot below.
- select the inner or the outer windshield surfaces.
- click the "Insert selection" tool button inside the Script Editor.
- (line 96 and line 97) by default, the horizontal_step and vertical_step are set to be 30mm. This means the horizontal and vertical distances between the 2 centre rays are 30mm.
- (line 98 and line 99) by default, the samples and radius values are set up to be 5 and 12mm. This represents the requirements from TL 957: 5 rays in total are required for each local calculation, 12 mm radius is needed as the distance between the centre ray and the other 4 rays on the circle.
- (line 106) by default, the rays' start positions' x coordinate is set to be 3500mm. If the user's windshield's x-coordinate position is larger than 3500mm, the user needs to increase this value.
- (line 120) by default, all ray files will be generated under C:\temp folder. If user does not have such a folder or wishes to generate files at a different location, user can define the target generation folder.
As a result, in the c:\temp folder, 5 different rayfile files are created: the ray_file_0.ray contains the centre rays. Open each rayfile file and check, there should be same number of rays, i.e. 463 rays inside each file.
Another option for this step is to use the rayfile files provided in the project in this example.
Step 2: Speos Simulations
- In Speos 2023R2, open speos project “windshield_distotion_study.scdocx” project and create 5 rayfile sources.
- To define the rayfile sources, select the 5 rayfiles generated from the step 1.
- Edit each direct simulation and select 1 rayfile source. Check the number of rays used by direct simulation and the LPF max path are both set to match the number of rays inside the rayfile.
- Update each direction simulation. Each simulation will generate a *.lp3 file.
Note, if the windshield geometry used in this project is defined by separated surfaces, i.e. there is no windshield volume in this geometry. To describe the optical property of a volume that is enclosed by surface, a Name-Selection/Group of windshield surfaces is used to define the windshield volume.
Step 3: Distortion Analysis via Processing LPF file
- Download or clone the Ansys optical-automation repo with the link .
- Install all the necessary python libraries as illustrated .
- Take the example_windshield_distortion_lpf_reader.py script from application folder inside the optical-automation repo.
- Execute the script.
- During execution, users are asked to select the 5 *.lp3 result file. User needs to select the central rayfile source firstly and the other 4 remaining *.lp3 files using the 4 other rayfiles.
The script will then plot 2 graphs: Distortion map and Diopter map:
The distortion map describes the distribution of maximum deflection angle and the diopter map describes the refractive power value.
Important Model Settings
Description of important objects and settings used in this model
CAD geometry orientation
It is important to notice that, in this example, the x-axis is used as the front direction. The final result produced plots results given at the y-z plane. Thus, it is necessary to make sure the windshield geometries are orientated using x-axis as front direction and z-axis as up direction.
Using fine meshing for windshield
Speos uses mesh to describe the geometry and ray propagation calculation. Thus, the meshing quality directly affects the precision of the windshield analysis calculations. It is important to have fine meshes for the windshield geometry. In this example, sag mode is used as Fixed with a value equals to 0.001mm since the windshield is a curved structure and needs to be finely meshed to accurately model the its performance.
Using the full-transparent surface optical property for windshield
In the distortion study, the optical distortion is calculated by comparing the incoming ray and the refracted outgoing ray. Thus, reflection needs to be avoided. A full transparent coating file is applied on the surface of the windshield.
Use the same number of rays for simulation and light expert function
A rayfile source explicitly defines the rays to be used in a simulation. During a simulation using a rayfile source, the Speos engine will create rays one by one based on the ray information list defined inside the rayfile file. Thus, it is important to not create fewer or more rays during the simulation. Thus, the number of rays used for a direct simulation and LPF max path number match the number of rays in the rayfile.
Updating the Model With Your Parameters
Instructions for updating the model based on your device parameters
Use a smaller step value to generate more detailed result maps
In this example, the step value/resolution for the map is set to be 30mm. To produce a more detailed result map, user can increase the resolution by creating a higher density rayfile in step 1, i.e. decrease the value of “step_size” inside the script.
Please noted, as the ray number in the rayfile is changed. It is necessary to adjust the simulation ray number the LPF max path number to match with the ray number.
Use lightbox to avoid remeshing for each simulation.
At the windshield analysis, an extremely fine meshing has been applied to the windshield geometry. Thus, meshing the geometry takes a big portion of simulation time. To avoid repeat the meshing, user can create a lightbox export using the windshield geometry. As a lightbox is a pre-meshed geometry with optical properties applied, the cost for meshing the windshield can be saved during the simulation run time.
Taking the Model Further
Information and tips for users that want to further customize the model
Change the parameters to implement ECE No. 43 regulation.
The No.43 regulation defines the windshield analysis is a very similar methodology. The differences are the value of distance value = 4mm and number of rays around the centre ray=12 (\({∆X}\)= 4 mm and surrounding rays = 12). User can implement the change in the first step of creating rayfile files:
- Change the radius value to 4
- Change the sample value to 13 (i.e. 1 centre ray with 12 surrounding rays)
Then, user will get 13 different rayfile files to be simulated.
Additional Resources
Additional documentation, examples and training material