Skip to main content
Solved

Optimization wizard, Merit function editor error message

  • November 6, 2022
  • 1 reply
  • 329 views

Mattia

Everyt ime i try to use the oprimization wizard and define a function; when i press the buttons: ‘ok’  and  ’apply’ i get this error message: “Can’t open File C:\Users\user1\Documents\Zemax\MeritFunction\favorite.mf!”. And i don’t understand why,. It seems that it is not saving the function that i am defining. With this i can’t use the optimizer because it says that there are no variables defined, it seems it is not saving correctly the merit functions that idefine?

What can i do to fix the problem? Am i doing something wrong? do i have to re-install OpticStudio?

Thanks in advance for the help

Best answer by Ethan

Hi @Mattia ,

I suspect that the file error is due to the use of the “Add Favorite Operands” feature. If checked, OpticStudio will add the merit function defined in Favorite.mf above the DMFS line. It will by default look in the <data>\MeritFunction folder to find this file. Since you have not created this file and likely aren’t wishing to add it, just make sure to uncheck this option:

Regarding the “no variables defined” error, this message relates to the data in the Lens Data Editor, and not the merit function itself. You need to set at least one parameter in your design to be variable, such as thickness, curvature, etc. The optimizer requires at least one degree of freedom to optimize the design.

Here is a great article on optimization that will likely be helpful in setting up the merit function and variables: How to design a singlet lens, Part 3: Optimization.

Best,
Ethan

View original
Did this topic help you find an answer to your question?

1 reply

Ethan
En-Lightened
Forum|alt.badge.img+2
  • En-Lightened
  • 107 replies
  • Answer
  • December 6, 2022

Hi @Mattia ,

I suspect that the file error is due to the use of the “Add Favorite Operands” feature. If checked, OpticStudio will add the merit function defined in Favorite.mf above the DMFS line. It will by default look in the <data>\MeritFunction folder to find this file. Since you have not created this file and likely aren’t wishing to add it, just make sure to uncheck this option:

Regarding the “no variables defined” error, this message relates to the data in the Lens Data Editor, and not the merit function itself. You need to set at least one parameter in your design to be variable, such as thickness, curvature, etc. The optimizer requires at least one degree of freedom to optimize the design.

Here is a great article on optimization that will likely be helpful in setting up the merit function and variables: How to design a singlet lens, Part 3: Optimization.

Best,
Ethan


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings