07-29-2013 06:20 AM
If you cannot split subB (why that is i cannot fathom), you'll need to use Events, occurence or rendevous to sync them up.
/Y
07-29-2013 06:29 AM
07-29-2013 04:05 PM
"But if I break that into too parts, all other vi linking to this one will be rewrite or relink or something anyway needed to be done. This is the problem of labview coding, so many cross-reference and I don't even dare to touch some critical code written by someone else in a big project."
This is not a problem of LabVIEW code, it is a problem of bad programming. Think what it would be like if someone wrote 400-500 pages of text based code with no subroutines and thousands of GOTO statements without meaningful labels.
This sounds as though the person(s) who wrote the original code did not understand dataflow. I realize that does not help you solve your immediate problem. At some point you may need to go to your supervisors and tell them that the old code is so poorly written that it cannot be modified without excessive risk of creating more problems than the modification was intended to solve. Often it is easier to completely rewrite code like that than to try to fix it.
Definitely, absolutely, before you do anything else, make multiple copies of the old code. Save them to DVD and store them in separate locations. That way when (not IF) one of your changes breaks something, you can go back.
Several other posters have recommended things you may be able to do which would be less problematic than local variables.
Lynn
07-29-2013 11:34 PM
Thanks all your guy's suggestions. It seems that using events, occurence or rendevous is a good idea. But I didn't use those before, I need to read some more information before I modify the code.
More generally, I have a similiar situtation needed to be handled like this one but SVA will send more than one data out to the external device, SVB will advance only when there is more than one set of data sent by SVA, so that's a producer-consumer model. I am thinking to add a signal in a queue when SVA finish one data dispatch, so SVB will montior the queue to see if it is ready to move. But in this case, we need common queue again (just like the global variable idea), but I don't see any way to implement it without using global variable. Maybe using events? But how ... ?
07-30-2013 12:15 AM - edited 07-30-2013 12:16 AM
Hello,
This Thread can help you to understand and implement..
07-30-2013 12:27 AM
@Himanshu_Goyal wrote:
Hello,
This Thread can help you to understand and implement..
Thanks a lot. I am reading that 🙂
07-30-2013 01:29 AM
@dragondriver wrote:
More generally, I have a similiar situtation needed to be handled like this one but SVA will send more than one data out to the external device, SVB will advance only when there is more than one set of data sent by SVA, so that's a producer-consumer model. I am thinking to add a signal in a queue when SVA finish one data dispatch, so SVB will montior the queue to see if it is ready to move. But in this case, we need common queue again (just like the global variable idea), but I don't see any way to implement it without using global variable. Maybe using events? But how ... ?
A Queue is a good idea in this case, as it'll automatically wait until it recieves information. With Obtain queue you'll get a named queue, so no Globals needed. With events you'll need to Create User Event outside both functions (or in an Action Engine) and wire in the events to both functions, so they can create/listen to it.
/Y
07-30-2013 01:38 AM
@Yamaeda wrote:
@dragondriver wrote:
More generally, I have a similiar situtation needed to be handled like this one but SVA will send more than one data out to the external device, SVB will advance only when there is more than one set of data sent by SVA, so that's a producer-consumer model. I am thinking to add a signal in a queue when SVA finish one data dispatch, so SVB will montior the queue to see if it is ready to move. But in this case, we need common queue again (just like the global variable idea), but I don't see any way to implement it without using global variable. Maybe using events? But how ... ?
A Queue is a good idea in this case, as it'll automatically wait until it recieves information. With Obtain queue you'll get a named queue, so no Globals needed. With events you'll need to Create User Event outside both functions (or in an Action Engine) and wire in the events to both functions, so they can create/listen to it.
/Y
You are right. I think that's what I am looking for too. I just find that there is an example for producer and consumer model in labview too 🙂
07-30-2013 02:33 AM
Hi al
@dragondriver wrote:
@Yamaeda wrote:
@dragondriver wrote:
More generally, I have a similiar situtation needed to be handled like this one but SVA will send more than one data out to the external device, SVB will advance only when there is more than one set of data sent by SVA, so that's a producer-consumer model. I am thinking to add a signal in a queue when SVA finish one data dispatch, so SVB will montior the queue to see if it is ready to move. But in this case, we need common queue again (just like the global variable idea), but I don't see any way to implement it without using global variable. Maybe using events? But how ... ?
A Queue is a good idea in this case, as it'll automatically wait until it recieves information. With Obtain queue you'll get a named queue, so no Globals needed. With events you'll need to Create User Event outside both functions (or in an Action Engine) and wire in the events to both functions, so they can create/listen to it.
/Y
You are right. I think that's what I am looking for too. I just find that there is an example for producer and consumer model in labview too 🙂
I have one question. Do I really have to release the queue at the end of the code? If I don't will it be release automatically by labview? Well in my code, there are so many subvi and other stuffs in the page, if I need to release the queue before everything done, it seems that i have to use a flat sequence and put everything in the first frame and release the queue in the last frame.
07-30-2013 03:42 AM
LV will clean it up, but it's better if you can manage to close the queue.
/Y