LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Coercion dot and strict type definition

Hello,
 
I seem t be having some problems learning how to use strict type defined controls, would someone please help?
 
Will you please tell me why the coercion dot is on the subVI's?
Will you please tell me how to link the  'CtlsToWLp Cluster' from Main.vi and the 'Clust Refnum' from the WLp2.vi to the same .ctl? 
 
Thanks,
                 
0 Kudos
Message 1 of 8
(3,475 Views)
I avoid strict typedefs and oph for regular typedefs unless I really need the strict defs (very infrequent),  the strict typedef will also make sure that many of the properties are the same between types (therefore a coercion dot problem).  Remember the typdef is for the programmer to increase maintance and readability of the code by making a "master" type definition for use throughout the code.  There is nothing attached to look at so I hope my comments help. 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 8
(3,468 Views)

Sorry there was a mild accident. I resubmitted. However, the code is now attached.

Thanks,

Morris W.

0 Kudos
Message 3 of 8
(3,453 Views)
You're incorrectly using refnums. You should not be using refnums to exclusively pass the value of a control into a subVI - You should wire the control directly. You should use a refnum if you need the subVI to access the total control - i.e., its other properties, or you need to modify the control from the subVI.  Also, you shouldn't make typedefs out of refnums - I have yet to run across a case where this was necessary, but perhaps someone else has a dissenting opinion on this.

Also, the way you made your cluster refnum isn't the way I would have done it. The refnum for the cluster should be the same as the refnum for the other controls you have - i.e., a simple control. Do this:
  1. Open Main.vi's block diagram.
  2. Open the "WI.p2" sub VI.
  3. Put the main VI's block diagram and the subVI's front panel side by side.
  4. Drag the "CtlsToWlp" control reference that you have on the main VI' block diagram and drop it on the subVI's front panel. Now you have a nice simple reference to that control.
0 Kudos
Message 4 of 8
(3,437 Views)

Hello smercurio...

Your suggestion of how to drag the control reference from the Main.vi to the WLp2.vi is how I created the references initially. I then created a .ctl file for it, I guess this is not something you would do. Will you tell me how you would go about passing the controls to the subVIs within a cluster and then in some method edit only one cluster, I thought through a strict typed .ctl file, so that all clusters are edited at the same time.

In this example I would like to edit the cluster in Main.vi and then that cluster be updated automatically within the two subVI’s, WLp1 and WLp2. Perhaps one could add another control to the cluster in Main.vi and then appropriately edit WLp1.vi to use the control, while WLp2 that does not use the control is automatically updated.

Thanks for the help,

Morris W.

0 Kudos
Message 5 of 8
(3,425 Views)
You already have what you need by the fact that you have a typedef of the cluster itself. Just copy the cluster control from the main VI onto your subVI, or on the subVI's front panel right-click and select "Select a control...", then navigate to where you saved your typedef and select it. The cluster control on the subVI will be linked to the typedef, so when you change your typedef all copies of the control will be updated.

I would also suggest reading up in the manual on typedefs. In your LabVIEW installation directory there's a "manuals" directory. In there you will find a PDF on custom controls, filename of "custcont.pdf".
0 Kudos
Message 6 of 8
(3,417 Views)
I tried your suggestion, I copied the .ctl.  Now I can edit the .ctl file and all clusters are updated, good.
However, the controls do not function, i.e., as the Main.vi controls within the cluster are adjusted while running, the subVI's are simply not getting them as before.
I don't know maybe I did something wrong or I did not do as you suggested, as I thought.  I attached the code.  I am open to more suggestions.
However, I will have to let this rest til tomorrow.  I am thankfull for you help.
 
Morris W.
0 Kudos
Message 7 of 8
(3,404 Views)
You had modified the subVI to use a control, but you had wired it to the value that was read at the start of Main, so the subVI was only ever using the cluster's values at that time. I looked at your VIs in more detail and based on what you're doing you will need to use control references, but you're still not doing the reference for the cluster correctly. I suspect when you dragged and dropped the control reference from the main VI you dropped it on the subVI's block diagram, instead of the front panel. I've modified your library to use a plain old cluster control reference. I also simplified your "CtlsToWlp.StopToWlp" event case.

Side note: Not sure if this is a proof of concept thing, but one thing to note is that your subVIs are not set up to pop open when you call them. Note that if you do this then you will need to add code in your boolean event cases to reset the values of the booleans because of the mechanical action that you have set up on them.
0 Kudos
Message 8 of 8
(3,395 Views)