Using the FRED Knowledge Base
Relevant knowledge base articles can be easily located using one of the following methods:
- Browse the Categories using the menu topics on the left of the page
- Enter a string in the Search box at the top left of the page
Featured Articles
May 17th, 2012
The purpose of this file is to demonstrate how to display a result dynamically in the 3D view as a calculation is being performed. In this case, the embedded script applies a stepped rotation and tilt to the lens element so that the source ray is deviated from its collimated direction. Inside of the loop, an analysis results node is repeatedly displayed in the 3D view showing the accumulated results up to the current iteration. The resulting display in the 3D view provides some dynamic capability for showing results as they are calculated.
Please note that this approach is not suitable for all systems because of the delay in updating and/or result calculation. In cases where trace/calculation time is significant, this approach could be modified to write out the results to a set of FGD files and then display them sequentially by reading them in from file.
Posted in Analyses, Analysis Surfaces, Scripting | Comments Off
May 16th, 2012
The Lens Module family of surfaces (Infinite conjugate, finite conjugate, afocal and spherical) provide a convenient mechanism for quickly defining an ideal lens element. If the circumstance arises where a lens module surface is desired to be included in an optimization, the user will find that there is no direct access via the default variables. The user-scripted variable can be used in this case to access any of the parameters of the lens module. This knowledge base article provides an example FRED file which demonstrates two use-scripted optimization variables that access the focal length and magnification parameters of a finite conjugate lens module. In this case, the optimization is setup to adjust the focal length and magnification of the lens module such that the diverging source is focused onto a static detector.
Posted in Geometry, Optimization | Comments Off
May 3rd, 2012
This knowledge base article demonstrates how to calculate the encircled energy in an ARN by scripting. The FRD file contains a simple gaussian source and analysis surface as well as an embedded script. The embedded script will calculate the irradiance on the analysis surface and store the result in an Analysis Result Node (ARN), after which it creates a library object from the attached script file “encircledEnergy.frs” and calls the encircled energy subroutine from it. When the encircled energy subroutine is finished, the two array arguments that are passed to it will have been populated with the radii and fractional encircled energy values.
Posted in Analyses, Scripting | Comments Off
April 18th, 2012
“Batch-Processing.frs” demonstrates how to run a sequence of raytraces using FRED’s COM capability. The script is kept generic by retrieving and executing the code in the Embedded Script of each FRED Document that is opened. The additional FRED Document “run1.frd” provides a simple demonstration of this where a raytrace is performed and Irradiance data is saved before the Document is closed.
Posted in Rays and Raytracing, Scripting | Comments Off
December 2nd, 2011
This knowledge base article discusses how to use FRED to accurately model the coupling from a ball-lens capped semiconductor laser diode to a single mode fiber – an optical system common in optical fiber communication applications. This model demonstrates FRED’s capability to propagate coherent fields, its accurate Laser Diode Beam source type and its ability to calculate fiber coupling efficiency.
Longitudinal, horizontal and angular alignment sensitivity of the fiber position is studied via embedded scripts.
Posted in Analyses, Scripting, Sources | Comments Off
October 12th, 2011
This knowledge base article demonstrates modeling of a three mirror 5x afocal telescope system as prescribed in “Modern Lens Design: A Resource Manual” by Warren Smith (McGraw Hill). This article discusses how to construct the off-axis parabolas (OAPs) in FRED using the surface apertures to select the off-axis portion of a base surface. Additionally, a custom script is used to trace a “gut ray” along the optical axis so that the decenter position can be accurately identified for the 2nd and 3rd mirrors of the system. Finally, an analysis surface is placed at the output plane to verify the system MP.
Posted in Geometry, Rays and Raytracing, Scripting | Comments Off
September 29th, 2011
This knowledge base article demonstrates an example of how to automate an analysis of which is dependent on a source’s wavelength specification. The setup is a ray bundle incident on a linear grating at some non-zero angle. The diffracted beam reflects from the grating and is absorbed by a detector surface. In the script, the goal is to perform the following tasks:
1) Modify the source wavelength
2) Trace the current configuration
3) Calculate the irradiance on the detector surface
4) Repeat steps 1) – 3) for a range of wavelength values
In this implementation the irradiance results are stored in analysis results nodes on the object tree, each uniquely named for the wavelength to which the results correspond. If the intent is to loop over many wavelengths, the user may choose to modify the script so that results are written to a data file on disk rather than being stored in memory on the object tree. Once the script is finished running, the user can right mouse click on any of the ARN’s and choose either “Display in Chart” or “Display in Visualization View” in order to review the results.
Posted in Analyses, Scripting, Sources | Comments Off
September 26th, 2011
The attached example file demonstrates an embedded script routine which will calculate the wavefront for rays on a particular surface of interest and write out the data to a text file. The text file can then be read back into FRED for analysis by navigating to Menu > Tools > Open Plot File in 3D Chart. The text file is saved into the same directory as the associated FRED file.
Posted in Analyses, Scripting | Comments Off
September 13th, 2011
The attached FRED file has an embedded script called “rotateAndAnalyze” that demonstrates how to rotate a source over a range of angles and perform an analysis at each step in the rotation. In this configuration, the asymmetric source is rotated about the z-axis as it is focused onto the detector. The number of steps in the rotation is specified by the user on line 18 and the maximum rotation angle is specified on line 19. Notice that the Analysis Results Nodes are used to store the results of each analysis on the object tree in the Analysis Results folder.
The user should be aware that these analysis results nodes are stored in memory and can pile up if the script is repeatedly run (potential memory management issue). Two commands exist for removing ARN’s from the object tree, ARNDelete and ARNDeleteAllNodes. Alternatively, the ARNs could be written to disk as an FGD file using the command ARNWriteToFile. These FGD files can then be brought back into any FRED document by right mouse clicking on the Analysis Results folder and selecting the option “Create New ARN from File”.
Posted in Analyses, Scripting | Comments Off
August 16th, 2011
Using FRED’s COM interface it is possible to exchange data with external programs such as MATLAB and Excel. This article presents an example where FRED and MATLAB are used respectively as the automation client and server in order to exchange data and create plots. There are a few steps that should be taken both in FRED and MATLAB before executing your script:
In MATLAB:
- Start an instance of MATLAB
- Execute the command: enableservice(‘AutomationServer’,true)
- Execute the command: enableservice(‘AutomationServer’)
In FRED:
- Right mouse click in the script editor and choose: Edit > References
- Choose the Matlab Type Library
- Dimension your Matlab object in the script as type MLApp.MLApp
The above steps will ensure that 1) FRED uses the current instance of MATLAB as the server instead of the command console, and 2) FRED loads the Matlab type library and can recognize and execute the server’s application commands. In general, it is not necessary to load the Matlab type library in FRED since the Matlab server can be generically defined as an Object.
The example enbedded script in the sample file with this article demonstrates how to use some of the following Matlab application commands:
- PutWorkspaceData: send real-valued data to Matlab
- PutFullMatrix: send complex-valued data to Matlab
- GetWorkspaceData: retrieve data from Matlab
- Execute: issue Matlab commands to the server for execution
Posted in Analyses, FAQ, Scripting | Comments Off
Recent Articles
May 17th, 2012
The purpose of this file is to demonstrate how to display a result dynamically in the 3D view as a calculation is being performed. In this case, the embedded script applies a stepped rotation and tilt to the lens element so that the source ray is deviated from its collimated direction. Inside of the loop, an analysis results node is repeatedly displayed in the 3D view showing the accumulated results up to the current iteration. The resulting display in the 3D view provides some dynamic capability for showing results as they are calculated.
Please note that this approach is not suitable for all systems because of the delay in updating and/or result calculation. In cases where trace/calculation time is significant, this approach could be modified to write out the results to a set of FGD files and then display them sequentially by reading them in from file.
Posted in Analyses, Analysis Surfaces, Scripting | Comments Off
May 16th, 2012
The Lens Module family of surfaces (Infinite conjugate, finite conjugate, afocal and spherical) provide a convenient mechanism for quickly defining an ideal lens element. If the circumstance arises where a lens module surface is desired to be included in an optimization, the user will find that there is no direct access via the default variables. The user-scripted variable can be used in this case to access any of the parameters of the lens module. This knowledge base article provides an example FRED file which demonstrates two use-scripted optimization variables that access the focal length and magnification parameters of a finite conjugate lens module. In this case, the optimization is setup to adjust the focal length and magnification of the lens module such that the diverging source is focused onto a static detector.
Posted in Geometry, Optimization | Comments Off
May 3rd, 2012
This knowledge base article demonstrates how to calculate the encircled energy in an ARN by scripting. The FRD file contains a simple gaussian source and analysis surface as well as an embedded script. The embedded script will calculate the irradiance on the analysis surface and store the result in an Analysis Result Node (ARN), after which it creates a library object from the attached script file “encircledEnergy.frs” and calls the encircled energy subroutine from it. When the encircled energy subroutine is finished, the two array arguments that are passed to it will have been populated with the radii and fractional encircled energy values.
Posted in Analyses, Scripting | Comments Off
April 18th, 2012
“Batch-Processing.frs” demonstrates how to run a sequence of raytraces using FRED’s COM capability. The script is kept generic by retrieving and executing the code in the Embedded Script of each FRED Document that is opened. The additional FRED Document “run1.frd” provides a simple demonstration of this where a raytrace is performed and Irradiance data is saved before the Document is closed.
Posted in Rays and Raytracing, Scripting | Comments Off
December 2nd, 2011
This knowledge base article discusses how to use FRED to accurately model the coupling from a ball-lens capped semiconductor laser diode to a single mode fiber – an optical system common in optical fiber communication applications. This model demonstrates FRED’s capability to propagate coherent fields, its accurate Laser Diode Beam source type and its ability to calculate fiber coupling efficiency.
Longitudinal, horizontal and angular alignment sensitivity of the fiber position is studied via embedded scripts.
Posted in Analyses, Scripting, Sources | Comments Off
October 12th, 2011
This knowledge base article demonstrates modeling of a three mirror 5x afocal telescope system as prescribed in “Modern Lens Design: A Resource Manual” by Warren Smith (McGraw Hill). This article discusses how to construct the off-axis parabolas (OAPs) in FRED using the surface apertures to select the off-axis portion of a base surface. Additionally, a custom script is used to trace a “gut ray” along the optical axis so that the decenter position can be accurately identified for the 2nd and 3rd mirrors of the system. Finally, an analysis surface is placed at the output plane to verify the system MP.
Posted in Geometry, Rays and Raytracing, Scripting | Comments Off
September 29th, 2011
This knowledge base article demonstrates an example of how to automate an analysis of which is dependent on a source’s wavelength specification. The setup is a ray bundle incident on a linear grating at some non-zero angle. The diffracted beam reflects from the grating and is absorbed by a detector surface. In the script, the goal is to perform the following tasks:
1) Modify the source wavelength
2) Trace the current configuration
3) Calculate the irradiance on the detector surface
4) Repeat steps 1) – 3) for a range of wavelength values
In this implementation the irradiance results are stored in analysis results nodes on the object tree, each uniquely named for the wavelength to which the results correspond. If the intent is to loop over many wavelengths, the user may choose to modify the script so that results are written to a data file on disk rather than being stored in memory on the object tree. Once the script is finished running, the user can right mouse click on any of the ARN’s and choose either “Display in Chart” or “Display in Visualization View” in order to review the results.
Posted in Analyses, Scripting, Sources | Comments Off
September 26th, 2011
The attached example file demonstrates an embedded script routine which will calculate the wavefront for rays on a particular surface of interest and write out the data to a text file. The text file can then be read back into FRED for analysis by navigating to Menu > Tools > Open Plot File in 3D Chart. The text file is saved into the same directory as the associated FRED file.
Posted in Analyses, Scripting | Comments Off
September 13th, 2011
The attached FRED file has an embedded script called “rotateAndAnalyze” that demonstrates how to rotate a source over a range of angles and perform an analysis at each step in the rotation. In this configuration, the asymmetric source is rotated about the z-axis as it is focused onto the detector. The number of steps in the rotation is specified by the user on line 18 and the maximum rotation angle is specified on line 19. Notice that the Analysis Results Nodes are used to store the results of each analysis on the object tree in the Analysis Results folder.
The user should be aware that these analysis results nodes are stored in memory and can pile up if the script is repeatedly run (potential memory management issue). Two commands exist for removing ARN’s from the object tree, ARNDelete and ARNDeleteAllNodes. Alternatively, the ARNs could be written to disk as an FGD file using the command ARNWriteToFile. These FGD files can then be brought back into any FRED document by right mouse clicking on the Analysis Results folder and selecting the option “Create New ARN from File”.
Posted in Analyses, Scripting | Comments Off
August 16th, 2011
Using FRED’s COM interface it is possible to exchange data with external programs such as MATLAB and Excel. This article presents an example where FRED and MATLAB are used respectively as the automation client and server in order to exchange data and create plots. There are a few steps that should be taken both in FRED and MATLAB before executing your script:
In MATLAB:
- Start an instance of MATLAB
- Execute the command: enableservice(‘AutomationServer’,true)
- Execute the command: enableservice(‘AutomationServer’)
In FRED:
- Right mouse click in the script editor and choose: Edit > References
- Choose the Matlab Type Library
- Dimension your Matlab object in the script as type MLApp.MLApp
The above steps will ensure that 1) FRED uses the current instance of MATLAB as the server instead of the command console, and 2) FRED loads the Matlab type library and can recognize and execute the server’s application commands. In general, it is not necessary to load the Matlab type library in FRED since the Matlab server can be generically defined as an Object.
The example enbedded script in the sample file with this article demonstrates how to use some of the following Matlab application commands:
- PutWorkspaceData: send real-valued data to Matlab
- PutFullMatrix: send complex-valued data to Matlab
- GetWorkspaceData: retrieve data from Matlab
- Execute: issue Matlab commands to the server for execution
Posted in Analyses, FAQ, Scripting | Comments Off