07-17-2014 08:34 PM
Hello,
I am trying to write a tuning algorithm that changes the calculated tune value after the program sees the same calculated value as before. My tuning algorithm gets hung up on the extremes (5000 and 10000) and just goes back and forth and does not get out of that mode. I wanted to adjust the calculated tune value up or down (depending which limit is hit), so that the program can continue working and converge to the correct tuned value.
In the attached VI, the Calc Tune Value array simulates the calculated tune value from my program that is derived within a while loop. In each iteration of the while loop, a tune value is generated (the index array in the attached VI simulates the tune value generated on each iteration of my actual program). As shown in the array, entry 3 is the same as entry 1. How can I modify the program such that when entry 3 shows up again, I modify the value. How can I keep a running check of the same value appearing again?
Thanks,
hiNI.
07-18-2014 12:28 AM
You can use a shift register and build an array by using the Tune values you generate. Then you can compare the tune value generated out of index array primitive with the shift register array and check if it has be already generated (When you cmpare you will get array of boolean output, perform an Arrya OR operation and find if the value is already present). Then you can perform action depending on the status.
I have attached an example.