07-25-2016 10:35 AM
Hi, I am working to calculate the internal resistance of a motor. My program is communicating via OPC servers to the PLC.
So what I actually need : When the state of the shared variable diresist is equal to 16 26 or 36... the program should run and make the whole sequence.
I tried with an event loop on the state of diresist but the program didnt run normally (you can only command the event structure from the front window)
So I tried with the while loop as in the program attached but I am getting the measurement in loop (he doesnt stop measuring). and if I click on the stop button, the program stops after making the measurement the second time. (Which is not a solution because I need the values and the graph of the first loop)
Any ideas please?
Solved! Go to Solution.
07-25-2016 10:47 AM
What does "diresist" mean?
Your diresist is not a shared variable. It is a front panel indicator. Also, since it is an indicator and not a control, there is no way to change it while the program is running. It is also why the event structure would not act on it.
Your stop button gets read once per loop iteration. It probably gets read very early in the loop iteration since the reading of that terminal is not dependent on anything else. That is why it appears your loop runs twice when you hit the stop button. Because it doesn't get read again until the next iteration.
07-25-2016 10:59 AM
You CAN trigger an event structure programatically by using the property node value(signaling), just make sure you don't program an endless chain of events. An easier approach would be using a notifier/queue via a producer/consumer loop, where one loop is querying the shared variable at a reasonable rate (maybe 10 times a second, depends on your needs) and sends a notifier or queue element to consumer when it reaches the desired value. Something along the lines of this
07-26-2016 01:30 AM
Hi everbody, thanks for your answer.
To ravens Fan: diresist is a shared variable used in another loop, the variable is changing and working well. I juste didnt put the loop of the shared variable within this program. Thank you for these informations.. and this is what I was trying to explain in my message.. any solutions to propose?
To Daikataro, Thanks for the solution. I will try it. Could you please send me the program? I have the version 2014 of labview.. Please attach it.
07-26-2016 02:11 AM
07-26-2016 02:31 AM
Dear Mike,
I looked in my exemples and I didnt find it already.. Could you please then give me the name of the template (if you know hat it exist?)
Thank you for your answer
07-26-2016 03:50 AM - edited 07-26-2016 03:50 AM
@marwah1 wrote:Dear Mike,
I looked in my exemples and I didnt find it already.. Could you please then give me the name of the template (if you know hat it exist?)
Thank you for your answer
Producer/Consumer-> https://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/creating_vis_from_templates/
More details: http://www.ni.com/white-paper/3023/en/
07-26-2016 04:28 AM
Thanks for the answer..
No it's not working actually.. this is how I made and I am not getting any results..
07-26-2016 04:38 AM
How should we debug a picture?
Do you know how Highlight Execution works and how to use it?
07-26-2016 04:44 AM
Did you go through the link?
-Simply adding queue doesn't solve.
-what's the datatype of queue?
-In first loop,inside true case if you are not doing anything how do you expect something to work?