Jump to content

sub-proccess synchronization


schneidley

Recommended Posts

hello, i am new to this forum and fairly new to LabView. i have been using previous programming knowlege to feel my way through LabView (with a little sweat, a lot of tears, and some blood - other people's blood - i have been able to do most of what i need, although not in the prettiest fashion). i appologize if this is a stupid question. i'm really over a barrel.

the goal: I am trying to synchronize two sub-proccesses. i want the first one to start collecting data from a "ni usb 6008" and loop until stopped. shortly after, i want another proccess to start running multiple RUS scans. once this proccess has run it's course, it will send the stop command to the first proccess. the effect is that i will have seizmic data (from the usb 6008) covering the entire time that the RUS scans took place.

the problem: the RUS proccess runs. when it completes, the usb 6008 proccess runs, but only iterates the loop once because the stop command was given by the RUS before this proccess even started. in terms of usability, this data is worthless because it is from after the RUS scans stopped. i've been pulling my hair out, trying to figgure this out. please help...

thanks a bunch for any and all help,

~B.

Link to comment

QUOTE (schneidley @ Aug 15 2008, 01:26 PM)

hello, i am new to this forum and fairly new to LabView.

Welcome to Lava! If you can post your code (or at least a screenshot) we'll have an easier time giving advice. It sounds like you may have some dataflow problems common to new LabVIEW programmers.

Link to comment

QUOTE (TobyD @ Aug 15 2008, 01:38 PM)

sure thing. i used lots of sub vi's (and sub sub sub... etc. vi's) to save time as opposed to starting completely from scratch, and don't want to clutter things by posting everything. if it will help though, i would gladly post everything i've got. as for a screen shot...

http://lavag.org/old_files/monthly_08_2008/post-12275-1218841563.jpg' target="_blank">post-12275-1218841563.jpg?width=400

the stacked sequence to the left is p1 (i want it to start first and run until stopped) and the beefy one on the right is p2 (for RUS; should start after p1 and tells p1 when to stop). it's messy, i know. i don't really wire things like this in real life ;).

the main vi is called russequential.vi, and i have included the two main sub vi's. the four files are in a zip folder so they could all be in a nice package. i hope this is enough info, but if anyone needs more, i can happily provide it.

thanks,

~B.

Link to comment

The problem lies in the flow of your data. In LabVIEW, a structure will never begin execution until all of its inputs have data. The loop that you want to run first is relying on data from the second loop (the stop boolean). The first loop will not start to run until it sees data on that input terminal, but that data does not arrive until the second loop stops and outputs its data.

I would highly recommend spending some time here and getting a good book (I found "LabVIEW For Everyone" to be extremely helpful and easy to follow) to learn the basics of dataflow in LabVIEW and the best practices for creating easy to read, expandable code. It will make your life a lot easier if you can break the habit of using all those stacked sequences. :)

Link to comment

schneidley,

I think this will work for you. I used two shared variables to start and stop the two parallel processes. You could also use globals. Just make sure you initialize these variables very first thing in your program. If you are passing read data between the two processes, I would highly recommend using queues.

post-11268-1219076478.jpg?width=400

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.