12-03-2009 06:04 PM
I am using the Lev-Mar non-linear fit to fit two curves of data in the same VI. However, the second time I call the Lev-Mar VI, it ignores the model and continues to use the first model. When I run Lev-Mar outside of my VI, it can fit both sets of data correctly using the two different models. How can I get the VI to use the correct model the second time I call it in my VI?
I am using Labview 8.0 on windows XP.
Solved! Go to Solution.
12-03-2009 08:37 PM
glor12 wrote:I am using the Lev-Mar non-linear fit to fit two curves of data in the same VI. However, the second time I call the Lev-Mar VI, it ignores the model and continues to use the first model. When I run Lev-Mar outside of my VI, it can fit both sets of data correctly using the two different models. How can I get the VI to use the correct model the second time I call it in my VI?
I am using Labview 8.0 on windows XP.
Lev-Mar non-linear fit is NECESSARILY re-entrant. Play with the "Pre-alocate clones" option to get the desired action.
12-03-2009 09:22 PM - edited 12-03-2009 09:27 PM
The LabVIEW 8.0 version of the nonlinear curve fit (formul string model) has a bug in that the formula is parsed only on "first run?"!
This was fixed in LabVIEW 8.2.
If you cannot upgrade and you are adventurous, you can fix it yourself. Just make a copy of the VI and save it elsewhere.
I would not modify the VI.lib version. Basically, you need to re-parse the model whenever the model changes instead of only on "first run?".
12-03-2009 09:36 PM - edited 12-03-2009 09:37 PM
altenbach wrote:The LabVIEW 8.0 version of the nonlinear curve fit (formul string model) has a bug in that the formula is parsed only on "first run?"!
Here's a quick comparison of the 8.0 and 8.2 version of "LM formula string function.vi".
The 8.0 version uses the "first run?" primitive, and thus parses the formula only once per session and then never again, even if the function changes it keeps using the originally cached model.
As you can see, the 8.2 correctly parses the formula whenever the "function parameters" variant changes.
(Briefly, the function is compared with an uninitialized shift register and if the values differ, the model is re-parsed. The new function parameters are fed into the shift register on the left, for comparison at the next call. Typically, the comparison inputs are equal (not equal=false) and the cached formula is used.)
12-03-2009 09:45 PM - edited 12-03-2009 09:51 PM
A quick fix would be to replace the "first run?" primitive with a feedback node, e.g. as follows:
From a historical perspective, I identified that problem back in mid 2006. 😄
See the original discussion and a link to download a corrected version.
(CAR# 3XHB2IQO)
12-04-2009 09:17 AM
Every once in a while I can post faster than Christian
I should learn
Thanks for the DETAILED info !
12-04-2009 09:52 AM
Jeff Bohrer wrote:Every once in a while I can post faster than Christian
Except the problem had nothing to do with any reentrancy settings. 😮 😄
12-04-2009 10:30 AM
Thanks for all the help!
One more question, how do I save a version of the LM non-linear fit so I can add the repairs? It asks for a password, and I saw that you asked for a work-around in 2006. Has one been found?
12-04-2009 10:53 AM - edited 12-04-2009 10:56 AM
The VI itself is not passworded, but it is part of a passworded library, indirectly blocking the operation.
You can always select all the code and copy it into a new VI, the hook up all the connectors.
You can also browse to the VI using explorer and copy it out. Give the copy a new name, open it, and disconnect from library (file menu) to fix the broken arrow.
I think you can also edit the original in place and hit "save". This does not need a password and will overwrite the existing VI. Make no mistakes here!