This widget could not be displayed.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for a way to synchronize two subview at some point

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 11 of 20
(1,033 Views)

You could have SVA send a notifier that SVB, after completing the parallel part, waits for.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 12 of 20
(1,031 Views)

"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

 

0 Kudos
Message 13 of 20
(1,022 Views)

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

0 Kudos
Message 14 of 20
(1,013 Views)

Hello,

 

This Thread can help you to understand and implement..

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 15 of 20
(1,006 Views)

@Himanshu_Goyal wrote:

Hello,

 

This Thread can help you to understand and implement..


Thanks a lot. I am reading that 🙂

0 Kudos
Message 16 of 20
(1,001 Views)

@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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 17 of 20
(997 Views)

@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 🙂

0 Kudos
Message 18 of 20
(994 Views)

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.

0 Kudos
Message 19 of 20
(991 Views)

LV will clean it up, but it's better if you can manage to close the queue.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 20 of 20
(988 Views)