LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do a XYZ Scanning?

Solved!
Go to solution

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,

Capture.JPG

My vi is redundancy, but I do not know how to simplify it. Can anyone help me to optimize it?

 

Thanks,

Mei

0 Kudos
Message 1 of 16
(4,902 Views)
  • 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.

0 Kudos
Message 2 of 16
(4,883 Views)

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".

 

ScanXY.png

Message 3 of 16
(4,855 Views)

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.



Bruce K

Not as smart as many other peepz on here....
0 Kudos
Message 4 of 16
(4,843 Views)

@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

0 Kudos
Message 5 of 16
(4,822 Views)

Thanks for your kindly reply, Bruce.

Mei

0 Kudos
Message 6 of 16
(4,819 Views)

There are several issues I would change:

 

  • "X(YZ) steps" should be renamed to step size, because that's what it is. You can change the ramp pattern to "ramp by delta" and wire your controls directly. No math needed.
  • Due to your use of autoindexing, you need to create two copies of the ramp data which seems redundant. My method is more efficient.
  • Wire the actual ramp array size to N, not some derived, potentially fractional value.
  • You should twiddle the various ramps so each Z layer starts at the last xy position for efficiency. Currently, you move all the way to the origin with every new Z plane.

Saving the scan data as a 3D text file is supported by "array to spreadsheet string", but be aware that a typical file only has 2 dimensions. For higher dimensions, LabVIEW will insert page markers (details). Write the resulting string to file. To read it back into a 3D array, simply reverse the procedure. Of course saving all the ramp data seems redundant, because it can be recreated by saving the values of the 9 controls. The ultimate lossless  compression! 😄

 

0 Kudos
Message 7 of 16
(4,789 Views)

Another option to save the data would be a 2D array where each row contains an xyz set as three numbers.

 

If this file is supposed to be read by other software, you need to adapt as required.

0 Kudos
Message 8 of 16
(4,770 Views)

Thanks, but I cannot understand this suggestion, I did not find out how to revise this one...


@altenbach
  • Due to your use of autoindexing, you need to create two copies of the ramp data which seems redundant. My method is more efficient.

 


In my revised vi, I cannot save y,z data  even I wire the y data and there exist some zero rows between each z scan, are these the page markers?? I want to process the saved data by matlab.

 

Thanks,

Mei

0 Kudos
Message 9 of 16
(4,767 Views)

Hi,

I changed data saving function in this version, it could save x,y,z data now. But the saving data seems strange as the follow pictures show.

1.JPG2.JPG  

 

The y,z data are saved in the last and extra page, and there are some zero rows after t 'array to spreadsheet string' and in the .txt file. Is it right?  I will load the .txt file  in matlab. 

 

Thanks,

Mei

0 Kudos
Message 10 of 16
(4,747 Views)