03-19-2018 11:04 AM
Hi all,
I want to do a xyz scanning by a xyz stage, and wrote a vi to mimic the scanning process (without hardware part). When the scanning is starting, the stage would move to the x,y,z starting position. And the xy scan order as follows,
My vi is redundancy, but I do not know how to simplify it. Can anyone help me to optimize it?
Thanks,
Mei
Solved! Go to Solution.
03-19-2018 11:55 AM
See how far you get.
03-19-2018 01:41 PM - edited 03-19-2018 02:10 PM
Here's a very simplified version that does YX. Expanding to XYZ is trivial, just another loop and tweak boundary conditions as desired.
You would use the current X,Y(,Z) integers to index into your ramp arrays using "index array".
03-19-2018 02:25 PM
For point to point translations like that, i typically use while loops and compare the current position to the desired. It makes it easier to interrupt but you could just use a conditional terminal on the for loop. Having the points calculated prior to execution probably makes the code look a little cleaner, but is a little less intuitive looking at the diagram in my opinion. But I'd definitely use a cluster and typedef it for the scan paramters.
03-20-2018 07:10 AM - edited 03-20-2018 07:11 AM
@altenbach wrote:
- Create three ramps (x, y, z) using "ramp pattern".
- Create a stack of three FOR loops, indexing into the ramps from the beginning or the end based of odd/even index [i] and N.
- Place all indicators in a location where they change, no local variables or case structures needed.
See how far you get.
Thanks, altenbach! I modified the vi as your advice, can you please help me check whether I need to revise more ? And, I want to save the scan data (3D or more dimensions array) as a .txt or . xls file. Can you give some suggestion about this? I do not know how to start it.
Thanks,
Mei
03-20-2018 07:17 AM