LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save only part of my indexed data

Hi Folks! I'm having some trouble saving only part of my streaming daqmx data to disk. I've attached a gauss meter to a Zaber stepper motor, and have it moving from a home position to an absolute position. at the same time, my gauss meter is mesuring data via daqmx while stepping. when i get to the end of the line, the stepper motor returns to home...data is recorded in both directions (forward and backward). I only want the forward data to collect. reverse data is not needed. this is especially important when i want to run more than one scan (move forward and backward n times.) I have a while loop gathering data (see attached.) Any ideas on how i can only record/index partial data coming in? Thanks in advance!

0 Kudos
Message 1 of 7
(3,572 Views)

You can make the indexing output tunnel condtional (right-click.. etc.). Wire a true only when the movement is in the desired direction. How does the program know the direction?

 

(I would also get rid if that huge stack of shift regsiters. Try the ptbypt mean, for example.) Why are you discarding the last sample when the program stops? Shouldn't you use one less shift regsiter and add the current data to the sum?

0 Kudos
Message 2 of 7
(3,563 Views)

thanks for the feedback altenbach!

 

So the ptbypt function is a lot handier than all those shift registers :).

 

Also, thanks for pointing out the conditional function for indexing. I recently took Core 1 & 2 for Labview, and am studying for my CLAD.

 

You bring up a good point on how to determine how the software knows when to run. I'll play around with the Zaber vis to see if i can pull out some processing data when the stepper motor is moving in the forward direction, and not in the reverse.

 

Check out the new code 🙂

Download All
0 Kudos
Message 3 of 7
(3,507 Views)

Hi Debrosse,

 

Would you be able to post the vi? I can take a look to see if there is a good way to add the direction checking.

 

From a first look, I think I would change the commands so that instead of using Request (once it sends, it waits for the completion before VI continues), to Send and then Read in a loop. During the loop, I would poll the position using the Return Current Position command. Finally I would compare the current loop iterations Position value to the previous iterations. If it is greater, then you are moving forward. If it is lesser, then you are retracting. If it is equal, then you've completed the movement and can move on to the next movement. 

 

Let me know if this makes sense. With a copy of the vi I could insert it if you aren't sure. 

 

 

Mike McDonald

Applications Engineer

Zaber Technologies

mike@zaber.com

0 Kudos
Message 4 of 7
(3,463 Views)

Mike, 

 

Thanks for taking a look!

 

I've attached. 

 

Note, there are mutiple while loops. One for the camera controls - no saving, just so the opperator can position the sensor. One loop for the data logging. And finally, a loop for all 3 stepper motors. I've added basic control for x, y, z control. i have one trigger to return the x axis to a starting positon before testing. Finally, the hardest part for the code is the (Run N scans simple button.) it runs well, but i only want the forward data, not the reverse.

 

Thanks for your help!

 

-Greg

0 Kudos
Message 5 of 7
(3,449 Views)

Don't have enough Monitor Real Estate!  See all those tiny 32 x 32 pixel boxes on your Block Diagram?  Many of those are icons for sub-VIs, which take much less space than the code they encapsulate and make your Block Diagram smaller, easier-to-read (because you can see it "at a glance", particularly if you keep your wires from getting tangled), and hide unimportant details.  It is also very easy to give each of your sub-VIs a 4-line (short) icon so you can readily tell what they do.  To get around the difficulty of posting multi-VI examples here in the Forum, Zip them together.  Sub-VIs also work very nicely with the LabVIEW Project.

 

Bob Schor

0 Kudos
Message 6 of 7
(3,437 Views)

Hi Debrosse

 

Thanks for sending the VI. 

 

I've attached an updated version. This one uses a while loop checking the 'status' of the stage to determine if the movement has completed. A value of 0 means the stage is idle and the next movement command can happen. Along with this, the 'Request' vis are replaced with 'Write' vis. 

 

I've also added a conditional on the indexing of the Measurement File loop, which polls the current position and compares it to the previous one. This should ensure that data is only recorded when the new position is larger than the last.

 

The movement commands will still be sending responses when they complete. This version of the VI doesn't rely on these, and they may complicate the communication of other commands. I would recommend turning these movement responses off by setting bit_0 of the Device Mode setting (cmd # 40) to 1 (in other words, read the previous value, and write back the same value +1). This will set it so that only commands with 'Return' in the name, such as 'Return Status' or 'Return Current Position' will send a response.

 

Please let me know if this has the desired effect! 

 

Mike

0 Kudos
Message 7 of 7
(3,429 Views)