SAPHIR - Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

load the same VI in different subpanels in XTab and data communication

hi all,

I use labview 2010 and the XTab of the Saphir toolkit. I have two questions about XTab:

  • I want to load the same VI in the created pages. Do I need to use the template VI (*.Vit) or there are other solutions?
  • I create many pages with the same VI. For each page, I want to send data from my main VI to the VI loaded in the page. How can I do that? In fact, I want to allow communication between the subVI and the main VI. any suggestions? are the queue functions adapted for such application? how can I manage the panel reference?

thanks

Cedric

0 Kudos
Message 1 of 11
(11,114 Views)

Hello Cedric,

I encourage you to glance at the PictureViewer.lvproj installed with ViBox - XControls toolkit. You can find it in NI Example Finder.

This project shows you how to add pages displaying the same VI. This is done using reentrant VI dynamic loading. Each page display an independant clone.

Communication between VIs displayed in XTab and your main VI can be handled by any mechanism usualy used to communicate between 2 loops. As main VI and VIs displayed in XTab could manage events I'd like to use custom user events but any other communication link (Q for example) could be used depending of your needs and your habits.

Feel free to post your project, I will look into to try to give best advice I could.

Regards,

Olivier


Olivier Jourdan

Wovalab founder | DQMH Consortium board member | LinkedIn |

Stop writing your LabVIEW code documentation, use Antidoc!
0 Kudos
Message 2 of 11
(6,410 Views)

Hi Oliver,

I tried to find some solutions using the 'user event' without success. My project is in attachement. I modified the front panel of the 'PV_Main.vi' and 'PV_Dlg_ViewOnePicture.vi' to be able to pass a text from the top VI to the subVI (active XTab Page). When the button 'Send_text' is pressed, the text in the 'Results_text' control has to be sent to the 'SubVi text' of the current XTab page. any suggestions?

thank you.

Cédric

0 Kudos
Message 3 of 11
(6,410 Views)

Hi Cedric,

I suggest a solution based on a "user event" implementation. See your project in attachment. In this solution, I've implemented a user event of String type in order to communicate a text value between the "PV_Main.vi" and the possible multiple instances of "PV_Dlg_ViewOnePicture.vi" :

In "PV_Dlg_ViewOnePicture.vi" : Creation of the string type user event and registration in the event structure. The event does simply pass the user event data value in the "SubVI_text" indicator.

In "PV_Main.vi" : The "SendText" button value change event is added. In this event, the user event reference is collected by VI server using the method "ControlValue.Get" of the active page VI reference of the Xtab and the user event is generated with the value of the "Results_text" control.

Another communication mechanism could be a "Queue communication" implementation.

Hope it will help

Matthieu

0 Kudos
Message 4 of 11
(6,410 Views)

thank you for the solution!

what about sending data from the subVI (XTab page) to the main VI? can I do that with Event or I need to implement Q strategies?

By the way, do you think that Q would be a better solution to manage the data flow from main VI to subVI and inverselly?

thank you.

Cedric

0 Kudos
Message 5 of 11
(6,410 Views)

hi Matthieu,

If I want to send many types of data (such a cluster of array, text and boolean, etc), a similar VI than 'PV_Gnl_DynamicallySendTextUserEvent.vi' has to be implemented. The block diagram of the 'PV_Gnl_DynamicallySendTextUserEvent.vi' is protected so maybe the use Q is better in my application. I am not completely familiar with Q, do you have some advices to pass data from the main VI to the subVI?

thank you for your help.

Cédric

0 Kudos
Message 6 of 11
(6,410 Views)

Both solutions are possible but this is the update frequency and the data treatment duration of the data flow which you select either solution.

You could combined a user event implementation with a Q communication.

The inconvenient of the user event is that it could block the structure which receive this event if the treatment of data is too long! But you can transfer the data flow from the event structure to a parallel loop with a Queue communication for example.

Generally, I used Q communication if you have several type of data flow to transfer to the subVI. I think that implement too much user events communication is not very efficient.

I suggest you an example of managing data flow beetween the MainVI and the subVI in both directions. This example implement a Q communication for transfer data from the MainVI to subVI and a user event to transfer string text from subVI to MainVI. See it in attachment!

Normally, no VI has its block diagram locked.

Regards

Matthieu

0 Kudos
Message 7 of 11
(6,410 Views)

thank you Matthieu, this is exactly what I wanted to do!

Cedric

0 Kudos
Message 8 of 11
(6,410 Views)

Hi,

In order to add functionalities to my application and to develop my skills in Q strategies, I tried to create another Q communication to transfer any type of data from the SubVI to the Main VI (see attached project). To do that I modified the 'PV_Gnl_dynamicallyEnqueueAction.vi', the 'PV_Main.vi' and the 'PV_Dlg_ViewOnePicture.vi' files. Basically, when the user press the button 'Send Data Graph To IHM' located on the subVI front panel, a signal (sin wave with noise) is send to the Main VI and displayed in the Main VI graph. To do that, I created a queue in the Main VI and sent the queue ref num to the subVI when it is created. Unfortunately, it doesn’t work! Any suggestions?

Thank you

Cedric

0 Kudos
Message 9 of 11
(6,410 Views)

Hi,

After checking my code many times, I found some mistakes. The attached code works well now!

Since I am not totally familiar with queue architecture, I implemented with my current knowledge of Labview. Do not hesitate to improve or optimize the attached project.

Thank you.

Cedric 

0 Kudos
Message 10 of 11
(6,410 Views)