LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i update a Vi created using a template

Hi All

 

I am new to Labview hence need  some help. I am trying to develop an application which reads some data from a Wireless Sensor Network (WSN). The WSN consists of base station connected to the USB port which recieves data from other sensor nodes.  The data comes in a certain format.  Node name, temperature reading, humidity reading etc. I want to read the data from the serial port and  based on the Node name, i want to display the information for each node in a listbox connected to a subpanel . Therefor allowing the user to access the different nodes using a listbox. So if a new node is detected then a new vi is created for that node and  added to the listbox and displayed in the subpanel. Or the user can acces the different nodes available by scrolling throught the listbox.

 

Since all the nodes have the same sensors on board i have decided to use a single . I can read the data using the serial port, parse the data to detect which node it is and also what the sensor readings are. I have created a template VI for the sensor node. and can create multiple subvi using the template.

 

The problem i am having is how to update the instances created using the template.  Each instance of the template should have a unique number, how can i acces this number. Also how to keep the listbox updated. I Would be greatful if someone could help to solve this problem either by suggesting a new way of doing this or by pointing out what i could do to solve this problem.

 

 

Raza

 

0 Kudos
Message 1 of 11
(3,363 Views)

uraza2001 wrote:

Hi All

...

 

The problem i am having is how to update the instances created using the template.  Each instance of the template should have a unique number, how can i acces this number. Also how to keep the listbox updated. I Would be greatful if someone could help to solve this problem either by suggesting a new way of doing this or by pointing out what i could do to solve this problem.

 

 

Raza


This is the method my grandaughter approves of.

Dynamic_Instance5.PNG

 

THe "Crtl Val.set" method updates the FP control AFTER the template is instaciated but BEFORE it is run.

 

Use queues for each template to get the data updates.

 

Ben

Message Edited by Ben on 04-13-2010 02:13 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 11
(3,349 Views)

Could you just use "Save As" to save each instance of your vi's created and give each a unique name?  Then you can modify each one separately.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 11
(3,347 Views)

Hi Ben

 

Many thanks for the reply, that is one cute and brainy grandughter you have Smiley Very Happy    Looking at the snapshot, how do you know which instance you are updating. The Logger Ref vi is  taking the reference as the input. Is the reference stored in this vi ? 

Do you have a simple example vi, which i could look at ?

 

I will look into queues to pass the reference for each instance.

 

 

Raza 

0 Kudos
Message 4 of 11
(3,321 Views)

Hi tbob

 

I am not sure how i can save each reference. Do you have any idea or example of how this is done ?

 

Many Thanks

 

 

Raza

0 Kudos
Message 5 of 11
(3,320 Views)

Hi Ben

 

Just to add one more question, once you create a number of  instances using a template which are running in the background, how would we be able to update these instances. Do we save the ref for each instace somewere ?

 

Many Thanks

 

 

Raza

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

If you are using Ben's method, you cannot save that instance.  You have to re-create it every time.  But once the code is written, it is done.  No need to save the instance.  Otherwise, you have create individual vi's and not use a template.

 

- tbob

Inventor of the WORM Global
Message 7 of 11
(3,298 Views)

I use different methods depending on the situation...

 

For a bunch of background objects like the one I was starting in the above image, I create multiple queues for interacting with each one. THese queues are typically "Command" and "Response" and the message they exchange are determined by the app. SO in the above...

 

I open a new instance from a template and before I run it, I set the FP control so the template can find the queues it needs. In the above I am using LVOOP but inside the LVOOP private data are the required queues.

 

After setting the FP control that instance is started-up and it gets the queue info from the control.

 

Sorry, but posting code will get me fired. Pictures and words only.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 11
(3,283 Views)

Hi Ben

 

Many Thyanks for the information, i will look into it and hopefully will beable to come up with a solution. I will get in touch once i have got around this problem

 

 

Raza

0 Kudos
Message 9 of 11
(3,263 Views)

Hi Ben

 

Sorry to bother you again, got a question...

 

For every node i will have an instance open using the template vit. I can save the names of each instance of the vit, for example "graph_template 617.vi" into an array. Is it possible it open the instance and update it ? Ive tried it once using the open Vi reference and i am getting Error 1004 vi not in memory. Is there a way around this. Or is this not possible

 

Many Thanks

 

 

Raza 

0 Kudos
Message 10 of 11
(3,252 Views)