Discussion:
Cluster and subrountine
(too old to reply)
Nones
2008-08-11 17:40:08 UTC
Permalink
Hello all,
 
I've created a VI that reads from a CAN based sensor and shows the response on a waveform graph as Temperature and Concentration. Now I need to make this VI into a subVI, however, I'm having problems with the terminals and function of the subVI. How do I create a subVI that takes a message as input and outputs just the response? Anyone knows about how to use "Cluster Constant"; refering to the cluster in the front panel, if I was to use this subVI as a cluster of a larger VI.
 
I have posted the VI.
 
Thanks!


subVI_cluster.vi:
http://forums.ni.com/attachments/ni/170/348355/1/subVI_cluster.vi
MikeS81
2008-08-11 18:10:08 UTC
Permalink
Hi Nones,what do you want. As i understand it, you need to create a control for your message. Right click on the input of the subvi and select create->control. Link this new control to the connector pane. Link also your output to the connector pane and save your vi. Insert it into your subvi and it should work. You should define a break decision to exit your vi.MikeMessage Edited by MikeS81 on 08-11-2008 07:51 PM
Nones
2008-08-11 18:10:10 UTC
Permalink
whats a connector pane?
MikeS81
2008-08-11 18:10:10 UTC
Permalink
Hi Nones, go to your front panel and right click on the icon, select "Show Connector". Mike
Nones
2008-08-11 20:10:07 UTC
Permalink
Thanks Mike, but the doubt still holds. Once I have my subVI, it has an input for the message, an output for the data display and a boolean input. The waveform graph is not outputting in real time, I have to stop the subVI ("subVI_1.0") first in order to get the data shown on the VI front panel ("cluster_1.0")  waveform.
 
Also, how do I get the results to be shown on real time as a cluster of a higher level VI?
 
Thanks
Nones
2008-08-11 20:10:07 UTC
Permalink
Forgotto post files for the last reply.


subVI_1.0.vi:
http://forums.ni.com/attachments/ni/170/348429/1/subVI_1.0.vi


cluster_1.0.vi:
http://forums.ni.com/attachments/ni/170/348429/2/cluster_1.0.vi
smercurio_fc
2008-08-11 18:40:06 UTC
Permalink
Have you gone through the LabVIEW tutorials? To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's <a href="http://zone.ni.com/devzone/cda/tut/p/id/5054" target="_blank">Learning Center</a> which provides links to other materials and other tutorials. You can also take the <a href="http://www.ni.com/academic/lv_training/how_learn_lv.htm" target="_blank">online courses</a> for free.
cschneider
2008-08-11 20:10:08 UTC
Permalink
I think what you are looking for is a reference to a front panel object. Right-click the terminal of an object and select "create--&gt;reference". Via the connector, you can wire this reference into a sub-vi and access there the properties of your front-panel-object (and of course modify them). So you can update your front-panel of a parent-vi while the sub-vi is running... Is this what you are looking for?Greetings,Christian
Nones
2008-08-11 20:40:05 UTC
Permalink
Here is a breifing on what I'm really trying to accomplish.
&nbsp;
The purpose of my project will be a LabView subroutine that would take in a list of messages and output the responses to those messages. A named cluster might be an appropriate format for the output. The subroutine should be generic in that once it is fed the appropriate message(s), it can query across the CAN to the appropriate sensor. We need this capability because many new sensors that we use for testing come only with CAN outputs rather than the traditional voltage outputs. Some examples are the NH3 sensor, and NOx/O2 sensors; all CAN based. These are relatively simple transducers that don't have extensive vocabularies. Six messages may be sufficient for each of these applications
&nbsp;
CAN subroutine suggestions:

-six message (word?) capability These messages can be fed in as inputs specific to the particular transducer the routine to be used.
-named cluster output
-should be able to run in a 20 hz main loop if possible
Jeremy_B
2008-08-13 15:10:12 UTC
Permalink
Hi Nones,&nbsp;&nbsp;Your waveform graph is not updating in real time because you have a loop in your sub VI.&nbsp; Your sub VI won't return until your loop ends, so your main VI sits and waits.&nbsp; If you want to have a loop in your sub VI, Christian's suggestion is a good way to make this work. &nbsp;&nbsp;There are multiple ways of accomplishing your task, and each way has a trade off between performance and ease of implementation.&nbsp; The easy way would be to create a sub VI which sends one message and expects a single response, and then use that VI in a loop to go through each sensor.&nbsp; The fast way would be to send all of the messages at once, and then possibly have a separate VI to listen for the response messages.&nbsp; LabVIEW is particularly good at doing this, you can have one loop to send messages, and another loop to listen for the responses and distribute them to their appropriate indicators. &nbsp;&nbsp;
Nones
2008-08-14 14:10:06 UTC
Permalink
Christian and Jeremy thanks!&nbsp;One more thing to clarify though; if I have 2 sensor, which would require 2 message inputs, should I have them in parallel or is there a cleaner way to bundle the messages in a loop and from a single wire transfer them to the response reading loop?
Jeremy_B
2008-08-15 17:40:30 UTC
Permalink
Hi Nones,&nbsp;You can put the messages in an array, and then use for loops to iterate through each message when you send them.&nbsp;One thing to watch out for is what order you expect to receive the responses in.&nbsp; With networked communications, there is always the chance that when you send two messages, you might get the response to the second message before you get the response to the first.&nbsp; I usually set up this type of application so the listener thread knows what I expect to receive, but makes no assumptions as to what order the responses will come in.&nbsp;I'm not sure if I answered your question thoroughly enough, let me know if I didn't, I'll continue to monitor this thread.&nbsp;
Loading...