02-12-2012 01:15 AM
For an HMI application that I am working on, I would like to inform the user at startup whether forcing is enabled on the target/whether any I/O is currently being forced. This information is easily available in the Distributed System Manager, but I can't seem to figure out how to get this information programmatically. Is this possible? I'm hoping that there is a simple solution that I'm overlooking.
Solved! Go to Solution.
02-13-2012 10:43 AM
Anyone?
02-13-2012 03:12 PM
Hi Apapr,
You can do this using an I/O Variable Engine property node, set the property to "Forcing Enabled" and set it to read.
These Forcing VIs have examples of using this property node if you open them up.
http://zone.ni.com/reference/en-XX/help/371361H-01/lvioscan/forcing_palette/
I've also attached pictures of the menus to go through to alter a generic property node to an I/O Variable Engine property node with the "Forcing Enabled" property.
Hope that helps!
02-13-2012 05:18 PM
Hi Alisha,
That works perfectly! Thanks for the reply. What I still can't figure out, however, is how to check whether individual I/O variables are being forced. In the Distributed System Manager the Quality of a variable will change from "Good" to "Forced" to indicate the forcing status. If I create an I/O variable property node I do not see a forcing property or anything related to quality. If I create a SharedVariableIO property node there is still no forcing status, but I can create a reference to the information I want (as shown in the image I attached). Of course this reference doesn't really do anything for me because I don't know what to do with it. What am I missing?
02-14-2012 12:56 PM
Hi Apapr,
Can you provide more detailed instructions on how you got to the point where you can see the ForceEnabled boolean in the Shared Variable browser?
What version of LabVIEW are you using?
Thanks,
02-14-2012 01:43 PM
Hi Alisha,
I am using LabVIEW 2010 SP1. I also have the DSC module. If I create a SharedVariableIO property node, then right-click on the reference input and create a constant, I can click on the down arrow on the constant and browse shared variables, as shown in the attached image. From there I can browse to my I/O, or drill down farther and select ForceEnabled, ForceValue, or RefersTo (this was the image in my previous post).
In my second image I show that you can wire either reference to the SharedVariableIO property node. (I'm not sure why you can do this because I do not think there are any properties specific to the second reference). I would like to access the forcing information for each variable, but the problem is that the SharedVariableIO property node does not have properties for this information. I can't figure out why I can browse to the information I want but not actually be able to use it.
Thanks again for your help; I really appreciate it.
02-15-2012 04:30 PM
Hi Apapr,
Since this property doesn't seem to be available through any of the variable property nodes, I don't think that there's currently a way to access the information programmatically. You could suggest adding this functionality to LabVIEW at ni.com/ideas.
In your program, you might consider forcing or unforcing the variable at the start of the program. At least, that way you would always know whether the variable was being forced or not. Also, if forcing is off in general, you'll know that none of the variables could be forced. I'm sorry not to be more help.
02-15-2012 08:43 PM
Hi Alisha,
I think I will follow your advice and get creative with forcing/unforcing at the start of the program. It seems like a very good alternative. I will also post on the idea exchange just to see what happens.
Thanks again for your help!
02-16-2012 10:17 AM
The items shown in the browse dialog you attached in your previous post are PSP data items that are automatically published by the scan engine for each variable. As long as you've enabled network publishing for the I/O Variable, you should be able to access the forcing information by reading a PSP Variable with the appropriate URL (e.g. "ni.var.psp://<hostname>/mod1/AI0/ForceEnabled"). Similarly, you could find out the forcing value by reading "ni.var.psp://<hostname>/mod1/AI0/ForceValue". This is how the browse dialog is obtaining that information. It's simply displaying all of the PSP items present on the network.
02-17-2012 09:11 AM
I can't believe all I needed was the Read Variable VI. It works exactly as I wanted it to. Thanks for the solution!