Datasocket and Event Structure.
I have developed a labview aplication that control some pumps and send the setpoint to some PID controllers in my test laboratory. this aplication run fine with Event Structure. I have developed too, a small labview software that use Datasocket to connect to previous software, the problem is that when i press a control from client (the control change in server) the Event structure don´t detect the "value changed" event, why? How could I find a solution?
Thanks in advance
Hi!
I came up, with this simple solution and it works with my datasocket appz.
Have a nice day!!
Attachments:
prog2.JPG 15 KB
fronpanel.JPG 11 KB
prog1.JPG 16 KB
Similar Messages
-
Run-Time Menu and Event Structure~~HELP~~
Hi, brothers,
I'm new user for LabVIEW. Use the version of LabVIEW is 8.6
One problem describe as below:
Can Run-Time Menu and Event Structure exist simultaneously?
Without Event Structure, Run-Time Menu works well, but Run-Time Menu works abnormally.after adding Event Structure,
How do I modify the problem?
Thank you for your help.
Attached is the program.
Attachments:
PC_Adjustment.zip 44 KBYes they can coexist, but not how you did it.
Every iteration of the while loop you wait for an event in the event structure, and you look if the user has selected anything from the menu.
To get this working you should add an event for <this VI>\Menu Selection (User):
Ton
PS you should add a stop button, the only way you can stop the VI is hitting the 'emergency stop' button, with hardware connected (like you have) this is not the adviced routine
Message Edited by TonP on 09-26-2008 07:34 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be!
Attachments:
Main_BD.png 5 KB -
Array of buttons and Event Structure
I have a the same problem... I was wondering if you were able to find a soln.
I have literally thousands of buttons and each button as a unique key code and unique name.
For Example :
Button Name – Key code #
PUSH - 1
POP - 2
PULL - 3
The way I program this simple algorithm is deadly painful.
1) I create 1000 buttons by going to control->buttons.
2) Then I have to go through one by one to change the Boolean text to “PUSH,POP,PULL…”
3) Then used the Event Structure, adding in all the controls names “PUSH, POP, PULL..” In side each event, I placed the key codes “1,2,3..”
I have search and tried for weeks to find a better way, and still nothing comes to mind.
Please help.Hi Ben,
Thank you for your reply, I have attached my try_code and a picture of the code I currently have. I am new in Labview, but I am confident that, there must be a easier way to make an array of buttons with different button name and an associated number to that button.
The 1st file, is to show you want I am currently doing, (painful)
The 2nd file attached is some of the things i tried, I had great hope with my try_code, array_jan25. But I couldn't get it. I think I am very close.
Thanks again,
Attachments:
ThePainfulWay.doc 63 KB
Array_jan25.vi 42 KB -
How to implement boolean comparison and event structure?
Hello all,
I'm currently developing an undergraduate lab in which a laptop sends out a voltage via USB-6008 to a circuit board with an op-amp, the voltage is amplified, and then sent back into the laptop. The student is going to have to determine an "unknown" voltage which will run in the background (they can do this by a step test, graph V_in vs V_out and extrapolate to the x-axis).
Currently, I have two loops that are independent in my VI. The first loop is used to "Set the zero." When 0 voltage (V_in) is sent out of the laptop it returns a value around -1.40V (V_out) typically. Thus, I created the first loop to average this value. The second loop, averages the V_out values that come into the laptop as the V_in numeric control changes. Then I take the "set zero" value from the first loop and subtract it from the second loop average to get as close to 0V for V_out when V_in is 0V.
The problem I'm facing is, the event structure waits for the V_in numeric control value change, but after "SET ZERO" is pressed, if there is an unknown value, it will not be added to the average for V_out until V_in is changed by the user. So, I tried implementing a comparison algorithm in the "[0] Timeout Case." This algorithm works for step tests with positive values for V_in, but there are two problems.
1) Negative values cannot be used for V_in
2) If a user uses increasing positive values for V_in there is no trouble, but if they try to go back to 0, the value change event has been called and it is added to V_out as well as the timeout case.
Sorry for the extremely long post, but I've been banging my head over this and can't figure out how to properly implement this. I'm using LabVIEW 8.0.
Attachments:
Average Reset Test.vi 371 KBOK you have bigger problems than Raven's Fan is pointing out.
When the first event loop stops ( after pressing "") (the boolean text is "Set Zero") The second loop may start- (AND PROCESSES all of the events it was registered to process before the loop started!) that would enclude the value change event from "" (The boolean text is Stop) Being pressed bebore the loop started. Of course, since the labels of "Set Zero" and Stop are identical nulls....................................................BOTH event trigger at the same time and are processed as soon as the event loop they are registerd to is available.
Get it ... The two buttons labeled "" both queue Value change events to both loops registered to act on the value change of the control labled ""!
Both loops will do what you programmed in the case of "" Value Change! This can, (as you have observered) lead to confusing code actions.
Do avoid controls with duplicate labels (There is a VI Analizer test for that!) Do avoid multiple event structures in the same hierarchy.
DO NOT bring this to your studients to help you learn LabVIEW! We get enough studii asking embarassing questions
VI Analizer will help you provide sound templates. If you need help with that hit my sig line- e-mail me and I'll always be willing to help.
Jeff -
Radio Buttons and Event Structures
Guys, I am hoping for some help here on something I probably should know but cant figure out how to do. I am using a set of radio buttons and an event structure to run a UI. The radio buttons are acting as both a user input and indicator of current status selected by the user. I have the event structure set to run on value change of the radio button. All works great unless the operator decides that he wants to repeat the selection that the radio button is already set to. The event structure does not recognize this as a change of value and will not execute. Is there a way to set the event structure up to run even if the same selection of the radio button is made a second time? I attached a crude example to this post. Basically everytime I press the button, I want an entry made into the text box, regardless if the selected item was already pressed. Any thoughts.
Troy
Attachments:
Radio Button Test.vi 16 KBInstead of hacking around the inherent nature of radio buttons, why not just use a Cluster? Its behavior in the UI is more customizable. Check this out:
I just replaced your radio buttons with a cluster, and added a little logic to the event structure to get it to behave the way you describe. I've attached the VI below, saved in 8.2, if you want to try it out.
Hope this helps,
-D
Message Edited by Darren on 11-07-2006 10:45 AM
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Attachments:
cluster_buttons.png 7 KB
Cluster Test.vi 17 KB -
User interfaces and event structures
I am just learning to use event structures to improve operation of front panels. At the moment, I am working on a tab strucrture we use to montinor/set program paramters. VArious parametera are displayed on each tab as controls (not indicators) and are constanly updated sice they can be modified elsewhere by other pieces of code. We controls are normally disabled via a property node so they behave more like indicators and the values are updated by writing to a local variable (I know this is evil but it works in this case). There is a boolean on each tab that toggles between "monitoring" and "changing" modes (or states). When toggles to "changing" (or setting) parameters the monitoring activities are suspended and the control are enabbled. After making the desired changes the controls are either read and the changes implimented or get rest based on some other boolean controls, the parameters controls are then disables and monitoring resumes. The issue is that many users fing the need to toggle between "monitorsing" and "changing" modes to be confusing. I want to replace this switch with an event. If the user clicks on any of the parameters controls in a tab, I want to go into changing mode rather than using the "monitoring"/"changing" boolean control. All other asspects are handled as before. My problem is than if I use a mousedown event to go into "changing" mode and the user clicks on several parameters to shift the keyboard focus to edit more than one parameter, these subsequent mose clciks get processed as new events when change mode is exited. This means that as soon as it returns to "monitoring" mode it jumps immeadiately back to "changing" mode. How should I structure the events to avoid this problem?
Thanks,
--LeeLee,
Instead of using a "mouse down" event, use a "value change" event for each
of the controls. Then your program can switch to the "changing" mode
whenever the value of the control is actually changed.
TJW
"Lee Robertson" <[email protected]> wrote in message
news:[email protected]...
>I am just learning to use event structures to improve operation of front
>panels. At the moment, I am working on a tab strucrture we use to
>montinor/set program paramters. VArious parametera are displayed on
>each tab as controls (not indicators) and are constanly updated sice they
>can be modified elsewhere by other pieces of code. We controls are
>normally disabled via a property node so they behave more like indicators
>and the values are updated by writing to a local variable (I know this is
>evil but it works in this case). There is a boolean on each tab that
>toggles between "monitoring" and "changing" modes (or states). When
>toggles to "changing" (or setting) parameters the monitoring activities are
>suspended and the control are enabbled. After making the desired
>changes the controls are either read and the changes implimented or get
>rest based on some other boolean controls, the parameters controls are then
>disables and monitoring resumes. The issue is that many users fing
>the need to toggle between "monitorsing" and "changing" modes to be
>confusing. I want to replace this switch with an event. If the
>user clicks on any of the parameters controls in a tab, I want to go into
>changing mode rather than using the "monitoring"/"changing" boolean
>control. All other asspects are handled as before. My problem
>is than if I use a mousedown event to go into "changing" mode and the user
>clicks on several parameters to shift the keyboard focus to edit more than
>one parameter, these subsequent mose clciks get processed as new events
>when change mode is exited. This means that as soon as it returns to
>"monitoring" mode it jumps immeadiately back to "changing" mode. How
>should I structure the events to avoid this problem?
>
> Thanks,
>
> --Lee -
Hi,
I'm having some troubles with a program that I'm doing.
I think the big problem are in the queues and the structure event. I don't know why, but the elements in the queue only increase. And I think, because of that, some things that should happen, don't happen. For example, when I press the button "Impact" an square wave should appear, and it didn't appear.
Thanks for all your help,
Sílvia
Attachments:
Sonic.zip 115 KBsreis wrote:
Hi,
Of course I read your post, but like I said, I don't understand why, when I press the "Impulse" button, I have the start in the queue. I shouldn't have the previous used enum, because of the shift register?
You are right, the things are slow down because of the re-enqueues and the many Acquire state I have in the queue. But how can I fix that?
Thanks,
Sílvia
Yes the previous enum will be there because of the shift register. But look at what is happening in your Acquire loop. You are enqueueing on every loop iteration. So your action is like this:
Press Start - enqueue Initialize and Acquire
Initilaize state runs
Acquire state runs - Acquire is queued up again. Because you have no wait state, this loop runs super fast and you keep dequeueing acquire and queueing acquire again. The wait state is imperative to allow the CPU time to process some other loops. This is not done automatically, you have to allow it by adding waits to loops.
Now you happen to press impact and somehow the CPU finds time to process the event. What state gets queued? Acquire again. Now you have two acquires queued because the last Acquire state also queued an acquire. Every button you press will enque something on top of what is already there and your dequeue will never be able to keep up.
The solution is to not enqueue anything in the bottom loop. Never do this. If you want to acquire when no event is happeing, queue up the acquire in the Timeout event.
- tbob
Inventor of the WORM Global -
How to stop a while loop of event structure from a main vi
Hello;
sorry for my english
I have to stop a subvi from my main vi, the subvi contains a while loop and an event structure so I need to stop this loop while directly from my main vi I have tried global variable but it did not work
any help please or example !!!
Solved!
Go to Solution.
Attachments:
stop a while loop and event structure from main vi.png 16 KBIYED wrote:
Hello;
sorry for my english
I have to stop a subvi from my main vi, the subvi contains a while loop and an event structure so I need to stop this loop while directly from my main vi I have tried global variable but it did not work
any help please or example !!!
If this is an example of how your code looks, I'd clean it up before the developer who has to work on it next hits you over the head with his LabVIEW Style Book.
Bill
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all. -
Producer/Consumer Design Pattern + DAQmx + Event Structure
Dear community users,
at the moment I try to implement the Producer/Consumer Design Pattern into my current project. For this purpose I am trying to make a "minimal-example" in which I use the Producer/Consumer Design Pattern for the data acquisition and analysis (display in GraphXY, calculation etc..) process. In the Producer Loop I perform the data readings via DAQmxRead.VI and in the Consumer Loop, in this example only, I display the data in a GraphXY. At the same time I want to control the data acquisition via an Event Structure, for example Start Measurement/Stop Measurement Buttons. To configure the measurement time, for example if the user only wants to measure 150 sec, I use the Time Out Event of the Event Structure. This is a technique which is often used, when data acquisition and Event Structures are used at the same time (Excuse me if this is wrong!). Due to understand the Producer/Consumer Design Pattern I looked up in the Template\Framework of LabVIEW.
In the attachment you will find my "minimal-example", which -sadly-, not working. What should I do ?
Thank you.
Best regards,
tugrul öztürk
Attachments:
daqEngine_PCP.vi 35 KBYour VI will never stop due to the Ok Button that stops the producer loop is read OUTSIDE of the loop. Add an event case for it.
Move the Start and the Ok Button inside of their respective event cases. This will allow the latch to reset when they are read.
Change the Ok Button to a stop button.
Use a Greater Or Equal instead of Equal for the measurement time comparison. What if somebody randomly changes it to 0 on you? Again, you will never stop.
Is the DAQ only supposed to read for "Measurement Time". Right now, it constantly reads. So if you don't use the DAQmx Read, you will get a buffer overflow error. You need to put the DAQmx Start Task inside of the Start event case and then the Stop DAQmx Task inside of the Timeout event case when the measurement time is exceeded. You should also perform the read regardless inside of the Timeout event case.
I HATE telling the consumer loop to stop by destroying the queue. You can look data that way. Instead, send something an empty array. In the consumer, check for an empty array. If it is empty, stop. Destroy the queue only AFTER BOTH LOOPS HAVE COMPLETED.
You should also report your errors in some way. Simple Error Handler at the minimum.
Since you are using Continous Samples, don't limit the buffer. Leave the Samples per Channel unwired on the DAQmx Timing VI.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Local variable event structure
Hi,
I am using an array control and event structure for detecting changes in the array value.
At first,I have performed changes in the array(during runtime) and the event structure detected it.
The next step was adding a parallel while loop in which I am writing to the control array(using local variable).
During the runtime the layout of the array indeed changed,but the event structure didn't detect it.
I have attached 2 figures :1)The loop of the event structure 2)the parallel loop.
Is it possible working in such way?
How can I make the event structure detect changes the software performed in the control array?
Thanks,
Leonid
Solved!
Go to Solution.
Attachments:
event.PNG 43 KB
update.PNG 34 KBThis is a long discussion about "red flags"
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it. -
Case structure & event structure
1.What are the disadvantages of case strucure?
2.What are the advantages of event structure?Are these test questions? I could name 10 for each, but why are you asking?
While there are often many ways to accomplish the same thing, Case structures and Event structures serve different purposes. Straight from the Help file:
Case Structure
Has one or more subdiagrams, or cases, exactly one of which
executes when the structure executes. The value wired to the selector terminal
determines which case to execute and can be Boolean, string, integer, or
enumerated type. Right-click the structure border to add or delete cases. Use
the Labeling tool to enter value(s) in the case selector label and configure the
value(s) handled by each case.
Event Structure (Not in Base Package)
Has one or more
subdiagrams, or event cases, exactly one of which executes when the structure
executes. The Event structure waits until an event happens, then executes the
appropriate case to handle that event.
Right-click the structure border to add new event cases and configure which
events to handle. Wire a value to the Timeout
terminal at the top left of the Event structure to specify the number of
milliseconds the Event structure should wait for an event to occur. The default
is –1, indicating never to time out. -
Simple example - Break FOR loop inside an event structure based on Front panel event change.
I am running a for loop inside a state machine architecture that contains a FOR loop. How can I break this For loop based on Event change in front panel ??
Abhilash S Nair
Research Assistant @ Photonic Devices and Systems lab
[ LabView professional Development System - Version 11.0 - 32-bit ]
LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021
OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
Attachments:
Case inside Event 3.vi 19 KB
Case inside Event.ctl 6 KB
Case inside Event 2.ctl 6 KBOkay. Accpeting that the design is not favorable and not advantageous when my program expands. I have begin to follow producer/consumer programming architecture.
Please find the attached program which is a simple producer consumer with event structure. I wonder how could I stop looping around the producer and consumer loops over and over again. I am pretty sure that this ENQUEUE ELEMENT loops back to the consumer loop and starts from begining.
I hope my first program in PC architecture with State machine and Event structure is correct.
Abhilash S Nair
Research Assistant @ Photonic Devices and Systems lab
[ LabView professional Development System - Version 11.0 - 32-bit ]
LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021
OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
Attachments:
Case inside Event 3.3-ProducerConsumer Event.vi 25 KB
Case inside Event.ctl 6 KB -
How can I determine whether to use an event structure or a case structure?
I'm starting a large project and need a state machine. I can't decide on whether to use a case structure or event structure. Is there an article or other information that describes criteria for selecting between the two approaches?
Thank you,
Chuck
Solved!
Go to Solution.Hi Chuck,
Well case structures and event structures differ quite alot. Here's a link for indepth information on Event Structures, and using them in state machines: http://zone.ni.com/devzone/cda/tut/p/id/2962. Hopefuly this will help you make up your mind.
Let me know if you have any questions after reading it.
Regards,
Dominic Walker
Cardiff University
Electrical and Electronic Engineering Student -
How to control the tab control using event structure?
Hi,
I am using tab control and event structure in the program.
When i run the application event is not happening for the active page.
When user switches from active page to the other page then event is taking place for all pages
So, how to get the event trigger for the active page when the application is started
For more clarification i am attaching the code "Test Control Tab using Event Structure.vi"
Attachments:
Test Control Tab using Event Structure.vi 52 KBYou have a basic misunderstanding of dataflow. Maybe you should start with some tutorials or study some of the examples that ship with LabVIEW.
The event structure belongs inside the while loop, and not vice versa. RIght now, the event structure only runs exactly once and never again.
If the stop is pressed first, the VI will stop. Game over.
If the tab control is changed (from any state to any other state!), the inner loop will spin forever as fast as the CPU allows, either executing one or the other case. It just reads the tab terminal to decide which case to execute. Changing tab never triggers any events. The VI is trapped inside the event until stop is pressed to stop the VI.
you were closer to a reasonable program in the other thread:
http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=287905
Have you tried execution highlighting? Maybe things would become more clear of you do.
LabVIEW Champion . Do more with less code and in less time . -
Calling a VI in a subpanel with parameters inside an event structure and using an abort button
Hi all,
I have a control panel with a tab control and two tabs have a sub panel in them. At runtime I load the VIs I want in to the sub panels. In the control panel event structure I want to start each of the VIs and monitor the execution state so I can abort the VI while it is running. One method I use can run the VI and the abort event will work (see example). The second method I use does not and this is what I want to do! I have many inputs to the VI I want to pass so placing the VI in the event blocks everything else and it has to wait until the VI has completed, so I cannot monitor the execution state.
I have attached an example of what I want to do.
Any help appreciated.
Martin
Solved!
Go to Solution.
Attachments:
SubPanel.lvlib 2 KBHello,
You can do this with queues.
The main vi and subpanel vi's should be based on the producer/consumer (events) and you handle the front panel events accordingly in the respective vi's.
Name the queues in obtain queue , for example the Main being MainQ, subpanels SubPanel1Q, SubPanel2Q. When you start the application, initialise the main vi and also run both of the subpanels (just to make sure that the queues are first obtained by themselves). Then you can use obtain queues to do inter vi communication.
For example if you need to send data from main to subpanel1, use obtain queue and use the name SubPanel1Q, pass the required data & command and voila. Subpanel1 vi will receive your message. You can do this anyway you want. Hope this helps.
Beginner? Try LabVIEW Basics
Sharing bits of code? Try Snippets or LAVA Code Capture Tool
Have you tried Quick Drop?, Visit QD Community.
Maybe you are looking for
-
Currency conversion not flowing in the report
Hi, The currency conversion is showing correct in TCURR table but in the query it is populating wrong. Can any one advise if I need to do any report relevant changes to make it properly visible in the report. Thanks, Lakshmi
-
Typical example of SAP change management in SD scenerio....
Dear All, Is there anybody who can provide me with typical example of SAP Change Management scenerio in manufacturing industry OR in consumer industry. I am looking for some example that has improved a business process tremendiously OR made the busin
-
Error when I try to save my website
Why do I get this error when I try to save or save as...any of my adobe muse websites? Thanks!
-
Will building the site using my own computer effect my client's usage?
I am wondering if I build my client's website in Contribute CS3 on my own computer, will my client have problems connecting and maintaining her website once I have finished? My client is going to purchase Contribute CS4. Thanks in advance.
-
My daughter's Macbook Air Safari (using Mac OS X 10.6.8) won't allow her to connect to Google, Yahoo and Facebook. It will for some reason allow for Bing searches and connections to specific other websites. The wifi seems to be connected fine. We