06-28-2016 07:56 AM
Afternoon Gurus,
I have inherited some Excel code which I want to convert to Labview. it uses the Solver function to optimize a system.
I have some input parameters which are passed to a process which is non-linear and cannot be described by a single function. The process outputs a couple of values which I compare with measurement. I want to optimise the input parameters so the output matches the measured, ideally of course! In excel, Solver looks to minimize the fraction error between the measured and modelled ((Modelled - measured)/measured)^2. It doesn't know that, it is just minimising a value in a cell by varying the input cells.
Which set of VI's do I need to replicate this system?
Many thanks,
Paul
06-28-2016 08:32 AM
On the Mathematics Block Diagram Palette, there is an Optimization sub-Palette. Optimization is a somewhat complex topic -- you should "know what you are doing" before blindly jumping in and choosing a method and options, particularly if dealing with non-linear problems.
Bob Schor
07-22-2016 04:23 AM
Thanks for that. This is indeed - complex.
For my application, I have a function f(x), which is bounded between upper and lower limits, and has a single peak at X0. I process the function in a non-linear way and end up with a modified function. I then sum that modified function up over the bounds and end up with a single value, which I can compare with a measured value. I want to mininize the relative error between the measured and modelled by optimising X0.
I shall carry on thinking and Googling.
Paul
07-24-2016 10:13 PM
I have had a lot of success using the "Constrained Non-Linear Curve Fit" and "Non-Linear Curve Fit" VI's located under Mathematics->Fitting. You will create a VI that is used as the non-linear function and outputs your error value, so it should translate very nicely from the Excel method.
07-25-2016 05:42 AM
Thanks,
I will have a look, but the issue is that I am not actually curve fitting. But I will see if I can use them.
Paul
07-25-2016 02:37 PM
Hi All,
Decided not to give up on this. Noticing a minor wiring error from a few days ago (max and min the wrong way around.....) I got this working. Attached is a ppt of the wiring diagram. Key is to: 1) use the template for the objective and constrains vi; 2) don't delete the unused items in the objective and constrains vi;
One note of caution. When I set the start point near to or at the max value, it did not find the minimum